antilog17 1 Posted July 31 Posted July 31 I wasn't sure the thread to post this, so I'm aiming for general help. If this should be in a different thread (Developer API or Plugin), let me know and I will move it. As a note, I am running my Emby Server 4.9.5.0 on QNAP. My end goal is to use the EmbyIcons plugin to show informative icons over posters. The plugin is great, but there is one bit missing: multiple versions. There is no in-built detection for an item having multiple versions. However, EmbyIcons allows you to define custom rules tied to the metadata, so I figured if I can automate adding a tag ("MultiVersion") to any item that has multiple versions (Logan, for example, which has color and black and white or even a movie where I have both 4K and 1080p versions). This led me to the Scripter-X plugin, which sounds exactly what I need, but I'm having trouble getting it to work. First, I'm sure the python script I wrote is not even getting executed. But before that, I'm trying to write a basic python script that, if provided with some identifying information like the Emby item ID, will go in and add the "MultiVersion" tag. To this end, I am trying to use the REST API to get the information, but am struggling with how to determine versions. The problem I'm getting is that the different versions have different IDs. In my particular example, I have 4K DolbyVision of LOTR: The Fellowship of the Ring and the 1080p version. In all Emby clients I've checked (Web Interface, Shield TV, and Android phone app), the entry shows as expected. Web Interface screenshot The URL in the web interface is: /web/index.html#!/item?id=354397&serverId=... If I go to the API link at the bottom of the dashboard to test out a REST API call, I only get a single video item back. It turns out that the 4K item, has a separate ID (354398). Since I may have items that are manually entered (not linked to a tmdb or thetvdb entry), I'm trying to find a reliable way to write a script to do the detection and tagging and run it with Scripter-X. Can anyone offer insight into: 1) How to determine if an item (movie or episode) has multiple versions via REST API? 2) How to get my Scripter-X working? URL in REST Call: /emby/Items?Fields=MediaSources&Ids=354397&api_key=... Output (I have removed the ServerId from the output below for security / privacy reasons): { "Items": [ { "Name": "The Lord of the Rings: The Fellowship of the Ring", "ServerId": HIDDEN_SERVERID, "Id": "354397", "Container": "mkv", "MediaSources": [ { "Chapters": [], "Protocol": "File", "Id": "mediasource_354397", "Path": "\\\\KSMEDIANAS\\HTPC\\Movies\\The Lord of the Rings The Fellowship of the Ring (2001)\\The Lord of the Rings The Fellowship of the Ring (2001) - 1080p Extended Remaster.mkv", "Type": "Default", "Container": "mkv", "Size": 18868053412, "Name": "1080p Extended Remaster", "IsRemote": false, "HasMixedProtocols": false, "RunTimeTicks": 136913860000, "SupportsTranscoding": true, "SupportsDirectStream": true, "SupportsDirectPlay": true, "IsInfiniteStream": false, "RequiresOpening": false, "RequiresClosing": false, "RequiresLooping": false, "SupportsProbing": true, "MediaStreams": [ { "Codec": "h264", "Language": "eng", "ColorTransfer": "bt709", "ColorPrimaries": "bt709", "ColorSpace": "bt709", "TimeBase": "1/1000", "VideoRange": "SDR", "DisplayTitle": "1080p H264", "DisplayLanguage": "English", "NalLengthSize": "4", "IsInterlaced": false, "BitRate": 11024773, "BitDepth": 8, "RefFrames": 1, "IsDefault": true, "IsForced": false, "IsHearingImpaired": false, "Height": 804, "Width": 1920, "AverageFrameRate": 23.976025, "RealFrameRate": 23.976025, "Profile": "High", "Type": "Video", "AspectRatio": "160:67", "Index": 0, "IsExternal": false, "IsTextSubtitleStream": false, "SupportsExternalStream": false, "Protocol": "File", "PixelFormat": "yuv420p", "Level": 41, "IsAnamorphic": false, "ExtendedVideoType": "None", "ExtendedVideoSubType": "None", "ExtendedVideoSubTypeDescription": "None", "AttachmentSize": 0 }, { "Codec": "eac3", "Language": "eng", "TimeBase": "1/1000", "DisplayTitle": "English EAC3 5.1 (Default)", "DisplayLanguage": "English", "IsInterlaced": false, "ChannelLayout": "5.1", "BitRate": 1024000, "Channels": 6, "SampleRate": 48000, "IsDefault": true, "IsForced": false, "IsHearingImpaired": false, "Type": "Audio", "Index": 1, "IsExternal": false, "IsTextSubtitleStream": false, "SupportsExternalStream": false, "Protocol": "File", "ExtendedVideoType": "None", "ExtendedVideoSubType": "None", "ExtendedVideoSubTypeDescription": "None", "AttachmentSize": 0 }, { "Codec": "ass", "Language": "eng", "TimeBase": "1/1000", "Title": "English", "DisplayTitle": "English (ASS)", "DisplayLanguage": "English", "IsInterlaced": false, "IsDefault": false, "IsForced": false, "IsHearingImpaired": false, "Type": "Subtitle", "Index": 2, "IsExternal": false, "IsTextSubtitleStream": true, "SupportsExternalStream": true, "Protocol": "File", "ExtendedVideoType": "None", "ExtendedVideoSubType": "None", "ExtendedVideoSubTypeDescription": "None", "AttachmentSize": 0, "SubtitleLocationType": "InternalStream" }, { "Codec": "ass", "Language": "eng", "TimeBase": "1/1000", "Title": "English SDH", "DisplayTitle": "English (ASS)", "DisplayLanguage": "English", "IsInterlaced": false, "IsDefault": false, "IsForced": false, "IsHearingImpaired": false, "Type": "Subtitle", "Index": 3, "IsExternal": false, "IsTextSubtitleStream": true, "SupportsExternalStream": true, "Protocol": "File", "ExtendedVideoType": "None", "ExtendedVideoSubType": "None", "ExtendedVideoSubTypeDescription": "None", "AttachmentSize": 0, "SubtitleLocationType": "InternalStream" } ], "Formats": [], "Bitrate": 11024773, "RequiredHttpHeaders": {}, "AddApiKeyToDirectStreamUrl": false, "ReadAtNativeFramerate": false, "ItemId": "354397" } ], "RunTimeTicks": 136913860000, "Size": 18868053412, "Bitrate": 11024773, "IsFolder": false, "Type": "Movie", "ImageTags": { "Primary": "bf3b07641d0b4f393ab0d823685b9997", "Art": "ba2a29d3e2c4549162d6367ba6810b50", "Banner": "faa410f0a07c2a34a6823c12e8d55dff", "Disc": "66b6e0835807582a2734693b8cafb80c", "Logo": "ed0a319dbdc716f4cd47ad8f54ddb129", "Thumb": "fbde7c997bb9440221a20159cb5fd6d8" }, "BackdropImageTags": [ "46150c0aedee3bdb8c840030c754f6c5" ], "MediaType": "Video" } ], "TotalRecordCount": 1 } Thank you for any insight anyone can offer. antilog17
Luke 43022 Posted July 31 Posted July 31 Hi, I would suggest posting in the dedicated topic for the plugin to ensure that the developer will see this. Thanks.
antilog17 1 Posted July 31 Author Posted July 31 (edited) Thank you, I wasn't sure if I should post it there are not as part of my issue was about the REST API and how the files are organized and retrieved. Is there any insight into the REST API bit? Edited July 31 by antilog17
Luke 43022 Posted yesterday at 03:42 PM Posted yesterday at 03:42 PM On 7/31/2026 at 3:30 PM, antilog17 said: Thank you, I wasn't sure if I should post it there are not as part of my issue was about the REST API and how the files are organized and retrieved. Is there any insight into the REST API bit? Hi, the item payload will have a list of MediaSources, so you can examine those and see if there is more than one. Make sure to use the single item endpoint, not the multi-item one.
antilog17 1 Posted 49 minutes ago Author Posted 49 minutes ago On 9/4/2026 at 11:42 AM, Luke said: Hi, the item payload will have a list of MediaSources, so you can examine those and see if there is more than one. Make sure to use the single item endpoint, not the multi-item one. The MediaSources didn't work because all scripter-X could get handed to it was the movie ID, which is apparently unique to each version (see the prior post). Fellowship has multiple versions, as correctly IDed on the interface, but the REST API only returned a single MediaSource when querying. I did end up getting everything working. I'll walk through the solutions here, but if someone wants the actual python code, let me know. To accomplish the tagging goal, I had to treat movies and TV episodes differently. Movies I tagged scripter-x to run against any item update that was a movie. I used the REST API to grab the parent of the movie instance and then grab all movies that shared the parent. This was the only way I found to grab all versions of a movie. Movies have separate instance IDs and outside of using a TheMovieDB or IMDB common ID (which I have some movies that may not match), this was the only way I found to grab all the "versions" of a movie since they since in the same folder (which is the movie parent). Episodes This was a little more straight forward since scripter-x can automatically retrieve the series, season, and episode numbers. Make a REST API query to get all episodes from a given season. Iterate through the results for all objects whose 'IndexNumber' matches the episode number (the REST API wouldn't take IndexNumber as a searchable input from my experimentation). End result is a list of all versions of that specific episode. 1
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now