Jump to content

Add movie to collection with C#


Recommended Posts

Posted

How I can add a movie to a collection using C#?
 

public class MovieProvider : BaseProvider, IRemoteMetadataProvider<Movie, MovieInfo>, IHasOrder{

.....
  public async Task<MetadataResult<Movie>> GetMetadata(MovieInfo info,
        CancellationToken cancellationToken){
 var result = new MetadataResult<Movie>{

......

};

      // Add collection.
        if (Configuration.EnableCollections && !string.IsNullOrWhiteSpace(m.Series))
            result.Item.AddCollection(m.Series);

......
  }
}

 

Posted

need implement IHasMetadataFeatures?

Posted
On 2/9/2025 at 8:11 AM, lvtianyi said:

need implement IHasMetadataFeatures?

Hi, yes. this will get the option to show up in library settings to import collections from internet metadata. 

And then yes, item.AddCollection should do it.

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