Jump to content

Using Curl to update library


Recommended Posts

dwarvenlord
Posted

First off, I am very impressed with this product.  I like that it has every feature Plex is lacking in my opinion.  Apparently you guys listen, and I think that is amazing.  Keep up the good work!

 

My main TV library has about 1000 tv shows in it, so running library scans is needlessly time consuming and puts needless strain on the disks.

 

I came across this post https://emby.media/community/index.php?/topic/50862-trigger-a-library-rescan-via-cmd-line/

 

In it, Mastermind11 talks about using a command like this:

curl --data '' "http://localhost:8096/emby/Items/XXXX/Refresh?Recursive=true&api_key=YYYY"
You'll have to open Developer Tools in Chrome and do a rescan on your library of choice.  From the request that gets posted (you'll see it in the developer tools window), grab the Item id.  It'll be after Items/ and before /Refresh in the POST.  Once you have that, you can run this command:

 

 

I have to assume that there is a database where I can get all the necessary ids, so my program that moves files to the correct location can then just shell out a curl command based on the show that is being updated.  I REALLY don't want to look up all the id's with the aforementioned process.

 

Currently I am using plex and looking at Emby.  Plex has a scanner tool that you can use at the command line to specify which library, and which folder to scan and update.  It is quite slick.  It appears this method is very much the same, but you have to know the ids.

 

My ultimate goal here is to minimize disk usage where possible.  Trying to get the wife to let me buy another drive usually requires too many things on the Honey Do list to be checked off for my tatse.

PenkethBoy
Posted

Welcome

 

Yes emby uses a database just like plex - emby's uses sqlite

 

yes there is an api - go to your emby server dashboard>look at the bottom of the page and click on API - brings up swagger.... away you go - and there are api wiki pages available

 

You can get ID's via the api or look at the web app url's or look in the database

 

yes you can scan individual folders via the api or the ui - nothing new in that

 

your better bet though is to turn on Real Time monitoring which will pick up file system changes and process new or changed files - its set in library option page

dwarvenlord
Posted

I was looking around for some information on how exactly Real Time monitoring works, but I didn't find anything.  Is there a summary somewhere in more detail than a sentence or two?  How does it detect changes?  The only thing google is giving me is a lot of posts that discuss how it doesn't work on non window machines.

 

Thanks for pointing out the API link!! Little bugger is very easily overlooked.  That should give me more than I need.

 

SQL will make it easy to query.

Happy2Play
Posted

I would have to search, but RTM uses iNotify.  Just search forum for iNotify.

 

So it is a matter of what filesystem you media is on also.

dwarvenlord
Posted

My media is sitting on a Windows Server 2016 Box that has a software raid called drive bender that combines all the drives into one big drive for the OS to see.  I think it is sitting at 30-35 TB at the moment.

 

OK, maybe I am missing something, but all the posts I am looking at are talking about iNotify not working for them.  The documentation on iNotify says it only runs on Linux Machines.  Specifically "Inotify is a Linux kernel feature that monitors file systems and immediately alerts an attentive application to relevant events, such as a delete, read, write, and even an unmount operation."

 

Does this feature work on Windows boxes?  Does it us iNotify?  I don't need enough information to try to recreate it, I am just curious how it works.  I think being a programmer makes me dig too deeply into stuff.

Happy2Play
Posted

May others here use Drive Bender and RTM works fine.  RTM looks at changes reported by the filesystem and only updates those items.  Well TV is able to update at I believe season level, where Movies does a scan of the entire parent library for the added item.

Happy2Play
Posted

Also note if you are trying to avoid/eliminate scheduled library scans, you will have issues as there are other routines that only run during these tasks.  One example if you use the Autoboxset plugin it only runs with the scheduled task or manual Scan All library option.

dwarvenlord
Posted

Thanks, appreciate the info.  When I understand how everything works together, it is MUCH easier to troubleshoot the inevitable service interruption due to computer silliness.

 

Yeah, fair enough.  I assume I am going to have issues with some things by only manually scanning weekly or so.  Then I can reassess my setup.

 

Since I just dump movies into a couple root folders, they are quite large, but still significantly less items than the damn TV Show share.

 

I'll play around and see what comes of it.  I think I found all the pieces I need to see how I can script it to update without huge comprehensive scans.

 

Again, great support!  I really think you guys are producing something that is awesome.  The damn Plex forums tell people to come to Emby more and more frequently since their devs don't seem to listen or respond to the users.  Keep it up!

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