Browse Source

Removed trailing whitespace

Sybren A. Stüvel 7 years ago
parent
commit
3da8125c3d
1 changed files with 18 additions and 18 deletions
  1. 18 18
      youtube_upload/main.py

+ 18 - 18
youtube_upload/main.py

@@ -1,5 +1,5 @@
 #!/usr/bin/env python
-# 
+#
 # Upload videos to Youtube from the command-line using APIv3.
 #
 # Author: Arnau Sanchez <pyarnau@gmail.com>
@@ -58,7 +58,7 @@ struct = collections.namedtuple
 def open_link(url):
     """Opens a URL link in the client's browser."""
     webbrowser.open(url)
-    
+
 def get_progress_info():
     """Return a function callback to update the progressbar."""
     progressinfo = struct("ProgressInfo", ["callback", "finish"])
@@ -99,13 +99,13 @@ def upload_youtube_video(youtube, options, video_path, total_videos, index):
     """Upload video with index (for split videos)."""
     u = lib.to_utf8
     title = u(options.title)
-    if hasattr(u('string'), 'decode'):   
+    if hasattr(u('string'), 'decode'):
         description = u(options.description or "").decode("string-escape")
     else:
         description = options.description
-    if options.publish_at:    
+    if options.publish_at:
       debug("Your video will remain private until specified date.")
-      
+
     tags = [u(s.strip()) for s in (options.tags or "").split(",")]
     ns = dict(title=title, n=index+1, total=total_videos)
     title_template = u(options.title_template)
@@ -135,8 +135,8 @@ def upload_youtube_video(youtube, options, video_path, total_videos, index):
 
     debug("Start upload: {0}".format(video_path))
     try:
-        video_id = upload_video.upload(youtube, video_path, 
-            request_body, progress_callback=progress.callback, 
+        video_id = upload_video.upload(youtube, video_path,
+            request_body, progress_callback=progress.callback,
             chunksize=options.chunksize)
     finally:
         progress.finish()
@@ -147,14 +147,14 @@ def get_youtube_handler(options):
     home = os.path.expanduser("~")
     default_client_secrets = lib.get_first_existing_filename(
         [sys.prefix, os.path.join(sys.prefix, "local")],
-        "share/youtube_upload/client_secrets.json")  
+        "share/youtube_upload/client_secrets.json")
     default_credentials = os.path.join(home, ".youtube-upload-credentials.json")
     client_secrets = options.client_secrets or default_client_secrets or \
         os.path.join(home, ".client_secrets.json")
     credentials = options.credentials_file or default_credentials
     debug("Using client secrets: {0}".format(client_secrets))
     debug("Using credentials file: {0}".format(credentials))
-    get_code_callback = (auth.browser.get_code 
+    get_code_callback = (auth.browser.get_code
         if options.auth_browser else auth.console.get_code)
     return auth.get_resource(client_secrets, credentials,
         get_code_callback=get_code_callback)
@@ -180,11 +180,11 @@ def run_main(parser, options, args, output=sys.stdout):
             debug("Video URL: {0}".format(video_url))
             if options.open_link:
                 open_link(video_url) #Opens the Youtube Video's link in a webbrowser
-                
+
             if options.thumb:
                 youtube.thumbnails().set(videoId=video_id, media_body=options.thumb).execute()
             if options.playlist:
-                playlists.add_video_to_playlist(youtube, video_id, 
+                playlists.add_video_to_playlist(youtube, video_id,
                     title=lib.to_utf8(options.playlist), privacy=options.privacy)
             output.write(video_id + "\n")
     else:
@@ -204,7 +204,7 @@ def main(arguments):
         help='Video category')
     parser.add_option('-d', '--description', dest='description', type="string",
         help='Video description')
-    parser.add_option('', '--description-file', dest='description_file', type="string", 
+    parser.add_option('', '--description-file', dest='description_file', type="string",
         help='Video description file', default=None)
     parser.add_option('', '--tags', dest='tags', type="string",
         help='Video tags (separated by commas: "tag1, tag2,...")')
@@ -218,12 +218,12 @@ def main(arguments):
     parser.add_option('', '--recording-date', dest='recording_date', metavar="datetime",
         default=None, help="Recording date (ISO 8601): YYYY-MM-DDThh:mm:ss.sZ")
     parser.add_option('', '--default-language', dest='default_language', type="string",
-        default=None, metavar="string", 
+        default=None, metavar="string",
         help="Default language (ISO 639-1: en | fr | de | ...)")
     parser.add_option('', '--default-audio-language', dest='default_audio_language', type="string",
-        default=None, metavar="string", 
+        default=None, metavar="string",
         help="Default audio language (ISO 639-1: en | fr | de | ...)")
-    parser.add_option('', '--thumbnail', dest='thumb', type="string", metavar="FILE", 
+    parser.add_option('', '--thumbnail', dest='thumb', type="string", metavar="FILE",
         help='Image file to use as video thumbnail (JPEG or PNG)')
     parser.add_option('', '--playlist', dest='playlist', type="string",
         help='Playlist title (if it does not exist, it will be created)')
@@ -240,13 +240,13 @@ def main(arguments):
         help='Open a GUI browser to authenticate if required')
 
     #Additional options
-    parser.add_option('', '--chunksize', dest='chunksize', type="int", 
+    parser.add_option('', '--chunksize', dest='chunksize', type="int",
         default = 1024*1024*8, help='Update file chunksize')
     parser.add_option('', '--open-link', dest='open_link', action='store_true',
         help='Opens a url in a web browser to display the uploaded video')
 
     options, args = parser.parse_args(arguments)
-    
+
     if options.description_file is not None and os.path.exists(options.description_file):
         with open(options.description_file, encoding="utf-8") as file:
             options.description = file.read()
@@ -259,6 +259,6 @@ def main(arguments):
 
 def run():
     sys.exit(lib.catch_exceptions(EXIT_CODES, main, sys.argv[1:]))
-  
+
 if __name__ == '__main__':
     run()