Jump to content

Getting missing episodes (from a series) and movies (from collections)


Recommended Posts

Posted

For the missing movies from collections, I have that working by looping over all collections, getting the tmdbid, then getting the list of movies in the collection, and finding movies that match the tmdbid of the movie.

No issues, for now I am directly calling tmdb, but I will be moving to using the provider.GetRemoteSearchResults api

But for finding missing episodes, Im trying to use the Emby Api.  The data is there, its just how :)

First doing a libraryManager.GetItemList where the query has Parent unset or set to a series where I know there is a missing episode, doesnt return the missing episode, ever.
I tried adding IsVirtualItem=true with nochanges.  

I have never recieved an epidode where LocationType was virtual.

Id rather not use the rest api from inside the plugin (just seems wrong :) ) but if I have to I will.

TIA

 

Posted

HI, try IProviderManager.GetAllEpisodes and GetAllItems

this just gets you everything. the determination of what is missing or not is not currently in a place where you can use it, so you'll have to write your own code to compare the list from the providers to what's in the library.

  • Agree 1
Posted
Quote

I was never able to get the built in provider functionality.

Well what did you try?

HawkXP71
Posted
On 9/30/2026 at 4:51 PM, GrimReaper said:

What is the issue you're facing? I'm getting proper response on that query.

 

 

On 9/30/2026 at 5:18 PM, Luke said:

Well what did you try?

Ill have to "undo" my direct call, but Ill get that tried out later today. Thanks for the response.

HawkXP71
Posted

@GrimReaper @Luke

        public async Task<TmdbCollection?> GetRemoteCollectionMembersAsyncViaProviders( string tmdbId, CancellationToken? cancellationToken = null, string language = "en-US" )
        {
            if( string.IsNullOrEmpty( tmdbId ) )
                return null;

            if( !CheckIsValid( false ) )
                return null;

            var languageCode = string.IsNullOrEmpty( language ) ? "en" : language.Split( '-' )[ 0 ]; 
            var countryCode = ( !string.IsNullOrEmpty( language ) && language.Split( '-' ).Length > 1 ) ? language.Split( '-' )[ 1 ] : "US";
            var boxSetLookupInfo = new BoxSetInfo
            {
                MetadataLanguage = languageCode,
                MetadataCountryCode = countryCode
            };
            boxSetLookupInfo.ProviderIds[ MetadataProviders.Tmdb.ToString() ] = tmdbId;
            var searchQuery = new RemoteSearchQuery<BoxSetInfo>
            {
                SearchInfo = boxSetLookupInfo,
                ItemId = 0 // Provide an existing Emby item ID if updating a specific item
            };

            var cancelToken = cancellationToken ?? CancellationToken.None;

            try
            {
                IEnumerable<RemoteSearchResult> results = await _embyInterfaces!._providerManager!.GetRemoteSearchResults<BoxSet, BoxSetInfo>(
                    searchQuery,
                    null, // referenceItem: Pass a BaseItem instance if contextual lookup is required
                    cancelToken
                ).ConfigureAwait( false );

                foreach( var result in results )
                {
                    foreach( var providerId in result.ProviderIds )
                    {
                        _embyInterfaces!._logger!.Info( "   -> External Provider: {0}, ID: {1}", providerId.Key, providerId.Value );
                    }
                }
            }
            catch( Exception ex )
            {
                _embyInterfaces!._logger!.Warn( "Failed to discover remote BoxSet results", ex );
            }
            return null;
        }

My custom search is the following:
 

        public async Task<TmdbCollection?> GetRemoteCollectionMembersAsyncViaCustom( string tmdbId, CancellationToken? cancellationToken = null, string language = "en-US" )
        {
            if( string.IsNullOrEmpty( tmdbId ) )
                return null;

            if( !CheckIsValid( false ) )
                return null;

            //string url = $"https://themoviedb.org/{tmdbCollectionId}?api_key={kApiKeyV3}&language={language}";
            var builder = new UriBuilder
            {
                Scheme = "https",
                Host = "api.themoviedb.org",
                Path = $"/3/collection/{tmdbId}?language={language}"
            };

            var query = HttpUtility.ParseQueryString( builder.Query );
            query[ "api_key" ] = kApiKeyV3;
            builder.Query = query.ToString();

            var url = builder.Uri.ToString();
            var options = new HttpRequestOptions
            {
                Url = url,
                CancellationToken = cancellationToken ?? CancellationToken.None,
                // Optional: Set cache timeout if you don't want to hit TMDB constantly
                CacheLength = System.TimeSpan.FromDays( 1 ),
                CacheMode = CacheMode.None
            };

            try
            {
                using( var response = await _embyInterfaces!._httpClient!.GetResponse( options ).ConfigureAwait( false ) )
                {
                    var collections = _embyInterfaces!._jsonSerializer!.DeserializeFromStream<TmdbCollection>( response.Content );
                    return collections ?? null;
                }
            }
            catch
            {
                return null;
            }
        }

Both are using the same tmdbid.

The custom one works the provider one does not

TIA
 

HawkXP71
Posted (edited)

I call my custom first, and then the provider search second.

In the log I see the Http request for mine
2026-10-02 11:13:48.261 Info HttpClient: GET https://api.themoviedb.org/3/collection/115838%3Flanguage=en-US?api_key=‌<api_key>
2026-10-02 11:13:48.387 Info HttpClient: Http response 200 from https://api.themoviedb.org/3/collection/115838%3Flanguage=en-US?api_key=‌<api_key>after 126ms

but I see nothing for the provider, I do have debug logging on

Edited by HawkXP71

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...