|
@ -70,9 +70,9 @@ def create_post(post_directory, video_metadata): |
|
|
|
|
|
|
|
|
#replace the truncated description with the full video description |
|
|
#replace the truncated description with the full video description |
|
|
#peertube api is some broken thing in between a py dict and a json file |
|
|
#peertube api is some broken thing in between a py dict and a json file |
|
|
api_response = peertube.VideoApi(client).videos_id_description_get(v['uuid']) |
|
|
api_response = peertube.VideoApi(client).videos_id_description_get(video_metadata['uuid']) |
|
|
long_description = ast.literal_eval(api_response) |
|
|
long_description = ast.literal_eval(api_response) |
|
|
v['description'] = long_description['description'] |
|
|
video_metadata['description'] = long_description['description'] |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
with open(os.path.join(post_directory,'index.md'),'w') as f: |
|
|
with open(os.path.join(post_directory,'index.md'),'w') as f: |
|
@ -112,16 +112,16 @@ template = env.get_template('index_template.md') |
|
|
|
|
|
|
|
|
existing_posts = os.listdir(output_dir) |
|
|
existing_posts = os.listdir(output_dir) |
|
|
|
|
|
|
|
|
for v in videos: |
|
|
for video_metadata in videos: |
|
|
post_dir = os.path.join(output_dir,v['uuid']) |
|
|
post_dir = os.path.join(output_dir, video_metadata['uuid']) |
|
|
|
|
|
|
|
|
if v['uuid'] not in existing_posts: #if there is a video we dont already have, make it |
|
|
if video_metadata['uuid'] not in existing_posts: #if there is a video we dont already have, make it |
|
|
print('New: ', v['name'], '({})'.format(v['uuid'])) |
|
|
print('New: ', video_metadata['name'], '({})'.format(video_metadata['uuid'])) |
|
|
create_post(post_dir, v) |
|
|
create_post(post_dir, video_metadata) |
|
|
|
|
|
|
|
|
elif v['uuid'] in existing_posts: # if we already have the video do nothing, possibly update |
|
|
elif video_metadata['uuid'] in existing_posts: # if we already have the video do nothing, possibly update |
|
|
update_post(post_dir, v) |
|
|
update_post(post_dir, video_metadata) |
|
|
existing_posts.remove(v['uuid']) # create list of posts which have not been returned by peertube |
|
|
existing_posts.remove(video_metadata['uuid']) # create list of posts which have not been returned by peertube |
|
|
|
|
|
|
|
|
for post in existing_posts: |
|
|
for post in existing_posts: |
|
|
print('deleted', post) #rm posts not returned |
|
|
print('deleted', post) #rm posts not returned |
|
|