ShokoServer icon indicating copy to clipboard operation
ShokoServer copied to clipboard

Renamer Metadata Rework

Open da3dsoul opened this issue 9 months ago • 2 comments

Current Feature

Renaming is not done if data is missing, even if it's irrelevant.

Feature Changes

Rework the checks for missing metadata into the renamers themselves.

Step 1.

Make Plugin Abstractions depend on net8.0. There's no reason to limit it to netstandard. We can have default interfaces that way.

Step 2.

Change Episodes and Series to XRefs, which each provide an Episode and a Series. This adds some complication, but we can have an auto-getter to return only the episodes or series for backwards compat and simplification of code. The reason is that we can open XRef providers and data to plugins, as well as doing this check in the renamer:

        // We don't have all the data yet, so don't try to rename yet.
        if (xrefs.Count != episodes.Count)
            return new()
            {
                Success = false,
                ShouldRetry = false,
                ErrorMessage = $"Not enough data to do renaming for the recognized file. Missing metadata for {xrefs.Count - episodes.Count} episodes.",
            };

This would be changed to:

        // We don't have all the data yet, so don't try to rename yet.
        foreach (var xref in args.XRefs)
        {
            if (xref.Episode == null)
                return new()
                {
                    Result = false,
                    Message = $"Not enough data to do renaming for the recognized file. Missing metadata for episode in {xref.Series.Name}",
                };
        }

Step 3.

Add default implementations in the interfaces with calls to a helper to make implementation and extension easy for plugin devs.

da3dsoul avatar Mar 31 '25 04:03 da3dsoul

This is in conjunction with #1228

da3dsoul avatar Mar 31 '25 04:03 da3dsoul

step 1 is already done im my pr to improve the abstraction (needed it too)

(edit: which apparently is linked above. didn'tsee that until now)

revam avatar Mar 31 '25 11:03 revam