Jump to content

Retrieve Filename within GetMetadata C#


xjasonlyu

Recommended Posts

xjasonlyu

I’ve recently been trying to write a metadata plugin for my Emby server, everything was just fine except I can’t find a way to get real movie path from GetMetadata method.

If it was first time emby find the movie and call GetMetadata, the info.Name of MovieInfo would seem to be the file name of that movie, but if I manually use Identify to search this movie then the info.Name would be the name I set on the GetSearchResults.

In Jellyfin, they have a info.Path for MovieInfo to retrieve movie path info but I can't find alternative property in emby's MovieInfo class..

So is there a way to retrieve the video path (or just file name) within GetMetadata method?

public class MovieProvider : IRemoteMetadataProvider<Movie, MovieInfo>
    {

        public MovieProvider(IHttpClient httpClient, IJsonSerializer jsonSerializer, ILogManager logManager) : base(
            httpClient,
            jsonSerializer,
            logManager.CreateLogger<MovieProvider>())
        {
            ...
        }

        public async Task<MetadataResult<Movie>> GetMetadata(MovieInfo info,
            CancellationToken cancellationToken)
  		{
  			info.Name // "Se7en.1995.REMASTERED.1080p.BluRay.x264-SADPANDA.mkv"  First time automaticly scaned and called by emby.
  			info.Name // "Se7en" When I use Identify search this movie, the Name would be I set on GetSearchResults => RemoteSearchResult.
  		}
  
  		...
  	}

I googled and searched the emby community but still haven’t found the answer. So I would really be appreciate it if someone can help me with it.

Link to comment
Share on other sites

xjasonlyu

In my case, I have a lot of movies with hardcoded subtitles which have suffixes like .eng.mp4 .cht.mkv.

Since it’s difficult to detect which language sub that movie has, I wanna extract the information from the original file name and add them as one of genres so I can quickly filter movies by genres.🤨

Link to comment
Share on other sites

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...