Jump to content

Recommended Posts

antilog17
Posted

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.
image.png.c43f6fb7521682c14c0725aa656b0c8c.png

Web Interface screenshot

image.png.45019199458ece3356d23aa8487a973d.png

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

Posted

Hi, I would suggest posting in the dedicated topic for the plugin to ensure that the developer will see this. Thanks.

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...