Jump to content

ApiClient; Getting a boxset's (collection) metadata programmatically


Sludge Vohaul
Go to solution Solved by Luke,

Recommended Posts

Sludge Vohaul

Hello,

 

I have programatically created a collection on the server, and would like to fetch it's metadata from the available providers.

 

How do I do that? 

The code which creates the collection is below.

 

Thanks in advance

sv

public async Task<ICollectionIdentifier> CreateCollectionAsync(IEmbyClient client, string collectionName)
{
    var args = new Dictionary<string, string>
    {
        {"IsLocked", "false"},
        {"Name", collectionName},
        {"ParentId", ""},
        {"Ids", ""}
    };
    var collectionCreationResult = await client.PostAsync<CollectionCreationResult>(client.GetApiUrl("Collections"), args);
 
    return new CollectionIdentifier
    {
        Name = collectionName,
        Id = collectionCreationResult.Id,
    };
}
Link to comment
Share on other sites

  • Solution

That's all you need to do because the server will look for internet metadata right after creating the collection.

  • Like 1
Link to comment
Share on other sites

Sludge Vohaul

Argh, sorry for wasting your time - you were right. My source data had a typo in the collection's name ('asd Fimreihe' instead of 'asd Filmreihe') so there was never a match.

Link to comment
Share on other sites

Sludge Vohaul

Just for the sake of completeness:

The automatic retrieval of metadata for a newly created collection seems to be aborted if it is still in progress (has not finished yet) when movies are added to it (i.e. create a collection, add immediately a movie to it -> no metadata).

Link to comment
Share on other sites

Sludge Vohaul

That's how it behaves here (3.2.27.0).

I have a code block which creates all the collections, followed by a code block which adds a movie to these created collections.

1. If both blocks are executed, the collection metadata is not updated.

2. If only the first block is executed, the collection metadata is updated.

3. if I add a breakpoint before executing the second block and a wait a little, the collection metadata is updated.

 

It's not a browser cache issue, as the collections do not have a tmdb id in Point 1

Edited by Sludge Vohaul
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...