CMorooney / obsidian-game-search-plugin

Obsidian plugin that automatically creates notes by searching for video games
MIT License
36 stars 10 forks source link

Using Steam Playtime vs RAWG Playtime #34

Open Handorin opened 3 months ago

Handorin commented 3 months ago

the playtime fields comes from the RAWG API and according to their documentation should represent the average playtime from Steam. There is currently no way to inject data from the Steam game data into the file templates for your vault (could be added, just isn't available in current version).

Originally posted by @CMorooney in https://github.com/CMorooney/obsidian-game-search-plugin/issues/32#issuecomment-2282970128

I was surprised when you said in the other thread that playtime was being pulled from the RAWG API rather than the Steam API. I'd personally love to be able to see my own playtime. I do see in the Steam API there's a couple items you could pull: playtime_2weeks The total number of minutes played in the last 2 weeks playtime_forever The total number of minutes played "on record", since Steam began tracking total playtime in early 2009.

I imagine it's a bit annoying to get RAWG and Steam to match, but if we're able to store the ID code for both APIs, that could maybe cut down on any work to future file updates.

CMorooney commented 2 months ago

I did start looking into this and have a local branch pulling in playtime_forever and playtime_2weeks when syncing steam data

I do think that if we're going to add this feature I need to create a separate command and startup sync option for updating existing notes that include steamId metadata with latest playtime (with more Steam API calls)

So I'm going to take a little more time to add those pieces and test

Handorin commented 2 months ago

That's a good idea. For playtime_forever, it might be worth adding an option to only sync games with more than 0 hours as well. Or maybe a user defined hour total, default of 0.

CMorooney commented 2 months ago

@Handorin I opened a PR here feel free to take a look, I'm going to sit on it and test a little more before merging (or if you have any comments, of course)

CMorooney commented 2 months ago

merged @Handorin if you're able to check out 0.2.9 lmk

Handorin commented 2 months ago

my steam playtime_forever is all over the place (one file claims over 56,000 hours). also, not sure if I'm doing anything wrong in my template, but at first I forgot to add the variables, and they got automatically added to the YAML section. I went back and added them and reran the files, but nothing populates there. Steam Playtime: {{steamPlaytimeForever}} Steam 2 Week: {{steamPlaytime2Weeks}}

CMorooney commented 2 months ago

steamPlaytimeForever and steamPlaytime2Weeks are injected into note metadata automatically, you do not need to template them nor will the tamp later pick them up.

I will have to add them to the template in a subsequent release, I guess I assumed folks would be querying this metadata, not displaying it directly in their notes which is silly.

They are also reported in minutes

Handorin commented 2 months ago

Ahh, that makes sense. In that case, dividing by 60 got me to the right spot. If it's in the docs, I didn't read it cause my dog is being a distraction and I'm multi tasking it lol

You're right on the template though, I'd probably only query it to some other place, but gotta try to break it and test what others might do