add update logic

This commit is contained in:
rra 2021-07-15 17:12:09 +02:00
parent 7a73acfbd6
commit 0658a87841

View File

@ -88,9 +88,10 @@ def update_post(post_directory, video_metadata):
if os.path.exists(post_directory):
if os.path.exists(os.path.join(post_directory,'.timestamp')):
old_timestamp = open(os.path.join(post_directory,'.timestamp')).read()
current_timestamp = arrow.get(video_metadata['updated_at'])
current_timestamp = arrow.get(current_timestamp.format('X'))
#FIXME: this is ugly but I need to do this because arrow removes miliseconds
current_timestamp = arrow.get(video_metadata['updated_at'])
current_timestamp = arrow.get(current_timestamp.format('X'))
if current_timestamp > arrow.get(old_timestamp):
print('Updating', video_metadata['name'], '({})'.format(video_metadata['uuid']))
@ -98,6 +99,7 @@ def update_post(post_directory, video_metadata):
else:
print('Video current: ', video_metadata['name'], '({})'.format(video_metadata['uuid']))
else:
#compat for when there is no timestamp yet..
create_post(post_dir, video_metadata)