Jump to content

Any way to delay scanning new media slightly?


Recommended Posts

Posted

I think no, but is there any way for emby to “wait 5 minutess” once a new file is available before running jobs on it?
I currently use the real-time monitoring. But I think the only other options are at an interval. But I specifically want Emby to see a file and wait 5 minutes from that time.

Reason being, I'm running a short transcode on new files, and typically Emby is faster than that process, causing things like Intro detection and metadata scans to run twice - once when the raw file is added, and again once the transcoded file replaces it. This is not really a huge deal but I feel like I'm wasting resources.

Alternatively, can Emby be configured to only scan files with a certain text in the name? I could make the transcoded file have a special character or similar and have Emby pick up that.

I think 'no' in both cases, but I have some other ideas if not, just wanted to check with those who know better than I.

Thanks!

Happy2Play
Posted
1 minute ago, podonnell said:

I think no, but is there any way for emby to “wait 5 minutess” once a new file is available before running jobs on it?
I currently use the real-time monitoring. But I think the only other options are at an interval. But I specifically want Emby to see a file and wait 5 minutes from that time.

Reason being, I'm running a short transcode on new files, and typically Emby is faster than that process, causing things like Intro detection and metadata scans to run twice - once when the raw file is added, and again once the transcoded file replaces it. This is not really a huge deal but I feel like I'm wasting resources.

Alternatively, can Emby be configured to only scan files with a certain text in the name? I could make the transcoded file have a special character or similar and have Emby pick up that.

I think 'no' in both cases, but I have some other ideas if not, just wanted to check with those who know better than I.

Thanks!

Are you talking about RealTimeMonitoring ie the default 90 second delay in your system.xml?

<LibraryMonitorDelaySeconds>90</LibraryMonitorDelaySeconds>

But sounds like you may just need to disable RTM and do on demand library scanning triggered per api call on library or schedules scans at specific times of the day.

  • Like 1
Posted
22 minutes ago, Happy2Play said:

Are you talking about RealTimeMonitoring ie the default 90 second delay in your system.xml?

<LibraryMonitorDelaySeconds>90</LibraryMonitorDelaySeconds>

But sounds like you may just need to disable RTM and do on demand library scanning triggered per api call on library or schedules scans at specific times of the day.

Ooh, I did not know about that system.xml value -- how does that work? Does it mean real-time is actually every 90 seconds, or once it sees a file, it waits 90 seconds to do anything with it?

 

Otherwise yeah, I would need to disable RTM. I did not think of an API call scan - I could programmatically have something wait the 5 minutes I need after import if I go that route.

Happy2Play
Posted (edited)
3 minutes ago, podonnell said:

Ooh, I did not know about that system.xml value -- how does that work? Does it mean real-time is actually every 90 seconds, or once it sees a file, it waits 90 seconds to do anything with it?

Correct this the delay that happens when iNotify triggers the refresh event on item/library.

3 minutes ago, podonnell said:

Otherwise yeah, I would need to disable RTM. I did not think of an API call scan - I could programmatically have something wait the 5 minutes I need after import if I go that route.

Yes you would have to postscript trigger a scan once said task was complete.

Edited by Happy2Play
  • Like 1
Posted

Alternatively, just write the transcoded file as a .tmp or something that emby will not recognise - once complete, then simply rename it to .mkv or whatever - and then emby will pick it up.

Posted
4 hours ago, Happy2Play said:

Correct this the delay that happens when iNotify triggers the refresh event on item/library.

Yes you would have to postscript trigger a scan once said task was complete.

Just to clarify, the delay works like this?

-New item added
-RTM notices new item
-90 second delay on item
-Item is scanned

I feel like I maybe have that wrong. Also does the scan occur on just the item itself, or does that trigger a full library scan? What would happen if another item was added, say during the 90 second wait for the first?

 

3 hours ago, rbjtech said:

Alternatively, just write the transcoded file as a .tmp or something that emby will not recognise - once complete, then simply rename it to .mkv or whatever - and then emby will pick it up.

I think this is kind of how it is working now. My goal was to prevent emby from doing all its work on a new file, having that file transcoded and then saved, and then having emby run all those same tasks.

Posted
Quote

Also does the scan occur on just the item itself, or does that trigger a full library scan?

It tries to keep it as localized as possible.

Posted (edited)

1. Create an Emby API within Emby - %EmbyAPIKey%

2. Turn off Real Time Monitoring for the library in question

3. Identify the Parent ID of the Library you are adding to (it will then only scan that library, not everything) - Get from looking at the URL when in the Library (says parentid=) - %ParentID%

4. Add post processing to your add script that Refreshes that library once all items have been added

curl -X POST "%IP_or_FQDN%:8096/emby/Items/%ParentID%/Refresh?api_key=%EmbyAPIKey%" -H "accept: */*"

ParentID can be any Parent - so a TV Show root or even Season for example.

There are also various parameters you can add to change the way it updates -

Recursive=true/false
MetadataRefreshMode=FullRefresh/ValidationOnly/Default
ImageRefreshMode=FullRefresh/ValidationOnly/Default
ReplaceAllMetadata=true/false
ReplaceAllImages=true/false

ie

curl -X POST "%IP_or_FQDN%:8096/emby/Items/%ParentID%/Refresh?Recursive=true&MetadataRefreshMode=FullRefresh&ImageRefreshMode=FullRefresh&ReplaceAllMetadata=true&ReplaceAllImages=true&api_key=%EmbyAPIKey" -H "accept: */*"

Would do a full refresh of all metadata and images for a TV Show if you specified the TV Show Root Parent.

On EmbyDev - See - postItemsByIdRefresh (emby.media)

 

Edited by rbjtech

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