Playnite Forums
DuplicateHider - Hide Duplicate Game Copies - Printable Version

+- Playnite Forums (https://playnite.link/forum)
+-- Forum: Extension Database (https://playnite.link/forum/forum-3.html)
+--- Forum: Generic Extensions (https://playnite.link/forum/forum-6.html)
+--- Thread: DuplicateHider - Hide Duplicate Game Copies (/thread-308.html)

Pages: 1 2 3 4 5 6 7


DuplicateHider - Hide Duplicate Game Copies - felixkmh - 06-22-2020

This plugin tries to hide duplicate copies of games based on a modified version of their name (because copies of the same game can have different names, this does not always work perfectly). Only the copy with the highest priority stays visible if the "Hide Duplicates" function is invoked. The priority is based on the order of the source names in the plugin settings section, which can be re-ordered by using the arrows or by dragging the entries according to preference. The higher in the list a source is, the higher its priority. Installed games always have a higher priority than uninstalled games.

You can enable the UI Integration option to display a toggle button next to the play button if it has copies. Note that this feature might not work with every custom theme. Here is an example using the Default theme:

[Image: Playbutton-Extension.png]

Settings:
  • Priorites: Source names ordered by their priority. Highest priority at the top. Can be re-ordered using the arrows or by dragging the entries onto the desired position.
  • Update Rank Automatically: If enabled, duplicates will be hidden when Playnite opens and whenever a game is changed, added or removed, ensuring that only the game with the highest priority stays visible. If disabled, the "Hide Duplicates" and "Reveal Duplicates" extension functions have to be invoked manually after any changes to games or settings.
  • Show Copies in Game Menu: If enabled, right clicking a game will show a "Other copies" entry which contains all other (hidden) copies of the currently selected game. Clicking on the other copies will attempt to launch them using Playnite.
  • Included Platforms: Only games with platforms enabled in this setting are considered when looking for duplicates. By clicking the down arrow in the text box, a list of all available platforms is revealed. Only checked platforms are enabled. You can also type in the text box to search for a specific platform you want to enable/disable. Only "PC" and "Undefined" are enabled by default.
  • Exluded Sources: Games form sources enabled in this setting are ingored when looking for duplicates. By clicking the down arrow in the text box, a list of all available sources is revealed. Only checked sources are enabled. You can also type in the text box to search for a specific source you want to enable/disable. None are enabled by default.
  • Exluded Categories: Similar to Exluded Sources, but excludes enabled categories.
  • Ignored Games: A list of games manually put onto a ignore list using the "Add Selected Games to Ignore List" extension function. Games on this list are not considered when looking for duplicates. Select one or more entries to remove them from the list by right clicking and then clicking "Remove Entry". You can also remove games from this list using the "Remove Selected Games from Ignore List" extension function.
  • Display string for other copies: String used to display other copies in the game menu, when enabled. Right click to insert placeholder variables. Conditional text can be added before and after the variable name: {Prefix'Variable'Suffix}. Prefix and Suffix will only be visible if Variable can be evaluated.
  • Custom Replacement Rule: String replacement rules that matches the left side with a part of a game name and replaces it with the right side. The left side can be interpreted as a regular expression if the checkbox next to "Regex" is checked.
  • Enable UI Integration: If enabled, DuplicateHider will try to add an extra button next to the play button to start and install other copies of a game. Might not work with every custom theme.

Drag-and-Drop the .pext file onto the Playnite window to install.

GitHub

Help translate: https://crowdin.com/project/duplicatehider

[Image: localized.svg]

[Image: 61e11d430afb112ea33c3aa5_Button-1-p-500.png]

Contributions:
Translation:
Portuguese, Brazilian: ferrell
French: ohkami, Lacro59
Dutch: WaelALR, wout25
Spanish: darklinkpower
Polish: luniewski

Change log:
v3.0.0:
  • Playnite 9 Beta Support, not compatible with Playnite 8
  • Custom UI Support, used in a showcase theme as an example: DH_Night, Forum Post
  • Addon-Id changed, so the extension needs to be uninstalled before installing the new one

v2.5.4:[attachment=1672]
  • updated to QuickSearchSDK 1.3
  • added settings to QuickSearch
  • added new option to sort by release date if source scores are equal
v2.5.3:[attachment=1656]
  • updated to QuickSearchSDK 1.2
v2.5.2:[attachment=1647]
  • updated to QuickSearchSDK 1.1
v2.5.1:[attachment=1639]
  • Added support for QuickSearch extension.
v2.5.0:[attachment=1568]
  • Added option to add toggle button next to play button to launch / install other copies of a game (might not work as expected with every theme)
  • Added option to define custom string replacement rules that are applied to game names before further processing
    • optionally: left side of rule can be intepreted as a regular expression if checkbox is checked.
v2.3.2:[attachment=1268]
  • fixed extension crashing when game names contained numbers outside int32 range
v2.3.1:[attachment=1258] v2.3.0:[attachment=1255]
  • Added new option for "Ignore List": "Add manually hidden/revealed Games". If enabled, when the visibility of a game is changed by something other than DuplicateHider, the game is added to the Ignore List. This way DuplicateHider does not override a game's visibibilty which prevented the user from hiding games that have duplicates.
v2.2.5:[attachment=1028]
  • Improved duplicate detection if game names contain roman numerals in one copy and arabic numerals in another
v2.2.4:[attachment=1021]
  • Added more symbols to the special character filter to improve duplicate detection
  • some small UI improvements
v2.2.3:[attachment=992]
  • Fixed Priorities list not being saved/loaded correctly.
v2.2.2:[attachment=935]
  • Fixed game not being automatically revealed if only one copy is left after removing another copy (Only if Update Rank Automatically is enabled)
v2.2.1:[attachment=920]
  • Display string can have a conditional prefix and/or suffix in this format: {Prefix'Variable'Suffix}. The prefix and suffix are only shown if the variable exists. E.g. {ROM: 'ImageNameNoExt} will evaluate to "ROM: MyRom" if an image file with the name "MyRom" exists, otherwise it will evaluate to the empty string.
v2.2:[attachment=919]
  • Added customizable display string to plugin settings. Right-click to insert placeholder varaibles
v2.1:[attachment=886]
  • Added option to show other copies of a game in a game's context menu (Game Menu)
v2.0.1:[attachment=863]
  • Fixed default settings not being applied
  • Fixed Priority list not being populated
v2.0:[attachment=817]
  • Ported script over to a full plugin
  • Added menu function to add/remove selected games from a ignore list, which will cause DuplicateHider to not consider them when looking for duplicates
  • Options moved to plugin settings menu
    • Priorites can be changed using the arrows or by dragging them to the desired position
    • Ignored games can be removed from the list by selecting one ore more entries and right-clicking them
    • Search function for Include/Exclude options
  • Old settings are not restored when updating from a version below 2.0
  • Old version needs to be uninstalled manually when updating from a version below 2.0, otherwise old menu functions will exist next to the new ones
v1.6:[attachment=749]
  • When UpdateAutomatically is enabled, priorities are also re-evaluated when a game is installed/uninstalled.
v1.5:[attachment=629]
  • Reminder: When updating, customized priority lists and exclusion lists will be overriden. Back it up before updating to restore it after the update
  • Moved configuration to extra json config file.
  • Config file can be opened via a new menu function.
  • Added option to automatically hide/reveal games when new games are added or when old ones are removed. This always keeps one copy visible, according to the priorities and include/exclude lists (disabled by default, set "UpdateAutomatically" to true in config.json to enable it).
v1.4:[attachment=336]
  • Reminder: When updating, customized priority lists and exclusion lists will be overriden. Back it up before updating to restore it after the update
  • Added "IncludePlatforms" list. Only platform specified in that list are considered when hiding duplicates. Defaulted to "PC" and "Undefined" (games without platform). (Addressing this issue)
v1.3:[attachment=325]
  • Reminder: When updating, customized priority lists will be overriden. Back it up before updating to restore it after the update
  • Added more sources to predefined priorities.
v1.2:[attachment=317]
  • Reminder: When updating, customized priority lists will be overriden. Back it up before updating to restore it after the update
  • added lists to exclude games in specific sources and games in specific categories from being hidden.
  • as suggested by darklinkpower:
    • added some string replacements to handle different kinds of "GOTY" tags in game names
    • added "Undefined" to Priorities list. Games without a source get the priority of "Undefined"
    • added "Rockstar Games" source to predefined priorities



RE: DuplicateHider - Hide Duplicate Game Copies - DonkeyOatay - 06-23-2020

Thanks a lot. I've already hidden all of the duplicates manually, so I wish this had been around when doing that, but I'll give it a go when I need it in future.


RE: DuplicateHider - Hide Duplicate Game Copies - SaltySamurai - 06-23-2020

Very nice, even better than the GOG solution I think

Ah, how do you alter the list?
"The priority is based on the order of the source names at the beginning of the script, which can be re-ordered according to preference." Where do I do that?


RE: DuplicateHider - Hide Duplicate Game Copies - felixkmh - 06-23-2020

(06-23-2020, 06:52 PM)SaltySamurai Wrote: Very nice, even better than the GOG solution I think

Ah, how do you alter the list?
"The priority is based on the order of the source names at the beginning of the script, which can be re-ordered according to preference." Where do I do that?
You should be able to find the script "DuplicateHider.py" at %APPDATA%\Playnite\Extensions\ inside a folder that begins with "DuplicateHider".
You can change the priorities by re-ordering the names in the Priorites list at the beginning of DuplicateHider.py:
Priorities = [
    "Steam",
    "GOG",
    "Epic",
    "Amazon",
    "Humble",
    "Twitch",
    "Xbox",
    "Uplay",
    "Origin",
    "Battle.net",
]
Here, steam has the highest priority. Just keep in mind that a game installed on GOG would still have a higher priority than a game not installed on Steam in this case. If both were installed or not installed, the Steam version would be prioritized.
If you are using other sources, you can also add them to that list.

And don't forget to reload the script after altering the list, otherwise it won't have an effect until the next time Playnite starts.


RE: DuplicateHider - Hide Duplicate Game Copies - SaltySamurai - 06-23-2020

(06-23-2020, 08:46 PM)felixkmh Wrote:
(06-23-2020, 06:52 PM)SaltySamurai Wrote: Very nice, even better than the GOG solution I think

Ah, how do you alter the list?
"The priority is based on the order of the source names at the beginning of the script, which can be re-ordered according to preference." Where do I do that?
You should be able to find the script "DuplicateHider.py" at %APPDATA%\Playnite\Extensions\ inside a folder that begins with "DuplicateHider".
You can change the priorities by re-ordering the names in the Priorites list at the beginning of DuplicateHider.py:
Priorities = [
    "Steam",
    "GOG",
    "Epic",
    "Amazon",
    "Humble",
    "Twitch",
    "Xbox",
    "Uplay",
    "Origin",
    "Battle.net",
]
Here, steam has the highest priority. Just keep in mind that a game installed on GOG would still have a higher priority than a game not installed on Steam in this case. If both were installed or not installed, the Steam version would be prioritized.
If you are using other sources, you can also add them to that list.

And don't forget to reload the script after altering the list, otherwise it won't have an effect until the next time Playnite starts.

Awesome, thankyou. I want Uplay at the top of the list because games you buy on steam are played through Uplay anyway. Then again I am wondering if I really prefer that, might need to test both. I suppose I still get the steam Overlay if I use the steam version.



RE: DuplicateHider - Hide Duplicate Game Copies - felixkmh - 06-24-2020

If you want to play around with different priorities, just keep in mind that the "Hide Duplicates" function does not make any copy visible. So if you use it multiple times with different priorities, all copies of a game might end up being hidden. You can use the "Show All Duplicates" function to make all copies of games visible that have more than one copy before calling "Hide Duplicates" again with different priorities.


RE: DuplicateHider - Hide Duplicate Game Copies - darklinkpower - 07-02-2020

The extension is working great but I just found another replacement case to provide better results: replace 'Game of the Year' for "GOTY" for cases like these.



[Image: nfsuBHo.png]



The only trouble there would be the 'Edition'. Perhaps it should be removed altogether for the comparison? I don't think there should be any issues. This game is affected by this too.



[Image: ni1t9Ys.png]



I added these changes to your script, only issue I found after the change was this:
[Image: G9Dj7Bs.png]

Adding the lower() method before the replacing fixed the issue and I just added
.replace('game of the year', "goty").replace('edition', "") to the replacing.

----------------------------------------------------

Another issue is that for some reason the numbers are not matching what has been hidden/showed

[Image: rwNmxLq.png]

[Image: TpJioeG.png]

[Image: jmdwZzO.png]


RE: DuplicateHider - Hide Duplicate Game Copies - felixkmh - 07-03-2020

Thanks for the input. That sound like a sensible addition. I will add something like that to get around the "goty" issue. For the other issue with the numbers not matching up, I don't know what could be causing that besides some games that are being hidden are inside your z_Hide category without being marked as "Hidden" before invoking the "Hide All Duplicates" function. Only games that are visible before are set to "hidden" and only those increase the count. If that's not the cause, there must be something else that I am entirely unaware of.

If you want to see which games are being hidden, add this to the end of the "hide_duplicates(args)" function (or "unhide_duplicates(args)").

    # Save list to file
    s = "\n".join([str((game.Name, ", ".join(
        [c.Name for c in game.Categories]) if game.Categories is not None else "None")) for game in updates])
    path = PlayniteApi.Dialogs.SaveFile("Text file|*.txt")
    if (path is not None and path != ""):
        with open(path, "w") as file:
            file.write(s)

This will prompt you to save a text file containing a list of all games that were hidden and their categories when "Hide All Duplicates" is executed.


RE: DuplicateHider - Hide Duplicate Game Copies - darklinkpower - 07-03-2020

Thanks, this helped me find the issue! One example:

[Image: H3N4vkW.png]

I had only PC games filtered so I didn't see this. It turns out it's hiding emulated games, which often have the same name for different platforms (and they could be the same game or not). Simply filtering the database for PC games will solve this, since there are not issues with game duplicates in emulated games.

I was also wondering if you could add some extra platforms by default to the priority list: default playnite/no plugin, itch.io and Rockstar library


RE: DuplicateHider - Hide Duplicate Game Copies - sunday_mf - 10-04-2020

This is one of the most useful extensions. Thank you for your product!


RE: DuplicateHider - Hide Duplicate Game Copies - Pretzel - 10-15-2020

Are you going to update for 8.0 anytime soon?


RE: DuplicateHider - Hide Duplicate Game Copies - felixkmh - 10-15-2020

(10-15-2020, 04:28 AM)Pretzel Wrote: Are you going to update for 8.0 anytime soon?

Just made the necessary changes and uploaded a version that should be compatible with Playnite 8.


RE: DuplicateHider - Hide Duplicate Game Copies - strider820 - 10-19-2020

(10-15-2020, 05:50 AM)felixkmh Wrote:
(10-15-2020, 04:28 AM)Pretzel Wrote: Are you going to update for 8.0 anytime soon?

Just made the necessary changes and uploaded a version that should be compatible with Playnite 8.

I'm having a problem with the setting menu not having anything in the priorities list. Am I missing something?


RE: DuplicateHider - Hide Duplicate Game Copies - felixkmh - 10-19-2020

(10-19-2020, 06:15 AM)strider820 Wrote: I'm having a problem with the setting menu not having anything in the priorities list. Am I missing something?

I'm not sure why that would happen, but I made some changes that sould definitely populate the priorities list with all available sources. Let me know if this version fixed that issue for you.


RE: DuplicateHider - Hide Duplicate Game Copies - hestoyjarto - 10-23-2020

Hi! Thanks for this extension.

Location file to change priority has changed with new version. You should notify that new json config file now is located under extenstion data folder link.
Most important! Extension doesn't work with playstation platform. I see all its duplicated games :-( I couldn't make it work with adding Playstation lines to json config file :S


RE: DuplicateHider - Hide Duplicate Game Copies - felixkmh - 10-23-2020

(10-23-2020, 09:40 AM)hestoyjarto Wrote: Hi! Thanks for this extension.

I can't find duplicateHider.py to change priority. Has it changed with new version?
Most important! Extension doesn't work with playstation platform. I see all its duplicated games :-(

Hi hestoyjarto,

yeah, since version 2.0 the settings have moved into the "Plugins" section of the playnite settings. I forgot to update the Plugin description, sorry about that.
Also, by default only PC games and games without a platform attached to them are considered when hiding duplicates. You can enable it in the plugin settings as well by checking the desired platform under "Included Platforms". You can use the text box to search for available platforms and then enable them by checking the checkbox. If you had a version below 2.0 installed previously, you should also remove or disable that if you want to use the newer version, because otherwise you get duplicate entries in the extension menu.
I will update the description as well to better reflect the current state of this plugin.

[Image: Settings.png]


RE: DuplicateHider - Hide Duplicate Game Copies - badleo - 10-25-2020

felixkmh, Thanks a lot! It is almost perfect to me!
But I got one problem, I don't know which copy of them, 
is it possible to have a options to show roms file name here?

Thank you!

[Image: Fx6pNcV.png]


RE: DuplicateHider - Hide Duplicate Game Copies - felixkmh - 10-25-2020

Hi badleo,

I just uploaded a new version which allows you to customize what the other copie's entries look like. You can edit the string at the bottom of the plugin settings. You can insert the available placeholders by right-clicking the text box at the position where you want to insert it. In your case you probably want to add either "{ImageNameNoExt}" or "{ImageName}", which gets replaced by the file name of the rom/image of a game, if it exists.


RE: DuplicateHider - Hide Duplicate Game Copies - badleo - 10-26-2020

(10-25-2020, 10:10 PM)felixkmh Wrote: Hi badleo,

I just uploaded a new version which allows you to customize what the other copie's entries look like. You can edit the string at the bottom of the plugin settings. You can insert the available placeholders by right-clicking the text box at the position where you want to insert it. In your case you probably want to add either "{ImageNameNoExt}" or "{ImageName}", which gets replaced by the file name of the rom/image of a game, if it exists.

It work like a charm! Thanks again!

[Image: G30wRDQ.png]


RE: DuplicateHider - Hide Duplicate Game Copies - masytan - 10-26-2020

This is excellent, thank you very much.