View unanswered posts | View active topics It is currently Fri Jan 19, 2018 9:24 am



Reply to topic  [ 1 post ] 
Tutorial- video uploading for mac users. 
Author Message
Site Moderator
Site Moderator
User avatar

Joined: Wed Aug 27, 2008 1:39 pm
Posts: 2856
Location: Maryland, USA
Rating: 1698
Rating Class: Class B (1600-1800)
Post Tutorial- video uploading for mac users.
We Mac users are a minority here and can't use the normal uploading procedure for PC users. Fortunately, our Admin has come up with a relatively easy method for us Mac types. It may seem a little involved at first but after 1 or 2 times it is not a big deal at all.

1. First, you must have Python installed in your system. It's probably already on your computer- if you open the Terminal application and type "python" (without the quotes) it will return a message with the current version number of Python that is installed. If it isn't there or is older than 3.1.2 then you may want to download it from here: http://www.python.org/ftp/python/3.1.2/ ... -03-24.dmg This is the latest version as of April 2010.

2. You will need the Uploader Script that admin created. in the text box and paste it into a plain text file. Name it video_setup.py

Code:
#!/usr/bin/python
# ChessVideos.TV Video Upload Helper
# Author: Dan Birken
# Copyright (c) ChessVideos.TV
# Version 0.2

import ftplib
import getpass
import md5
import os
import StringIO
import sys
import time

VALID_EXTENSIONS = ('mov', 'avi', 'wmv')

def hash_file(filename):
  f = open(filename, 'rb')
  filehash = md5.md5()
  filehash.update(f.read())
  f.close()
  return filehash.hexdigest()

def get_safe_number(desc, min, max):
  while True:
    value = raw_input(desc)
    if check_number(value, min, max):
      return value

def check_number(num_string, min, max):
  try:
    return max >= int(num_string) >= min
  except ValueError:
    return False

if len(sys.argv) != 2:
  print "Error, expects video_setup.py [video file]"
  sys.exit(1)

ext = sys.argv[1][-3:]

if ext not in VALID_EXTENSIONS:
  print "Error, files extension must be one of %s" % VALID_EXTENSIONS
  sys.exit(1)

# Now lets make sure it exists
if not os.path.exists(sys.argv[1]):
  print "Error, Given file does not exist."
  sys.exit(1)

# Input username and password
username = raw_input('Input your forum username: ')
password = getpass.getpass('Input your forum password: ')
title = raw_input('Input the title of the video: ')

while len(title) > 40 or len(title) < 10:
  title = raw_input('(Title must be between 10-40 chars) '
                    'Input the title of the video: ')

tags = raw_input('Input a list of tags for this video '
                 '(use commas for multiple tags): ')

level = get_safe_number('Input the level of your video: \n'
                        '(0) Beginner\n'
                        '(1) Intermediate\n'
                        '(2) Expert\n',
                        0, 2)

type = get_safe_number('Input the type of video: \n'
                       '(0) Live Commentary\n'
                       '(1) Dual Commentary\n'
                       '(2) Game Analysis\n'
                       '(3) Endgame\n'
                       '(4) Opening\n'
                       '(5) Middlegame\n'
                       '(6) Chess Puzzle\n',
                       0, 6)

color = get_safe_number('Input your color: \n'
                        '(0) White\n'
                        '(1) Black\n'
                        '(2) N/A or doesn\'t matter\n',
                        0, 2)

file_hash = hash_file(sys.argv[1])
passhashobj = md5.md5()
passhashobj.update(password)
pass_hash = passhashobj.hexdigest()

out_file = [title, username, pass_hash, level, file_hash,
            'EXT', type, '', tags, color, '']

# Generate a nice StringIO for the metadata
metadata = StringIO.StringIO('\n'.join(out_file))
print 'Video metadata created, attempting to upload...'

out_hash = file_hash + str(int(time.time()))
remote_metadata = out_hash + '.%s.info' % ext
local_file = sys.argv[1]
remote_file = out_hash + '.%s' % ext

ftp = ftplib.FTP('www.chessvideos.tv')
ftp.login()
print 'Connected to chessvideos.tv...'

ftp.storlines('STOR %s' % remote_metadata, metadata)
print 'Metadata uploaded successfully, uploading video file.'
print 'This may take a while, so be patient.'

ftp.storbinary('STOR %s' % remote_file, open(local_file, 'rb'))
print 'Video uploaded successfully.'


3. After copying and pasting the script into a plain text file, create a new folder on your desktop named "CV" (again without the quotes). Put the script into this folder.

4. Record your video (quicktime movie or AVI are good formats- I recommend QT as it uses smaller file sizes and is quicker to upload). There are a number of screen capture utilities that will work. Personally, I use IShowU which is excellent though it is a commercial product.

5. Drag your completed movie into the "CV" folder you created earlier. Let's assume that the file name of the video you created is "mychessvideo.mov" .

6. Open the Terminal application. Type "cd desktop/cv" (without the quotes)

7. Now type "python video_setup.py mychessvideo.mov" (without the quotes) and press return. Naturally, you would alter what you type based on the actual filename of your video. It should look something like this (before you press return) :

Image

8. If all has gone well, the terminal will prompt you for your forum username and password (from your chessvideos.tv account info). It will also prompt you for the name of the video- you can name it anything at this stage- it doesn't have to be the filename of the video.. What you type will be the title of the video as it appears on the forum.

9. It will prompt you for some further info on your video which is pretty self-explanatory. It will then give you a message shortly (depends on the size of the video) that your "video successfully uploaded"

10. Check out the new posts on the forum to see if it uploaded properly. Normally there is a delay before it is posted, again depending on the size of the video. It's not unusual for a large video to take 30 minutes or more before it shows up on the site so don't despair if it doesn't show up right away.

OK this seems like a lot but after you have laid the groundwork it's basically this:

1. Make video. Drag to "CV" folder

2. Open terminal and perform steps 6, 7 and 8 above. That's pretty much it. I tried to make this tutorial idiot-proof which accounts for the number of steps involved- if you still have questions, or I left something out, please post your question here and I will reply promptly as possible.

Good luck!

_________________
illigetimi non carborundum.


Mon Apr 26, 2010 2:32 pm
Profile WWW
Display posts from previous:  Sort by  
Reply to topic   [ 1 post ] 

Who is online

Users browsing this forum: No registered users and 0 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
cron
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group.
Designed by STSoftware for PTF