Skip to content

Commit

Permalink
fix: hide files in import limbo (again)
Browse files Browse the repository at this point in the history
- Hide files in "import limbo" from the unrecognized files option again, but this time properly add new include options to the monolithic file endpoint to include them separately. They're hidden/excluded by default but can be included if needed.
  • Loading branch information
revam committed Oct 20, 2024
1 parent 0da092d commit ac81733
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 5 deletions.
1 change: 1 addition & 0 deletions Shoko.Server/API/v3/Controllers/FileController.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1471,6 +1471,7 @@ public ActionResult<List<File>> RegexSearchByFileName([FromRoute] string path)
/// <param name="page">Page number.</param>
/// <param name="includeXRefs">Set to false to exclude series and episode cross-references.</param>
/// <returns></returns>
[Obsolete("Use the universal file endpoint instead.")]
[HttpGet("MissingCrossReferenceData")]
public ActionResult<ListResult<File>> GetFilesWithMissingCrossReferenceData(
[FromQuery, Range(0, 1000)] int pageSize = 100,
Expand Down
8 changes: 5 additions & 3 deletions Shoko.Server/API/v3/Helpers/ModelHelper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -549,9 +549,11 @@ public static ListResult<File> FilterFiles(IEnumerable<SVR_VideoLocal> input, SV
if (include_only.Contains(FileIncludeOnlyType.Duplicates) && locations!.Count <= 1) return false;

if (exclude.Contains(FileExcludeTypes.Unrecognized) && xrefs.Count == 0) return false;
if (include_only.Contains(FileIncludeOnlyType.Unrecognized) && xrefs.Count > 0 && xrefs.Any(x =>
RepoFactory.AnimeSeries.GetByAnimeID(x.AnimeID) != null &&
RepoFactory.AnimeEpisode.GetByAniDBEpisodeID(x.EpisodeID) != null)) return false;
if (include_only.Contains(FileIncludeOnlyType.Unrecognized) && xrefs.Count > 0) return false;

// this one is also special because files in import limbo are excluded by default
if (!include_only.Contains(FileIncludeOnlyType.ImportLimbo) && !include.Contains(FileNonDefaultIncludeType.ImportLimbo) && xrefs.Count > 0 && xrefs.Any(x => x.AniDBAnime is not null && x.AniDBEpisode is not null)) return false;
if (include_only.Contains(FileIncludeOnlyType.ImportLimbo) && !(xrefs.Count > 0 && xrefs.Any(x => x.AniDBAnime is not null && x.AniDBEpisode is not null))) return false;

if (exclude.Contains(FileExcludeTypes.ManualLinks) && xrefs.Count > 0 &&
xrefs.All(xref => xref.CrossRefSource == (int)CrossRefSource.User)) return false;
Expand Down
6 changes: 4 additions & 2 deletions Shoko.Server/API/v3/Models/Common/FileIncludeTypes.cs
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,8 @@ public enum FileNonDefaultIncludeType
Ignored,
MediaInfo,
XRefs,
AbsolutePaths
AbsolutePaths,
ImportLimbo,
}

[JsonConverter(typeof(StringEnumConverter))]
Expand All @@ -30,5 +31,6 @@ public enum FileIncludeOnlyType
Duplicates,
Unrecognized,
ManualLinks,
Ignored
Ignored,
ImportLimbo,
}

0 comments on commit ac81733

Please sign in to comment.