Jump to content

Automation question (refresh library + subtitles download)


xservers

Recommended Posts

xservers

Question: Is there a way to automate the following processes via bash commands?:

- Video Library refresh (detect new media)

- Subtitles automatic download

I made a bash script that moves folders into the Emby library once are ready to be moved, and I would like to trigger the detection and automatic subtitles download without user intervention. Is it possible?

Running Emby on a Syno NAS.

Link to comment
Share on other sites

Hi, why not just configure it Emby library setup?

Link to comment
Share on other sites

xservers
7 minutes ago, Luke said:

Hi, why not just configure it Emby library setup?

Hi - not sure I got what you meant. I'm not talking about library settings, but to trigger a refresh (and download the subtitles when it does) via some command once I move content into it (either that, or emby immediately detecting new content). Emby goes to a cycle to detect new content, I am talking about immediate refreshes when the content is added). This is the option I want to trigger (but also need to download the subtitles when it does):
image.png.e0bb38d63058cee60d9d97609f885bb2.png

Link to comment
Share on other sites

Happy2Play

But in Library setup you can configure it to download subs when content is added?  

image.png.28191dfcbd90b8eef4bb4c4067949e5f.png

But I guess you can look at the api and do what you want manually.

REST API Documentation

Link to comment
Share on other sites

TMCsw

How about just enabling RTM for the library

image.thumb.png.f04050e1bf6483ce7c173bff8cca3bfe.png

Link to comment
Share on other sites

xservers

Thanks, unfortunately the subtitles download does not always trigger upon adding new content and adding new content to the libraries does not refresh until the cycle is over (being this the main reason why I'm forced to automate all this externally).
I wasn't aware in all this years using Emby that it had an API. This is what I need probably. I'll give it a try,

Thanks 

Link to comment
Share on other sites

xservers
2 minutes ago, TMCsw said:

How about just enabling RTM for the library

image.thumb.png.f04050e1bf6483ce7c173bff8cca3bfe.png

I wish this ever worked, but it doesn't... refreshes after a cycle (there have been times when I had to wait hours and ended up opening the interface just to refresh it). This is why I'm automating it on my own now.

image.png.bfe400c76dc41319e65e438272c74430.png

Link to comment
Share on other sites

Happy2Play
2 minutes ago, xservers said:

I wish this ever worked, but it doesn't... refreshes after a cycle (there have been times when I had to wait hours and ended up opening the interface just to refresh it). This is why I'm automating it on my own now.

image.png.bfe400c76dc41319e65e438272c74430.png

Must be a platform issue as Windows flags the refresh and after 90 seconds (new set interval was prevously 60 seconds) RTM stops monitoring and scans the new flagged media.

But Synology is infamous for iNotify errors and requires modification to extend default values.  But server log would tell you that.

 

  • Agree 1
Link to comment
Share on other sites

xservers
2 minutes ago, Happy2Play said:

Must be a platform issue as Windows flags the refresh and after 90 seconds (new set interval was prevously 60 seconds) RTM stops monitoring and scans the new flagged media.

But Synology is infamous for iNotify errors and requires modification to extend default values.  But server log would tell you that.

 

OMG - if this works, you saved my day. Trying it right now, will update later!

Link to comment
Share on other sites

Happy2Play
1 minute ago, xservers said:

OMG - if this works, you saved my day. Trying it right now, will update later!

Does your server log contain then mentioned error?

But troubleshooting we would need specific examples.

Link to comment
Share on other sites

xservers

Yeah, logs shows nothing... I just moved 4 movies 15 minutes ago (after creating -and running- the task with the fix for RTM) and the new additions are still not being displayed:

2024-05-05 00:00:01.122 Info App: Application version: 4.7.14.0
2024-05-05 00:00:01.122 Info App: Emby
Command line: /volume1/@appstore/EmbyServer/system/EmbyServer.dll -programdata /var/packages/EmbyServer/var -ffdetect /var/packages/EmbyServer/target/bin/ffdetect -ffmpeg /var/packages/EmbyServer/target/bin/ffmpeg -ffprobe /var/packages/EmbyServer/target/bin/ffprobe -nolocalportconfig -ignore_vaapi_enabled_flag -pidfile /var/packages/EmbyServer/var/EmbyServer.pid -defaultdirectory /volume1/Public -updatepackage emby-server-synology72_{version}_x86_64.spk
Operating system: Linux version 4.4.302+ (root@build5) (gcc version 12.2.0 (GCC) ) #69057 SMP Fri Jan 12 17:02:27 CST 2024
Framework: .NET 6.0.20
OS/Process: x64/x64
Runtime: volume1/@appstore/EmbyServer/system/System.Private.CoreLib.dll
Processor count: 8
Data path: /var/packages/EmbyServer/var
Application path: /volume1/@appstore/EmbyServer/system
2024-05-05 00:00:01.122 Info App: Logs path: /var/packages/EmbyServer/var/logs
2024-05-05 00:00:01.122 Info App: Cache path: /var/packages/EmbyServer/var/cache
2024-05-05 00:00:01.122 Info App: Internal metadata path: /var/packages/EmbyServer/var/metadata
2024-05-05 00:00:01.122 Info App: Transcoding temporary files path: /var/packages/EmbyServer/var/transcoding-temp
2024-05-05 00:00:01.122 Info App: Plugins:
Bluray Folder Support 1.0.0.0
Cinema Intros 1.0.40.0
DLNA 1.3.5.0
Dvd Folder Support 1.0.0.0
Emby Guide Data 1.0.13.0
Fanart.tv 1.0.16.0
M3U TV Tuner 1.0.13.0
Movie Theme Songs 1.8.1.0
MovieDb 1.7.6.0
MusicBrainz 1.0.24.0
Nfo Metadata 1.0.79.0
OMDb 1.0.21.0
Open Subtitles 1.0.52.0
Port Mapper 1.2.1.0
Studio Images 1.0.3.0
TheAudioDb 1.0.18.0
Theme Songs 1.8.1.0
TheTVDB 1.4.9.0
Trailers 1.3.8.0
Trakt 3.6.9.0
Webhooks 1.0.25.0
XmlTV 1.1.4.0
2024-05-05 00:08:28.881 Error PortMapper: Error creating port map

Link to comment
Share on other sites

Happy2Play

Not sure as this becomes a platform issue.  All your media is on the Synology also correct?

Doubt it will make a difference but is there a reason you are still on 4.7.14.0?

 

As a note for the api it requires localhost or https connection but there are browser flag workarounds.

Mentions in the first section of this how to.

 

Link to comment
Share on other sites

xservers
6 minutes ago, Happy2Play said:

Not sure as this becomes a platform issue.  All your media is on the Synology also correct?

Doubt it will make a difference but is there a reason you are still on 4.7.14.0?

 

As a note for the api it requires localhost or https connection but there are browser flag workarounds.

Mentions in the first section of this how to.

 

RE: Emby version; absolutely... life drain... since a while back Emby got removed from the Syno repo and forces me to update it manually, so I do it once a while (when I find the time!). At any rate shouldn't be that old... is been a couple of months I believe since updated it manually.

To this point, the movies added didn't appear after the changes (will remove the scheduled task as had no effect).

I've also enabled debug logs just in case -attached-, but I don't see any automatic refresh trigger (although, I will trigger it manually after this message because I want to add my movies 🤣)

 

embyserver.txt

Link to comment
Share on other sites

Happy2Play

First thing I would do is disable UPNP port mapper as it is flooding log with noise.

Bottom of Network Menu (have to enable remote access to see it near bottom) or uninstall plugin.

FYI you are looking at "LibraryMonitor" per your log.  But per the log inotify is your issue.

2024-05-05 06:38:31.265 Error LibraryMonitor: Error in Directory watcher for: /volume1/Video/Movies
2024-05-05 06:38:31.265 Error LibraryMonitor: Error in Directory watcher for: /volume1/Video/Series
2024-05-05 06:38:31.419 Error LibraryMonitor: Error in Directory watcher for: /volume1/Video/Videoclips

System.IO.IOException: System.IO.IOException: The configured user limit (8192) on the number of inotify watches has been reached, or the operating system failed to allocate a required resource.

Not sure why the How to would not resolve the issue but a fellow Synology user may need to assist more.

@FrostByteany ideas?

Link to comment
Share on other sites

FrostByte
Posted (edited)

If it already scanned those movies once and failed it may not scan them again after the change.  Add something new and post a new log.  Also, the watches are still set at 8192, so nothing was changed.

Redo step 3.  Run the task as admin or su and check the values using the cat command to make sure they changed.  Or, reboot and the script will run then.

Edited by FrostByte
  • Thanks 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...