Skip to content
This repository has been archived by the owner on Aug 6, 2022. It is now read-only.

Add Emby Support #132

Open
jetbalsa opened this issue Jan 11, 2020 · 13 comments
Open

Add Emby Support #132

jetbalsa opened this issue Jan 11, 2020 · 13 comments

Comments

@jetbalsa
Copy link

jetbalsa commented Jan 11, 2020

Emby Support /should/ be pretty easy to add for partial updates.

The API Endpoint you are looking for is
http://{IP-PORT}/emby/Library/Media/Updated?api_key={APIKEY}

with the post data of

{
  "Updates": [
    {
      "Path": "{FullPathToLocalFileAsSeenByEmby}",
      "UpdateType": "Created"
    }
  ]
}

Per the API Docs the UpdateType can be "Created","Modified", "Deleted"

In the embyserver.txt logs you can find the API Call and its actions, This is a example I did probing out the API using curl

2020-01-11 15:20:35.142 Info HttpServer: HTTP POST http://192.168.1.191:8096/emby/Library/Media/Updated. UserAgent: curl/7.66.0
2020-01-11 15:20:35.150 Debug LibraryMonitor: New file refresher created for /mnt/drive/Media/Anime/Welcome to Demon-School, Iruma-kun/Season 1/Welcome to Demon School! Iruma-kun - S01E09 - Iruma’s Decision and Hard Work HDTV-1080p.mkv
@jetbalsa
Copy link
Author

I monkey patched the hell out of start_scan function to do a test run

I replaced it with

def start_scan(path, scan_for, scan_type, scan_title=None, scan_lookup_type=None, scan_lookup_id=None):
    if conf.configs['SERVER_USE_SQLITE']:
        section = 1
        db_exists, db_file = db.exists_file_root_path(path)
        if not db_exists and db.add_item(path, scan_for, section, scan_type):
            logger.info("Added '%s' to Plex Autoscan database.", path)
            logger.info("Proceeding with scan...")
        else:
            logger.info(
                "Already processing '%s' from same folder. Skip adding extra scan request to the queue.", db_file)
            resleep_paths.append(db_file)
            return False
    postdata = "{  \"Updates\": [    {      \"Path\": "+json.dumps(path)+",      \"UpdateType\": \"Created\"    }  ]}"
    logger.info("Custom Processing '%s' for Emby", path)
    logger.info("Sending: %s", postdata)
    r = http.request('POST', 'http://192.168.1.191:8096/emby/Library/Media/Updated?api_key=#APIKEY#', body=postdata, headers={'accept':'application/json', 'Content-Type':'application/json'})
    logger.info("%s", r.headers)
    return True

Logs from emby show a good update that happens and shows up on the media server to the end users once FFProbe is done going over the file

2020-01-11 20:35:09.937 Info HttpServer: HTTP POST http://192.168.1.191:8096/emby/Library/Media/Updated. UserAgent:
2020-01-11 20:35:09.947 Debug LibraryMonitor: New file refresher created for /mnt/drive/Media/TV/Doom Patrol/Season 1/Doom Patrol - S01E12 - Cyborg Patrol WEBDL-1080p.mkv
2020-01-11 20:36:09.945 Debug LibraryMonitor: Timer stopped.
2020-01-11 20:36:11.218 Info LibraryMonitor: Cyborg Patrol (/mnt/drive/Media/TV/Doom Patrol/Season 1/Doom Patrol - S01E12 - Cyborg Patrol WEBDL-1080p.mkv) will be refreshed.
2020-01-11 20:36:11.371 Debug App: EpisodeNfoProvider reports change to 2536 - /mnt/drive/Media/TV/Doom Patrol/Season 1/Doom Patrol - S01E12 - Cyborg Patrol WEBDL-1080p.mkv
2020-01-11 20:36:11.371 Debug App: Refreshing /mnt/drive/Media/TV/Doom Patrol/Season 1/Doom Patrol - S01E12 - Cyborg Patrol WEBDL-1080p.mkv due to date modified change 1575860304 - 1578772368.
2020-01-11 20:36:11.371 Debug App: FFProbeProvider reports change to 2536 - /mnt/drive/Media/TV/Doom Patrol/Season 1/Doom Patrol - S01E12 - Cyborg Patrol WEBDL-1080p.mkv
2020-01-11 20:36:11.397 Debug App: Running FFProbeProvider for /mnt/drive/Media/TV/Doom Patrol/Season 1/Doom Patrol - S01E12 - Cyborg Patrol WEBDL-1080p.mkv
2020-01-11 20:36:11.397 Info MediaProbeManager: ProcessRun 'ffprobe' Execute: /bin/ffprobe -i file:"/mnt/drive/Media/TV/Doom Patrol/Season 1/Doom Patrol - S01E12 - Cyborg Patrol WEBDL-1080p.mkv" -threads 0 -v info -print_format json -show_streams -show_chapters -show_format -show_data
2020-01-11 20:36:11.407 Debug MediaProbeManager: ProcessRun 'ffprobe' Started.

@desimaniac
Copy link
Collaborator

desimaniac commented Jan 12, 2020

Thanks. But PAS may not be necessary when using Emby with any of the ARRs. The built in “connect“ for Emby already sends a path-specific scan request. This script makes sense for Plex as there is no API for that. I guess you could use it for the Google Drive monitoring aspect.

@RXWatcher
Copy link

Google drive monitoring would be where I see this being useful. I'm in support of adding this.

@jetbalsa
Copy link
Author

Thats what I use it for as well, When GDrive gets updated and auto updates Emby

@titooo7
Copy link

titooo7 commented Jan 28, 2020

Google drive monitoring would be where I see this being useful. I'm in support of adding this.

I couldn't get JRWR modification working for myself due to same error about module http not defined. So I forked it and make my own modification which use curl. Here it is just in case you can give it a try: https://github.com/titooo7/plex_emby_jellyfin_autoscan

Of course it would be better to have this done in the original plex_autoscan project since he is actually an skilled dev while I'm not even beginner, but for the time being my fork works at least...

@Quick104
Copy link

Sonarr/Radarr's Emby connection has pretty hit or miss for me lately.

Would definitely be useful. Even if it was just drive monitoring

@Yankees4life
Copy link

Bump

I would like to see this for plex autoscan. My windows laptop could well use this for jellyfin

@Quick104
Copy link

Bump

I would like to see this for plex autoscan. My windows laptop could well use this for jellyfin

You'll likely just want to use https://github.com/Cloudbox/autoscan

@Yankees4life
Copy link

Bump
I would like to see this for plex autoscan. My windows laptop could well use this for jellyfin

You'll likely just want to use https://github.com/Cloudbox/autoscan

That doesn't have windows support. Nor does it work with windows drives

@RXWatcher
Copy link

RXWatcher commented Apr 13, 2022 via email

@Yankees4life
Copy link

It actually does work on windows: Your machine runs Linux, macOS or WSL2 PAS(PlexAutoScan) is effectively sunset as L3uddz has moved on. You can run the much newer AutoScan on windows via WSL2 and you can map drives in WSL2: https://linuxnightly.com/mount-and-access-hard-drives-in-windows-subsystem-for-linux-wsl/ It might be time to become comfortable with linux.

On Wed, Apr 13, 2022, 18:00 Yankees4life @.> wrote: Bump I would like to see this for plex autoscan. My windows laptop could well use this for jellyfin You'll likely just want to use https://github.com/Cloudbox/autoscan That doesn't have windows support. Nor does it work with windows drives — Reply to this email directly, view it on GitHub <#132 (comment)>, or unsubscribe https://github.com/notifications/unsubscribe-auth/ADLOXCKPHTWQEUUUSTOUADDVE3VQFANCNFSM4KFSP2VA . You are receiving this because you commented.Message ID: @.>

Sad to that. I already tried setting up autoscan with WSL2 and the windows drives with the slashes messes everything up (and the developer over there refused to even bother).

Hmm...I might just try to take a fork and take a stab at making something for Emby/Jellyfin in order to have a native windows build which work with windows drives.

@NiNiyas
Copy link

NiNiyas commented May 25, 2022

If anyone is still looking for this, I made a fork with jellyfin and emby support. I have not yet tested it with windows. https://github.com/NiNiyas/autoscan

@Yankees4life
Copy link

Yankees4life commented May 25, 2022

If anyone is still looking for this, I made a fork with jellyfin and emby support. I have not yet tested it with windows. https://github.com/NiNiyas/autoscan

There is a God. 😄

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

7 participants