Open gritstub opened 1 year ago
Here is a quick workaround that I made. It might be better to store an override image in a different folder, in case the user wants to clear their image cache at some time.
diff --git a/nut/Title.py b/nut/Title.py
index d4fbcaa..43c4c1f 100644
--- a/nut/Title.py
+++ b/nut/Title.py
@@ -619,7 +619,7 @@ class Title:
def download(self, base, fileName, url):
path = os.path.join(base, fileName)
- if os.path.isfile(path):
+ if os.path.isfile(path) or url is None:
return path
os.makedirs(base, exist_ok=True)
urllib.request.urlretrieve(url, path)
@@ -664,10 +664,13 @@ class Title:
if 'iconUrl' not in self.__dict__:
self.iconUrl = None
- if not self.iconUrl or self.iconUrl.startswith('cocoon:/'):
+ if not self.iconUrl:
+ baseName = self.id
+ ext = ".jpg"
+ elif self.iconUrl.startswith('cocoon:/'):
return None
-
- baseName, ext = os.path.splitext(self.iconUrl)
+ else:
+ baseName, ext = os.path.splitext(self.iconUrl)
return self.getResizedImage(self.download(Config.paths.titleImages + self.id, 'icon' + ext, self.iconUrl), width, height)
def screenshotFile(self, i, width=None, height=None):```
Is your feature request related to a problem? Please describe. If a file doesn't have an iconUrl property in titledb, it will show up as a blank square
Describe the solution you'd like Allow the user to override this with a local file. Possibly check for a cached local file first, otherwise download a new version of the image.