use descriptoin more often

This commit is contained in:
j 2021-11-12 13:02:02 +00:00
parent 333828e864
commit a79b913f2d
2 changed files with 4 additions and 8 deletions

View file

@ -35,11 +35,9 @@ if (locationHash !== '') {
document.querySelectorAll('.films .film figure').forEach(figure => { document.querySelectorAll('.films .film figure').forEach(figure => {
var imgs = figure.querySelectorAll('img') var imgs = figure.querySelectorAll('img')
if (imgs.length > 1) { if (imgs.length > 1) {
console.log('needs updates', figure)
setInterval(() => { setInterval(() => {
var img = figure.querySelector('img') var img = figure.querySelector('img')
img.parentElement.appendChild(img) img.parentElement.appendChild(img)
console.log('change img', img, figure.querySelector('img')) }, 5000 + Math.random() * 1000)
}, 5000)
} }
}) })

View file

@ -34,9 +34,10 @@ class Command(BaseCommand):
folders = {} folders = {}
for item in api.find(**query)['data']['items']: for item in api.find(**query)['data']['items']:
if item['folder'] not in folders: if item['folder'] not in folders:
description = item['folderdescription'] or item['summary']
folders[item['folder']] = { folders[item['folder']] = {
'title': item['folder'], 'title': item['folder'],
'description': item['folderdescription'], 'description': description,
'url': api.url.replace('/api/', '/grid/folder==' + escape(item['folder'])), 'url': api.url.replace('/api/', '/grid/folder==' + escape(item['folder'])),
'items': [], 'items': [],
} }
@ -46,9 +47,6 @@ class Command(BaseCommand):
folders[item['folder']]['items'].append(item) folders[item['folder']]['items'].append(item)
for item in folders.values(): for item in folders.values():
if not item['description'] and len(item['items']) == 1:
item['description'] = item['items'][0]['summary']
item['items'][0]['summary'] = ''
f, c = models.Film.objects.get_or_create(pandora_url=item['url']) f, c = models.Film.objects.get_or_create(pandora_url=item['url'])
for key, value in item.items(): for key, value in item.items():
if key != 'url': if key != 'url':
@ -56,5 +54,5 @@ class Command(BaseCommand):
}.get(key, key)] = value }.get(key, key)] = value
if c: if c:
f.public = True f.public = True
f.slug = escape_slug(item['title']) f.slug = escape_slug(item['title'])
f.save() f.save()