massimilianodelliubaldini / galaxy-integration-rpcs3

GOG Galaxy 2.0 Integration with RPCS3
MIT License
22 stars 6 forks source link

code errors when reading certain files and times #25

Open jfmherokiller opened 4 years ago

jfmherokiller commented 4 years ago

it seems on my platform/setup this plugin has a few errors I patched them like so.

in backend.py I made it ignore unicode errors this was the first error i encountered wherein it seemed to be unable to read some unicode symbols

                            str(title, 'utf-8',errors='ignore')])

In plugin.py i added some exception handing because that seems to be where it was failing for the second time

            try:
                with open(game_times_path, 'w', encoding='utf-8') as game_times_file:
                    json.dump(game_times, game_times_file, indent=4)
            except:
                print("")
        try:
        # If (when) the file exists, read it and return the game times.  
            with open(game_times_path, 'r', encoding='utf-8') as game_times_file:
                game_times_json = json.load(game_times_file)

                for game_id in game_times_json:
                    if game_id in game_ids:
                        time_played = game_times_json.get(game_id).get('time_played')
                        last_time_played = game_times_json.get(game_id).get('last_time_played')

                        game_times[game_id] = GameTime(game_id, time_played, last_time_played)
        except:
            print("")
jfmherokiller commented 4 years ago

for the second error the info from the log was as follows TypeError: Object of type GameTime is not JSON serializable