Skip to content

Commit 299c53c

Browse files
authored
Merge pull request #30 from aanderse/kodi-19
port to kodi 19.x
2 parents 82b7e98 + 176219c commit 299c53c

File tree

5 files changed

+22
-20
lines changed

5 files changed

+22
-20
lines changed

addon.xml

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
2-
<addon id="plugin.program.steam.library" name="Steam Library" version="0.7.0" provider-name="aanderse">
2+
<addon id="plugin.program.steam.library" name="Steam Library" version="0.8.0" provider-name="aanderse">
33
<requires>
4-
<import addon="xbmc.python" version="2.19.0" />
4+
<import addon="xbmc.python" version="3.0.0" />
55
<import addon="script.module.requests" version="2.18.4" />
66
<import addon="script.module.requests-cache" version="0.4.13" />
77
<import addon="script.module.routing" version="0.2.0"/>
@@ -43,6 +43,8 @@
4343
- added support for more arts types and views for games, such as posters
4444
- added play time information and sorting games by play time
4545
- Offline support of the game lists, with a caching mechanism of the Steam API responses
46+
v0.8.0 (2021-03-12)
47+
- ported to kodi 19.x
4648
</news>
4749
<assets>
4850
<icon>icon.png</icon>

resources/arts.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,14 +6,14 @@
66
import requests
77
import requests_cache
88

9-
from util import log
9+
from .util import log
1010

1111
__addon__ = xbmcaddon.Addon()
1212
artFallbackEnabled = __addon__.getSetting("enable-art-fallback") == 'true' # Kodi stores boolean settings as strings
1313
monthsBeforeArtsExpiration = int(__addon__.getSetting("arts-expire-after-months")) # Default is 2 months
1414

1515
# define the cache file to reside in the ..\Kodi\userdata\addon_data\(your addon)
16-
addonUserDataFolder = xbmc.translatePath(__addon__.getAddonInfo('profile')).decode('utf-8')
16+
addonUserDataFolder = xbmc.translatePath(__addon__.getAddonInfo('profile'))
1717
ART_AVAILABILITY_CACHE_FILE = xbmc.translatePath(os.path.join(addonUserDataFolder, 'requests_cache_arts'))
1818

1919
cached_requests = requests_cache.core.CachedSession(ART_AVAILABILITY_CACHE_FILE, backend='sqlite',

resources/main.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,10 @@
33
import sys
44
import xbmcplugin
55

6-
import arts
7-
import registry
8-
import steam
9-
from util import *
6+
from . import arts
7+
from . import registry
8+
from . import steam
9+
from .util import *
1010

1111
__addon__ = xbmcaddon.Addon()
1212

resources/registry.py

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,10 @@
44

55
import os
66
import xbmc
7-
from util import *
7+
from .util import *
88

99
if os.name == 'nt':
10-
import _winreg
10+
import winreg
1111

1212

1313
# https://github.com/lutris/lutris/blob/master/lutris/util/steam.py
@@ -50,10 +50,10 @@ def is_installed_win(app_id):
5050
:return: True if the app is installed, false otherwise
5151
"""
5252
try:
53-
app = _winreg.OpenKey(_winreg.HKEY_CURRENT_USER, "Software\\Valve\\Steam\\Apps\\" + app_id)
54-
print(_winreg.QueryInfoKey(app)[1])
55-
for i in range(_winreg.QueryInfoKey(app)[1]):
56-
name, value, type = _winreg.EnumValue(app, i)
53+
app = winreg.OpenKey(winreg.HKEY_CURRENT_USER, "Software\\Valve\\Steam\\Apps\\" + app_id)
54+
print(winreg.QueryInfoKey(app)[1])
55+
for i in range(winreg.QueryInfoKey(app)[1]):
56+
name, value, type = winreg.EnumValue(app, i)
5757
if name == "Installed":
5858
return value == 1
5959

@@ -73,10 +73,10 @@ def get_installed_steam_apps(registry_path):
7373

7474
if os.name == 'nt':
7575
try:
76-
apps = _winreg.OpenKey(_winreg.HKEY_CURRENT_USER, "Software\\Valve\\Steam\\Apps")
77-
print(_winreg.QueryInfoKey(apps)[0])
78-
for i in range(_winreg.QueryInfoKey(apps)[0]):
79-
app_id = _winreg.EnumKey(apps, i)
76+
apps = winreg.OpenKey(winreg.HKEY_CURRENT_USER, "Software\\Valve\\Steam\\Apps")
77+
print(winreg.QueryInfoKey(apps)[0])
78+
for i in range(winreg.QueryInfoKey(apps)[0]):
79+
app_id = winreg.EnumKey(apps, i)
8080
if is_installed_win(app_id):
8181
installed_apps.append(app_id)
8282

resources/steam.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,13 +10,13 @@
1010
import requests
1111
import requests_cache
1212

13-
from util import log
13+
from .util import log
1414

1515
__addon__ = xbmcaddon.Addon()
1616
minutesBeforeGamesListsExpiration = int(__addon__.getSetting("games-expire-after-minutes")) # Default is 3 days
1717

1818
# define the cache file to reside in the ..\Kodi\userdata\addon_data\(your addon)
19-
addonUserDataFolder = xbmc.translatePath(__addon__.getAddonInfo('profile')).decode('utf-8')
19+
addonUserDataFolder = xbmc.translatePath(__addon__.getAddonInfo('profile'))
2020
STEAM_GAMES_CACHE_FILE = xbmc.translatePath(os.path.join(addonUserDataFolder, 'requests_cache_games'))
2121

2222
# cache expires after: 86400=1 day 604800=7 days

0 commit comments

Comments
 (0)