@@ -418,7 +418,7 @@ def get_talks(file):
418
418
with open (file , encoding = "utf8" ) as f :
419
419
data = ruamel .yaml .load (f , ruamel .yaml .RoundTripLoader )
420
420
for t in data ['talks' ]:
421
- if t .get ('speaker' ):
421
+ if t .get ('speaker' ) and t . get ( 'track' ) :
422
422
yield t
423
423
424
424
def update_talks (file , videos ):
@@ -558,20 +558,15 @@ def do_upload(youtube, videos):
558
558
559
559
560
560
if __name__ == '__main__' :
561
- argparser .add_argument ("--driveurl" , required = True , help = "share url for the videos" )
561
+ argparser .add_argument ("--driveurl" , required = False , help = "share url for the videos" )
562
562
argparser .add_argument ("--talks" , required = True , help = "Talks.yaml file" )
563
563
argparser .add_argument ("--channelid" , default = "UCtHekbmBXtp5AYSVARFQQiw" )
564
564
argparser .add_argument ("--no_upload" , default = False , action = 'store_true' )
565
- #argparser.add_argument("--title", help="Video title", default="Test Title")
566
- # argparser.add_argument("--description", help="Video description",
567
- # default="Test Description")
568
565
# argparser.add_argument("--category", default="22",
569
566
# help="Numeric video category. " +
570
567
# "See https://developers.google.com/youtube/v3/docs/videoCategories/list")
571
568
# argparser.add_argument("--keywords", help="Video keywords, comma separated",
572
569
# default="")
573
- # argparser.add_argument("--privacyStatus", choices=VALID_PRIVACY_STATUSES,
574
- # default=VALID_PRIVACY_STATUSES[0], help="Video privacy status.")
575
570
args = argparser .parse_args ()
576
571
#
577
572
# if not os.path.exists(args.file):
@@ -588,25 +583,29 @@ def do_upload(youtube, videos):
588
583
channel = get_channel (youtube , args .channelid )
589
584
#channel = dict([('Do you know what Pycon Thailand is all about?', {'id': 'UExY3mb-CkA', 'filename': 'pycon2018.mp4', 'title': 'Do you know what Pycon Thailand is all about?', 'publishedAt': '2019-05-15T07:46:52.000Z', 'channelId': 'UCtHekbmBXtp5AYSVARFQQiw', 'description': "Wonder what Pycon is all about? Here's a video on what happened last year. With more attendees, more booths, and more keynote speakers this year, we're ...", 'thumbnails': {'default': {'url': 'https://i.ytimg.com/vi/UExY3mb-CkA/default.jpg', 'width': 120, 'height': 90}, 'medium': {'url': 'https://i.ytimg.com/vi/UExY3mb-CkA/mqdefault.jpg', 'width': 320, 'height': 180}, 'high': {'url': 'https://i.ytimg.com/vi/UExY3mb-CkA/hqdefault.jpg', 'width': 480, 'height': 360}}, 'channelTitle': 'PyCon Thailand', 'liveBroadcastContent': 'none'}), ('Introduction to serverless Python with AWS Lambda', {'id': 'NPsp_MwhUiI', 'filename': 'unknown', 'title': 'Introduction to serverless Python with AWS Lambda', 'publishedAt': '2018-08-09T04:08:48.000Z', 'channelId': 'UCtHekbmBXtp5AYSVARFQQiw', 'description': 'PyCon Thailand: https://2018.th.pycon.org/ Introduction to serverless Python with AWS Lambda Speaker: Murat Knecht https://twitter.com/muratknecht ...', 'thumbnails': {'default': {'url': 'https://i.ytimg.com/vi/NPsp_MwhUiI/default.jpg', 'width': 120, 'height': 90}, 'medium': {'url': 'https://i.ytimg.com/vi/NPsp_MwhUiI/mqdefault.jpg', 'width': 320, 'height': 180}, 'high': {'url': 'https://i.ytimg.com/vi/NPsp_MwhUiI/hqdefault.jpg', 'width': 480, 'height': 360}}, 'channelTitle': 'PyCon Thailand', 'liveBroadcastContent': 'none'}), ('Graph-Theoretic Computation in Python', {'id': '1-aSxYDiyZM', 'filename': 'unknown', 'title': 'Graph-Theoretic Computation in Python', 'publishedAt': '2018-08-08T12:54:45.000Z', 'channelId': 'UCtHekbmBXtp5AYSVARFQQiw', 'description': 'PyCon Thailand: https://2018.th.pycon.org/ Graph-Theoretic Computation in Python Speaker: Poomjai Nacaskul, PhD, DIC, CFA ------------ Description: Playing ...', 'thumbnails': {'default': {'url': 'https://i.ytimg.com/vi/1-aSxYDiyZM/default.jpg', 'width': 120, 'height': 90}, 'medium': {'url': 'https://i.ytimg.com/vi/1-aSxYDiyZM/mqdefault.jpg', 'width': 320, 'height': 180}, 'high': {'url': 'https://i.ytimg.com/vi/1-aSxYDiyZM/hqdefault.jpg', 'width': 480, 'height': 360}}, 'channelTitle': 'PyCon Thailand', 'liveBroadcastContent': 'none'}), ('Python for Self-Trackers: How to Visualize and Better Understand Your Life in Data', {'id': 'wHuHC1VflZ8', 'filename': 'unknown', 'title': 'Python for Self-Trackers: How to Visualize and Better Understand Your Life in Data', 'publishedAt': '2018-08-08T12:02:27.000Z', 'channelId': 'UCtHekbmBXtp5AYSVARFQQiw', 'description': 'PyCon Thailand: https://2018.th.pycon.org/ Python for Self-Trackers: How to Visualize and Better Understand Your Life in Data Speaker: Mark Koester ...', 'thumbnails': {'default': {'url': 'https://i.ytimg.com/vi/wHuHC1VflZ8/default.jpg', 'width': 120, 'height': 90}, 'medium': {'url': 'https://i.ytimg.com/vi/wHuHC1VflZ8/mqdefault.jpg', 'width': 320, 'height': 180}, 'high': {'url': 'https://i.ytimg.com/vi/wHuHC1VflZ8/hqdefault.jpg', 'width': 480, 'height': 360}}, 'channelTitle': 'PyCon Thailand', 'liveBroadcastContent': 'none'})])
590
585
591
- merged , no_matched , to_upload = join (channel , talks ,
586
+ merged , no_matched , no_video = join (channel , talks ,
592
587
lambda i : i ['title' ].lower ().replace ('_' ,' ' ),
593
588
lambda i : ' - ' .join ([i ['title' ],i ['speaker' ]]).lower (),
594
589
lambda l ,r : dict (youtubeid = l ['id' ], snippet = l ['snippet' ], youtubetitle = l ['title' ], ** r ))
595
- print ("unmatched" )
590
+ print ("Youtube videos - unmatched" )
596
591
for item in no_matched :
597
- print (item ['title' ])
598
- print ("matched" )
599
- for item in merged :
600
- print (item ['youtubetitle' ])
601
- print (item ['title' ])
592
+ print (" - " , item ['title' ])
593
+ print ("Talks with no video" )
594
+ for item in no_video :
595
+ print (" - " , item ['title' ], " - " , item ['speaker' ])
596
+
597
+ # print("matched")
598
+ # for item in merged:
599
+ # print(item['youtubetitle'])
600
+ # print(item['title'])
602
601
603
602
update_talks (args .talks , merged )
604
603
# TODO: Update title and description on youtube if different
605
604
update_youtube (youtube , merged )
606
605
607
- if not args .no_upload :
606
+ if not args .no_upload and args . driveurl :
608
607
to_upload , no_drive , no_talks = join (get_videos (drive , args .driveurl ),
609
- to_upload ,
608
+ no_video ,
610
609
key_drive ,
611
610
key_yaml ,
612
611
lambda l , r : dict ([('drive_id' , l ['id' ])] + list (r .items ())))
0 commit comments