FIX: Fix for Story Arc detail not being accessible if story arc was not refreshed prior to attempting to load the detail page

This commit is contained in:
evilhero 2018-07-12 19:50:55 -04:00
parent 2aab239cf6
commit 33dc2ef822
1 changed files with 26 additions and 18 deletions

View File

@ -2727,25 +2727,33 @@ class WebInterface(object):
#bannerwidth = 263 #bannerwidth = 263
filepath = None filepath = None
sb = 'cache/storyarcs/' + str(arcinfo[0]['CV_ArcID']) + '-banner' sb = 'cache/storyarcs/' + str(arcinfo[0]['CV_ArcID']) + '-banner'
dir = os.listdir(os.path.join(mylar.CONFIG.CACHE_DIR, 'storyarcs')) storyarc_imagepath = os.path.join(mylar.CONFIG.CACHE_DIR, 'storyarcs')
for fname in dir: if not os.path.exists(storyarc_imagepath):
if str(arcinfo[0]['CV_ArcID']) in fname: try:
storyarcbanner = sb os.mkdir(storyarc_imagepath)
filepath = os.path.join(mylar.CONFIG.CACHE_DIR, 'storyarcs', fname) except:
# if any(['H' in fname, 'W' in fname]): logger.warn('Unable to create storyarc image directory @ %s' % storyarc_imagepath)
# if 'H' in fname:
# bannerheight = int(fname[fname.find('H')+1:fname.find('.')])
# elif 'W' in fname:
# bannerwidth = int(fname[fname.find('W')+1:fname.find('.')])
# if any([bannerwidth != 263, 'W' in fname]): if os.path.exists(storyarc_imagepath):
# #accomodate poster size dir = os.listdir(storyarc_imagepath)
# storyarcbanner += 'W' + str(bannerheight) for fname in dir:
# else: if str(arcinfo[0]['CV_ArcID']) in fname:
# #for actual banner width (ie. 960x280) storyarcbanner = sb
# storyarcbanner += 'H' + str(bannerheight) filepath = os.path.join(storyarc_imagepath, fname)
storyarcbanner += os.path.splitext(fname)[1] + '?' + datetime.datetime.now().strftime('%y-%m-%d %H:%M:%S') # if any(['H' in fname, 'W' in fname]):
break # if 'H' in fname:
# bannerheight = int(fname[fname.find('H')+1:fname.find('.')])
# elif 'W' in fname:
# bannerwidth = int(fname[fname.find('W')+1:fname.find('.')])
# if any([bannerwidth != 263, 'W' in fname]):
# #accomodate poster size
# storyarcbanner += 'W' + str(bannerheight)
# else:
# #for actual banner width (ie. 960x280)
# storyarcbanner += 'H' + str(bannerheight)
storyarcbanner += os.path.splitext(fname)[1] + '?' + datetime.datetime.now().strftime('%y-%m-%d %H:%M:%S')
break
template = 'storyarc_detail.html' template = 'storyarc_detail.html'
if filepath is not None: if filepath is not None: