Jump to content

Which Interface for Metadata saver such as xml, nfo ?


Recommended Posts

mickle026
Posted

Which Interface to enable a metadata saver here?

Screenshot2024-06-14at13-00-01Library.png.3ff07db510ab0f1444b25c6414a91a90.png

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

Posted

Looks like you got it right.

mickle026
Posted
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?

mickle026
Posted

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?

Posted

What did you compare you with the nfo plug-in?

mickle026
Posted

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:

Screenshot2024-06-14at13-00-01Library.png.e22477538816d39f2bc70343e98145a5.png

mickle026
Posted (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

20_06.2024_11_22.12_REC.png.f09511af9a90440b450afec40c3b8767.png

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

20_06.2024_11_27.03_REC.png.916774cb93abe5d592607ab7a9e6743f.png

 

No option to enable XML either .............

 

 

Edited by mickle026
Posted
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
Posted

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

mickle026
Posted (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 by mickle026
Posted

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
Posted

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

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