mirror of
https://github.com/truewhile/MeBox.git
synced 2026-09-29 11:36:36 +08:00
Fix local adult metadata and watch history removal
This commit is contained in:
@@ -55,7 +55,7 @@ func imageProxyHandler(svc *service.Container) gin.HandlerFunc {
|
||||
}
|
||||
}
|
||||
|
||||
// scrapeOneHandler enriches a single media via TMDb. Admin-only.
|
||||
// scrapeOneHandler enriches a single media via the configured scraper chain.
|
||||
func scrapeOneHandler(svc *service.Container) gin.HandlerFunc {
|
||||
return func(c *gin.Context) {
|
||||
m, err := svc.Repo.Media.FindByID(c.Request.Context(), c.Param("id"))
|
||||
@@ -63,10 +63,6 @@ func scrapeOneHandler(svc *service.Container) gin.HandlerFunc {
|
||||
c.JSON(http.StatusNotFound, gin.H{"error": "not found"})
|
||||
return
|
||||
}
|
||||
if !svc.TMDb.Enabled() {
|
||||
c.JSON(http.StatusPreconditionFailed, gin.H{"error": "tmdb api key not configured"})
|
||||
return
|
||||
}
|
||||
if err := svc.Scraper.EnrichOne(c.Request.Context(), m); err != nil {
|
||||
c.JSON(http.StatusInternalServerError, gin.H{"error": err.Error()})
|
||||
return
|
||||
@@ -76,17 +72,13 @@ func scrapeOneHandler(svc *service.Container) gin.HandlerFunc {
|
||||
}
|
||||
}
|
||||
|
||||
// scrapeLibraryHandler enriches every pending media in a library. Admin-only.
|
||||
// scrapeLibraryHandler retries every pending/no_match media in a library.
|
||||
func scrapeLibraryHandler(svc *service.Container) gin.HandlerFunc {
|
||||
return func(c *gin.Context) {
|
||||
if !svc.TMDb.Enabled() {
|
||||
c.JSON(http.StatusPreconditionFailed, gin.H{"error": "tmdb api key not configured"})
|
||||
return
|
||||
}
|
||||
// Run in the background so HTTP returns instantly; the WS hub
|
||||
// pushes per-item progress on the "scrape" topic.
|
||||
go func(libID string) {
|
||||
_, _ = svc.Scraper.EnrichLibrary(context.Background(), libID)
|
||||
_, _ = svc.Scraper.EnrichLibrary(context.Background(), libID, true)
|
||||
}(c.Param("id"))
|
||||
c.JSON(http.StatusAccepted, gin.H{"status": "scraping"})
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user