Playnite Forums
  • Playnite Web
  • Rules
  • Members
  • Team
  • Search
  • Register
  • Login
  • Home
  • Members
  • Help
  • Search
Playnite Forums Development Extensions Filtered Games List

Filtered Games List
ChonUnca
Offline

#1
10-11-2020, 06:19 AM
Hello!
I try to export list of multi-player games.

In my mind i had 2 choices:
- Manually filtered game in the view, then exporting the view with my extension
- Filtering list of games from database in my extension and then export it

My problem is i found nothing to realize that in Api docs.

I tried the PlayniteApi.MainView.SelectedGames but it export only manually selected games, i miss a CurrentViewGames method to get all game currently displayed depending of filters/display options choosed, or a method to allow my extension to select all the games from the current view (without manually selecting them)
Then i tried to use IGameDatabase too, but i miss arguments to give to method for filtering the list with tags=multiplayer.

Can someone point me where in the APIdoc i can found something to help me with this kind of needs?
Crow
Offline

Administrator
#2
10-11-2020, 07:33 AM
You need to iterate through "Games" collection and check "Features" or "Tags" of each game for multi-player, then export that game if you need to.

If you just want to export currently filtered list, then that's not possible at the moment: https://github.com/JosefNemec/Playnite/issues/1177
ChonUnca
Offline

#3
10-11-2020, 10:50 AM
Ok! thank for your quick answer Smile
darklinkpower
Offline

#4
10-11-2020, 01:26 PM (This post was last modified: 10-11-2020, 01:33 PM by darklinkpower.)
If you just want to export you can simply filter in the pipeline using the library exporter that is included in Playnite.

https://github.com/JosefNemec/Playnite/b...ter.ps1#L8

You can add to the pipeline

Where-Object {$_.Features.name -contains "Multiplayer"}

So it would be:

$PlayniteApi.Database.Games | Where-Object {$_.Features.name -contains "Multiplayer"} | Select Name, Source, ReleaseDate, Playtime, IsInstalled | ConvertTo-Csv | Out-File $path -Encoding utf8

You can also use the Dialogs API to not have to hardcode the feature name and be able to input it

...

$featureInput = $PlayniteApi.Dialogs.SelectString("Input feature name", "Library Export", "");
if ($featureInput.result -eq $false)
{
    exit
}

...

$PlayniteApi.Database.Games | Where-Object {$_.Features.name -contains "$($featureInput.SelectedString)"} | ...

...
« Next Oldest | Next Newest »



  • View a Printable Version
  • Subscribe to this thread

© Designed by D&D - Powered by MyBB

Linear Mode
Threaded Mode