Esempio n. 1
0
def record(
    username='',    password='',    title='',
    description='',    tag_list='asdfss'    ):
    "Usage : prog  "
    for required in [username,password,title,description]:
        if required == '':
            print "missing option  try -h to list options "
            return


    terminalcast_dir = get_empty_directory()
    tcast_file = "%s/tcast_data" % terminalcast_dir
    tcast_timing = "%s/timing.js" % terminalcast_dir
    tcast_sound = "%s/sound.wav" % terminalcast_dir
    tcast_mp3 = "%s/sound.mp3" % terminalcast_dir
    tcast_ogg = "%s/sound.ogg" % terminalcast_dir
    tcast_zip = "%s/tc.zip" % terminalcast_dir
    tcast_desc = "%s/desc.pckl" % terminalcast_dir

    description_dict = dict(
        title=title, description=description, tag_list=tag_list)
    cPickle.dump(description_dict, open(tcast_desc,"w"))

    sound_recorder = SOUND_RECORDING_CLASS(tcast_sound)
    TCAST_RECORDING_FUNC(tcast_file, tcast_timing)
    sound_recorder.finish()
    post_process_sound(tcast_sound, tcast_mp3, tcast_ogg)

    zf = ZipFile( tcast_zip ,'w')
    zf.write(tcast_file, "tcast_data")
    zf.write(tcast_timing, "timing.js")
    zf.write(tcast_ogg, "tcast_sound.ogg")
    zf.write(tcast_mp3, "tcast_sound.mp3")
    zf.close ()
    upload_terminalcast(tcast_zip, description_dict, username, password, host=TC_HOST)
Esempio n. 2
0
def upload(number='', username='', password='', host=TC_HOST):
    if not host == TC_HOST:
        host = LOCAL_TC_HOST
    for required in [number,username,password]:
        if required == '':
            print "missing option  try -h to list options "
            return
    number=int(number)
    terminalcast_dir = os.path.expanduser("%s%d/" % (TC_DIR, number))
    tcast_zip = "%s/tc.zip" % terminalcast_dir
    tcast_desc = "%s/desc.pckl" % terminalcast_dir
    description_dict = cPickle.load(open(tcast_desc))
    upload_terminalcast(tcast_zip, description_dict, username, password, host=host)