Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Do not apply search results on seasons #5384

Merged
merged 2 commits into from Jun 11, 2021

Conversation

Larvitar
Copy link
Contributor

@Larvitar Larvitar commented Mar 5, 2021

This one has already caused several issues with season metadata providers over last few years (!). TLDR: When using "Identify" Jellyfin would set series name and providers into SeasonInfo when calling GetMetadata on it.

Changes

if (refreshOptions.SearchResult != null && !(itemOfType is Season))
{
    ApplySearchResult(id, refreshOptions.SearchResult);
}

refreshOptions.SearchResult contains series info even when refreshing metadata for seasons. I've just added season type check since I did not have any better ideas and we can't use "Identify" for seasons anyways.

Issues
#4948
#4134
#1843

P.S. I hate myself for spending so much time debugging this.

EDIT: I've noticed that when reidentifying a series, season and episode metadata is not reset. Shouldn't we do it? I mean if a series was identified wrong then all seasons and episodes will have wrong provider IDs. When refreshing metadata for season/episode after "Identify" metadata providers will not care that series ID has changed because episode/season ID is set. I think that when refreshOptions.SearchResult for series is set then we should clear all children metadata to make sure that all seasons and episodes are identified correctly after a refresh.

Example: An 'X' metadata provider uses IDs for series, seasons and episodes. It misidentified a series, assigned an ID to it, its seasons and all episodes (each episode has it's own unique ID). User uses "Identify" on said series assigning a correct ID but all seasons and episodes are still using old IDs! In this case user has to manually go through all episodes (there may be hundreds of them), remove IDs from all of them by hand and only then "Identify" the parent series.

@Bond-009
Copy link
Member

Bond-009 commented Apr 2, 2021

Maybe add a comment explaining the check?

@cvium
Copy link
Member

cvium commented May 27, 2021

@Larvitar Thanks for investigating. I did a little further digging and I think changing ApplySearchResult to the following will do everything you want while also fixing the bug

        private static void ApplySearchResult(ItemLookupInfo lookupInfo, RemoteSearchResult result)
        {
            switch (lookupInfo)
            {
                case EpisodeInfo episodeInfo:
                    episodeInfo.SeriesProviderIds = result.ProviderIds;
                    episodeInfo.ProviderIds.Clear();
                    break;
                case SeasonInfo seasonInfo:
                    seasonInfo.SeriesProviderIds = result.ProviderIds;
                    seasonInfo.ProviderIds.Clear();
                    break;
                default:
                    lookupInfo.ProviderIds = result.ProviderIds;
                    lookupInfo.Name = result.Name;
                    lookupInfo.Year = result.ProductionYear;
                    break;
            }
        }

@Bond-009 Bond-009 merged commit 83e492b into jellyfin:master Jun 11, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants