Skip to content

Commit 2e3b4e2

Browse files
committed
upload more videos
1 parent de0aea9 commit 2e3b4e2

File tree

2 files changed

+20
-16
lines changed

2 files changed

+20
-16
lines changed

talks2019.yaml

+5
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,7 @@ talks:
6363
time: 14:05
6464
dur: 00:40
6565

66+
youtube_url: https://www.youtube.com/watch?v=tv2GNIRA9_E
6667
- bio: |-
6768
CEO of DycodeX - the AIoT enabler in Indonesia. Microsoft Most Valuable Professional (MVP) of Microsoft Azure.
6869
15 years as entrepreneur. A developer, hardware maker, and public speaker.
@@ -174,6 +175,7 @@ talks:
174175
time: 15:45
175176
dur: 00:40
176177

178+
youtube_url: https://www.youtube.com/watch?v=keAeVmYPpz4
177179
- bio: |-
178180
My name is Charin Polpanumas and I am a data scientist with over five years of track records in Southeast Asia,
179181
Japan, and China. I have delivered data products that save millions USD annually at the region's largest
@@ -228,6 +230,7 @@ talks:
228230
time: 10:20
229231
dur: 00:40
230232

233+
youtube_url: https://www.youtube.com/watch?v=Jhp5RPTHStQ
231234
- bio: |-
232235
Drishti is a Computer Engineer at heart and a technology enthusiast. She loves to use technology to help the less fortunate. She believes in democratizing opportunities and brings knowledge of the latest developments in the fast-moving field of technology to deserving students, and keep them up to date and well-equipped for their respective professional careers.
233236
She has spoken at 12+ conferences across the globe and is also a social entrepreneur. Her non-profit organisation - Samyak Drishti Foundation works in environment, education and healthcare sectors and operates in 10 cities across India.
@@ -1264,6 +1267,7 @@ talks:
12641267
time: 09:05
12651268
dur: 00:45
12661269

1270+
youtube_url: https://www.youtube.com/watch?v=ajW0JaxLK44
12671271
- title: PyCon Thailand Group Photo
12681272
speaker: All of Us (bottom of Auditorium)
12691273
description:
@@ -1343,6 +1347,7 @@ talks:
13431347
time: 17:45
13441348
dur: 00:45
13451349

1350+
youtube_url: https://www.youtube.com/watch?v=RpVtXCaeT_Q
13461351
- title: Closing
13471352
speaker: PyCon Thailand Team
13481353
description: A few words to wrap up what was an amazing event and thank everyone

videoupload.py

+15-16
Original file line numberDiff line numberDiff line change
@@ -418,7 +418,7 @@ def get_talks(file):
418418
with open(file, encoding="utf8") as f:
419419
data = ruamel.yaml.load(f, ruamel.yaml.RoundTripLoader)
420420
for t in data['talks']:
421-
if t.get('speaker'):
421+
if t.get('speaker') and t.get('track'):
422422
yield t
423423

424424
def update_talks(file, videos):
@@ -558,20 +558,15 @@ def do_upload(youtube, videos):
558558

559559

560560
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")
562562
argparser.add_argument("--talks", required=True, help="Talks.yaml file")
563563
argparser.add_argument("--channelid", default="UCtHekbmBXtp5AYSVARFQQiw")
564564
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")
568565
# argparser.add_argument("--category", default="22",
569566
# help="Numeric video category. " +
570567
# "See https://developers.google.com/youtube/v3/docs/videoCategories/list")
571568
# argparser.add_argument("--keywords", help="Video keywords, comma separated",
572569
# default="")
573-
# argparser.add_argument("--privacyStatus", choices=VALID_PRIVACY_STATUSES,
574-
# default=VALID_PRIVACY_STATUSES[0], help="Video privacy status.")
575570
args = argparser.parse_args()
576571
#
577572
# if not os.path.exists(args.file):
@@ -588,25 +583,29 @@ def do_upload(youtube, videos):
588583
channel = get_channel(youtube, args.channelid)
589584
#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'})])
590585

591-
merged, no_matched, to_upload = join(channel, talks,
586+
merged, no_matched, no_video = join(channel, talks,
592587
lambda i: i['title'].lower().replace('_',' '),
593588
lambda i: ' - '.join([i['title'],i['speaker']]).lower(),
594589
lambda l,r: dict(youtubeid=l['id'], snippet=l['snippet'], youtubetitle=l['title'], **r))
595-
print("unmatched")
590+
print("Youtube videos - unmatched")
596591
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'])
602601

603602
update_talks(args.talks, merged)
604603
# TODO: Update title and description on youtube if different
605604
update_youtube(youtube, merged)
606605

607-
if not args.no_upload:
606+
if not args.no_upload and args.driveurl:
608607
to_upload, no_drive, no_talks = join(get_videos(drive, args.driveurl),
609-
to_upload,
608+
no_video,
610609
key_drive,
611610
key_yaml,
612611
lambda l, r: dict([('drive_id', l['id'])] + list(r.items())))

0 commit comments

Comments
 (0)