Пример #1
0
def upload(filename,
           title,
           tags='PCCES',
           description='video of PCCES, pcces.org'):
    file_info = {'title': title, 'tags': tags, 'description': description}
    youku = YoukuUpload(CLIENT_ID, CLIENT_SECRET, filename)
    youku.upload(file_info)
Пример #2
0
def main():
    file_info = {
        'title': u'Google I/O 2014',
        'tags': 'Google,IO',
        'description': 'I/O Keynote'
    }
    file = '/home/hanguokai/filename.mp4'
    youku = YoukuUpload(settings.YOUKU_CLIENT_ID, ACCESS_TOKEN, file)
    youku.upload(file_info)
Пример #3
0
 def upload(self, id):
     file_info = {
         'title': self.info['title'],
         'description': self.info['description']
     }
     file = '../Videos/' + str(id) + '.mp4'
     youku = YoukuUpload('f469de6164958f24',
                         '4bcca5a8766d02c80a2345a12c86b520', file)
     youku.upload(file_info)
     os.remove(file)
Пример #4
0
    def test_upload(self):
        UPLOAD_FILE = 'f3659211207n.mp4'
        youku = YoukuUpload(CLIENT_ID, ACCESS_TOKEN, UPLOAD_FILE)

        # youku.create(youku.prepare_video_params(**params))
        # youku.create_file()
        # youku.upload_slice()
        # youku.check()
        # youku.commit()
        # youku.cancel()
        # youku.spec()
        youku.upload(self.file_info)
Пример #5
0
        sys.exit(-1)
    access_token = access_token['access_token']
    tf = file('token.txt', 'w+')
    tf.write(access_token)
    tf.close()
if not access_token:
    print 'Failed to get an access token'
    import sys
    sys.exit(-1)
print 'Access token is good, start uploading now, please be patient!'
print '-------------------------------------------------------------'
for f in ready_for_upload_list:
    file_info = {
        'title': f['title'],
        'tags': f['tag'],
        'description': f['desc']
    }
    youku = YoukuUpload(config.CLIENT_ID, access_token, f['path'])

    t1 = Thread(target=upload_main, args=(file_info, ))
    t2 = Thread(target=show_process, args=(None, ))
    t2.start()
    t1.start()
    t2.join()
    t1.join()

    #print "\n%d videos have been processed, %d are finished, %d are failed, %d left." % (already+failed,already,failed,total-already-failed)
    print 'go to next'
print "\n%d videos have been processed, %d are finished, %d are failed, %d left." % (
    already + failed, already, failed, total - already - failed)