From f0eb84511151eaa3b544e9c8af0ca946bb22fd0e Mon Sep 17 00:00:00 2001 From: Mike Lang Date: Mon, 10 Oct 2022 10:00:26 +1100 Subject: [PATCH 1/2] Fix a bug where modified videos are missing static tags --- cutter/cutter/main.py | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/cutter/cutter/main.py b/cutter/cutter/main.py index 56ae5dc..a94d1ca 100644 --- a/cutter/cutter/main.py +++ b/cutter/cutter/main.py @@ -697,7 +697,7 @@ class VideoUpdater(object): CHECK_INTERVAL = 10 # this is slow to reduce the chance of multiple cutters updating the same row ERROR_RETRY_INTERVAL = 20 - def __init__(self, location, segments_path, backend, dbmanager, stop): + def __init__(self, location, segments_path, backend, dbmanager, tags, stop): """ backend is an upload backend that supports video updates. Stop is an Event triggering graceful shutdown when set. @@ -706,6 +706,7 @@ class VideoUpdater(object): self.segments_path = segments_path self.backend = backend self.dbmanager = dbmanager + self.tags = tags self.stop = stop self.logger = logging.getLogger(type(self).__name__) @@ -732,7 +733,8 @@ class VideoUpdater(object): updates = {} try: # Update video metadata - self.backend.update_video(job.video_id, job.video_title, job.video_description, job.video_tags, job.public) + tags = list(set(self.tags + job.video_tags) + self.backend.update_video(job.video_id, job.video_title, job.video_description, tags, job.public) # Update thumbnail if needed. This might fail if we don't have the right segments, # but that should be very rare and can be dealt with out of band. @@ -935,7 +937,7 @@ def main( for location, backend in needs_transcode_check.items() ] updaters = [ - VideoUpdater(location, base_dir, backend, dbmanager, stop) + VideoUpdater(location, base_dir, backend, dbmanager, tags, stop) for location, backend in needs_updater.items() ] jobs = [gevent.spawn(cutter.run)] + [ From 1f8a1605027fe59b256d0f23b68108493f3b00d0 Mon Sep 17 00:00:00 2001 From: Mike Lang Date: Mon, 10 Oct 2022 10:08:13 +1100 Subject: [PATCH 2/2] fix a bug where shift is calculated wrong we need to use the hour in PST, which we just hard-code as 8 hours. If we ever hit DST before the run, we'll go back and do it properly. --- thrimshim/thrimshim/main.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/thrimshim/thrimshim/main.py b/thrimshim/thrimshim/main.py index ccdc2f8..01efba1 100644 --- a/thrimshim/thrimshim/main.py +++ b/thrimshim/thrimshim/main.py @@ -179,7 +179,9 @@ def get_row(ident): if response['event_start'] is not None: start = response['event_start'] if response['thumbnail_template'] is None: - response['thumbnail_template'] = DEFAULT_TEMPLATES[int(start.hour / 6)] + pst_hour = (start.hour - 8) % 24 + shift = int(pst_hour / 6) + response['thumbnail_template'] = DEFAULT_TEMPLATES[shift] if response['thumbnail_time'] is None: if response['event_end'] is not None: # take full duration, and add half to start to get halfway