Jump to content

Api filtering on Tags


TeamB

Recommended Posts

Question 1:

Is there a way of filtering on tags to not include an item if it has a certain tag

i.e.

{server}/emby/Users/{userid}/Items?tags=!SomeTag

Question 2:

Is it possible to delete an items tag like when adding it using

/Items/{Id}/Tags/Add

Is there an
/Items/{Id}/Tags/Delete
 
Edited by TeamB
Link to comment
Share on other sites

Cheesegeezer

 

5 hours ago, TeamB said:

Question 1:

Is there a way of filtering on tags to not include an item if it has a certain tag

i.e.

{server}/emby/Users/{userid}/Items?tags=!SomeTag

Question 2:

Is it possible to delete an items tag like when adding it using

/Items/{Id}/Tags/Add

Is there an
/Items/{Id}/Tags/Delete
 

 

Hey bud,

So the way i do this is in c# is to get the library items you want and then iterate thru each item and interogate the tags which is a LinkedItemInfo

You will need to pass the BaseItem into your method as a param so that the item's complete info is populated for you.

Here is a snippet that i use to remove existing tags

List<string> vidList = new List<string>();
vidList = _videoTrackTitle.Split(' ').ToList();
var itemTags = item.TagItems;
                        if (config.RemoveTags)
                        {
                            Log.Debug("Removing Video Tags");

                            var tagList = itemTags.ToList();
                            foreach (var vidTag in vidList)
                            {
                                foreach (var itemTag in itemTags)
                                {
                                    if (itemTag.Name == vidTag)
                                    {
                                        Log.Debug("Removing Video Tag - {0}", itemTag.Name);
                                        item.RemoveTag(itemTag.Name);
                                        
                                    }
                                }
                            }
                            ItemRepository.SaveItem(item, CancellationToken.None);
                            
                        }

 

Link to comment
Share on other sites

thanks,

this is for a client (EmbyCon) I dont want to have to have a server plugin to accomplish this. I was just looking for a Web API way.

Link to comment
Share on other sites

Cheesegeezer
16 minutes ago, TeamB said:

thanks,

this is for a client (EmbyCon) I dont want to have to have a server plugin to accomplish this. I was just looking for a Web API way.

Ah ok sorry.  No worries

  • Thanks 1
Link to comment
Share on other sites

15 hours ago, TeamB said:

Question 1:

Is there a way of filtering on tags to not include an item if it has a certain tag

i.e.

{server}/emby/Users/{userid}/Items?tags=!SomeTag

Question 2:

Is it possible to delete an items tag like when adding it using

/Items/{Id}/Tags/Add

Is there an
/Items/{Id}/Tags/Delete
 

There isn't. I added the /Add api for you specifically, so I'd have to do a corresponding delete api.

  • Thanks 1
Link to comment
Share on other sites

  • 1 year later...
On 2/21/2024 at 12:07 PM, quickmic said:

Just asking, was this "delete" ever been added?

Adding it now.

  • Like 1
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...