Watcher3 icon indicating copy to clipboard operation
Watcher3 copied to clipboard

Request - Download Default + 4k

Open jaketame opened this issue 8 years ago • 7 comments

Hi,

Great work on recent months. App is performing great.

I'm about to purchase a 4K tele and in order to not allow others access to 4K content to stop my server from being stretched. I've created a separate Plex library for 4K content.

Whats the chances of allow Watcher to either sync to instances of Watcher? So I only need to add a movie to 1 Watcher library or add a flag to download 2160p and 1080p but run different post processing scripts to get it into Plex.

jaketame avatar Mar 19 '18 11:03 jaketame

I'd do plenty of testing to make sure something unexpected doesn't happen, but in theory this should be pretty easy to set up.

You can probably run two instances and point them to the same userdata folder, then launch with separate --conf flags so each can have their own config.

Everything required to make Watcher run is in the database or config file (things like the poster folder in userdata isn't required. Configs are read to memory when the script launches (which is why certain options require a restart), but the database connection is much more flexible. When I'm testing I'll have Watcher running while I'm editing the database in another application and everything works as expected since no database calls are cached. The database is locked when reading/writing so corruption won't be a problem, and there is a mechanism in the sqldb method core.sqldb.execute() that tries 5 times to access the database if it is locked, waiting a second between each attempt. This is what keeps everything running smoothly if the database is being written to via a webui command, and an api request comes in, and a scheduled task all attempt to write to the db at once.

So ignoring all the technical stuff, launch each with the same --userdata flag so they both access the same database and posters folder, then give each their own --config file. I'd also make sure each has their own API key just to be safe.

And make sure they are not pointed toward the same log dir if you use a custom location. I don't think it would break anything since that file is only locked while writing, but you'll want to have separate log files.

Edit:

I just opened up two instances of my testing copy using the method I described above. Then I opened two browser tabs to each web ui and had them run a full backlog search on 66 movies at the same time with no problems. It was slow due to rate limiting on api calls, but nothing broke.

Edit2:

Though if all you are doing is processing each one separately you might be able to get away with a Finished plugin that moves the file based on its resolution. So if that is all you need -- move 4k movies to a different dir than others -- I'll write a plugin for you.

nosmokingbandit avatar Mar 22 '18 03:03 nosmokingbandit

Thanks for your comprehensive response!

Thoughts on what you have proposed.

  1. If i'm running two instances both accessing the same database, what happens if one instance updates the DB to say a movie is completed but only download 1080p but not 4K or vice-versa?
  2. Post processing is separate for both 1080p/4k into separate Plex libraries and its called using the Plex AutoScan tool from l3luddz (https://github.com/l3uddz/plex_autoscan) 2a) Plex Autoscan will detect the move path and then scan the correct library based on the file path.

jaketame avatar Mar 23 '18 14:03 jaketame

I may have misunderstood exactly what you are going for. You want to be able to have two copies of the same movie, one in 4k and one in 1080p, each on different plex servers? I think they only way to handle that is to have two completely separate instances altogether.

If you want to avoid adding a movie to both instances you can use an Added plugin to send an api request to the other instance to add the movie as well. This may work in both directions as well, but might get messy since server One adds a movie, sends a request to Two, which then adds a movie and sends a request to One, which already has the movie and responds as such, so Two is done and finally sends the response back to One.

If that is what you want I can write the plugin easily enough.

nosmokingbandit avatar Mar 29 '18 03:03 nosmokingbandit

Yes thats correct, two copies of the movie but it goes to the same Plex server just different libraries. My plugin is already handling that from two separate instances.

A plugin to send an API request to another instance after it being added to one instance would be great - We could even add a tickbox of sort when adding a movie to give people an option for Single copy or two copies as not all movies are available in 4K so the second instance of Watcher will just get filled up with movies that won't ever download.

jaketame avatar Mar 29 '18 07:03 jaketame

https://github.com/nosmokingbandit/watcherplugins/commit/4b0b4460bfb7b07a09a36c2aac42e83717b1f31f

I just tested it locally, but it should easily work the same on foreign IPs.

I'm not going to modify the main codebase to help this since it is a bit of a fringe case. Plugins fire every time a movie is added. It will send an api request to the second instance to add the same movie with the same quality profile name (if it doesn't exist on the remote instance it will fall back to the default profile).

You can choose to sync only movies of a certain quality profile as well, so you can have a quality specifically set aside for sync.

nosmokingbandit avatar Apr 04 '18 15:04 nosmokingbandit

Thanks. Will test this now... Will this work for items added via sync lists too?

jaketame avatar Apr 05 '18 07:04 jaketame

Yep. Added plugins are called for every added movie, regardless of source.

nosmokingbandit avatar Apr 07 '18 03:04 nosmokingbandit