|
@@ -27,6 +27,7 @@ import youtube_upload.auth
|
|
|
import youtube_upload.upload_video
|
|
|
import youtube_upload.categories
|
|
|
import youtube_upload.lib as lib
|
|
|
+import playlists
|
|
|
|
|
|
# http://code.google.com/p/python-progressbar (>= 2.3)
|
|
|
try:
|
|
@@ -151,8 +152,13 @@ def run_main(parser, options, args, output=sys.stdout):
|
|
|
for index, video_path in enumerate(args):
|
|
|
video_id = upload_video(youtube, options, video_path, len(args), index)
|
|
|
video_url = WATCH_VIDEO_URL.format(id=video_id)
|
|
|
+
|
|
|
if options.thumb:
|
|
|
youtube.thumbnails().set(videoId=video_id, media_body=options.thumb).execute()
|
|
|
+
|
|
|
+ if options.playlist:
|
|
|
+ playlists.add_to_playlist(youtube, video_id, options)
|
|
|
+
|
|
|
debug("Video URL: {0}".format(video_url))
|
|
|
output.write(video_id + "\n")
|
|
|
else:
|
|
@@ -181,6 +187,8 @@ def main(arguments):
|
|
|
help='Video location"')
|
|
|
parser.add_option('', '--thumbnail', dest='thumb', type="string",
|
|
|
help='Video thumbnail')
|
|
|
+ parser.add_option('', '--playlist', dest='playlist', type="string",
|
|
|
+ help='Playlist title (will create if necessary)')
|
|
|
parser.add_option('', '--title-template', dest='title_template',
|
|
|
type="string", default="{title} [{n}/{total}]", metavar="STRING",
|
|
|
help='Template for multiple videos (default: {title} [{n}/{total}])')
|