playnite-non-steam-shortcuts icon indicating copy to clipboard operation
playnite-non-steam-shortcuts copied to clipboard

Set "lastplaytime" to playnites last reported playtime

Open Bluscream opened this issue 4 years ago • 2 comments

  • https://playnite.link/docs/api/Playnite.SDK.Models.Game.html#Playnite_SDK_Models_Game_LastActivity

Bluscream avatar May 15 '20 21:05 Bluscream

This is possible I think, shortcuts.vdf supports it. But what happens after the initial import? If you play a game from steam, does it update the value inside shortcuts.vdf with the added playtime?

Or are you okay with this becoming very out of sync until the user regenerates the shortcuts? (It's theoretically possible to hook the on_game_stopped Playnite event and detect the changed playtime. But you can't really update shortcuts.vdf in the background I don't think. If the user is currently modifying their shortcuts in the Steam UI, we don't want to clobber changes, and Steam only reloads shortcuts.vdf on launch. This extension doesn't do updates in the background.)

bburky avatar May 15 '20 21:05 bburky

How hard are you regenerating the shortcuts.vdf file? If you can read the value for each game in there before overwriting it should be as easy as if (vdf.shortcut[current].lastplaytime == 0) overwriteWithPlayNiteLastPlayTime() so after handing once to steam it takes care of it since it will see all playtime of the internal shortcut anyway ^^

Bluscream avatar May 15 '20 21:05 Bluscream