Emby - any way to trigger an update

Running FileBot from the console, Groovy scripting, shell scripts, etc
Post Reply
xyrgh
Posts: 10
Joined: 15 Feb 2016, 09:00

Emby - any way to trigger an update

Post by xyrgh »

I've been toying with Emby as an alternative to Plex recently. I use the AMC script in filebot to sort all my media. The AMC script has a command that triggers Plex to update.

Is there a way to trigger Emby to update, or can it be included in the AMC script? I know it can receive an update trigger as Sickrage has the built in functionality, but I have zero idea of how to do it.

Thanks for your help.
xyrgh
Posts: 10
Joined: 15 Feb 2016, 09:00

Re: Emby - any way to trigger an update

Post by xyrgh »

I've got some info from over on the Emby forums as to their api to update the library, they provided me this:

Code: Select all

[Route("/Library/Series/Added", "POST", Summary = "Reports that new episodes of a series have been added by an external source")]
    [Route("/Library/Series/Updated", "POST", Summary = "Reports that new episodes of a series have been added by an external source")]
    [Authenticated]
    public class PostUpdatedSeries : IReturnVoid
    {
        [ApiMember(Name = "TvdbId", Description = "Tvdb Id", IsRequired = false, DataType = "string", ParameterType = "path", Verb = "GET")]
        public string TvdbId { get; set; }
    }

    [Route("/Library/Movies/Added", "POST", Summary = "Reports that new movies have been added by an external source")]
    [Route("/Library/Movies/Updated", "POST", Summary = "Reports that new movies have been added by an external source")]
    [Authenticated]
    public class PostUpdatedMovies : IReturnVoid
    {
        [ApiMember(Name = "TmdbId", Description = "Tmdb Id", IsRequired = false, DataType = "string", ParameterType = "path", Verb = "GET")]
        public string TmdbId { get; set; }
        [ApiMember(Name = "ImdbId", Description = "Imdb Id", IsRequired = false, DataType = "string", ParameterType = "path", Verb = "GET")]
        public string ImdbId { get; set; }
    }
And this advice:
an api_key query string param is required, which the user can generate in their server dashboard under advanced
Is this something the AMC script can work with?
User avatar
rednoah
The Source
Posts: 23953
Joined: 16 Nov 2011, 08:59
Location: Taipei
Contact:

Re: Emby - any way to trigger an update

Post by rednoah »

An example request with the curl command for requesting a rescan would be extremely helpful.
:idea: Please read the FAQ and How to Request Help.
xyrgh
Posts: 10
Joined: 15 Feb 2016, 09:00

Re: Emby - any way to trigger an update

Post by xyrgh »

No problems, I''ll go back to the devs and see what I can get :-)
xyrgh
Posts: 10
Joined: 15 Feb 2016, 09:00

Re: Emby - any way to trigger an update

Post by xyrgh »

Hi Luke,

I've been told that to request the library refresh, you can issue a post command to:

http://localhost:8096/Library/Refresh?api_key='key'

Where 'key' is the api key created in the advanced settings in Emby.

I've tested this on my system and it does indeed trigger a library refresh.

Can that be then incorporated into AMC? I assume something similar to Plex, ie:

--def emby=host:token where token is the api key created in the advanced settings.

Is that possible? Or is there some way I can include that at the same time as using the AMC script?
User avatar
rednoah
The Source
Posts: 23953
Joined: 16 Nov 2011, 08:59
Location: Taipei
Contact:

Re: Emby - any way to trigger an update

Post by rednoah »

Looks good. I'll add this when I'm back (around 23 February).
:idea: Please read the FAQ and How to Request Help.
xyrgh
Posts: 10
Joined: 15 Feb 2016, 09:00

Re: Emby - any way to trigger an update

Post by xyrgh »

That's awesome mate, thankyou.
User avatar
rednoah
The Source
Posts: 23953
Joined: 16 Nov 2011, 08:59
Location: Taipei
Contact:

Re: Emby - any way to trigger an update

Post by rednoah »

Done. Please test the latest revision by calling dev:amc.

Code: Select all

--def emby=127.0.0.1:<APIKEY>
:idea: Please read the FAQ and How to Request Help.
xyrgh
Posts: 10
Joined: 15 Feb 2016, 09:00

Re: Emby - any way to trigger an update

Post by xyrgh »

Thanks mate. Just gave it a quick run and log shows this:

Code: Select all

Notify Emby: 192.168.1.21
GET: http://192.168.1.21:8096/Library/Refresh?api_key=key
FileNotFoundException: http://192.168.1.21:8096/Library/Refresh?api_key=key
Done ヾ(@⌒ー⌒@)ノ
Looks like it sending a GET not a POST from my basic understanding?

(Replaced my API key with 'key' for posting purposes).
User avatar
rednoah
The Source
Posts: 23953
Joined: 16 Nov 2011, 08:59
Location: Taipei
Contact:

Re: Emby - any way to trigger an update

Post by rednoah »

Alright, using a POST request instead. So should api_key be passed as GET parameter, POST parameter, or HTTP HEADER then?
:idea: Please read the FAQ and How to Request Help.
xyrgh
Posts: 10
Joined: 15 Feb 2016, 09:00

Re: Emby - any way to trigger an update

Post by xyrgh »

Using postman extension in Chrome, if I send the command (the whole http://192.168.1.21:8096/Library/Refresh?api_key=key) as a POST parameter, it triggers the update.

Does that help?
User avatar
rednoah
The Source
Posts: 23953
Joined: 16 Nov 2011, 08:59
Location: Taipei
Contact:

Re: Emby - any way to trigger an update

Post by rednoah »

That means you're sending a POST request with GET parameters, but without any POST parameters.

Do -clear-cache once and try again.
:idea: Please read the FAQ and How to Request Help.
xyrgh
Posts: 10
Joined: 15 Feb 2016, 09:00

Re: Emby - any way to trigger an update

Post by xyrgh »

That did the trick, working perfectly now. Can't say how much I appreciate the help, thankyou.
Post Reply