jaydenmilne / steamsync

Tool to automatically add games from the Epic Games Launcher to Steam
GNU Affero General Public License v3.0
157 stars 17 forks source link

UWPHook and SteamSync conflict #41

Open anaisbetts opened 5 months ago

anaisbetts commented 5 months ago

If a user has used UWPHook in the past, running SteamSync with --download-art will fail:

  File "C:\Users\ani\AppData\Local\Programs\Python\Python312\Lib\site-packages\steamsync\steamsync.py", line 652, in main
    result, msg = add_games_to_shortcut_file(
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\ani\AppData\Local\Programs\Python\Python312\Lib\site-packages\steamsync\steamsync.py", line 355, in add_games_to_shortcut_file
    success = steamdb.download_art(user, game, should_replace_existing=False)
              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\ani\AppData\Local\Programs\Python\Python312\Lib\site-packages\steamsync\steameditor.py", line 292, in download_art
    appid = self.guess_appid(game.display_name)
            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\ani\AppData\Local\Programs\Python\Python312\Lib\site-packages\steamsync\steameditor.py", line 203, in guess_appid
    name = self._make_gamename_comparable(name)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\ani\AppData\Local\Programs\Python\Python312\Lib\site-packages\steamsync\steameditor.py", line 128, in _make_gamename_comparable
    name = re_remove_hyphen.sub("", name)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
TypeError: expected string or bytes-like object, got 'NoneType'

This is because UWPHook ends up creating shortcuts that SteamSync finds that are bogus:

{'app_name': None,
 'art_url': None,
 'display_name': None,     ## No Display Name so we blow up
 'executable_path': '"C:\\Users\\ani\\AppData\\Roaming\\Briano\\UWPHook\\UWPHook.exe"',
 'icon': '"C:\\Users\\ani\\AppData\\Roaming\\Briano\\UWPHook\\UWPHook.exe"',
 'install_folder': '"C:\\Users\\ani\\AppData\\Roaming\\Briano\\UWPHook',
 'launch_arguments': '',
 'shortcut_id': -1915271522,
 'storetag': 'ignore tag',
 'uri': None}

The solution is probably to either recognize these bogus entries and ignore them or to tell the user about it