Browse Source

add update logic

master
rra 3 years ago
parent
commit
0658a87841
  1. 6
      video-feed.py

6
video-feed.py

@ -88,9 +88,10 @@ def update_post(post_directory, video_metadata):
if os.path.exists(post_directory): if os.path.exists(post_directory):
if os.path.exists(os.path.join(post_directory,'.timestamp')): if os.path.exists(os.path.join(post_directory,'.timestamp')):
old_timestamp = open(os.path.join(post_directory,'.timestamp')).read() 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): if current_timestamp > arrow.get(old_timestamp):
print('Updating', video_metadata['name'], '({})'.format(video_metadata['uuid'])) print('Updating', video_metadata['name'], '({})'.format(video_metadata['uuid']))
@ -98,6 +99,7 @@ def update_post(post_directory, video_metadata):
else: else:
print('Video current: ', video_metadata['name'], '({})'.format(video_metadata['uuid'])) print('Video current: ', video_metadata['name'], '({})'.format(video_metadata['uuid']))
else: else:
#compat for when there is no timestamp yet..
create_post(post_dir, video_metadata) create_post(post_dir, video_metadata)

Loading…
Cancel
Save