Jump to content

Trying to force the scan of individual items via CLI...


juanmartinbravo
 Share

Recommended Posts

juanmartinbravo

My file system that isn't compatible with real time monitoring. I upload movies and series several times per day and I don't want to do a full scan for the whole library every time I add a new movie.

 

The following curl command

curl -d '{"Updates":[{"path":"/path/my-movies/movie (2020)/movie (2020).mkv","updateType":"Created"}]}' -H "Content-Type: application/json" -X POST http://localhost:8096/emby/Library/Media/Updated?api_key=my-apI-key

When I ran this command I can see on Emby debug logs a message that says:

New file refresher created for "/path/my-movies/movie (2020)/movie (2020).mkv"

However the file doesn't seem to be scanned. Am I doing something wrong? 

 

Isn't it possible to force the scan of one individual file rather than the whole library?

 

thanks

Edited by juanmartinbravo
Link to comment
Share on other sites

juanmartinbravo

Thanks for the quick reply Luke.  But what I observe is that it seems to trigger the scan of the whole library located on:

 /path/my-movies/ 

when I would expect it to scan only this:

/path/my-movies/movie (2020)/movie (2020).mkv 

My idea was to get only the new files  scanned. I don't need/want to get the files that were already there scanned again...

 

Is that possible?

Edited by juanmartinbravo
Link to comment
Share on other sites

That's just the way our scanning works, it's going to do a scan of the parent folder of whatever was added.

Link to comment
Share on other sites

juanmartinbravo

That's just the way our scanning works, it's going to do a scan of the parent folder of whatever was added.

Thanks for the info. 

I noticed in the DEBUG logs that when an episode is added to "/mnt/media/series/SeriesName/Season 1/SeriesName - S01E01 - 1080p.mkv" then Sonarr v3 sends a POST update that triggers only the scan of the folder Season 1 (not the full library).

I'm trying to replicate the same behavior via curl with a command like this:

curl -d '{"Updates":[{"Path":"/mnt/media/series/SeriesName/Season 1/SeriesName - S01E01 - 1080p.mkv","UpdateType":"Created "}]}' -H "Content-Type: application/json" -X POST http://localhost:8096/emby/Library/Media/Updated?api_key=EMBY-API-KEY

But that triggers the a refresh of the whole /mnt/media/series/ rather than just Season 1 as Sonarr does.

 

Is there something wrong on my curl script? I want to replicate the same type of POST sent by Sonarr with curl but I don't see what I'm doing wrong

Link to comment
Share on other sites

juanmartinbravo

In that case Season 1 folder already existed (meaning was previously scanned by Emby for other episodes)

 

But I tried also with other series where the Season 1 folder was never scanned before and I get the same result:

 

the whole library is scanned when I run the curl command. But only the Season is scanned when Sonarr is the one sending POST

Link to comment
Share on other sites

juanmartinbravo

Ok, so I'm now using a curl command identical to the on mentioned in the API:

curl -X POST "http://localhost:8096/emby/Library/Media/Updated?api_key=my-emby-api-key" -H  "accept: */*" -H  "Content-Type: application/json" -d "{\"Updates\":[{\"Path\":\"/path/to/media/movies/movie (year)/file.mkv/\",\"UpdateType\":\"Created\"}]}"

I noticed that when I sent a curl POST command to a file in my movies library (/mnt/unionfs/movies/moviename (year)/movie.mkv then I get this:

Info LibraryMonitor: movies (/mnt/unionfs/movies) will be refreshed.

However if I send a curl command to any of my two Series libraries ( /mnt/unionfs/tv/seriesname/season 3/seriesname - episode s02e01.mkv or /mnt/unionfs/series-spanish/seriesname/season 4/seriesname - episode s04e05.mkv ) then I get something like this:

2020-01-22 18:45:18.333 Info LibraryMonitor: Friday Night Lights (/mnt/unionfs/tv/Friday Night Lights) will be refreshed.
2020-01-22 17:43:30.582 Info LibraryMonitor: Season 4 (/mnt/unionfs/series-spanish/This Is Us/Season 4) will be refreshed.

Obviously what happens when I send a curl POST to any of my two series libraries is what I expect: just an scan of the season or the tv show at best, but never an scan of the whole library.

Therefore I wonder why with the movies library it doesn't work the same way... is this something that should be revised in the API or Emby code?

 

PS: I tested in two different emby server installations (local and remote) and both have the same behaviour

 


 


 

Edited by juanmartinbravo
Link to comment
Share on other sites

Happy2Play

It really is not logical to compare Movies to Shows.  As movies are not a member or anything else in that folder.  A Shows metadata contains the metadata for its episodes via the cached metadata.  So child items can be identified from Show/Season parent folders. 

Link to comment
Share on other sites

juanmartinbravo

It might not be a "logical" comparison but since scripts can be created for the competitor to scan individual folders rather than the main parent folder of the library I was hoping we could do the same with Emby...

 

Its probably a not very important feature for most people, but it's a decisive factor for some

Link to comment
Share on other sites

Ok, so I'm now using a curl command identical to the on mentioned in the API:

curl -X POST "http://localhost:8096/emby/Library/Media/Updated?api_key=my-emby-api-key" -H  "accept: */*" -H  "Content-Type: application/json" -d "{\"Updates\":[{\"Path\":\"/path/to/media/movies/movie (year)/file.mkv/\",\"UpdateType\":\"Created\"}]}"

I noticed that when I sent a curl POST command to a file in my movies library (/mnt/unionfs/movies/moviename (year)/movie.mkv then I get this:

Info LibraryMonitor: movies (/mnt/unionfs/movies) will be refreshed.

However if I send a curl command to any of my two Series libraries ( /mnt/unionfs/tv/seriesname/season 3/seriesname - episode s02e01.mkv or /mnt/unionfs/series-spanish/seriesname/season 4/seriesname - episode s04e05.mkv ) then I get something like this:

2020-01-22 18:45:18.333 Info LibraryMonitor: Friday Night Lights (/mnt/unionfs/tv/Friday Night Lights) will be refreshed.
2020-01-22 17:43:30.582 Info LibraryMonitor: Season 4 (/mnt/unionfs/series-spanish/This Is Us/Season 4) will be refreshed.

Obviously what happens when I send a curl POST to any of my two series libraries is what I expect: just an scan of the season or the tv show at best, but never an scan of the whole library.

Therefore I wonder why with the movies library it doesn't work the same way... is this something that should be revised in the API or Emby code?

 

PS: I tested in two different emby server installations (local and remote) and both have the same behaviour

 

 

 

 

That's just the way our scanning currently works. We scan the parent folder because there will be some data attached to the parent folder about the items underneath. It's something that can be improved in future updates though. Thanks.

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
 Share

×
×
  • Create New...