Skip to content

Commit dd44c85

Browse files
committed
Changed expiration time settings from minutes to months
1 parent d8e3410 commit dd44c85

2 files changed

Lines changed: 4 additions & 3 deletions

File tree

resources/arts.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,21 +2,22 @@
22
import xbmcaddon
33

44
import os
5+
from datetime import timedelta
56
import requests
67
import requests_cache
78

89
from util import log
910

1011
__addon__ = xbmcaddon.Addon()
1112
artFallbackEnabled = __addon__.getSetting("enable-art-fallback") == 'true' # Kodi stores boolean settings as strings
12-
minutesBeforeArtsExpiration = int(__addon__.getSetting("arts-expire-after-minutes")) # Default is 2 months
13+
monthsBeforeArtsExpiration = int(__addon__.getSetting("arts-expire-after-months")) # Default is 2 months
1314

1415
# define the cache file to reside in the ..\Kodi\userdata\addon_data\(your addon)
1516
addonUserDataFolder = xbmc.translatePath(__addon__.getAddonInfo('profile'))
1617
ART_AVAILABILITY_CACHE_FILE = xbmc.translatePath(os.path.join(addonUserDataFolder, 'requests_cache_arts'))
1718

1819
cached_requests = requests_cache.core.CachedSession(ART_AVAILABILITY_CACHE_FILE, backend='sqlite',
19-
expire_after=60 * minutesBeforeArtsExpiration,
20+
expire_after= timedelta(weeks=4*monthsBeforeArtsExpiration),
2021
allowable_methods=('HEAD',), allowable_codes=(200, 404),
2122
old_data_on_error=True,
2223
fast_save=True)

resources/settings.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,6 @@
88
<setting id="steam-args" type="text" label="Arguments to pass to your Steam executable"/>
99
<setting id="version" type="text" label="Internal version number, do not modify" visible="false"/>
1010
<setting id="enable-art-fallback" type="bool" default="true" label="Fallback to another art type if a game has missing art. First launch may be longer for large libraries."/>
11-
<setting id="arts-expire-after-minutes" type="number" default="87600" label="Number of minutes before expiration of the arts availability cache"/>
11+
<setting id="arts-expire-after-months" type="number" default="2" label="Number of months before expiration of the arts availability cache"/>
1212
<setting id="delete-cache" type="action" label="Clean available games and arts cache" action="RunPlugin(plugin://plugin.program.steam.library/delete_cache)"/>
1313
</settings>

0 commit comments

Comments
 (0)