Closed XenorPLxx closed 2 years ago
Can you try with this version? playnite-successstory-plugin_2_2_1.zip
I don't have any PS4 / PS5 games to check. So I made some assumptions about query results.
I've tried refreshing data on all my PSN games after updating the plugin, but no trophies showed up - I have over 200 PS4 & PS5 games.
You could try adding some free games to your library, like:
14-10 16:41:03.484|ERROR|SuccessStory#Common:Error on GetAchievements()|D:\GitHub\Lacro59\playnite-successstory-plugin\source\Clients\PSNAchievements.cs|84
System.Net.Http.HttpRequestException: Response status code does not indicate success: 404 (Not Found).
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at CommonPluginsShared.Web.<DownloadStringData>d__12.MoveNext() in D:\GitHub\Lacro59\playnite-successstory-plugin\source\playnite-plugincommon\CommonPluginsShared\Web.cs:line 528
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at System.Runtime.CompilerServices.TaskAwaiter.ValidateEnd(Task task)
at SuccessStory.Clients.PSNAchievements.GetAchievements(Game game) in D:\GitHub\Lacro59\playnite-successstory-plugin\source\Clients\PSNAchievements.cs:line 84
Per https://andshrew.github.io/PlayStation-Trophies/#/APIv2?id=obtaining-an-authentication-token
Invoke-RestMethod -Uri "https://m.np.playstation.net/api/trophy/v1/users/me/titles/trophyTitles?npTitleIds=PPSA01802_00" -Authentication Bearer -Token $token | ConvertTo-Json -Depth 6 | Out-File id-conversion.json
Invoke-RestMethod -Uri "https://m.np.playstation.net/api/trophy/v1/npCommunicationIds/NPWR21924_00/trophyGroups/all/trophies" -Authentication Bearer -Token $token | ConvertTo-Json -Depth 3 | Out-File trophy.json
Invoke-RestMethod -Uri "https://m.np.playstation.net/api/trophy/v1/users/me/trophyTitles" -Authentication Bearer -Token $token | ConvertTo-Json -Depth 3 | Out-File trophies.json
Results: apis.zip
Hope that helps :)
Thanks for your help.
This version must be good: playnite-successstory-plugin_2_2_1.zip
Yes, it seems to be working fine now :). I'm seeing trophies for PS4 and PS5 games. Thanks for fixing this :).
I've just seen the update for the SuccesStory, but it doesn't solve the problem for me - there's still no trophies.
There are two kinds of IDs in the PSN APIs -
titleId
(usually CUSAxxxxx_xx) andcommunicationId
(usually NPWRxxxxxx_xx). All PS4 and PS5 games usetitleId
as Playnite's GameId, as it's the most universal one. Only PS3/PSP/PSVITA games usecommunicationId
as GameId directly, as those don't have theirtitleId
exposed.From your code, it seems that you are using the GameId directly for all games, which won't work for PS4 and PS5 games in the db. To get
communicationId
needed to retrieve trophies, you first need to retrieve it by translatingtitleId
intocommunicationId
by callingPsnAPI.GetTrohpiesWithIdsMobile
, example use here: https://github.com/XenorPLxx/playnite-library-psn/blob/f430cb288444e36d3da8ff48d5564efbd9eda257/source/Libraries/PSNLibrary/PSNLibrary.cs#L267Also, as the API takes 5
titleIds
at a time, I'd suggest dumping it into a file instead of resolving it each time. PSN plugin does this only once to import 1.0 plugin games, so I didn't need to save it. There'll be some custom metadata fields in P10 that could be used to storecommunicationId
.