Jump to content

Trigger a library rescan from cron


Recommended Posts

JuJuJurassic
Posted

Hi All,

I want to trigger a library scan after an event in cron. The cron task looks and copies new files over, only if they are less than a day old, after it's found some and moved them, I'd like to trigger Emby to rescan it's libraries. However there may not be files always in which case I don't want it to trigger a rescan.

Is there a way to do it? If not I've set the library to rescan every hour.

Thanks and have a good evening

🙂

darkassassin07
Posted (edited)

curl -X 'POST' 'http://<emby-host>/emby/Library/Refresh?api_key=<key>' -H 'accept: */*' -d ''

 

Add your hostname and api key and this will trigger a full library scan.

Edited by darkassassin07
Missed a space
JuJuJurassic
Posted

Brilliant, thank you 🙂

 

  • Like 1
JuJuJurassic
Posted

I just copied and pasted it into a terminal

curl -X 'POST' 'http://11.22.33.44/emby/Library/Refresh?api_key=123456' -H 'accept: */*' -d''

and got

curl: option -d: requires parameter
 

The problem with a copy and paste is it sometimes misses something. is the line above correct?

Thanks

darkassassin07
Posted

I missed a space, fixed.

darkassassin07
Posted

Also, unless you run emby on port 80, remember to add :8096 to your ip

Happy2Play
Posted

There are many posts on this.  Have you actually when to Emby's API?

REST API Documentation

image.thumb.png.18f7dd53b74ae9360b0f588b47e545b1.png

Happy2Play
Posted

But can depend on if you want to scan a specific library or all libraries also.

 

JuJuJurassic
Posted

Thank you all so much. I'm going to have a look at this tomorrow, but for now I'm going to watch my emby, have a good evening 🙂

 

  • Thanks 1
Happy2Play
Posted

A side note you may run into CORS issues depending on your Emby connection as the Swagger will require localhost or https connection unless you adjust browser flags for your server connection mentioned at the beginning of this How to.

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