示例#1
0
def downloadPlaylistAudio(url):
    utils.writeHistory(url)
    downloadCmd = 'mkdir %s;cd %s;%s -cit %s' % (utils.TEMPDIR, utils.TEMPDIR, utils.YOUTUBE_DL, url)
    for i in os.listdir(utils.TEMPDIR):
        if utils.FORMAT_AUDIO:
            if utils.FORMAT_AUDIO == '.mp3':
                convertCmd = '%s -y -i %s -b:a 320k %s' % (utils.FFMPEG, utils.formatSpaces('%s%s' % (utils.TEMPDIR, i)),
                utils.replaceExtension('%s%s' % (utils.DOWNLOAD, utils.formatConsole(utils.formatSpaces(mediaFile))), utils.FORMAT_AUDIO))
            else:
                convertCmd = '%s -y -i %s %s' % (utils.FFMPEG, utils.formatSpaces('%s%s' % (utils.TEMPDIR, i)),
                utils.replaceExtension('%s%s' % (utils.DOWNLOAD, utils.formatConsole(utils.formatSpaces(mediaFile))), utils.FORMAT_AUDIO))
        else:
            convertCmd = '%s -y -i %s -b:a 320k %s' % (utils.FFMPEG, utils.formatSpaces('%s%s' % (utils.TEMPDIR, i)),
            utils.replaceExtension('%s%s' % (utils.DOWNLOAD, utils.formatConsole(utils.formatSpaces(mediaFile))), '.mp3'))
    if utils.PROGRESS:
        downloadCmd = '%s --newline' % downloadCmd
        proc = utils.runProgressBarDownload(downloadCmd, quitFilter = False)
        utils.runProgressBarConvert(convertCmd)
    else:
        utils.displayNotification(utils.TITLE, url, '► Downloading Playlist\'s Audio', 'open %s' % utils.DOWNLOAD)
        proc = utils.runProcess(downloadCmd)
        utils.runProcess(convertCmd)
    utils.displayNotification(utils.TITLE, url, 'Download Complete', 'open %s' % utils.DOWNLOAD)
    os.system('rm -rf %s' % utils.TEMPDIR)
    utils.sendDiagnostics('downloadPlaylistAudio', downloadCmd, convertCmd, proc)
    
示例#2
0
def downloadAudio(url):
    utils.writeHistory(url)
    (mediaTitle, mediaFile) = utils.getMediaInfo(url)
    utils.writeTemp(url)
    downloadCmd = '%s -i %s -o %s' % (utils.YOUTUBE_DL, url, utils.TEMPORARY)
    if utils.FORMAT_AUDIO:
        if utils.FORMAT_AUDIO == '.mp3':
            convertCmd = '%s -y -i %s -b:a 320k %s' % (utils.FFMPEG, utils.TEMPORARY, 
            utils.replaceExtension('%s%s' % (utils.DOWNLOAD, utils.formatConsole(utils.formatSpaces(mediaFile))), utils.FORMAT_AUDIO))
        else:
            convertCmd = '%s -y -i %s %s' % (utils.FFMPEG, utils.TEMPORARY, 
            utils.replaceExtension('%s%s' % (utils.DOWNLOAD, utils.formatConsole(utils.formatSpaces(mediaFile))), utils.FORMAT_AUDIO))
    else:
        convertCmd = '%s -y -i %s -b:a 320k %s' % (utils.FFMPEG, utils.TEMPORARY, 
        utils.replaceExtension('%s%s' % (utils.DOWNLOAD, utils.formatConsole(utils.formatSpaces(mediaFile))), '.mp3'))
    if utils.PROGRESS:
        downloadCmd = '%s --newline' % downloadCmd
        proc = utils.runProgressBarDownload(downloadCmd, quitFilter = False)
        utils.runProgressBarConvert(convertCmd)
    else:
        utils.displayNotification(utils.TITLE, mediaTitle, '► Downloading Audio', 'open %s' % utils.DOWNLOAD)
        proc = utils.runProcess(downloadCmd)
        utils.runProcess(convertCmd)
    utils.displayNotification(utils.TITLE, mediaTitle, 'Download Complete', 'open %s' % utils.DOWNLOAD)
    os.system('rm -rf %s' % utils.TEMPORARY)
    utils.sendDiagnostics('downloadAudio', downloadCmd, convertCmd, proc)
示例#3
0
def advancedDownloadAudio(node, url, extension, fileName, mediaTitle, format):
    utils.writeHistory(url)
    utils.writeTemp(url)
    downloadCmd = '%s %s -o %s' % (utils.YOUTUBE_DL, url, utils.TEMPORARY)
    if extension == '.mp3':
        convertCmd = '%s -y -i %s -b:a 320k %s' % (
            utils.FFMPEG, utils.TEMPORARY, '%s%s' %
            (utils.DOWNLOAD,
             utils.formatConsole(
                 utils.formatSpaces(utils.replaceExtension(
                     fileName, extension)))))
    else:
        convertCmd = '%s -y -i %s %s' % (
            utils.FFMPEG, utils.TEMPORARY, '%s%s' %
            (utils.DOWNLOAD,
             utils.formatConsole(
                 utils.formatSpaces(utils.replaceExtension(
                     fileName, extension)))))
    if utils.PROGRESS:
        downloadCmd = '%s --newline' % downloadCmd
        proc = utils.runProgressBarDownload(downloadCmd, quitFilter=False)
        utils.runProgressBarConvert(convertCmd)
    else:
        utils.displayNotification(utils.TITLE, mediaTitle,
                                  '► Downloading Audio',
                                  'open %s' % utils.DOWNLOAD)
        proc = utils.runProcess(downloadCmd)
        utils.runProcess(convertCmd)
    utils.displayNotification(utils.TITLE, mediaTitle, 'Download Complete',
                              'open %s' % utils.DOWNLOAD)
    utils.sendDiagnostics('advancedDownloadAudio', downloadCmd, convertCmd,
                          proc)
def displayHistory():
    proc = '%s textbox --title %s --informative-text %s --text-from-file %s --button1 %s --button2 %s --float' % (utils.COCOA,
    utils.TITLE, utils.formatSpaces('Luxinate download history:'), utils.formatSpaces(utils.HISTORY), 'Ok', utils.formatSpaces('Clear History'))
    results = utils.runProcess(proc)
    if results.split('\n')[0] == '2':
        wipeHistory = open(utils.HISTORY, 'w')
        wipeHistory.close()
        utils.displayNotification(utils.TITLE, 'Luxinate history cleared', '', '')
示例#5
0
def displayHistory():
    proc = '%s textbox --title %s --informative-text %s --text-from-file %s --button1 %s --button2 %s --float' % (utils.COCOA,
    utils.TITLE, utils.formatSpaces('Luxinate download history:'), utils.formatSpaces(utils.HISTORY), 'Ok', utils.formatSpaces('Clear History'))
    results = utils.runProcess(proc)
    if results.split('\n')[0] == '2':
        wipeHistory = open(utils.HISTORY, 'w')
        wipeHistory.close()
        utils.displayNotification(utils.TITLE, 'Luxinate history cleared', '', '')
def installSoundCloudAPI():
    validatePip = utils.runProcess('whereis pip')
    if validatePip:
        osaCmd = 'osascript -e \'tell application "Alfred 2" to do shell script "sudo pip install soundcloud" with administrator privileges\''
    else:
        osaCmd = 'osascript -e \'tell application "Alfred 2" to do shell script "sudo easy_install soundcloud" with administrator privileges\''
    utils.displayNotification(utils.TITLE, 'Installing SoundCloud API', 'Please enter your user password...', '')
    utils.runProcess(osaCmd)
    utils.displayNotification(utils.TITLE, 'Installation Complete', '', '')
示例#7
0
def installSoundCloudAPI():
    validatePip = utils.runProcess('whereis pip')
    if validatePip:
        osaCmd = 'osascript -e \'tell application "Alfred 2" to do shell script "sudo pip install soundcloud" with administrator privileges\''
    else:
        osaCmd = 'osascript -e \'tell application "Alfred 2" to do shell script "sudo easy_install soundcloud" with administrator privileges\''
    utils.displayNotification(utils.TITLE, 'Installing SoundCloud API', 'Please enter your user password...', '')
    utils.runProcess(osaCmd)
    utils.displayNotification(utils.TITLE, 'Installation Complete', '', '')
def toggleProgressBar():
    if utils.PROGRESS:
        wipeProgress = open(utils.PROGRESS_BAR, 'w')
        wipeProgress.close()
        utils.displayNotification(utils.TITLE, 'Progress bar turned off', '', '')
    else:
        bumpProgress = open(utils.PROGRESS_BAR, 'w')
        bumpProgress.write('True')
        bumpProgress.close()
        utils.displayNotification(utils.TITLE, 'Progress bar turned on', '', '')
示例#9
0
def toggleProgressBar():
    if utils.PROGRESS:
        wipeProgress = open(utils.PROGRESS_BAR, 'w')
        wipeProgress.close()
        utils.displayNotification(utils.TITLE, 'Progress bar turned off', '', '')
    else:
        bumpProgress = open(utils.PROGRESS_BAR, 'w')
        bumpProgress.write('True')
        bumpProgress.close()
        utils.displayNotification(utils.TITLE, 'Progress bar turned on', '', '')
示例#10
0
def setDownloadPath():
    proc = '%s fileselect --title %s --text %s --select-only-directories --stirng-output --float' % (utils.COCOA,
    utils.TITLE, utils.formatSpaces('Set where downloads are saved to by default:'))
    result = utils.runProcess(proc)
    if len(result.split('\n')) < 2:
        sys.exit(0)
    else:
        downloadText = open(utils.DOWNLOADS, 'w')
        downloadText.write('%s/' % result.split('\n')[0])
        downloadText.close()
        utils.displayNotification(utils.TITLE, 'Download path changed', '%s/' % result.split('\n')[0], '')
示例#11
0
def setDownloadPath():
    proc = '%s fileselect --title %s --text %s --select-only-directories --stirng-output --float' % (utils.COCOA,
    utils.TITLE, utils.formatSpaces('Set where downloads are saved to by default:'))
    result = utils.runProcess(proc)
    if len(result.split('\n')) < 2:
        sys.exit(0)
    else:
        downloadText = open(utils.DOWNLOADS, 'w')
        downloadText.write('%s/' % result.split('\n')[0])
        downloadText.close()
        utils.displayNotification(utils.TITLE, 'Download path changed', '%s/' % result.split('\n')[0], '')
示例#12
0
def advancedDownloadVideo(node, url, extension, fileName, mediaTitle, format):
    utils.writeHistory(url)
    utils.writeTemp(url)
    downloadCmd = 'cd %s;%s -f %s %s' % (utils.DOWNLOAD, utils.YOUTUBE_DL, format, url)
    if utils.PROGRESS:
        downloadCmd = '%s --newline' % downloadCmd
        proc = utils.runProgressBarDownload(downloadCmd)
    else:
        utils.displayNotification(utils.TITLE, utils.deformatConsole(mediaTitle), '► Downloading Video', 'open %s' % utils.DOWNLOAD)
        proc = utils.runProcess(downloadCmd)
    utils.killProgressBar()
    utils.displayNotification(utils.TITLE, utils.deformatConsole(mediaTitle), 'Download Complete', 'open %s' % utils.DOWNLOAD)
    utils.sendDiagnostics('advancedDownloadVideo', downloadCmd, '', proc)
示例#13
0
def downloadPlaylistVideo(url):
    utils.writeHistory(url)
    if utils.FORMAT_VIDEO:
        downloadCmd = 'cd %s;%s -citf %s %s' % (utils.DOWNLOAD, utils.YOUTUBE_DL, utils.FORMAT_VIDEO, url)
    else:
        downloadCmd = 'cd %s;%s -it %s' % (utils.DOWNLOAD, utils.YOUTUBE_DL, url)
    if utils.PROGRESS:
        downloadCmd = '%s --newline' % downloadCmd
        proc = utils.runProgressBarDownload(downloadCmd)
    else:
        utils.displayNotification(utils.TITLE, url, '► Downloading Playlist\'s Video', 'open %s' % utils.DOWNLOAD)    
        proc = utils.runProcess(downloadCmd)
    utils.displayNotification(utils.TITLE, url, 'Download Complete', 'open %s' % utils.DOWNLOAD)
    utils.sendDiagnostics('downloadPlaylistVideo', downloadCmd, '', proc)
示例#14
0
def downloadPlaylistAudio(url):
    def convertFiles(progressBar = False):
        for i in os.listdir(utils.TEMPDIR):
            mediaFile = os.path.basename(i).split('.')[0]
            if utils.FORMAT_AUDIO:
                if utils.FORMAT_AUDIO == '.mp3':
                    convertCmd = '%s -y -i %s -b:a 320k %s' % (utils.FFMPEG, utils.formatSpaces('%s%s' % (utils.TEMPDIR, utils.formatConsole(i))),
                    utils.replaceExtension('%s%s' % (utils.DOWNLOAD, utils.formatConsole(utils.formatSpaces(mediaFile))), utils.FORMAT_AUDIO))
                else:
                    convertCmd = '%s -y -i %s %s' % (utils.FFMPEG, utils.formatSpaces('%s%s' % (utils.TEMPDIR, utils.formatConsole(i))),
                    utils.replaceExtension('%s%s' % (utils.DOWNLOAD, utils.formatConsole(utils.formatSpaces(mediaFile))), utils.FORMAT_AUDIO))
            else:
                convertCmd = '%s -y -i %s -b:a 320k %s' % (utils.FFMPEG, utils.formatSpaces('%s%s' % (utils.TEMPDIR, utils.formatConsole(i))),
                utils.replaceExtension('%s%s' % (utils.DOWNLOAD, utils.formatConsole(utils.formatSpaces(mediaFile))), '.mp3'))
            if progressBar:
                utils.runProgressBarConvert(convertCmd, quitFilter = False)
            else:
                utils.runProcess(convertCmd)
    passConvert = False
    utils.writeHistory(url)
    if 'soundcloud' in utils.checkDomain(url):
            passConvert = True
            convertCmd = ''
    if not passConvert:
        downloadCmd = 'mkdir %s;cd %s;%s -cit %s' % (utils.TEMPDIR, utils.TEMPDIR, utils.YOUTUBE_DL, url)
    else:
        downloadCmd = 'cd %s;%s -cit %s' % (utils.DOWNLOAD, utils.YOUTUBE_DL, url)
    if utils.PROGRESS:
        utils.spawnProgressBar()
        utils.writeTemp(url)
        downloadCmd = '%s --newline' % downloadCmd
        if not passConvert:
            utils.runProgressBarDownload(downloadCmd, quitFilter = False)
            convertFiles(progressBar = True)
            proc = ''
        else:
            utils.runProgressBarDownload(downloadCmd)
            proc = ''
    else:
        utils.displayNotification(utils.TITLE, url, '► Downloading Playlist\'s Audio', 'open %s' % utils.DOWNLOAD)
        if not passConvert:
            proc = utils.runProcess(downloadCmd)
            convertFiles()
        else:
            proc = utils.runProcess(downloadCmd)
    utils.killProgressBar()
    utils.displayNotification(utils.TITLE, url, 'Download Complete', 'open %s' % utils.DOWNLOAD)
    os.system('rm -rf %s' % utils.TEMPDIR)
    utils.sendDiagnostics('downloadPlaylistAudio', downloadCmd, 'Playlist_Download', proc)
示例#15
0
def advancedDownloadVideo(node, url, extension, fileName, mediaTitle, format):
    utils.writeHistory(url)
    utils.writeTemp(url)
    downloadCmd = 'cd %s;%s -f %s %s' % (utils.DOWNLOAD, utils.YOUTUBE_DL,
                                         format, url)
    if utils.PROGRESS:
        downloadCmd = '%s --newline' % downloadCmd
        proc = utils.runProgressBarDownload(downloadCmd)
    else:
        utils.displayNotification(utils.TITLE, mediaTitle,
                                  '► Downloading Video',
                                  'open %s' % utils.DOWNLOAD)
        proc = utils.runProcess(downloadCmd)
    utils.displayNotification(utils.TITLE, url, 'Download Complete',
                              'open %s' % utils.DOWNLOAD)
    utils.sendDiagnostics('advancedDownloadVideo', downloadCmd, '', proc)
示例#16
0
def downloadVideo(url):
    utils.writeHistory(url)
    (mediaTitle, mediaFile) = utils.getMediaInfo(url)
    utils.writeTemp(url)
    if utils.FORMAT_VIDEO:
        downloadCmd = 'cd %s;%s -itf %s %s' % (utils.DOWNLOAD, utils.YOUTUBE_DL, utils.FORMAT_VIDEO, url)
    else:
        downloadCmd = 'cd %s;%s -it %s' % (utils.DOWNLOAD, utils.YOUTUBE_DL, url)
    if utils.PROGRESS:
        downloadCmd = '%s --newline' % downloadCmd
        proc = utils.runProgressBarDownload(downloadCmd)
    else:
        utils.displayNotification(utils.TITLE, mediaTitle, '► Downloading Video', 'open %s' % utils.DOWNLOAD)
        proc = utils.runProcess(downloadCmd)
    utils.displayNotification(utils.TITLE, mediaTitle, 'Download Complete', 'open %s' % utils.DOWNLOAD)
    utils.sendDiagnostics('downloadVideo', downloadCmd, '', proc)
示例#17
0
def downloadPlaylistAudio(url):
    utils.writeHistory(url)
    downloadCmd = 'mkdir %s;cd %s;%s -cit %s' % (utils.TEMPDIR, utils.TEMPDIR,
                                                 utils.YOUTUBE_DL, url)
    for i in os.listdir(utils.TEMPDIR):
        if utils.FORMAT_AUDIO:
            if utils.FORMAT_AUDIO == '.mp3':
                convertCmd = '%s -y -i %s -b:a 320k %s' % (
                    utils.FFMPEG,
                    utils.formatSpaces('%s%s' % (utils.TEMPDIR, i)),
                    utils.replaceExtension(
                        '%s%s' %
                        (utils.DOWNLOAD,
                         utils.formatConsole(utils.formatSpaces(mediaFile))),
                        utils.FORMAT_AUDIO))
            else:
                convertCmd = '%s -y -i %s %s' % (
                    utils.FFMPEG,
                    utils.formatSpaces('%s%s' % (utils.TEMPDIR, i)),
                    utils.replaceExtension(
                        '%s%s' %
                        (utils.DOWNLOAD,
                         utils.formatConsole(utils.formatSpaces(mediaFile))),
                        utils.FORMAT_AUDIO))
        else:
            convertCmd = '%s -y -i %s -b:a 320k %s' % (
                utils.FFMPEG, utils.formatSpaces('%s%s' % (utils.TEMPDIR, i)),
                utils.replaceExtension(
                    '%s%s' %
                    (utils.DOWNLOAD,
                     utils.formatConsole(utils.formatSpaces(mediaFile))),
                    '.mp3'))
    if utils.PROGRESS:
        downloadCmd = '%s --newline' % downloadCmd
        proc = utils.runProgressBarDownload(downloadCmd, quitFilter=False)
        utils.runProgressBarConvert(convertCmd)
    else:
        utils.displayNotification(utils.TITLE, url,
                                  '► Downloading Playlist\'s Audio',
                                  'open %s' % utils.DOWNLOAD)
        proc = utils.runProcess(downloadCmd)
        utils.runProcess(convertCmd)
    utils.displayNotification(utils.TITLE, url, 'Download Complete',
                              'open %s' % utils.DOWNLOAD)
    os.system('rm -rf %s' % utils.TEMPDIR)
    utils.sendDiagnostics('downloadPlaylistAudio', downloadCmd, convertCmd,
                          proc)
示例#18
0
def downloadAudio(url):
    utils.writeHistory(url)
    (mediaTitle, mediaFile) = utils.getMediaInfo(url)
    utils.writeTemp(url)
    downloadCmd = '%s -i %s -o %s' % (utils.YOUTUBE_DL, url, utils.TEMPORARY)
    if utils.FORMAT_AUDIO:
        if utils.FORMAT_AUDIO == '.mp3':
            convertCmd = '%s -y -i %s -b:a 320k %s' % (
                utils.FFMPEG, utils.TEMPORARY,
                utils.replaceExtension(
                    '%s%s' %
                    (utils.DOWNLOAD,
                     utils.formatConsole(utils.formatSpaces(mediaFile))),
                    utils.FORMAT_AUDIO))
        else:
            convertCmd = '%s -y -i %s %s' % (
                utils.FFMPEG, utils.TEMPORARY,
                utils.replaceExtension(
                    '%s%s' %
                    (utils.DOWNLOAD,
                     utils.formatConsole(utils.formatSpaces(mediaFile))),
                    utils.FORMAT_AUDIO))
    else:
        convertCmd = '%s -y -i %s -b:a 320k %s' % (
            utils.FFMPEG, utils.TEMPORARY,
            utils.replaceExtension(
                '%s%s' %
                (utils.DOWNLOAD,
                 utils.formatConsole(utils.formatSpaces(mediaFile))), '.mp3'))
    if utils.PROGRESS:
        downloadCmd = '%s --newline' % downloadCmd
        proc = utils.runProgressBarDownload(downloadCmd, quitFilter=False)
        utils.runProgressBarConvert(convertCmd)
    else:
        utils.displayNotification(utils.TITLE, mediaTitle,
                                  '► Downloading Audio',
                                  'open %s' % utils.DOWNLOAD)
        proc = utils.runProcess(downloadCmd)
        utils.runProcess(convertCmd)
    utils.displayNotification(utils.TITLE, mediaTitle, 'Download Complete',
                              'open %s' % utils.DOWNLOAD)
    os.system('rm -rf %s' % utils.TEMPORARY)
    utils.sendDiagnostics('downloadAudio', downloadCmd, convertCmd, proc)
示例#19
0
def downloadPlaylistVideo(url):
    utils.writeHistory(url)
    if utils.FORMAT_VIDEO:
        downloadCmd = 'cd %s;%s -citf %s %s' % (
            utils.DOWNLOAD, utils.YOUTUBE_DL, utils.FORMAT_VIDEO, url)
    else:
        downloadCmd = 'cd %s;%s -it %s' % (utils.DOWNLOAD, utils.YOUTUBE_DL,
                                           url)
    if utils.PROGRESS:
        downloadCmd = '%s --newline' % downloadCmd
        proc = utils.runProgressBarDownload(downloadCmd)
    else:
        utils.displayNotification(utils.TITLE, url,
                                  '► Downloading Playlist\'s Video',
                                  'open %s' % utils.DOWNLOAD)
        proc = utils.runProcess(downloadCmd)
    utils.displayNotification(utils.TITLE, url, 'Download Complete',
                              'open %s' % utils.DOWNLOAD)
    utils.sendDiagnostics('downloadPlaylistVideo', downloadCmd, '', proc)
示例#20
0
def setAudioFormat():
    audioFormats = {
        '.mp3':'MP3', '.wav':'WAV', '.ogg':'OGG', '.m4a':'M4A', '.wma':'WMA'
    }
    audioFormatsList = '"%s"' % '" "'.join(audioFormats.values())
    procCmd = '%s dropdown --title %s --text %s --items %s --string-output --button1 %s --button2 %s --button3 %s --float' % (utils.COCOA, 
    utils.TITLE, utils.formatSpaces('Choose default audio format:'), audioFormatsList, 'Ok', 'Cancel', 'Reset')
    desiredFormat = utils.runProcess(procCmd)
    if desiredFormat.split('\n')[0].lower() == 'cancel':
        sys.exit(0)
    elif desiredFormat.split('\n')[0].lower() == 'reset':
        wipeFormat = open(utils.FORMAT_AUDIO_PATH, 'w')
        wipeFormat.close()
        utils.displayNotification(utils.TITLE, 'Default audio download format reset', '', '')
    else:
        for key, value in audioFormats.iteritems():
            if value == desiredFormat.split('\n')[1].replace('\n', ''):
                newFormat = open(utils.FORMAT_AUDIO_PATH, 'w')
                newFormat.write(key)
                newFormat.close()
                utils.displayNotification(utils.TITLE, 'Default audio format: %s' % value, '', '')
示例#21
0
def setAudioFormat():
    audioFormats = {
        '.mp3':'MP3', '.wav':'WAV', '.ogg':'OGG', '.m4a':'M4A', '.wma':'WMA'
    }
    audioFormatsList = '"%s"' % '" "'.join(audioFormats.values())
    procCmd = '%s dropdown --title %s --text %s --items %s --string-output --button1 %s --button2 %s --button3 %s --float' % (utils.COCOA, 
    utils.TITLE, utils.formatSpaces('Choose default audio format:'), audioFormatsList, 'Ok', 'Cancel', 'Reset')
    desiredFormat = utils.runProcess(procCmd)
    if desiredFormat.split('\n')[0].lower() == 'cancel':
        sys.exit(0)
    elif desiredFormat.split('\n')[0].lower() == 'reset':
        wipeFormat = open(utils.FORMAT_AUDIO_PATH, 'w')
        wipeFormat.close()
        utils.displayNotification(utils.TITLE, 'Default audio download format reset', '', '')
    else:
        for key, value in audioFormats.iteritems():
            if value == desiredFormat.split('\n')[1].replace('\n', ''):
                newFormat = open(utils.FORMAT_AUDIO_PATH, 'w')
                newFormat.write(key)
                newFormat.close()
                utils.displayNotification(utils.TITLE, 'Default audio format: %s' % value, '', '')
示例#22
0
def downloadVideo(url):
    utils.writeHistory(url)
    (mediaTitle, mediaFile) = utils.getMediaInfo(url)
    utils.writeTemp(url)
    if utils.FORMAT_VIDEO:
        downloadCmd = 'cd %s;%s -itf %s %s' % (
            utils.DOWNLOAD, utils.YOUTUBE_DL, utils.FORMAT_VIDEO, url)
    else:
        downloadCmd = 'cd %s;%s -it %s' % (utils.DOWNLOAD, utils.YOUTUBE_DL,
                                           url)
    if utils.PROGRESS:
        downloadCmd = '%s --newline' % downloadCmd
        proc = utils.runProgressBarDownload(downloadCmd)
    else:
        utils.displayNotification(utils.TITLE, mediaTitle,
                                  '► Downloading Video',
                                  'open %s' % utils.DOWNLOAD)
        proc = utils.runProcess(downloadCmd)
    utils.displayNotification(utils.TITLE, mediaTitle, 'Download Complete',
                              'open %s' % utils.DOWNLOAD)
    utils.sendDiagnostics('downloadVideo', downloadCmd, '', proc)
示例#23
0
def advancedDownloadAudio(node, url, extension, fileName, mediaTitle, format):
    utils.writeHistory(url)
    utils.writeTemp(url)     
    downloadCmd = '%s %s -o %s' % (utils.YOUTUBE_DL, url, utils.TEMPORARY)
    if extension == '.mp3':
        convertCmd = '%s -y -i %s -b:a 320k %s' % (utils.FFMPEG, 
        utils.TEMPORARY, '%s%s' % (utils.DOWNLOAD, utils.replaceExtension(fileName, extension)))
    else:
        convertCmd = '%s -y -i %s %s' % (utils.FFMPEG,
        utils.TEMPORARY, '%s%s' % (utils.DOWNLOAD, utils.replaceExtension(fileName, extension)))
    if utils.PROGRESS:
        downloadCmd = '%s --newline' % downloadCmd
        utils.runProgressBarDownload(downloadCmd, quitFilter = False)
        proc = ''
        utils.runProgressBarConvert(convertCmd)
    else:
        utils.displayNotification(utils.TITLE, utils.deformatConsole(mediaTitle), '► Downloading Audio', 'open %s' % utils.DOWNLOAD)
        proc = utils.runProcess(downloadCmd)
        utils.runProcess(convertCmd)
    utils.killProgressBar()
    utils.displayNotification(utils.TITLE, utils.deformatConsole(mediaTitle), 'Download Complete', 'open %s' % utils.DOWNLOAD)
    utils.sendDiagnostics('advancedDownloadAudio', downloadCmd, convertCmd, proc)
示例#24
0
def setVideoFormat():
    videoFormats = {
        '5':'FLV 240p', '6':'FLV 270p', '17':'3GP 144p', '18':'MP4 360p', '22':'MP4 720p', '34':'FLV 360p',
        '35':'FLV 480p', '36':'3GP 240p', '37':'MP4 1080p', '43':'WebM 360p', '44':'WebM 480p', '45':'WebM 720p', '46':'WebM 1080p',
        '82':'[3D] MP4 360p', '83':'[3D] MP4 240p', '84':'[3D] MP4 720p', '85':'[3D] MP4 520p', '100':'[3D] WebM 360p', '102':'[3D] WebM 720p'
    }
    videoFormatsList = '"%s"' % '" "'.join(videoFormats.values())
    procCmd = '%s dropdown --title %s --text %s --items %s --string-output --button1 %s --button2 %s --button3 %s --float' % (utils.COCOA, 
    utils.TITLE, utils.formatSpaces('Choose desired video format:'), videoFormatsList, 'Ok', 'Cancel', 'Reset')
    desiredFormat = utils.runProcess(procCmd)
    if desiredFormat.split('\n')[0].lower() == 'cancel':
        sys.exit(0)
    elif desiredFormat.split('\n')[0].lower() == 'reset':
        wipeFormat = open(utils.FORMAT_VIDEO_PATH, 'w')
        wipeFormat.close()
        utils.displayNotification(utils.TITLE, 'Default video download format reset', '', '')
    else:
        for key, value in videoFormats.iteritems():
            if value == desiredFormat.split('\n')[1].replace('\n', ''):
                newFormat = open(utils.FORMAT_VIDEO_PATH, 'w')
                newFormat.write(key)
                newFormat.close()
                utils.displayNotification(utils.TITLE, 'Default video format: %s' % value, '', '')
示例#25
0
def setVideoFormat():
    videoFormats = {
        '5':'FLV 240p', '6':'FLV 270p', '17':'3GP 144p', '18':'MP4 360p', '22':'MP4 720p', '34':'FLV 360p',
        '35':'FLV 480p', '36':'3GP 240p', '37':'MP4 1080p', '43':'WebM 360p', '44':'WebM 480p', '45':'WebM 720p', '46':'WebM 1080p',
        '82':'[3D] MP4 360p', '83':'[3D] MP4 240p', '84':'[3D] MP4 720p', '85':'[3D] MP4 520p', '100':'[3D] WebM 360p', '102':'[3D] WebM 720p'
    }
    videoFormatsList = '"%s"' % '" "'.join(videoFormats.values())
    procCmd = '%s dropdown --title %s --text %s --items %s --string-output --button1 %s --button2 %s --button3 %s --float' % (utils.COCOA, 
    utils.TITLE, utils.formatSpaces('Choose desired video format:'), videoFormatsList, 'Ok', 'Cancel', 'Reset')
    desiredFormat = utils.runProcess(procCmd)
    if desiredFormat.split('\n')[0].lower() == 'cancel':
        sys.exit(0)
    elif desiredFormat.split('\n')[0].lower() == 'reset':
        wipeFormat = open(utils.FORMAT_VIDEO_PATH, 'w')
        wipeFormat.close()
        utils.displayNotification(utils.TITLE, 'Default video download format reset', '', '')
    else:
        for key, value in videoFormats.iteritems():
            if value == desiredFormat.split('\n')[1].replace('\n', ''):
                newFormat = open(utils.FORMAT_VIDEO_PATH, 'w')
                newFormat.write(key)
                newFormat.close()
                utils.displayNotification(utils.TITLE, 'Default video format: %s' % value, '', '')