Browse Source

fix title template

Arnau Sanchez 10 years ago
parent
commit
2d43706950
2 changed files with 7 additions and 24 deletions
  1. 0 17
      examples/upload_with_curl.sh
  2. 7 7
      youtube_upload/main.py

+ 0 - 17
examples/upload_with_curl.sh

@@ -1,17 +0,0 @@
-#!/bin/bash
-#
-# Upload videos to youtube using youtube-upload and curl.
-#
-#   $ youtube-upload --get-upload-form-info ... | upload_with_curl.sh [CURL_OPTIONS]
-#
-set -e
-
-debug() { echo "$@" >&2; }
-
-while { read FILE; read TOKEN; read POST_URL; }; do
-  URL="$POST_URL?nexturl=http://code.google.com/p/youtube-upload"
-  VIDEO_ID=$(curl --include -F "token=$TOKEN" -F "file=@$FILE" "$@" "$URL" | 
-    grep -m1 "^Location: " | grep -o "id=[^&]\+" | cut -d"=" -f2-)
-  test "$VIDEO_ID" || { debug "Error uploading"; exit 1; }            
-  echo "http://www.youtube.com/watch?v=$VIDEO_ID"
-done

+ 7 - 7
youtube_upload/main.py

@@ -13,9 +13,8 @@
 # You should have received a copy of the GNU General Public License
 # along with Youtube-upload. If not, see <http://www.gnu.org/licenses/>.
 #
-# Author: Arnau Sanchez <tokland@gmail.com>
-# Websites: http://code.google.com/p/youtube-upload
-#           http://code.google.com/p/tokland
+# Author: Arnau Sanchez <pyarnau@gmail.com>
+# Site: https://github.com/tokland/youtube-upload
 """
 Upload a video to Youtube from the command-line.
 
@@ -163,6 +162,7 @@ def upload_video(youtube, options, video_path, total_videos, index):
         },
     }
 
+    debug("Start upload: {} ({})".format(video_path, complete_title))
     video_id = youtube_upload.upload_video.upload(youtube, video_path, body,
         progress_callback=progress.callback, chunksize=16*1024)
     progress.finish()
@@ -195,7 +195,7 @@ def run_main(parser, options, args, output=sys.stdout):
 
 def main(arguments):
     """Upload video to Youtube."""
-    usage = """Usage: %prog [OPTIONS] VIDEO_PATH ...
+    usage = """Usage: %prog [OPTIONS] VIDEO_PATH [VIDEO_PATH2 ...]
 
     Upload videos to youtube."""
     parser = optparse.OptionParser(usage, version=VERSION)
@@ -212,13 +212,13 @@ def main(arguments):
     parser.add_option('', '--keywords', dest='keywords', type="string",
         help='Video(s) keywords (separated by commas: tag1,tag2,...)')
     parser.add_option('', '--title-template', dest='title_template',
-        type="string", default="$title [$n/$total]", metavar="STRING",
+        type="string", default="{title} [{n}/{total}]", metavar="STRING",
         help='Template for multiple videos (default: {title} [{n}/{total}])')
     parser.add_option('', '--privacy', dest='privacy', metavar="STRING",
         default="public", help='Privacy status (public | unlisted | private)')
     parser.add_option('', '--location', dest='location', type="string",
-        default=None, metavar="LAT,LON",
-        help='Video(s) location (latitude=VAL, longitude=VAL, altitude=VAL)."')
+        default=None, metavar="latitude=VAL, longitude=VAL, altitude=VAL",
+        help='Video(s) location"')
 
     # Authentication
     parser.add_option('', '--client-secrets', dest='client_secrets',