mirror of
https://git.lecygnenoir.info/LecygneNoir/prismedia.git
synced 2025-10-05 10:19:23 +02:00
peertube: fix default playlist
This commit is contained in:
parent
9118f7b082
commit
461beaa5cb
1 changed files with 8 additions and 4 deletions
|
@ -48,8 +48,11 @@ def get_authenticated_service(secret):
|
||||||
return oauth
|
return oauth
|
||||||
|
|
||||||
|
|
||||||
def get_playlist_by_name(user_info, options):
|
def get_default_playlist(user_info):
|
||||||
|
return user_info['videoChannels'][0]['id']
|
||||||
|
|
||||||
|
|
||||||
|
def get_playlist_by_name(user_info, options):
|
||||||
for playlist in user_info["videoChannels"]:
|
for playlist in user_info["videoChannels"]:
|
||||||
if playlist['displayName'] == options.get('--playlist'):
|
if playlist['displayName'] == options.get('--playlist'):
|
||||||
return playlist['id']
|
return playlist['id']
|
||||||
|
@ -155,10 +158,11 @@ def upload_video(oauth, secret, options):
|
||||||
playlist_id = get_playlist_by_name(user_info, options)
|
playlist_id = get_playlist_by_name(user_info, options)
|
||||||
if not playlist_id and options.get('--playlistCreate'):
|
if not playlist_id and options.get('--playlistCreate'):
|
||||||
playlist_id = create_playlist(oauth, url, options)
|
playlist_id = create_playlist(oauth, url, options)
|
||||||
|
elif not playlist_id:
|
||||||
|
logging.warning("Playlist `" + options.get('--playlist') + "` is unknown, using default playlist.")
|
||||||
|
playlist_id = get_default_playlist(user_info)
|
||||||
else:
|
else:
|
||||||
playlist_id = user_info['id']
|
playlist_id = get_default_playlist(user_info)
|
||||||
else:
|
|
||||||
playlist_id = user_info['id']
|
|
||||||
fields.append(("channelId", str(playlist_id)))
|
fields.append(("channelId", str(playlist_id)))
|
||||||
|
|
||||||
multipart_data = MultipartEncoder(fields)
|
multipart_data = MultipartEncoder(fields)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue