Jump to content

Automated Tagging


Steve86

Recommended Posts

Steve86

Hey guys,

 

i'm new to emby server and couldn't find any clou about automation of adding specific tags to movies. As an example i'd like to add a 4K tag to every movie which has this resolution. I'm aware, that i can search for 4K movies without the tag, but i'd like to prevent certain users from accessing this movies via black listing the tag. This is just an example and i'd like to use this also on audio language or 3d movies aswell.

 

I tested the blacklist and it works great, but some rule based automatic adding of tags would be much appreciated.

 

The only other way i found, was to make different libraries for any different kind of movies (e.g. video resolution), but this makes it impossilbe to put different versions of a movies into the same folder for other users that have access. I'd like to still be able to use 'Multi-version movies' as discribed here https://support.emby.media/support/solutions/articles/44001159102-movie-naming

 

Is there any way to auto tag for this?

 

Thanks in advance,

Steve

Edited by Steve86
  • Like 1
Link to comment
Share on other sites

Hi, we don't currently have any automated tagging features but this would be a nice plugin idea.

@@chef might be interested.

  • Like 2
Link to comment
Share on other sites

Steve86

Thanks Luke and chef for picking up my request this fast. That is amazing :) Thank you very much.

 

I suppose it would make sense to implement it as a plugin, since only some users might need it.

 

I did some further testing into the idea and wanted to prevent some users to access a specific version of a movie (e.g. 1080p and 2160p) by blacklisting some manually added '4k' tags. I seems that this won't work as 'beautifully' as i hoped. The reason is, that a tag affects all versions of a movie unless i split it into separate items (or don't use the naming convention for Multi-Versions in the beginning). This will result in two different entries in the library for users which aren't blacklisted for one of them. I am out of ideas how to solve this, unless it would be possible to tag each version of a movie. :(  But i feel like this might be a misuse of tags and would require some other kind of user based filtering which goes down to the specific versions of a movie. Anyway, this is a 'beauty flaw' i could live with, if i don't have to add all tags by hand.

Link to comment
Share on other sites

  • 5 months later...

Sorry!  fell of my radar. Argh! I'll look at it this weekend. We can most likely add tags for movies through the API. We can try, listing a bunch of them and bulk edit the tags.

Do you think that would work?

Link to comment
Share on other sites

@chef Thanks for picking this up again. Don't worry about it, you probably have lots on your radar.

I had a nice web gui solution in mind, but an API solution also sounds reasonable, although i never used the Emby API before. I suppose it would be some kind of script then? I use FreeBSD 11.4 to run emby-server at the moment, so \bin\sh would be no problem. If you point me to the promising api calls, i could even try a simple solution on my own. Can you set tags via API?

Edited by Steve86
Link to comment
Share on other sites

PenkethBoy

yes you can

try via swagger - via the api link at bottom of dashboard main page

you would probably do it via curl

Link to comment
Share on other sites

  • 1 month later...
  • 1 month later...
On 11/28/2020 at 7:15 PM, MajorTomG said:

I'd be interested in an auto tag solution for the exact same reason as op. Has anyone had any joy implementing something like this?

I'm interested in too !

Link to comment
Share on other sites

I'm finally getting around to this today. 

  • a select box with item types ("Movie", "Series"). If series is selected, a second select box with seasons, then episodes.
  • second static select box list containing the actual base items (movie, episode)
  • a third text input where you can attach tags to the item.
  • A save button

The tag text input is going to have to get populated with current tags when the item is selected, and save the new tags when the item is saved.

 

Questions:

1. are we bulk updating many tags here? Do you guys want to send a comma delimited list of tags, or do you want to add one tag at a time?

2. Are we tagging at each level? For example are we tagging series, as well as individual episodes?

Just trying to figure out the workflow. :)

 

@PenkethBoy does this look like I'm doing this properly LOL! setting the new tag value at the end of the array, and calling LibraryManager UpdateItem? 🤪

        public void Post(UpdateTagRequest request)
        {
            var item = LibraryManager.GetItemById(request.InternalId);
            item.Tags.SetValue(request.Tag, item.Tags.Length);
            LibraryManager.UpdateItem(item, item.Parent, ItemUpdateType.MetadataEdit);
        }

 

Edited by chef
Link to comment
Share on other sites

Okay to answer some of my own questions here.

This is how we are going to update the tags:

        public void Post(UpdateTagRequest request)
        {
            var item = LibraryManager.GetItemById(request.InternalId);
            item.Tags = request.Tags;
            LibraryManager.UpdateItem(item, item.Parent, ItemUpdateType.MetadataEdit);
        }

We send back the entire list and overwrite the saved tags with the new list, which contains the old tags.

Inside the configuration, we show the list of tags for each selected item.

The user will be able to add to the list, and save them back to the base item object.

It sounds complicated, but when the editor is finished it will be "super easy, barely an inconvenience..."

  • Like 1
Link to comment
Share on other sites

PenkethBoy

one thing to remeber is that tags and tagitems are different

Tags are just a string of comma separated items

but tagitems also have an ID assigned

via the http api its a mess i have reported a couple of time to Luke as some parts of the api dont work as you would expect

so i would check that via a plugin that its actually doing what you think it should as easy to lose all tags on an edited item

  • Thanks 1
Link to comment
Share on other sites

Just now, PenkethBoy said:

one thing to remeber is that tags and tagitems are different

Tags are just a string of comma separated items

but tagitems also have an ID assigned

via the http api its a mess i have reported a couple of time to Luke as some parts of the api dont work as you would expect

so i would check that via a plugin that its actually doing what you think it should as easy to lose all tags on an edited item

I just realized this! Thank you!

{
  "Items": [
    {
      "Name": "Prometheus",
      "ServerId": "6ba0e0a1172b4591b87a50d0c23cce3e",
      "Id": "127001",
      "RunTimeTicks": 74265600000,
      "IsFolder": false,
      "Type": "Movie",
      "TagItems": [],
      "Tags": [],
      "ImageTags": {
        "Primary": "aed39463a13c86fc7ce246567c5122ab",
        "Logo": "004040d8ef411752e01d6d7ac6aebaa7",
        "Thumb": "6a8ad9cc18f3c1c7f6e4afe71100952b"
      },
      "BackdropImageTags": [
        "50f4f3a0fa1184f8186f1ff2e445cbcc",
        "e66f7223126e4ba88e64dc0a332481d1",
        "410aac1315f615029ac94df11617b6a0"
      ],
      "MediaType": "Video"
    }
  ],
  "TotalRecordCount": 1
}

I will attempt to change both and see what happens. 

 

I apparently am not using any tags for movies...

 

@Luke which baseItem element and I changing here? LOL. Is it "Tags"?

Link to comment
Share on other sites

PenkethBoy

@chef

its been a while so might have this backwards

but what i found that works is delete any tagitems - just return the Tags (comma separated) and emby will update the tagitems for you as it imports the whole record etc

complete hollicks of a situation

  • Like 1
Link to comment
Share on other sites

Just now, PenkethBoy said:

@chef

its been a while so might have this backwards

but what i found that works is delete any tagitems - just return the Tags (comma separated) and emby will update the tagitems for you as it imports the whole record etc

complete hollicks of a situation

oh, so tagitems are like pointers or something? 

I'll try empting the tagitems before updating the tags. 

Thank you for the help ;) I'm positive I'll have more questions LOL

 

Link to comment
Share on other sites

1 minute ago, roaku said:

 

Okay, thanks for that.

I think I understand what's happening.  

Lets see if we can fix all of this inside this plugin while we're creating the editor. Maybe. ;)

  • Haha 2
Link to comment
Share on other sites

Well, we have the inner workings of an editor.

tageditor.thumb.png.b1b5b2cc832edd49d178a0531e1ad92b.png

 

At least we are getting items in lists to manipulate now.

 

If it wasn't for the whole home schooling, lockdown, stuff happening at the same time as trying to write this thing, I think I might have even had it finished by now 😁

Link to comment
Share on other sites

Getting even closer with the editor. About half way there... I think. 😆

tageditor2.thumb.png.35bc90fb8c57b197efc7320890b51ad7.png

tageditor3.thumb.png.d96ba2de96c48f3bba8dc3ce46576d85.png

 

Hmm. Still don't know if we are targeting series, or individual episodes, or both, or ...??

Edited by chef
Link to comment
Share on other sites

PenkethBoy

well genres can be applied to all three levels for tv - and tags can as well - so do all three as you are in the mood as if you dont somebody is bound to want it after you release it :)

  • Like 1
Link to comment
Share on other sites

I thought about something like this, but it's not going to work. Each select box item could have different tags.

tageditor4.thumb.png.c43462c9133f2e39900bbc416e55db68.png

 

When dealing with series,  each select box is going to have to have a tag list underneath it with the ability to add or remove tags.

then a save button.

seems easy enough :)

Link to comment
Share on other sites

PenkethBoy

have three tag dialogs - enabled disabled via the toggles?

filled with existing tags on load?

save button for each ?

  • Like 1
Link to comment
Share on other sites

PenkethBoy

but what do we do if we want to save one (or more) tag(s) to all series etc - i guess a separate editor page?

  • Like 1
Link to comment
Share on other sites

rbjtech

When I looked at this a while back, pretty sure the tags in the db was just a single field with ; separated items - so I assume you could add multiple tags this way - let me check ...

edit

Apologies - it's a <space>vertical bar/ASCII-124<space>

tag.PNG

Edited by rbjtech
  • 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...