Playnite icon indicating copy to clipboard operation
Playnite copied to clipboard

Library cloud sync

Open janforster opened this issue 7 years ago • 29 comments

Hi,

It would be nice to have a built-in functionality to save config files and profiles into a cloud platform (google drive/dropbox...) for storage and backup across several machines. Right now I am solving this by using the portable installation which I have (alongside the db file) saved in my google drive, but it would be convenient to have this functionality already out-of-the-box in the app.

Cheers

janforster avatar Sep 17 '17 11:09 janforster

Are you talking about save files for games or Playnite files?

JosefNemec avatar Sep 18 '17 10:09 JosefNemec

I mean the Playnite files: For example, I want to make sure that the way I categorised my games in Playnite is the same across all of the PCs I use.

janforster avatar Sep 18 '17 10:09 janforster

Couldn't you just save Playnite's database file to your Dropbox folder? Other files can stay in default paths (even when using installer and not portable version) and everything should work just fine.

JosefNemec avatar Oct 07 '17 16:10 JosefNemec

During the resolution of #181 I figured why is the cloud backup relevant besides holding the database: I need to be able to sync also my categorisation of games - Which does not seem to be part of the database as I lost all of it while moving back to 2.4.

janforster avatar Oct 11 '17 18:10 janforster

Categories are definitely part of the database, that looks like some issue related to #181 crash.

JosefNemec avatar Oct 11 '17 18:10 JosefNemec

As discussed on Discord: It would be nice to have a native cloud support (i.e. Playnite requests access to rights to the cloud storage and pulls/pushes updates there on its own). This should solve the current issue with locking of the database while Playnite is running from a cloud folder.

janforster avatar Jun 24 '18 19:06 janforster

Cloud Sync that's meaningful cross-device would likely need some tweaking or restructuring of the database schema. Especially when considering installation-specific information.

I'm not sure a "game" and a "library item" are necessarily the same thing all the time. Different data in a game have different loci:


Title (Global)

Information that doesn't depend on editions or vendor

  • Critic score, time to beat, description, additional resources (wiki, Forum), etc.

Store-SKU (Global)

A particular SKU in a particular game store. For example: Wasteland 2 (Steam), Wasteland 2: Directors Cut (Steam), Wasteland 2: Director's Cut (GoG) are all distinct store-SKUs despite all potentially being considered the same game, "Wasteland 2".

  • Specific Title, Platform, Publisher, etc.

Installation (Personal)

There may be more than one on a single machine (multiple copies of a game with different configs), may exist on multiple machines, may not exist at all (uninstalled everywhere)

  • Install directory, Launch Actions, Installed/Running states, etc.

"Concept" (Personal)

A personal concept of a particular "game". It's possible any particular person would want to think of a game in terms of its particular Store-SKU or Title, or Installation. It may even be a cross-platform idea - one might want to be able to count how much time was spent playing Minecraft regardless of whether they played it on a console or on their PC.

  • Play time, Last played, Play count, Category, etc

Each library is inherently personal but the "Global" information can be initially populated from shared databases (such is IGDB or the stores) and conceptually lives globally.

It could also make sense to consider this part of a larger idea where things like play time are shown potentially as aggregations (local counter + game store A's counter + game store B's counter) or Store-SKUs can be grouped into a single title, or multiple installs treated independently.

tylerszabo avatar Jul 10 '19 21:07 tylerszabo

Could Joplin's code help? It's a note taking application with good syncing capabilities. The syncing feature could be a useful reference.

poperigby avatar Aug 01 '19 15:08 poperigby

Is this still needed? We no longer prevent access to library files when application is running (since Playnite 4), so 3rd party sync tools shouldn't have any issues syncing Playnite's files.

I honestly don't want to add this as native feature because supporting all these various services would be a ton of work on something that could be achieved by simply using desktop tools that come with those services.

JosefNemec avatar Nov 05 '19 11:11 JosefNemec

I think we still need this. Syncing using portable files is not very reliable. I am running it that way since I started using playnite and it happens to me at least once every two weeks that the file gets corrupted and I have to redo everything from a backup.

This is actually the main reason I switched to GOG Galaxy 2, where sync works flawlessly.

janforster avatar Nov 05 '19 12:11 janforster

If the sync gets corrupted then you should probably switch to a different cloud provider. I'm using OneDrive and I haven't notice any issues.

The way Galaxy 2 does it comes with a lot of limitations and requires bespoke backed service to run. If I was to do it in the similar way I would have to charge for it because I don't have a resources to run something like that for free. And the alternative of doing it via existing cloud services (OneDrive, Google Drive, Dropbox etc.), would be very time consuming and hard to maintain.

JosefNemec avatar Nov 05 '19 12:11 JosefNemec

I think there's one part of this that is still relevant - the metadata that's related to the specific machine (launch action, installation directory, installed/uninstalled state) causes issues when syncing across machines with different games / install locations.

tylerszabo avatar Nov 05 '19 23:11 tylerszabo

I'll think about it some more, but I'm not sure how to implement this. I would have to completely rework (again) how we store library data and separate machine specific information somehow.

More that I think about it, I'm not sure I will be able to do this using some existing cloud solutions (even if we directly support them) and will have to implement our own library/account/profile service. But again, that would be so much effort and would require a lot of resources, that could be probably spent on more smaller features. You have to keep in mind that Playnite is still mainly developed and supported by a single person.

I'm really torn on this issue. On one point it would be really cool to have some online profile that would show your Playnite library and allowed you to sync that between machines, but then I realize how complex is that to implement...

JosefNemec avatar Nov 06 '19 07:11 JosefNemec

Every time I think about this problem it gets complicated with edge-cases and even then it would certainly require non-trivial changes. Perhaps another layer of abstraction; a database normalization, or both and possibly a migration would be needed (and that would create its own pain).

It's possible that eventually it'll be a moot point: for instance a slow migration to metadata provider plugins might make each attribute primarily sourced by a plugin such that the core DB really only handles attributes related to the local system. Or perhaps there's possibility to include and commit some data by reference when reading from and writing to the library.

This seems like something that should sit in backlog to be considered for future decisions while focus is made elsewhere. I'd mostly urge you not to close this but to let it sit as a V-next until it makes sense.

tylerszabo avatar Nov 06 '19 09:11 tylerszabo

Wonder if there's some kind of library that would make this easier to implement and not put maintainership burden on you.

doublah avatar Nov 06 '19 09:11 doublah

I don't care about cloud sync, but I do care about computer-specific entries. Notably, I am syncing my library, and the location of a bunch of games are different on the two computers. The only workaround is to force the paths to be the same.

Perhaps this issue can be split up? The first part would be to separate data by computer, the second is the sync. I think both of those tasks are still quite complex, but perhaps not quite as daunting taken individually.

nathanmerrill avatar Jun 14 '20 01:06 nathanmerrill

It's not a bad idea to separate device specific data. But still, it would be a fairly complex thing to implement.

JosefNemec avatar Jun 14 '20 07:06 JosefNemec

You could also provide the necessary APIs to extensions and make this a community effort (e.g. person A implements OneDrive, person B implements Google Drive, etc). You could then maybe take ownership of only one of them which would be the "official" cloud sync solution.

ohadschn avatar Oct 25 '20 16:10 ohadschn

An additional advantage of this could be syncing authentication info, which is a big time saver when re-installing Playnite. I just reinstalled my machine, and with GOG Galaxy I only had to login to GOG, all other integrations just worked automatically. It's a real nuisance to go through ~10 providers, each with their own user/pass, 2-factor auth...

ohadschn avatar Nov 22 '20 14:11 ohadschn

You don't need to re-authenticate if you backup and carry over user data folder. It's no different to GOG in that regards, in fact, GOG uses the same login process for a lot of their integrations as Playnite.

https://github.com/JosefNemec/Playnite/wiki/Frequently-Asked-Questions#how-do-i-backup-playnite-library-and-move-it-to-another-pc

JosefNemec avatar Nov 22 '20 14:11 JosefNemec

I see, thanks for the tip! What I did is only sync (via OneDrive) the library folder, and that did give me all the games but not the auth...

So you're saying the solution here is to use the portable version and sync all of it? I was under the impression this might cause issues due to https://github.com/JosefNemec/Playnite/issues/1975

ohadschn avatar Nov 22 '20 14:11 ohadschn

What if the "database location" were %appdata%\Playnite (as opposed to %appdata%\Playnite\library)? Then I could have that entire folder in OneDrive and possibly alleviate some of the issues of syncing the entire program folder...

ohadschn avatar Nov 22 '20 15:11 ohadschn

You don't need to use portable version, see the link from my previous comment.

As far as syncing, I generally don't recommend it because it can lead to issues, see this link for more information.

JosefNemec avatar Nov 22 '20 15:11 JosefNemec

Oh that is unfortunate... I saw in the other thread you were using OneDrive yourself though to sync your library, has that changed?

ohadschn avatar Nov 22 '20 15:11 ohadschn

You know what, looks like I spoke too soon, opening the GOG Galaxy Integrations settings page I can see I'm actually NOT authenticated... Could still be a cool feature for the sync though :)

ohadschn avatar Nov 22 '20 15:11 ohadschn

You don't need to re-authenticate if you backup and carry over user data folder.

I'm not seeing this. I'm using the Portable version, with the entire portable folder synced via Nextcloud. Only one instance of Playnite is open at one time.
Every time I switch between my desktop and my laptop, Playnite loses authentication information for all external services. After authenticating on one system, I can close and re-launch it on that system as many times as I want without authentication again, but if I switch to another system, all authentication information is lost. If I authenticate on the second system, all authentication information on the first system is lost.

sukarn-m avatar Aug 30 '22 06:08 sukarn-m

Most authentications are likely to be invalidated if you switch PCs because some use encrypted data that's encrypted to a specific Windows account and other use cookies or other browser data which get invalidated when you move them to another location (by design from the original auth service). Just don't sync extension's data and browser cache folders to prevent this from happening.

JosefNemec avatar Aug 30 '22 08:08 JosefNemec

Most authentications are likely to be invalidated if you switch PCs because some use encrypted data that's encrypted to a specific Windows account and other use cookies or other browser data which get invalidated when you move them to another location (by design from the original auth service). Just don't sync extension's data and browser cache folders to prevent this from happening.

Thanks @JosefNemec !

In general, I wanted to carry over extensions data, like the Game Pass extension that checks for changes in game pass and makes changes in the library based on that. So, for anyone else reading this, this is the list of sync exclusions I set up:

  • Playnite/browsercache/
  • Playnite/ExtensionsData/*/login.json
  • Playnite/ExtensionsData/*/token.json
  • Playnite/ExtensionsData/*/tokens.json
  • Playnite/ExtensionsData/*/xsts.json

In a quick test, this worked with the following library integrations:

  • Epic
  • GOG
  • Humble
  • Nintendo
  • Origin
  • Steam
  • Ubisoft Connect
  • Xbox

sukarn-m avatar Aug 30 '22 17:08 sukarn-m

It's an immense pain to download and import Playnite backups on handhelds like the Rog Ally or the Lenovo Legion.

It would be a killer feature if I could log in to Google Drive or Playnite and have it sync my settings.

livejamie avatar Jun 17 '24 10:06 livejamie