Use default image if not found

main
Bob Mottram 2021-08-21 13:33:49 +01:00
parent c8c85915c2
commit dcce90e8c0
1 changed files with 10 additions and 0 deletions

View File

@ -468,6 +468,16 @@ def _getImageFile(baseDir: str, name: str, directory: str,
bannerExtensions = getImageExtensions() bannerExtensions = getImageExtensions()
bannerFile = '' bannerFile = ''
bannerFilename = '' bannerFilename = ''
for ext in bannerExtensions:
bannerFileTest = name + '.' + ext
bannerFilenameTest = directory + '/' + bannerFileTest
if os.path.isfile(bannerFilenameTest):
bannerFile = name + '_' + theme + '.' + ext
bannerFilename = bannerFilenameTest
return bannerFile, bannerFilename
# if not found then use the default image
theme = 'default'
directory = baseDir + '/' + theme + '/default'
for ext in bannerExtensions: for ext in bannerExtensions:
bannerFileTest = name + '.' + ext bannerFileTest = name + '.' + ext
bannerFilenameTest = directory + '/' + bannerFileTest bannerFilenameTest = directory + '/' + bannerFileTest