From a79b913f2db7d6dc3903feb2c123de6b01f05f61 Mon Sep 17 00:00:00 2001 From: j Date: Fri, 12 Nov 2021 13:02:02 +0000 Subject: [PATCH] use descriptoin more often --- app/static/js/films.js | 4 +--- app/video/management/commands/load_titles.py | 8 +++----- 2 files changed, 4 insertions(+), 8 deletions(-) diff --git a/app/static/js/films.js b/app/static/js/films.js index 62e6be7..54a18a7 100644 --- a/app/static/js/films.js +++ b/app/static/js/films.js @@ -35,11 +35,9 @@ if (locationHash !== '') { document.querySelectorAll('.films .film figure').forEach(figure => { var imgs = figure.querySelectorAll('img') if (imgs.length > 1) { - console.log('needs updates', figure) setInterval(() => { var img = figure.querySelector('img') img.parentElement.appendChild(img) - console.log('change img', img, figure.querySelector('img')) - }, 5000) + }, 5000 + Math.random() * 1000) } }) diff --git a/app/video/management/commands/load_titles.py b/app/video/management/commands/load_titles.py index 90b586b..50230bd 100644 --- a/app/video/management/commands/load_titles.py +++ b/app/video/management/commands/load_titles.py @@ -34,9 +34,10 @@ class Command(BaseCommand): folders = {} for item in api.find(**query)['data']['items']: if item['folder'] not in folders: + description = item['folderdescription'] or item['summary'] folders[item['folder']] = { 'title': item['folder'], - 'description': item['folderdescription'], + 'description': description, 'url': api.url.replace('/api/', '/grid/folder==' + escape(item['folder'])), 'items': [], } @@ -46,9 +47,6 @@ class Command(BaseCommand): folders[item['folder']]['items'].append(item) 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']) for key, value in item.items(): if key != 'url': @@ -56,5 +54,5 @@ class Command(BaseCommand): }.get(key, key)] = value if c: f.public = True - f.slug = escape_slug(item['title']) + f.slug = escape_slug(item['title']) f.save()