Kodi Community Forum

Full Version: get all tags
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Hi. I'm trying to create a context menu addon that allows me to add or remove a tag to a media. The problem is that I don't know where I can get all the existing tags. I can retrieve all the movies and create the list but it's very slow. Is there a better method?
Files.GetDirectory() + the VFS path of tags node should do the trick.
Thanks it works well!
Maybe I will create a pull request for J to have a "GetTags" method like you have a "GetGenres" method
Thanks again!
(2015-06-30, 16:32)phate89 Wrote: [ -> ]Maybe I will create a pull request for J to have a "GetTags" method like you have a "GetGenres" method

There's really no need, you just use GetMovies with a filter on tag:
Code:
{"jsonrpc": "2.0", "method": "VideoLibrary.GetMovies", "params": {"sort": {"order": "ascending", "method": "title"}, "filter": {"operator": "contains", "field": "tag", "value": "%"}, "properties": ["title", "art", "tag"]}, "id": "libTags"}

The "%" value for the filter "value" field is a bit of a hack to return all movies with a tag.
(2015-07-01, 05:06)Milhouse Wrote: [ -> ]
(2015-06-30, 16:32)phate89 Wrote: [ -> ]Maybe I will create a pull request for J to have a "GetTags" method like you have a "GetGenres" method

There's really no need, you just use GetMovies with a filter on tag:
Code:
{"jsonrpc": "2.0", "method": "VideoLibrary.GetMovies", "params": {"sort": {"order": "ascending", "method": "title"}, "filter": {"operator": "contains", "field": "tag", "value": "%"}, "properties": ["title", "art", "tag"]}, "id": "libTags"}

The "%" value for the filter "value" field is a bit of a hack to return all movies with a tag.

You still have to go through all result entries and perform de-duplication etc. A VideoLibrary.GetTags will provide the minimum result set to get all tags.
(2015-06-30, 16:32)phate89 Wrote: [ -> ]Maybe I will create a pull request for J to have a "GetTags" method like you have a "GetGenres" method

hi guys. sorry for the necromancy, bumping up such an old thread.

i guess this happened, because i just made a context addon that uses it.

would love some feedback before submitting it

http://forum.kodi.tv/showthread.php?tid=310752