Andy6666 0 Posted June 8, 2021 Share Posted June 8, 2021 Hi, I want build a MetadataProvider plugin to define some rules to read my file. I got a problem that I can't get the file full path in a Privider class. My Class implements "IHasOrder, IRemoteMetadataProvider<Movie, MovieInfo>" So, How can I get the file full path so I can modify my file name rules. thanks Link to comment Share on other sites More sharing options...
Luke 36886 Posted June 8, 2021 Share Posted June 8, 2021 Hi, what do you need the full file path for? 1 Link to comment Share on other sites More sharing options...
Andy6666 0 Posted June 8, 2021 Author Share Posted June 8, 2021 Hello, I know the naming convention of emby, but I have a lot of video files that are not named according to the naming convention of emby. For example, a/a.1080p.x264/a.1080p.x264.mkv many files are like this. In order to get better metadata, I modified an open source Douban plugin to make it more suitable for my existing file naming rules. I hope I can use the path in the plug-in to get the correct movie name, and then scrape the metadata to be more accurate. Link to comment Share on other sites More sharing options...
Andy6666 0 Posted June 8, 2021 Author Share Posted June 8, 2021 37 minutes ago, Luke said: Hi, what do you need the full file path for? Hello, I know the naming convention of emby, but I have a lot of video files that are not named according to the naming convention of emby. For example, a/a.1080p.x264/a.1080p.x264.mkv many files are like this. In order to get better metadata, I modified an open source Douban plugin to make it more suitable for my existing file naming rules. I hope I can use the path in the plug-in to get the correct movie name, and then scrape the metadata to be more accurate. Link to comment Share on other sites More sharing options...
roaku 791 Posted June 8, 2021 Share Posted June 8, 2021 I don't know the specifics of MetadataProvider, but if you have access to the movie as a BaseItem, you can get to the file path of the 'primary' movie file like this: BaseItem.GetMediaStreams()[0].Path Or, if you have a multi-version movie and need to check all versions, like this: //item is a BaseItem you got from somewhere List<MediaSourceInfo> mediaSources = item.GetMediaSources(true, false, _libraryManager.GetLibraryOptions(item)); if (mediaSources != null) { foreach (MediaSourceInfo mediaSourceInfo in mediaSources) { if (mediaSourceInfo.Path != null) { //do something with the path for that file } } } Link to comment Share on other sites More sharing options...
Andy6666 0 Posted June 9, 2021 Author Share Posted June 9, 2021 (edited) 13 hours ago, roaku said: I don't know the specifics of MetadataProvider, but if you have access to the movie as a BaseItem, you can get to the file path of the 'primary' movie file like this: BaseItem.GetMediaStreams()[0].Path Or, if you have a multi-version movie and need to check all versions, like this: //item is a BaseItem you got from somewhere List<MediaSourceInfo> mediaSources = item.GetMediaSources(true, false, _libraryManager.GetLibraryOptions(item)); if (mediaSources != null) { foreach (MediaSourceInfo mediaSourceInfo in mediaSources) { if (mediaSourceInfo.Path != null) { //do something with the path for that file } } } Thanks for your solution. I have a question that how can I have access to baseItem class? my class is defined like following code: public class MovieProvider : BaseProvider, IHasOrder, IRemoteMetadataProvider<Movie, MovieInfo> // BaseProvider is a base class defined. public abstract class BaseProvider I try to get BaseItem from IRemoteMetadataProvider, but it didn't work. I notice Movie class is a son class of BaseItem, But I can't access, too. Should I inherit the BaseItem Class? @roaku Edited June 9, 2021 by Andy6666 Link to comment Share on other sites More sharing options...
Andy6666 0 Posted June 9, 2021 Author Share Posted June 9, 2021 (edited) Reply to someone using Quote button? Can other people receive a notify? Sorry about lots of questions, I'm a newer. @Luke Edited June 9, 2021 by Andy6666 Link to comment Share on other sites More sharing options...
Luke 36886 Posted June 21, 2021 Share Posted June 21, 2021 Ok, I suppose we could look at adding the Path in there. Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now