Python youtube-upload opens file dialog box -
when type youtube-upload --title="the chain ~ guardians of galaxy vol. 2" the_chain.mp4
onto cmd, opens file dialog box. have followed installation of youtube-upload properly. please help
you can follow answer in so post. a
:: == assumptions == :: - script in same directory csv file :: - csv lines in following order: :: file_name;title;description;category;tags;recording_date :: - descriptions not contain semicolons @echo off set video_folder="c:\path\to\your\video\folder" :: if videos , csv file in same directory, don't need pushd or popd :: also, couldn't line continuation work inside of loop, :: must on same line. pushd %video_folder% /f "tokens=1-6 delims=;" %%a in (vids.csv) ( youtube-upload --title="%%~b" --description="%%~c" --category="%%~d" --tags="%%~e" --recording-date="%%~f" --default-language="en" --default-audio-language="en" --client-secrets=client-secrets.json --credentials-file=client_secrets.json "%%~a" ) popd pause
also second answer useful when python.
once python might investigate youtube api can accessed directly python.
to started i'd use fact youtube-upload in fact loaded python module, instead of calling subprocess import youtube-upload , call youtube-upload.main(commandline).
the core program like:
import csv import subprocess def upload(csvfile): open(csvfile') f: info in csv.dictreader(f): info.update({'client-secrets':'client_secrets.json', 'credentials-file':'client_secrets.json') subprocess.call(['youtube-upload'] + ['--{0}="{1}"'.format(k,v) k,v in info.items()]})
and utility this:
#!python """ upload media files specified in csv file youtube using youtube-upload script. csv file exported excel (i.e. commas quoted) first line contains upload parameters column headers subsequent lines contain per media file values corresponding options. e.g. file,description,category,tags... test.mp4,a.s. mutter,a.s. mutter plays beethoven,music,"mutter, beethoven" etc... """ import csv import subprocess def upload(csvfile): open(csvfile) f: info in csv.dictreader(f): info.update({'client-secrets':'client_secrets.json', 'credentials-file':'client_secrets.json'}) commandline = ['youtube-upload'] + ['--{0}="{1}"'.format(k,v) k,v in info.items()] #print commandline subprocess.call(commandline) def main(): import argparse p = argparse.argumentparser(description='youtube upload media files specified in csv file') p.add_argument('-f', '--csvfile', default='vids.csv', help='file path of csv file containing list of media upload') args = p.parse_args() upload(args.csvfile) if __name__ == '__main__': main()
Comments
Post a Comment