Cloudbox / autoscan

Autoscan replaces the default Plex and Emby behaviour for picking up changes on the file system.
MIT License
597 stars 49 forks source link

Tdarr support #134

Open deathbybandaid opened 2 years ago

deathbybandaid commented 2 years ago

The old plex_autoscan can be triggered with this tdarr plugin:

https://github.com/HaveAGitGat/Tdarr_Plugins/blob/master/Community/Tdarr_Plugin_MC93_MigzPlex_Autoscan.js

I'd imagine that something similar could be made for Autoscan to do the same thing. I assume something would have to be coded for each repo for it to work?

Flute7 commented 2 years ago

Tdarr has just been updated to include this implementation of Autoscan. Update Tdarr to version 2.00.13 (docker version) and look for this plugin 'Tdarr_Plugin_TD01_TOAD_Autoscan'.

deathbybandaid commented 2 years ago

I was also thinking an eventual special path like sonarr and radarr.

This would also allow re-analysis in plex targets as in #105

deathbybandaid commented 2 years ago

Also an idea occurs to me that the autoscan api could include a parameter for scanning versus analysis, but default to scanning if not provided.

m-rots commented 2 years ago

Also an idea occurs to me that the autoscan api could include a parameter for scanning versus analysis, but default to scanning if not provided.

Analysis is not supported by the Plex API endpoint we're utilising so unfortunately Autoscan cannot provide this functionality as of now.

buroa commented 1 year ago

We should support #151 and I'm willing to work on it after vacation. All that is needed is basically:

Then we can analyze or refresh the metadata id like so:

If the metadata id is an episode, we should also refresh the parent/grandparent metadata id's. This way a shows seasons and a seasons episodes are also updated. Note that we don't have to analyze parent/grandparent metadata id's unless someone wants too (but I don't see the reason).

I use the analyze feature heavily in the old plex_autoscan because I stream Plex websocket events and purge Cloudflare cache based on metadata id's.

Screen Shot 2022-11-11 at 8 10 21 AM

cc @l3uddz

m-rots commented 1 year ago

We should support #151 and I'm willing to work on it after vacation. All that is needed is basically:

  • Grab the metadata id from the sqlite database like we've previously done in plex_autoscan.
  • Or, fix this issue so that we can send a API call to Plex to grab the metadata id like so:

    • curl plex.fqdn:32400/library/all?file=/my/path/to/my.movie.or.show.mkv

Looking at the linked Plex thread, it does not seem like the /all?file=... endpoint will be supported anytime soon. Regarding the sqlite database: Early on l3uddz and I decided to build Autoscan on top of network-accessible, publicly supported API, such as the /library/refresh endpoint in Plex, the web hooks from the -arrs and the Google Drive API (now moved to a-train). Swapping the Plex API with the Plex Media Scanner CLI doesn't lineup with this vision, especially as it reintroduces some of PAS' most common set-up problems: making the CLI (and database file) accessible from within the Docker container.

However, it could be possible to support an alternative, CLI-based Plex target which users could swap to if they require the needed (extra) functionality. This would be a target only advanced users would switch to who are aware of the extra setup required to get this target to work inside a Docker container.

Then we can analyze or refresh the metadata id like so:

  • Analyze: curl -X PUT plex.fqdn:32400/library/metadata/{metadata_id}/analyze
  • Refresh: curl -X PUT plex.fqdn:32400/library/metadata/{metadata_id}/refresh

If the metadata id is an episode, we should also refresh the parent/grandparent metadata id's. This way a shows seasons and a seasons episodes are also updated. Note that we don't have to analyze parent/grandparent metadata id's unless someone wants too (but I don't see the reason).

I'm unsure if PAS refreshes the parent metadata ID. I'm guessing it takes the parent's path instead, like we currently do with Autoscan as well.

However, it must be said that I do not think Autoscan requires any changes regarding metadata. As Plex's refresh endpoint only accepts directory paths, not file paths, it makes sense that Plex processes all the modified content inside this directory. This includes sensing that a subtitle file has been added, and thus that this file should be linked to the corresponding media file, also inside that directory. If anything, this sounds more like a Plex bug than an endpoint that's missing on their side.

SpartacusIam commented 9 months ago

Was any development or progress ever made on this front of adding the ability to support plex analysis? It would really be a huge benefit to those who pro procress their files after plex has scanned them. As it stands, plex will not re-analyze an item that's already been scanned in the past unless the filename changes.