mickle026 650 Posted June 14, 2024 Posted June 14, 2024 Which Interface to enable a metadata saver here? I have tried the following but it doesnt appear in the selectable options. namespace LocalMetadataSaver.saver { public abstract class LocalMetadataSaver : IMetadataSaver { protected IFileSystem FileSystem { get; private set; } protected IServerConfigurationManager ConfigurationManager { get; private set; } protected ILibraryManager LibraryManager { get; private set; } protected IUserManager UserManager { get; private set; } protected IUserDataManager UserDataManager { get; private set; } public string Name =>"Local Info Saver"; public LocalMetadataSaver(IFileSystem fileSystem, IServerConfigurationManager configurationManager, ILibraryManager libraryManager, IUserManager userManager, IUserDataManager userDataManager) { FileSystem = fileSystem; ConfigurationManager = configurationManager; LibraryManager = libraryManager; UserManager = userManager; UserDataManager = userDataManager; } public bool IsEnabledFor(BaseItem item, ItemUpdateType updateType) { return item is Movie && updateType >= ItemUpdateType.MetadataEdit; } public Task Save(BaseItem item, LibraryOptions libraryOptions, CancellationToken cancellationToken) { } } } Can you give me a clue which is the correct interface for my own metadata saver? Thanks you
mickle026 650 Posted June 14, 2024 Author Posted June 14, 2024 22 minutes ago, Luke said: Looks like you got it right. It doesn't show as a selection though in library edit return item is Movie && updateType >= ItemUpdateType.MetadataEdit I'll check this line maybe the itemUpdateType has to be set as a download for it to appear?
Luke 42077 Posted June 14, 2024 Posted June 14, 2024 I would compare your code to the nfo plugin: https://github.com/MediaBrowser/NfoMetadata
mickle026 650 Posted June 16, 2024 Author Posted June 16, 2024 I dont see anything different to my code, but it still will not show up as a metadata saver in library edit to be able to enable it. I changed the code, but still nothing is appears as a metadata saver! public bool IsEnabledFor(BaseItem item, ItemUpdateType updateType) { if (!item.IsFileProtocol) { return false; } if (item.GetType() == typeof(Movie)) { return item is Movie && updateType >= ItemUpdateType.MetadataDownload; } else if (item.GetType() == typeof(Video)) { return item is Video && updateType >= ItemUpdateType.MetadataDownload; } else if (item.GetType() == typeof(MusicVideo)) { return item is MusicVideo && updateType >= ItemUpdateType.MetadataDownload; } else { return false; } } I dont see any missing interrface components, but what is wrong?
mickle026 650 Posted June 16, 2024 Author Posted June 16, 2024 The basic interface, I am missing what it needs to enable it as a saver - I cannot see anything other than IsEnabledFor ? - other plugins have the public bool supports, but this doesnt seem to apply here.. public Task Save(BaseItem item, LibraryOptions libraryOptions, CancellationToken cancellationToken) { // do stuff } public bool IsEnabledFor(BaseItem item, ItemUpdateType updateType) { // eanable it for movies ?? return item is Movie && updateType >= ItemUpdateType.MetadataDownload; } public string Name { // display the name that shows in library edit return "PluginName"; } I am looking for the information/c# code to make it appear here:
mickle026 650 Posted June 20, 2024 Author Posted June 20, 2024 (edited) Not sure its even me making an error here If i install XML Metadata (and restart) that does not appear in the metadata savers either? - only a reader If i remove the abstract part of the class, i get a simple injector error public abstract class InfoMetadataSaver:IMetadataSaver > remove the abstract public class InfoMetadataSaver:IMetadataSaver 2024-06-20 11:01:41.652 Error App: Error creating LocalMetadataSaver.InfoMetadataSaver *** Error Report *** Version: 4.9.0.25 Command line: C:\Users\mike\AppData\Roaming\Emby-Server\system\EmbyServer.dll -noautorunwebapp Operating system: Microsoft Windows 10.0.18362 OS/Process: x64/x64 Framework: .NET 8.0.5 Runtime: C:/Users/mike/AppData/Roaming/Emby-Server/system/System.Private.CoreLib.dll Processor count: 4 Data path: C:\Users\mike\AppData\Roaming\Emby-Server\programdata Application path: C:\Users\mike\AppData\Roaming\Emby-Server\system SimpleInjector.ActivationException: SimpleInjector.ActivationException: No registration for type InfoMetadataSaver could be found. Make sure InfoMetadataSaver is registered, for instance by calling 'Container.Register<InfoMetadataSaver>();' during the registration phase. For the container to be able to create InfoMetadataSaver it should have only one public constructor: it has none. at SimpleInjector.Container.ThrowNotConstructableException(Type concreteType) at SimpleInjector.Container.ThrowMissingInstanceProducerException(Type type) at SimpleInjector.Container.GetInstanceForRootType(Type serviceType) at SimpleInjector.Container.GetInstance(Type serviceType) at Emby.Server.Implementations.ApplicationHost.CreateInstanceSafe(Tuple`2 typeInfo) Source: SimpleInjector TargetSite: Void ThrowNotConstructableException(System.Type) and still nothing in savers No option to enable XML either ............. Edited June 20, 2024 by mickle026
Luke 42077 Posted June 20, 2024 Posted June 20, 2024 Quote If i install XML Metadata (and restart) that does not appear in the metadata savers either? - only a reader There's no more xml saving support. The features of that plugin have been gradually getting chopped down to steer people to the built-in nfo support.
mickle026 650 Posted June 20, 2024 Author Posted June 20, 2024 Well I still cannot fathom why mine will not show as a saver, can you show me the base code what is needed for it to show up? A bare bones interface ? I cannot see what is different in the nfo plugin and mine. Thanks
Luke 42077 Posted June 20, 2024 Posted June 20, 2024 https://github.com/MediaBrowser/NfoMetadata/blob/master/NfoMetadata/Savers/MovieNfoSaver.cs#L166 and base class: https://github.com/MediaBrowser/NfoMetadata/blob/master/NfoMetadata/Savers/BaseNfoSaver.cs#L160
mickle026 650 Posted June 23, 2024 Author Posted June 23, 2024 (edited) Still doesnt show up even with the base class. I cannot see why it would need the base class, but I edited it as you suggested anyway. Either i am doing something wrong or Emby is, Here is the c# solution. Please look at it and tell me what is missing rather than pointing to the same code that is not really helping me. ie, do I need to add configuration options for it to show up? Many thanks LocalMetadataSaver.zip Edited June 23, 2024 by mickle026
Luke 42077 Posted June 24, 2024 Posted June 24, 2024 Another thing to check is that you're using the a nuget package version that is >= to the version of the server that you're testing against.
mickle026 650 Posted June 24, 2024 Author Posted June 24, 2024 Updating the nugets to \.nuget\packages\mediabrowser.common\4.9.0.14-beta\ \.nuget\packages\mediabrowser.server.core\4.9.0.14-beta\ has not affected whether this shows up in library edit or not - still not visible
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