Jump to content

Proper UNC path encoding.


rodadams

Recommended Posts

rodadams

 

Hello --

I recently moved from having my Emby server and other *arrs/etc tools from all being on the same Windows machine to being split where Emby is still on my windows host, but most of the rest are in docker compose, running on my NAS [which Emby reads . This is all working great, except that it seems due to various filesystem/filesharing limitations, the real time monitoring system no longer functions. le sigh.

Due to Emby server on windows seeing the base Movies path as \\server\media\Media\Movies, and radarr seeing it as /movies/; using the *arr builtin connect feature "works", in that it sends a message, but doesn't work, in that the paths are mismatched, and Emby doesn't interpret the information correctly.

Rummaging around the forums, I've found fizzyade's bash script, which one can have *arr connect call, it mutates the path for you, and then fires off an Emby API call to inform it of the changes. I have it all triggering, but I seem to be left with a problem: How on earth does one encode the unc path for the script?

 

Details for Movies/Radarr case, TV/Sonarr is similar enough to not repeat.

  • Emby Movies library is composed of the folder \\pandora\media\Media\Movies
  • radarr (running on pandora in docker) sees the same folder locally as  /movies
  • For example, "/movies/Godzilla (1954)" would match "\\pandora\media\Media\Movies\Godzilla (1954)"

 

what I currently have at the top of the script, which isn't triggering Emby to find it.

apiKey="<a_real_key>"
url="http://192.168.1.102:8096"
local_movie_path="/movies/"
local_tv_path="/tv/"
remote_movie_path="\\\\pandora\\media\\Media\\Movies\\"
remote_tv_path="\\\\pandora\\media\\Media\\TV\\"

I suspect I just need to recode the remote_movie_path to express the UNC in some other way, just not sure how.

 

I know the key and url work because I can get the updates I need with

curl --data '' $url/Emby/Library/Refresh?api_key=$apiKey

but asking for a full refresh of all my libraries for every single update feels a bit like buying 100 hammers to pound one nail.

 

Any thoughts?

 

 

Link to comment
Share on other sites

Hello rodadams,

** This is an auto reply **

Please wait for someone from staff support or our members to reply to you.

It's recommended to provide more info, as it explain in this thread:


Thank you.

Emby Team

Link to comment
Share on other sites

rbjtech
14 minutes ago, rodadams said:

I know the key and url work because I can get the updates I need with

curl --data '' $url/Emby/Library/Refresh?api_key=$apiKey

but asking for a full refresh of all my libraries for every single update feels a bit like buying 100 hammers to pound one nail.

Any thoughts?

Specify the Parentid in the Refresh command and it will just Refresh that library, not all of them.

ie

curl -X POST "http://embyhost:8096/emby/Items/2237026/Refresh?api_key=*" -H "accept: */*"

Where 2237026 is the parentid of the Library  in my case (look in a browser for the url when you open that library - it will be at the end)

..... 311d249&parentId=2237026

 

Edited by rbjtech
  • Thanks 1
Link to comment
Share on other sites

rodadams

@rbjtech

That helps some, in that it would mean I'm buying fewer hammers, but ultimately, I'd like to figure out the path translation, so I can use Library/Media/Updated endpoint in fizzyade's script, to just update the path for the one movie/show.  Though, your solution would still get problematic on the TV side, as I have Anime in a separate library from TV, but both come in from sonarr, so I'd have to have logic to sort that out.

Thanks for trying, though!

  • Thanks 1
Link to comment
Share on other sites

rodadams

Still waiting to hear if anyone knows the correct way to encode a Windows UNC path for the Library/Media/Updated endpoint.  RbjTech's option was a valiant attempt to assist in my issue, but really didn't change my situation.

Link to comment
Share on other sites

rbjtech

 The API (without further processing - see below) will not be able to use the direct movie/episode file path in these commands - it must use the ItemId.  Thus, unless you have this variable - you will not be able to target an individual item for any API command.   Therefore doing it at the library level (which I showed above) is a possible solution. 

However ..

To get the ItemId for a given path - you could query the API to get it - and then pass this into the Refresh/Update APi command to just refresh that item.

curl -X GET "http://host:8096/emby/Items?Recursive=true&Fields=Path&Path=%5C%5CMEDIA%5CFilms%5C2%20Guns%20%282013%29%20%5BtmdbId%3D136400%5D%5C2%20Guns%20%282013%29%20-%20WEBDL-1080p.mkv&api_key=<key>" -H "accept: application/json"

where path=\\MEDIA\Films\2 Guns (2013) [tmdbId=136400]\2 Guns (2013) - WEBDL-1080p.mkv in the above (%5C=\) in the above example

it returns ..

{
  "Items": [
    {
      "Name": "2 Guns",
      "ServerId": "***",
      "Id": "3179703",
      "Path": "\\\\MEDIA\\Films\\2 Guns (2013) [tmdbId=136400]\\2 Guns (2013) - WEBDL-1080p.mkv",
      "RunTimeTicks": 65305600000,
      "IsFolder": false,
      "Type": "Movie",
      "ImageTags": {
        "Primary": "35f123c575ee2545d3a3994fe70198ed",
        "Logo": "8a66838e6b437a29cf3332eaae8c1020",
        "Thumb": "2dc61c6a857e213ea95cea2d330392c3"
      },
      "BackdropImageTags": [
        "57b31a3fde633d0f5647fcf327ad1994"
      ],
      "MediaType": "Video"
    }
  ],
  "TotalRecordCount": 1
}

Note - you now have the 'Id' - and you can use that to just Refresh the individual item.

Maybe have a play with the API - you can also use provider ID's (I know the Arr's use/have these as variables.. ) - so it might be better if it queried via those for more accuracy/speed.

curl -X GET "http://host:8096/emby/Items?Recursive=true&Fields=Path&AnyProviderIdEquals=tmdb.136400&api_key=***" -H "accept: application/json"

Will return the same data based on the tmdbid for example.

Link to comment
Share on other sites

rodadams

Hmm. Okay, you seem to be suggesting that the Library/Media/Updated endpoint used in fizzyade's script (linked above) doesn't support UNC paths for notification. That's dissappointing.

I understand your points about finding the ID of the media, and then refreshing that. However, my most common case will be "Add the media in this directory which didn't exist before", so it won't have such an ID until it's imported.... and the main point was to trigger Emby to import the new media.

Hrm. Sounding like I'm stuck with forcing full library updates to trigger the import faster. Unless you know of a different endpoint where I can send a location to look for media from...  [not add a new path to a library, but notify of a new subdirectory in the library [movie], or file within the directory [tv].

 

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