mirror of
https://git.lecygnenoir.info/LecygneNoir/prismedia.git
synced 2025-10-03 17:39:16 +02:00
modify yt lib to use docopt instead of argparser arguments
This commit is contained in:
parent
bd8c143661
commit
8863c6856d
1 changed files with 9 additions and 7 deletions
|
@ -46,19 +46,21 @@ def get_authenticated_service():
|
||||||
return build(API_SERVICE_NAME, API_VERSION, credentials = credentials)
|
return build(API_SERVICE_NAME, API_VERSION, credentials = credentials)
|
||||||
|
|
||||||
def initialize_upload(youtube, options):
|
def initialize_upload(youtube, options):
|
||||||
|
path = options.get('--file')
|
||||||
|
print options.get('--name')
|
||||||
tags = None
|
tags = None
|
||||||
if options.keywords:
|
if options.get('--tags'):
|
||||||
tags = options.keywords.split(',')
|
tags = options.get('--tags').split(',')
|
||||||
|
|
||||||
body=dict(
|
body=dict(
|
||||||
snippet=dict(
|
snippet=dict(
|
||||||
name=options.name,
|
title=options.get('--name') or os.path.splitext(os.path.basename(path))[0],
|
||||||
description=options.description,
|
description=options.get('--description') or "",
|
||||||
tags=tags,
|
tags=tags,
|
||||||
categoryId=options.category
|
categoryId=str(options.get('--category') or 1),
|
||||||
),
|
),
|
||||||
status=dict(
|
status=dict(
|
||||||
privacyStatus=options.privacyStatus
|
privacyStatus=str(options.get('--privacy') or "private"),
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -66,7 +68,7 @@ def initialize_upload(youtube, options):
|
||||||
insert_request = youtube.videos().insert(
|
insert_request = youtube.videos().insert(
|
||||||
part=','.join(body.keys()),
|
part=','.join(body.keys()),
|
||||||
body=body,
|
body=body,
|
||||||
media_body=MediaFileUpload(options.file, chunksize=-1, resumable=True)
|
media_body=MediaFileUpload(path, chunksize=-1, resumable=True)
|
||||||
)
|
)
|
||||||
|
|
||||||
resumable_upload(insert_request)
|
resumable_upload(insert_request)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue