Files
J621/backend/apps/library/urls.py
T
JakeBreath 09405d1a0f Match local files to e621: MD5 lookups, manual links, batch scans
- MediaItem gains e621_match_status (unknown/matched/not_found/deleted)
  and e621_checked_at, backfilled for existing matched items.
- Server-side e621 client (apps/library/e621.py) using the user's stored
  credentials, throttled to 2 req/s, with typed errors.
- Matching service: MD5 lookup, manual post linking (flags MD5
  mismatches), unlink, metadata refresh, deleted-post detection.
- Detail actions POST /api/files/J-x/match/ and /unlink/ (uploader or
  staff only).
- Background library scans: MatchTask + /api/matches/ with missing/all
  scopes, progress polling, cancel and stale-task reaping; the scan
  counts toward the footer's Active Workers. Same pass available as
  manage.py match_e621 for cron.
- Library gains not_found/deleted status filters; the detail page adds
  an e621 match card (check / link by post ID / unlink) and the metadata
  card warns when a post was deleted on e621.
2026-09-17 13:41:08 -05:00

50 lines
1.4 KiB
Python

from django.urls import include, path
from rest_framework.routers import DefaultRouter
from .tools import (
ClearTempView,
DeleteFilesView,
ExactDuplicatesView,
StorageView,
TagCloudView,
VisualGroupsView,
VisualMatchesView,
)
from .uploads import TempUploadViewSet
from .views import (
ClientDownloadView,
DownloadTaskViewSet,
MatchTaskViewSet,
MediaItemViewSet,
)
router = DefaultRouter()
router.register("files", MediaItemViewSet, basename="file")
router.register("uploads", TempUploadViewSet, basename="upload")
router.register("online/downloads", DownloadTaskViewSet, basename="download")
router.register("matches", MatchTaskViewSet, basename="match")
urlpatterns = [
path("", include(router.urls)),
path("online/file/", ClientDownloadView.as_view(), name="client_download"),
path(
"duplicates/md5/",
ExactDuplicatesView.as_view(),
name="duplicates_md5",
),
path(
"duplicates/visual/",
VisualMatchesView.as_view(),
name="duplicates_visual",
),
path(
"duplicates/visual_groups/",
VisualGroupsView.as_view(),
name="duplicates_groups",
),
path("delete/", DeleteFilesView.as_view(), name="delete_files"),
path("temp/clear/", ClearTempView.as_view(), name="clear_temp"),
path("tags/cloud/", TagCloudView.as_view(), name="tag_cloud"),
path("storage/", StorageView.as_view(), name="storage_info"),
]