Rename variables in main function
This commit is contained in:
parent
0be2379675
commit
080842758d
12
main.py
12
main.py
@ -291,10 +291,10 @@ def main():
|
|||||||
limit=args.limit, dry_run=args.dry_run)
|
limit=args.limit, dry_run=args.dry_run)
|
||||||
|
|
||||||
elif args.command == 'add':
|
elif args.command == 'add':
|
||||||
playlist = get_playlist_id(args.playlist)
|
playlist_id = get_playlist_id(args.playlist)
|
||||||
# {video_id: video_title} for videos already in the playlist
|
# {video_id: video_title} for videos already in the playlist
|
||||||
pl_videos = {pl_item['snippet']['resourceId']['videoId']: pl_item['snippet']['title']
|
pl_videos = {pl_item['snippet']['resourceId']['videoId']: pl_item['snippet']['title']
|
||||||
for pl_item in list_playlist(youtube, playlist)}
|
for pl_item in list_playlist(youtube, playlist_id)}
|
||||||
|
|
||||||
for video_id in args.video_ids:
|
for video_id in args.video_ids:
|
||||||
if video_id in pl_videos:
|
if video_id in pl_videos:
|
||||||
@ -302,7 +302,7 @@ def main():
|
|||||||
print(f"Video '{short_title}' [{video_id}]"
|
print(f"Video '{short_title}' [{video_id}]"
|
||||||
f" is already in playlist {args.playlist}")
|
f" is already in playlist {args.playlist}")
|
||||||
continue
|
continue
|
||||||
add_video_to_playlist(youtube, video_id, playlist, args.dry_run)
|
add_video_to_playlist(youtube, video_id, playlist_id, args.dry_run)
|
||||||
|
|
||||||
elif args.command == 'add-csv':
|
elif args.command == 'add-csv':
|
||||||
video_ids = []
|
video_ids = []
|
||||||
@ -310,10 +310,10 @@ def main():
|
|||||||
reader = csv.reader(csvfile)
|
reader = csv.reader(csvfile)
|
||||||
next(reader, None) # skip the headers
|
next(reader, None) # skip the headers
|
||||||
video_ids.extend(row[0] for row in reader if row)
|
video_ids.extend(row[0] for row in reader if row)
|
||||||
playlist = get_playlist_id(args.playlist)
|
playlist_id = get_playlist_id(args.playlist)
|
||||||
# {video_id: video_title} for videos already in the playlist
|
# {video_id: video_title} for videos already in the playlist
|
||||||
pl_videos = {pl_item['snippet']['resourceId']['videoId']: pl_item['snippet']['title']
|
pl_videos = {pl_item['snippet']['resourceId']['videoId']: pl_item['snippet']['title']
|
||||||
for pl_item in list_playlist(youtube, playlist)}
|
for pl_item in list_playlist(youtube, playlist_id)}
|
||||||
if args.limit > 0:
|
if args.limit > 0:
|
||||||
video_ids = video_ids[:args.limit]
|
video_ids = video_ids[:args.limit]
|
||||||
for video_id in video_ids:
|
for video_id in video_ids:
|
||||||
@ -322,7 +322,7 @@ def main():
|
|||||||
print(f"Video '{short_title}' [{video_id}]"
|
print(f"Video '{short_title}' [{video_id}]"
|
||||||
f" is already in playlist {args.playlist}")
|
f" is already in playlist {args.playlist}")
|
||||||
continue
|
continue
|
||||||
add_video_to_playlist(youtube, video_id, playlist, args.dry_run)
|
add_video_to_playlist(youtube, video_id, playlist_id, args.dry_run)
|
||||||
|
|
||||||
elif args.command == "dups":
|
elif args.command == "dups":
|
||||||
processed = 0
|
processed = 0
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user