Browse Source

using {index} to make it python2.6 compatible

Arnau Sanchez 10 years ago
parent
commit
94ab4f444d
3 changed files with 7 additions and 7 deletions
  1. 1 1
      youtube_upload/auth.py
  2. 1 1
      youtube_upload/lib.py
  3. 5 5
      youtube_upload/main.py

+ 1 - 1
youtube_upload/auth.py

@@ -9,7 +9,7 @@ YOUTUBE_UPLOAD_SCOPE = "https://www.googleapis.com/auth/youtube.upload"
 
 
 def _get_code_from_prompt(authorize_url):
 def _get_code_from_prompt(authorize_url):
     """Show authorization URL and return the code the user wrote."""
     """Show authorization URL and return the code the user wrote."""
-    message = "Check this link in your browser: {}".format(authorize_url)
+    message = "Check this link in your browser: {0}".format(authorize_url)
     sys.stderr.write(message + "\n")
     sys.stderr.write(message + "\n")
     return raw_input("Enter verification code: ").strip()
     return raw_input("Enter verification code: ").strip()
 
 

+ 1 - 1
youtube_upload/lib.py

@@ -53,6 +53,6 @@ def retriable_exceptions(fun, retriable_exceptions, max_retries=None):
                 raise exc
                 raise exc
             else:
             else:
                 seconds = random.uniform(0, 2**retry)
                 seconds = random.uniform(0, 2**retry)
-                lib.debug("Retryable error {}/{}: {}. Waiting {} seconds".
+                lib.debug("Retryable error {0}/{1}: {2}. Waiting {3} seconds".
                     format(retry, max_retries or "-", type(exc).__name__, seconds))
                     format(retry, max_retries or "-", type(exc).__name__, seconds))
                 time.sleep(seconds)
                 time.sleep(seconds)

+ 5 - 5
youtube_upload/main.py

@@ -68,7 +68,7 @@ def get_category_id(category):
         if category in youtube_upload.categories.IDS:
         if category in youtube_upload.categories.IDS:
             return str(youtube_upload.categories.IDS[category])
             return str(youtube_upload.categories.IDS[category])
         else:
         else:
-            msg = "{} is not a valid category".format(category)
+            msg = "{0} is not a valid category".format(category)
             raise InvalidCategory(msg)
             raise InvalidCategory(msg)
 
 
 def upload_video(youtube, options, video_path, total_videos, index):
 def upload_video(youtube, options, video_path, total_videos, index):
@@ -95,7 +95,7 @@ def upload_video(youtube, options, video_path, total_videos, index):
         },
         },
     }
     }
 
 
-    debug("Start upload: {} ({})".format(video_path, complete_title))
+    debug("Start upload: {0} ({1})".format(video_path, complete_title))
     video_id = youtube_upload.upload_video.upload(youtube, video_path, body,
     video_id = youtube_upload.upload_video.upload(youtube, video_path, body,
         progress_callback=progress.callback, chunksize=16*1024)
         progress_callback=progress.callback, chunksize=16*1024)
     progress.finish()
     progress.finish()
@@ -116,14 +116,14 @@ def run_main(parser, options, args, output=sys.stdout):
     default_credentials = os.path.join(home, ".youtube-upload-credentials.json")
     default_credentials = os.path.join(home, ".youtube-upload-credentials.json")
     client_secrets = options.client_secrets or default_client_secrets
     client_secrets = options.client_secrets or default_client_secrets
     credentials = options.credentials_file or default_credentials
     credentials = options.credentials_file or default_credentials
-    debug("Using client secrets: {}".format(client_secrets))
-    debug("Using credentials file: {}".format(credentials))
+    debug("Using client secrets: {0}".format(client_secrets))
+    debug("Using credentials file: {0}".format(credentials))
     youtube = youtube_upload.auth.get_resource(client_secrets, credentials)
     youtube = youtube_upload.auth.get_resource(client_secrets, credentials)
 
 
     for index, video_path in enumerate(args):
     for index, video_path in enumerate(args):
         video_id = upload_video(youtube, options, video_path, len(args), index)
         video_id = upload_video(youtube, options, video_path, len(args), index)
         video_url = WATCH_VIDEO_URL.format(id=video_id)
         video_url = WATCH_VIDEO_URL.format(id=video_id)
-        debug("Video URL: {}".format(video_url))
+        debug("Video URL: {0}".format(video_url))
         output.write(video_id + "\n")
         output.write(video_id + "\n")
 
 
 def main(arguments):
 def main(arguments):