feat: add dynamic collections, manual ordering and game details list
- Add dynamic collections filled by rules: condition blocks combined with AND/OR, a rule builder with live preview, and automatic updates when games change, on startup and after library updates - Add manual game ordering by drag and drop, context menu and Alt+arrow keys - Show the selected game's collections below the description in the game details view, as a theme element or inserted automatically - Add settings to turn off the automatic list and to hide dynamic collections from it - Add "Open in Collections" to the collection window opened from game details - Migrate collections.json step by step using SchemaVersion, keeping a copy of the old file - Add developer and theme integration docs - Bump version to 1.1.0
This commit is contained in:
1 parent
72e35002f7
commit
690a79b014
41 files changed
+3739
-52
No files matched your search
+23
-3
@@ -1,5 +1,7 @@
|
||||
# Architecture and development
|
||||
|
||||
For how it works in depth and how to change it, see the [developer guide](developer-guide.md).
|
||||
|
||||
## Repository layout
|
||||
|
||||
```
|
||||
@@ -19,7 +21,7 @@ GameCollections/
|
||||
├─ manifests/
|
||||
│ ├─ installer_manifest.yaml release list Playnite reads for installs and updates
|
||||
│ └─ X4Lo_GameCollections.yaml entry for the Playnite add-on database
|
||||
├─ docs/ this documentation
|
||||
├─ docs/ user guide, developer guide, theme integration
|
||||
├─ screenshots/ images for the README and add-on database
|
||||
├─ .github/ CI build/release workflow, issue template
|
||||
└─ dist/ build output: the .pext package (git-ignored)
|
||||
@@ -59,7 +61,14 @@ To try a build in Playnite, open the `.pext` file (Playnite installs it after a
|
||||
| `GameCollectionsPlugin` | Wires everything together; game menu item, sidebar item, settings; reacts to library changes. |
|
||||
| `CollectionRepository` | Reads/writes `collections.json`. Atomic save (temp file + `File.Replace` with a `.bak`), recovery from the backup, data sanitising. |
|
||||
| `PosterStorage` | Copies custom posters into `Posters\`, deletes them, cleans up orphans. |
|
||||
| `CollectionManager` | All collection rules: validation, unique titles, create/update/delete, membership changes in one save, poster resolution, pruning deleted games. Raises `CollectionsChanged`. |
|
||||
| `CollectionManager` | All collection rules: validation, unique titles, create/update/delete, membership changes in one save, ordering, applying dynamic matches, the game-to-collections lookup, poster resolution, pruning deleted games. Raises `CollectionsChanged`. |
|
||||
| `CollectionsDataMigrator` | Upgrades `collections.json` step by step from its `SchemaVersion` to the current one. |
|
||||
| `SidebarNavigator` | Switches to the Collections section through Playnite's internals, as the SDK has no API for it. |
|
||||
| `RuleEngine` | Compiles dynamic rules into a predicate over games. Pure and thread-safe. |
|
||||
| `DynamicCollectionRefresher` | Decides when dynamic collections are evaluated: debounced game changes, delayed startup and library-update refreshes on a background thread, an hourly refresh for time-based rules. |
|
||||
| `RuleText` | Field and operator names, the values offered for each field, and rule summaries. |
|
||||
| `GameCollectionsControl` | Lists the selected game's collections. Themes can place it as a custom element. |
|
||||
| `DetailsViewIntegration` | For themes that don't place that element: inserts one instance below `PART_ElemDescription` (or `PART_ElemNotes`) in the visual tree. Stands aside if the theme has its own, skips `Grid` parents, and only searches the tree after a selection or view change, up to 3 times. |
|
||||
| `ImageLoader` | Asynchronous, downscaled (`DecodePixelWidth`), frozen, cached image decoding with limited concurrency. |
|
||||
| `DialogService` | Hosts the Add to Collection and create/edit dialogs in Playnite windows. |
|
||||
| `CollectionsRootViewModel` | Sidebar page navigation (home ↔ collection) and shared open/edit/delete actions. Lives for the whole session so view state is kept. |
|
||||
@@ -70,7 +79,7 @@ To try a build in Playnite, open the `.pext` file (Playnite installs it after a
|
||||
|
||||
```json
|
||||
{
|
||||
"SchemaVersion": 1,
|
||||
"SchemaVersion": 2,
|
||||
"Collections": [
|
||||
{
|
||||
"Id": "guid",
|
||||
@@ -79,6 +88,7 @@ To try a build in Playnite, open the `.pext` file (Playnite installs it after a
|
||||
"Rating": 8.5,
|
||||
"PosterFileName": "guid_ticks.png",
|
||||
"GameIds": ["game guid", "..."],
|
||||
"Rules": null,
|
||||
"CreatedAt": "2026-10-30T12:00:00Z",
|
||||
"ModifiedAt": "2026-10-30T12:00:00Z"
|
||||
}
|
||||
@@ -88,6 +98,16 @@ To try a build in Playnite, open the `.pext` file (Playnite installs it after a
|
||||
|
||||
Only game IDs are stored. Missing games are removed on startup and whenever Playnite deletes a game.
|
||||
|
||||
### Dynamic collections
|
||||
|
||||
`Rules` on a collection makes it dynamic (null means manual), and `GameIds` caches its latest matches. Pages and the
|
||||
game details therefore never search the library. Rules store IDs rather than names, so renaming a tag keeps them
|
||||
working. Enums are stored as numbers, so existing values must not be renumbered.
|
||||
|
||||
Evaluation only reads in-memory game fields. A change to some games tests only those games, and full searches run on
|
||||
a background thread and are discarded if the rules were edited meanwhile. In a synthetic test, a full search of 20
|
||||
collections over 20,000 games took under a second. The data file is only written when membership really changed.
|
||||
|
||||
### Performance
|
||||
|
||||
Covers and posters are decoded at display size, off the UI thread, and cached. On a collection's page,
|
||||
|
||||
@@ -0,0 +1,278 @@
|
||||
# Developer guide
|
||||
|
||||
How Game Collections works and how to change it. For a short overview of the layout and components, see
|
||||
[architecture.md](architecture.md). For behaviour as users see it, see [user-guide.md](user-guide.md).
|
||||
|
||||
## Getting started
|
||||
|
||||
You need Windows and a .NET SDK (6.0 or later recommended). The .NET Framework 4.6.2 reference assemblies come from
|
||||
NuGet, so no targeting pack is needed. The project targets `net462` with C# 7.3, matching Playnite extensions, and
|
||||
references `PlayniteSDK` 6.11.0.
|
||||
|
||||
```
|
||||
dotnet build source/GameCollections.sln -c Debug
|
||||
```
|
||||
|
||||
To run it, add `source/GameCollections/bin/Debug` under Playnite's *Settings → For developers → Custom extension
|
||||
folders* and restart Playnite after each build. A Release build also creates the `.pext` in `dist/`.
|
||||
|
||||
Logs go to Playnite's `extensions.log`. Data is in `ExtensionsData\3f6b8d2e-5c41-4a7e-9e0b-6d2f1a8c7b54`.
|
||||
|
||||
## How the pieces fit together
|
||||
|
||||
```
|
||||
GameCollectionsPlugin Playnite entry point and event wiring
|
||||
├─ CollectionManager the only code that changes collections
|
||||
│ ├─ CollectionRepository collections.json: load, recover, atomic save
|
||||
│ ├─ PosterStorage Posters\ folder
|
||||
│ └─ RuleEngine rules -> predicate (static, no state)
|
||||
├─ DynamicCollectionRefresher when dynamic collections are re-evaluated
|
||||
├─ DetailsViewIntegration inserts the list into themes without the element
|
||||
├─ DialogService dialogs in Playnite-created windows
|
||||
└─ CollectionsRootViewModel sidebar state; created on first use, kept for the session
|
||||
├─ CollectionsHomeViewModel -> CollectionCardViewModel
|
||||
└─ CollectionDetailsViewModel -> CollectionGameViewModel
|
||||
```
|
||||
|
||||
### Rules to keep
|
||||
|
||||
- **All changes go through `CollectionManager`.** Each change saves and then raises `CollectionsChanged` with the
|
||||
affected IDs. View models and `GameCollectionsControl` react to that event, and don't update themselves.
|
||||
- **`CollectionManager` is UI-thread only.** Playnite's database events can arrive on other threads, so the plugin
|
||||
sends them through `RunOnUiThread`. Only the static `CollectionManager.FindMatches` and `RuleEngine` are safe on a
|
||||
background thread.
|
||||
- **Collections store game IDs only.** Metadata is always read from Playnite's database.
|
||||
- **Views use theme resources only**, such as `TextBrush`, `NormalBrush` and `FontIcoFont`, through `DynamicResource`,
|
||||
so light and dark themes both work. The one fixed colour is the dynamic badge in `Styles.xaml`.
|
||||
- **No user-visible text in code or XAML.** Add a `LOCGameCollections_*` key to `Localization/en_US.xaml`, and read it
|
||||
with `Loc` in code or `DynamicResource` in XAML.
|
||||
|
||||
## Startup and lifecycle
|
||||
|
||||
1. **Constructor:** creates settings, services and the dialog host, and registers settings and custom element support.
|
||||
The game database isn't ready yet, so nothing is loaded.
|
||||
2. **`OnApplicationStarted`:** loads collections, prunes games no longer in the library, deletes unreferenced posters,
|
||||
subscribes to database events, then starts the refresher and, in Desktop mode, the details integration.
|
||||
3. **`GetSidebarItems` → `Opened`:** builds a new view each time around the same `CollectionsRootViewModel`. That is
|
||||
why the open page, search and sort survive leaving the sidebar page.
|
||||
4. **`OnApplicationStopped`:** unsubscribes and stops the timers.
|
||||
|
||||
## Data
|
||||
|
||||
### collections.json
|
||||
|
||||
`CollectionsDataFile` holds `SchemaVersion` and a list of `GameCollection`. See the example in
|
||||
[architecture.md](architecture.md#data-model).
|
||||
|
||||
**Saving** (`CollectionRepository.Save`) writes a temp file, then swaps it in with `File.Replace`, keeping the previous
|
||||
version as `collections.json.bak`. It falls back to copying where `File.Replace` isn't supported.
|
||||
|
||||
**Loading** moves an unreadable file aside as `collections.unreadable-<timestamp>.json` so a later save can't overwrite
|
||||
it, then tries the backup, and returns a warning that the plugin shows as a notification. `Sanitize` repairs damaged
|
||||
records, such as missing IDs, duplicate IDs, or out-of-range ratings.
|
||||
|
||||
### Versioning and migrations
|
||||
|
||||
The file has a `SchemaVersion`, and `CollectionsDataMigrator` runs on every load, before the JSON becomes model objects:
|
||||
|
||||
1. It reads `SchemaVersion`, or assumes 1 if it's missing.
|
||||
2. It applies each step from that version up to `CurrentVersion`, in order, so someone updating from 1 to 7 runs
|
||||
1→2, 2→3 and so on.
|
||||
3. `CollectionRepository` copies the original to `collections.json.v<old version>.bak` and saves the migrated data.
|
||||
|
||||
If a step fails or is missing, the file counts as unreadable: it's moved aside and the normal backup is tried, also
|
||||
through the migrator. A file from a **newer** version isn't changed by the migrator. It loads as well as it can, a copy
|
||||
is kept, and the user gets a warning, because properties this version doesn't know about are lost on the next save.
|
||||
|
||||
**To change the format:**
|
||||
|
||||
1. Change the model, and repair or default the value in `Sanitize`.
|
||||
2. Increase `CollectionsDataMigrator.CurrentVersion`.
|
||||
3. Add a step to `Steps` with `FromVersion` set to the previous version. It edits the raw `JObject`:
|
||||
|
||||
```csharp
|
||||
// 2 -> 3 (extension 1.2.0): renamed Rating to Score.
|
||||
new DataMigrationStep(2, data =>
|
||||
{
|
||||
foreach (var collection in data["Collections"])
|
||||
{
|
||||
collection["Score"] = collection["Rating"];
|
||||
((JObject)collection).Remove("Rating");
|
||||
}
|
||||
})
|
||||
```
|
||||
|
||||
4. Add a line to the version history below.
|
||||
|
||||
Steps use raw JSON so they keep working after the model changes. Never edit a released step, rename a property without
|
||||
a step, or renumber an enum value, because enums are stored as numbers. A new property with a safe default still needs
|
||||
a version bump only if old files need converting, but bumping keeps the history clear.
|
||||
|
||||
Version history: **1** was the initial format (extension 1.0.0); **2** added `GameCollection.Rules` (extension 1.1.0).
|
||||
|
||||
`config.json` (settings) isn't versioned. Playnite reads it directly, and new settings simply take their defaults.
|
||||
|
||||
### Settings
|
||||
|
||||
`GameCollectionsSettings` is saved by Playnite to `config.json`. Add a property using `SetValue`, and bind to
|
||||
`Settings.<Name>` in `GameCollectionsSettingsView.xaml`. Mark state that shouldn't be saved with `[DontSerialize]`.
|
||||
Themes can read these properties through `{PluginSettings Plugin=GameCollections, Path=<Name>}`.
|
||||
`SettingsChanged` fires after the settings dialog is saved or cancelled.
|
||||
|
||||
## Manual order
|
||||
|
||||
The order is simply the order of `GameCollection.GameIds`, which is also what the automatic poster uses (first game).
|
||||
`CollectionManager.MoveGames(collectionId, gameIds, anchorId, after)` is the single move operation. Selected games keep
|
||||
their relative order.
|
||||
|
||||
On the page, `CollectionDetailsViewModel.CanReorder` requires the *Collection order, ascending* sort, because a moved
|
||||
game wouldn't stay put in any other. Moves relate to *visible* games, so with a filter active, "move earlier" passes the
|
||||
previous visible game.
|
||||
|
||||
Dragging is in `CollectionDetailsView.xaml.cs`. A click on an already selected game in a multi-selection delays
|
||||
collapsing the selection until the mouse button is released, otherwise several games couldn't be dragged.
|
||||
`FindDropTarget` picks the closest tile on the pointer's row and which side of it to use.
|
||||
|
||||
## Dynamic collections
|
||||
|
||||
A collection is dynamic when `Rules` is not null. `GameIds` stores the latest matches, so no page has to search the
|
||||
library.
|
||||
|
||||
### Evaluation
|
||||
|
||||
`RuleEngine.Compile(rules, now)` returns a `Func<Game, bool>`:
|
||||
|
||||
- Conditions in a block are ANDed.
|
||||
- Blocks combine strictly from top to bottom using each block's `Join`, without AND taking priority over OR. This
|
||||
matches how they read in the editor.
|
||||
- Hidden games never match.
|
||||
- Rules that aren't complete compile to "match nothing", so damaged data can't fill a collection with the whole library.
|
||||
- Compile once and reuse the predicate. It prepares `HashSet`s and parsed dates up front.
|
||||
|
||||
`MergeMatches` applies results: games still matching keep their position, which preserves manual order, and new ones go
|
||||
at the end.
|
||||
|
||||
### When it runs
|
||||
|
||||
`DynamicCollectionRefresher` owns the timing:
|
||||
|
||||
| Trigger | Method | Scope and thread |
|
||||
|---|---|---|
|
||||
| Collection created or edited | `CreateCollection` / `UpdateCollection` | One collection, UI thread |
|
||||
| Game added or updated | `NotifyGamesChanged` → `ApplyGameChanges` | Changed games only, 1 s debounce, UI thread |
|
||||
| Startup | `Start` → `RefreshAllAsync` | All, after 5 s, background |
|
||||
| Library update finished | `ScheduleFullRefresh` | All, after 1 s, background |
|
||||
| Hourly, if a rule uses relative days | `RefreshAllAsync` | All, background |
|
||||
| **Refresh now** button | `RefreshCollection` | One collection, UI thread |
|
||||
|
||||
Two details prevent wrong results from a background search:
|
||||
|
||||
- Each result carries the `DynamicRules` object it used. `ApplyMatches` skips it if the collection now has a different
|
||||
one, because every save of the editor creates a new object.
|
||||
- Game changes arriving during a search stay queued and are applied after its results.
|
||||
|
||||
### Adding a rule field
|
||||
|
||||
1. Add it to the end of `RuleField` in `Models/DynamicRules.cs`.
|
||||
2. In `RuleEngine`, update `GetValueKind` and add it to `GetItemIds` or `GetNumber` (or the date selection in
|
||||
`CompileDate`).
|
||||
3. For a list field, return its items from `RuleText.LoadItems`.
|
||||
4. Add it to `FieldOrder` in `RuleConditionViewModel`, plus `UnitText` if it has a unit.
|
||||
5. Add `LOCGameCollections_RuleField<EnumName>` to the strings. The key is built from the enum name.
|
||||
|
||||
`RuleText.Describe` and the editor pick it up from there.
|
||||
|
||||
### Adding an operator
|
||||
|
||||
Add it to the end of `RuleOperator`, offer it in `RuleEngine.GetOperators`, handle it in the matching `Compile*` method
|
||||
and in `IsComplete`, and add `LOCGameCollections_RuleOperator<EnumName>`. If it needs different inputs, adjust the
|
||||
`Show*` properties of `RuleConditionViewModel`, `ToModel` and `RuleBuilderView.xaml`.
|
||||
|
||||
### Editor
|
||||
|
||||
`DynamicRulesViewModel` → `RuleBlockViewModel` → `RuleConditionViewModel`. Values stay as text while editing, and
|
||||
`ToModel()` produces the saved form, so `RuleEngine.IsComplete` is the one source of validation. The preview searches
|
||||
the library after a 250 ms pause, on the UI thread, which is fast enough at the sizes tested (see Performance).
|
||||
|
||||
## Game details
|
||||
|
||||
For theme authors, see [theme-integration.md](theme-integration.md). `GameCollectionsControl` is a `PluginUserControl`. It reads `GameContext`, uses the cached
|
||||
`CollectionManager.GetCollectionsForGame` lookup, and collapses when there's nothing to show. It subscribes to events
|
||||
only while loaded, so a discarded instance can be collected.
|
||||
|
||||
It reaches the screen in one of two ways:
|
||||
|
||||
1. **Custom element.** A theme adds `<ContentControl x:Name="GameCollections_CollectionsControl" />`, and Playnite
|
||||
calls `GetGameViewControl`. This is the supported route and works in Desktop mode only.
|
||||
2. **`DetailsViewIntegration`.** Playnite has no API for adding to a theme, so this walks the main window's visual tree
|
||||
for `PART_ElemDescription`, or else `PART_ElemNotes`, and inserts one control after it.
|
||||
|
||||
The integration's safeguards:
|
||||
|
||||
- It stands aside when it finds a theme-placed control (`IsInjected` is false).
|
||||
- It doesn't insert into a `Grid`, which would need a new row, or an items host.
|
||||
- It searches only after a game selection, a view change or a settings change, up to 3 times each, and skips
|
||||
`ListBoxItem`s, which hold most of the tree. A 1 second timer only compares `ActiveDesktopView`.
|
||||
- Every error is caught and logged, and stops further searching until the next trigger.
|
||||
|
||||
**This relies on Playnite's internal part names.** Check it after Playnite updates. The default layouts are
|
||||
`Themes/Desktop/Default/Views/DetailsViewGameOverview.xaml` and `GridViewGameOverview.xaml` in Playnite's repository.
|
||||
|
||||
Clicking a collection calls `CollectionsRootViewModel.OpenCollectionInWindow`. The page uses `CloseWindow` to know it's
|
||||
in a window, where **Open in Collections** replaces **Select in library**. That button opens the page in the sidebar
|
||||
view's state, closes the window, then calls `SidebarNavigator.TryActivate`.
|
||||
|
||||
The SDK has no way to switch sidebar views, so `SidebarNavigator` uses reflection to run the `Command` of the matching
|
||||
entry in `SidebarItems` on the main window's view model, as Playnite's `SwitchToLibraryView` does. **This relies on
|
||||
Playnite's internals, so check it after Playnite updates.** If it fails, a notification tells the user to click
|
||||
Collections, and the page is already open there.
|
||||
|
||||
## Images
|
||||
|
||||
`ImageLoader` decodes at the size needed, off the UI thread, with limited concurrency, and returns frozen bitmaps. Its
|
||||
cache key includes the path, width, modified time and file size, so a changed file is reloaded. Pass the display width
|
||||
to it rather than loading full-size artwork. Game covers on a collection's page load only near the viewport.
|
||||
|
||||
## Performance
|
||||
|
||||
Measured in the test harness, not in Playnite: 20 full searches of 20,000 synthetic games took about 0.85 s in total.
|
||||
Keep these costs in mind:
|
||||
|
||||
- Nothing should scan the library on the UI thread when a game is selected.
|
||||
- Writes happen only when something changed, because `collections.json` is rewritten in full each time.
|
||||
- Don't subscribe to `ItemUpdated` for per-game work without a debounce. Library updates send many at once.
|
||||
|
||||
## Testing
|
||||
|
||||
**There's no test project in the repository yet.** The checks so far ran in a throwaway harness outside it, against a
|
||||
fake Playnite API built with `RealProxy`. Its limits:
|
||||
|
||||
- `Playnite.SDK.Data.Serialization` and `API.Instance` are normally set by Playnite, so any test host has to supply
|
||||
them. The SDK alone throws `NullReferenceException`.
|
||||
- It doesn't load a real theme, so screenshots have wrong glyphs and default button colours. Theming can only be judged
|
||||
in Playnite.
|
||||
- Real mouse drag-and-drop and insertion into real theme layouts can't be tested there.
|
||||
|
||||
Before a release, check these by hand in Playnite:
|
||||
|
||||
1. Create, edit and delete manual and dynamic collections, in a light and a dark theme.
|
||||
2. Open the value picker in the rule builder, search, and tick several values.
|
||||
3. Drag one game and several games, including scrolling while dragging.
|
||||
4. Select games in Details and Grid view, and switch between views; the list should appear once, below the description.
|
||||
Click a collection there, then **Open in Collections**.
|
||||
5. Toggle both details view settings.
|
||||
6. Change a game's tags, and play a game, and watch a dynamic collection update.
|
||||
|
||||
## Known issues to watch
|
||||
|
||||
- `ApplicationMode` other than Desktop is untested, and the views need Desktop theme styles.
|
||||
- A search of the library in the rule preview runs on the UI thread. Very large libraries could feel it while editing.
|
||||
- Only `en_US` strings exist so far.
|
||||
|
||||
## Releasing
|
||||
|
||||
Update the version in both `GameCollections.csproj` and `extension.yaml`, add it to `CHANGELOG.md`, and add a new entry
|
||||
at the top of `Packages` in `manifests/installer_manifest.yaml`. Pushing a `v*` tag makes the
|
||||
[workflow](../.github/workflows/build.yml) build the `.pext` and create the release. Check the manifest with
|
||||
`Toolbox.exe verify installer <url>`. `PackageUrl` must match the file name exactly, which includes the extension ID and
|
||||
the version with underscores.
|
||||
@@ -0,0 +1,40 @@
|
||||
# Theme integration
|
||||
|
||||
For theme authors. Everything here is optional: Game Collections works in themes that do none of it.
|
||||
|
||||
## Collections list
|
||||
|
||||
Shows the collections of the selected game, each with its poster. Clicking one opens it. The list collapses itself when
|
||||
the game is in no collection or no single game is selected.
|
||||
|
||||
By default, the extension inserts the list below the game description in any theme that keeps Playnite's standard
|
||||
description or notes section. To choose the position yourself, add this anywhere in a game details view:
|
||||
|
||||
```xml
|
||||
<ContentControl x:Name="GameCollections_CollectionsControl" />
|
||||
```
|
||||
|
||||
When your theme has this element, the extension doesn't insert a second list, and your list stays visible even if the
|
||||
user turns off **Show collections in details view**. The list shown there includes dynamic collections unless the user
|
||||
turns off **Display dynamic collections in details view**.
|
||||
|
||||
## Settings available to themes
|
||||
|
||||
Bind to these with `PluginSettings`:
|
||||
|
||||
| Path | Type | Meaning |
|
||||
|---|---|---|
|
||||
| `IsDetailsControlVisible` | `bool` | The list currently has collections to show. Use it to hide a surrounding header or panel. |
|
||||
| `ShowDynamicCollectionsInDetails` | `bool` | The user's choice for listing dynamic collections. |
|
||||
| `AddDetailsListToAnyTheme` | `bool` | The user's choice for inserting the list automatically. |
|
||||
|
||||
```xml
|
||||
<Border Visibility="{PluginSettings Plugin=GameCollections, Path=IsDetailsControlVisible, Converter={StaticResource BooleanToVisibilityConverter}}">
|
||||
<ContentControl x:Name="GameCollections_CollectionsControl" />
|
||||
</Border>
|
||||
```
|
||||
|
||||
## Compatibility
|
||||
|
||||
Keep the element name and these setting names stable across themes: they're treated as public, and any future
|
||||
changes or new integration points will be listed in this file.
|
||||
+70
-2
@@ -37,17 +37,80 @@ Deleting a collection never deletes or changes any games.
|
||||
When there's no custom poster, the cover of the first game in the collection is used; with no cover either,
|
||||
a placeholder is shown.
|
||||
|
||||
## Dynamic collections
|
||||
|
||||
A dynamic collection fills itself from rules. To make one, choose **Dynamic** under **Type** when creating or
|
||||
editing a collection.
|
||||
|
||||
- A **block** is a group of conditions. A game must meet **every** condition in a block.
|
||||
- Between blocks, choose **AND** or **OR**. Blocks combine from top to bottom, so
|
||||
*A OR B AND C* means *(A or B) and C*.
|
||||
- The bar at the bottom shows how many games currently match, and some of their names.
|
||||
- Hidden games are never included.
|
||||
|
||||
| You can filter by | Conditions |
|
||||
|---|---|
|
||||
| Name | includes, does not include |
|
||||
| Platform, genres, developers, publishers, categories, features, tags, series | includes any of, all of or none of; is empty |
|
||||
| Completion status | includes any of or none of; is empty |
|
||||
| Release date, last played | after, before, between; in the last or older than a number of days; has no date |
|
||||
| User, critic and community score | at least, at most, between; is empty |
|
||||
| Time played (hours), play count | at least, at most, between |
|
||||
|
||||
Dates can be a year, a month or a day (`2005`, `2005-03` or `2005-03-14`). *After 2005* starts at 2006, and
|
||||
*between 1995 and 1999* includes both years.
|
||||
|
||||
**Example:** Block 1: *Platform includes any of Windows PC* and *Categories includes any of Boomer shooter*.
|
||||
OR Block 2: *Tags includes any of Action*.
|
||||
|
||||
**When it updates** (nothing you need to do):
|
||||
|
||||
| When | What is checked |
|
||||
|---|---|
|
||||
| You create or edit the collection | That collection, right away |
|
||||
| A game is added or changed, including after playing it | Only those games, about a second later |
|
||||
| A game is removed from Playnite | Removed from collections right away |
|
||||
| Playnite starts (after 5 seconds) and after a library update | Every dynamic collection, in the background |
|
||||
| Every hour, if a rule uses "in the last" or "older than" days | Every dynamic collection, in the background |
|
||||
| You click **Refresh now** on its page | That collection, right away |
|
||||
|
||||
You can't add or remove a dynamic collection's games by hand, but you can reorder them; the order is kept when it
|
||||
updates, and new games go at the end. Switching a dynamic collection to manual keeps its current games. Switching a
|
||||
manual collection to dynamic replaces its games with the matches, and the dialog warns you first.
|
||||
|
||||
If a tag, genre or similar is deleted from Playnite, it stops counting in rules. If a condition is left with no
|
||||
values, the rules match nothing until you edit them, so a broken rule can never pull in your whole library.
|
||||
|
||||
## Game details
|
||||
|
||||
The selected game's collections appear below the description in Playnite's game details, each with its poster.
|
||||
Click one to open it in a window, where **Open in Collections** takes you to its page in the Collections section. The list is hidden when the game is in no collection or several games are selected.
|
||||
|
||||
In the extension's settings:
|
||||
|
||||
- **Show collections in details view** turns the automatic list on or off.
|
||||
- **Display dynamic collections in details view** lists dynamic collections as well as manual ones.
|
||||
|
||||
The list is added to the theme's layout automatically, because Playnite has no official way to do this. It needs the
|
||||
theme to keep Playnite's standard description or notes section in a simple panel, so a heavily customized theme may
|
||||
not show it. List view has no details panel, so it doesn't appear there. Theme authors can see
|
||||
[Theme integration](theme-integration.md).
|
||||
|
||||
## A collection's page
|
||||
|
||||
- Header with poster, title, rating, game count and description, plus **Edit**, **Select in library** and **Delete**.
|
||||
Dynamic collections also show their rules and a **Refresh now** button.
|
||||
- **Search** the collection's games by name.
|
||||
- **Sort** by collection order (the order games were added), name, release date, last played, time played
|
||||
or date added, ascending or descending.
|
||||
- **Sort** by collection order (the order you arranged, or the order games were added), name, release date,
|
||||
last played, time played or date added, ascending or descending.
|
||||
- **Installed only** hides games that aren't installed (uninstalled games are dimmed otherwise).
|
||||
- For each game (right-click, or keyboard):
|
||||
- **Play** / **Install** – double-click or **Enter**.
|
||||
- **Show in library** – selects the game in Playnite's library view.
|
||||
- **Remove from collection** – **Delete**. Works on several selected games at once (Ctrl/Shift-click).
|
||||
Not available in dynamic collections.
|
||||
- **Reorder** while sorted by collection order, ascending: drag games (several at once if selected), use
|
||||
**Move to top / earlier / later / to end** in the right-click menu, or press **Alt+arrow keys**.
|
||||
|
||||
## Where data is stored
|
||||
|
||||
@@ -56,6 +119,7 @@ In Playnite's `ExtensionsData\3f6b8d2e-5c41-4a7e-9e0b-6d2f1a8c7b54` folder:
|
||||
- `collections.json` – your collections. `collections.json.bak` holds the previous save.
|
||||
- `Posters\` – copies of custom posters.
|
||||
- `config.json` – extension settings.
|
||||
- `collections.json.v<number>.bak` – a copy from before an update changed the file's format.
|
||||
|
||||
Back up this folder to back up your collections. If `collections.json` ever becomes unreadable, it is renamed to
|
||||
`collections.unreadable-<date>.json`, the backup is loaded instead, and Playnite shows a notification.
|
||||
@@ -67,5 +131,9 @@ These come from Playnite's extension API:
|
||||
- Extensions can't open a game's details page directly. **Show in library** selects the game and switches to
|
||||
the library view, where its details appear. If a library filter hides the game, Playnite can't select it –
|
||||
clear the filter and try again.
|
||||
- Extensions have no official way to switch to their own sidebar view, so **Open in Collections** uses Playnite's
|
||||
internals. If that ever stops working, the page is still ready, and a notification tells you to click Collections.
|
||||
- Extensions have no official way to add to a theme's details view, so the list is inserted into the theme's layout.
|
||||
It may not appear in heavily customized themes.
|
||||
- Extensions can't embed Playnite's own library grid, so a collection's page uses its own game grid.
|
||||
- The extension targets Desktop mode. Fullscreen mode doesn't show sidebar views or game context menus from extensions.
|
||||
Reference in new issue
Block a user