Fmstrat / plex-db-sync

Synchronizes the database watched status between two Plex servers. This includes watched times, and works for all users on the system without the need for tokens.
151 stars 24 forks source link

Central Db and run app next to each plex instance #19

Open seertenedos opened 4 years ago

seertenedos commented 4 years ago

Any chance of updating to use something like MariaDB and then instead of having one copy of the app you have one copy next to each plex instance so that it can read and write the DB without the restart or connection between the server? I would love to put this all in docker containers but my docker-compose files run as services that auto restart if any container stops so does not work with the current version that stops plex. Also i prefer a central data store because then other things could mark things as watched if it say monitoried netflix or emby or any other player or source out there.

Fmstrat commented 4 years ago

Oh how I wish Plex was built on a database in the first place. I'm actually looking to contribute to Jellyfin on exactly this.

In any event, I'm not sure what the advantage to this structure would be. We would still need a connection between the servers, and we would still need to update Plex's Sqlite DB, and due to Plex's unique caching of the SB a stop/start is still required.

As for compose, if you use docker-compose stop it will override the restart flag. Or you could set restart to unless-stopped.

Lastly, there are plugins out there that will sync to third party services now. Unfortunately I don't have the time to recreate that functionality, but would welcome contributions.

If I was going to do a revamp of anything, it would be to use the Plex web API to set status like plex-sync but build an interface to auto grab tokens.

seertenedos commented 4 years ago

I did not know about the cache. That stuffs me up. Is there any way to flush it out from API?

Reasons I wanted a db. Trusted store of watch status (Plex seems to loose some of mine every now and then especially older ones) A central store of watched stuff that may not be on all servers It is for all users. Originally a central db meant I did not need to worry about sqlite write lock over ssh and if it would work correctly while Plex was running like it should when doing it local.

On Mon, 13 Jan 2020, 10:32 pm Fmstrat, notifications@github.com wrote:

Oh how I wish Plex was built on a database in the first place. I'm actually looking to contribute to Jellyfin on exactly this.

In any event, I'm not sure what the advantage to this structure would be. We would still need a connection between the servers, and we would still need to update Plex's Sqlite DB, and due to Plex's unique caching of the SB a stop/start is still required.

As for compose, if you use docker-compose stop it will override the restart flag. Or you could set restart to unless-stopped.

Lastly, there are plugins out there that will sync to third party services now. Unfortunately I don't have the time to recreate that functionality, but would welcome contributions.

If I was going to do a revamp of anything, it would be to use the Plex web API to set status like plex-sync but build an interface to auto grab tokens.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/Fmstrat/plex-db-sync/issues/19?email_source=notifications&email_token=AADB44PFOCA6TX5KU4GQDHTQ5RGN3A5CNFSM4KF7ZHX2YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOEIYMFIQ#issuecomment-573620898, or unsubscribe https://github.com/notifications/unsubscribe-auth/AADB44K5IRBJO2MUCHN4ZMLQ5RGN3ANCNFSM4KF7ZHXQ .

Fmstrat commented 4 years ago

Unfortunately no, there isn't. And there is no way to get tokens for all users from the DB. Plex is kind of a nightmare for this. It's part of the reason I want Jellyfin to get to a mature state.

ChrisPates commented 3 years ago

You do know that SQLite do has built in eventual consistency replication out of the box?

Has anyone looked at modifying the SQLite Parameters in plexmedia?

yusufali94 commented 3 years ago

check out this repo: https://github.com/drgroot/plexcontroller Its my project that I built to solve this problem. I am in the process of writing a README so its useable by the general public concept of the idea can be found here: https://www.reddit.com/r/PleX/comments/o46emw/plex_build_log_part1_network_loadbalancing/