video: use video title for filename
This commit is contained in:
parent
a4f22b95b7
commit
77b8c9e0af
@ -97,6 +97,11 @@ def update_post(post_directory, video_metadata, host):
|
||||
# compat for when there is no timestamp yet..
|
||||
create_post(post_directory, video_metadata, host)
|
||||
|
||||
def sanitize_name(name):
|
||||
sanitized = "".join([c if c.isalnum() or c == " " else "-" for c in name])
|
||||
if len(sanitized) > 40:
|
||||
return sanitized[:40]
|
||||
return sanitized
|
||||
|
||||
def main():
|
||||
v = peertube.VideoApi(client)
|
||||
@ -114,7 +119,7 @@ def main():
|
||||
existing_posts = os.listdir(output_dir)
|
||||
|
||||
for video_metadata in videos:
|
||||
post_dir = os.path.join(output_dir, video_metadata["uuid"])
|
||||
post_dir = os.path.join(output_dir, sanitize_name(video_metadata["name"]) + "-" + video_metadata["uuid"])
|
||||
|
||||
if (
|
||||
video_metadata["uuid"] not in existing_posts
|
||||
|
Loading…
Reference in New Issue
Block a user