예제 #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 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)
예제 #3
0
def downloadVideo_Audio(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.FORMAT_AUDIO:
        if utils.FORMAT_AUDIO == '.mp3':
            convertCmd = '%s -y -i %s -b:a 320k %s' % (utils.FFMPEG, utils.formatConsole(utils.formatSpaces('%s%s' % (utils.DOWNLOAD, mediaFile))), 
            utils.replaceExtension('%s%s' % (utils.DOWNLOAD, utils.formatConsole(utils.formatSpaces(mediaFile))), utils.FORMAT_AUDIO))
        else:
            convertCmd = '%s -y -i %s %s' % (utils.FFMPEG, utils.formatConsole(utils.formatSpaces('%s%s' % (utils.DOWNLOAD, mediaFile))),
            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.formatConsole(utils.formatSpaces('%s%s' % (utils.DOWNLOAD, mediaFile))), 
        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 Video', 'open %s' % utils.DOWNLOAD)
        proc = utils.runProcess(downloadCmd)
        utils.displayNotification(utils.TITLE, mediaTitle, '► Downloading Audio', 'open %s' % utils.DOWNLOAD)
        utils.runProcess(convertCmd)
    utils.displayNotification(utils.TITLE, mediaTitle, 'Download Complete', 'open %s' % utils.DOWNLOAD)
    utils.sendDiagnostics('downloadVideo_Audio', downloadCmd, convertCmd, proc)
                          
예제 #4
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', '', '')
예제 #5
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', '', '')
예제 #6
0
def downloadVideo_Audio(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.FORMAT_AUDIO:
        if utils.FORMAT_AUDIO == '.mp3':
            convertCmd = '%s -y -i %s -b:a 320k %s' % (
                utils.FFMPEG,
                utils.formatConsole(
                    utils.formatSpaces('%s%s' % (utils.DOWNLOAD, mediaFile))),
                utils.replaceExtension(
                    '%s%s' %
                    (utils.DOWNLOAD,
                     utils.formatConsole(utils.formatSpaces(mediaFile))),
                    utils.FORMAT_AUDIO))
        else:
            convertCmd = '%s -y -i %s %s' % (
                utils.FFMPEG,
                utils.formatConsole(
                    utils.formatSpaces('%s%s' % (utils.DOWNLOAD, mediaFile))),
                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.formatConsole(
                utils.formatSpaces('%s%s' % (utils.DOWNLOAD, mediaFile))),
            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 Video',
                                  'open %s' % utils.DOWNLOAD)
        proc = utils.runProcess(downloadCmd)
        utils.displayNotification(utils.TITLE, mediaTitle,
                                  '► Downloading Audio',
                                  'open %s' % utils.DOWNLOAD)
        utils.runProcess(convertCmd)
    utils.displayNotification(utils.TITLE, mediaTitle, 'Download Complete',
                              'open %s' % utils.DOWNLOAD)
    utils.sendDiagnostics('downloadVideo_Audio', downloadCmd, convertCmd, proc)
예제 #7
0
def parseQuery(query):
    try:
        q = ast.literal_eval(query)
        if q['node'] == 1:
            downloadPlaylistVideo(q['url'])
        else:
           downloadPlaylistAudio(q['url'])
    except UnicodeDecodeError:
        pass
    except:
        utils.runProcess('osascript -e \'tell application \"Alfred 2\" to search \"luxplaylist ► \" & \"%s\"\'' % query)
                          
예제 #8
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)
예제 #9
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)
예제 #10
0
 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)
예제 #11
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', '', '')
예제 #12
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', '', '')
예제 #13
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], '')
예제 #14
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], '')
예제 #15
0
def checkUpdates():
    import ast
    import urllib2
    import webbrowser
    updateDict = ast.literal_eval(urllib2.urlopen('https://raw.github.com/Ritashugisha/luxinate/master/Updates/update.txt').read())
    if updateDict['version'] > utils.VERSION:
        procCmd = '%s msgbox --title %s --text %s --informative-text %s  --button1 %s --button2 %s --button3 %s --string-output --float' % (utils.COCOA, 
        utils.TITLE, utils.formatSpaces('Luxinate %s is available to update!' % updateInfo['version']),
        utils.formatSpaces('Choose which color of Luxinate you would like to update:'), 'Black', 'White', 'Cancel')
        updateResponse = utils.runProcess(procCmd)
        if updateResponse.lower() == 'cancel':
            sys.exit(0)
        else:
            if updateResponse.lower()[0] == 'w':
                webbrowser.open(updateInfo['white'])
            elif updateResponse.lower()[0] == 'b':
                webbrowser.open(updateInfo['black'])
    else:
        procCmd = '%s msgbox --title %s --text %s --button1 %s' % (utils.COCOA, 
        utils.TITLE, utils.formatSpaces('Your version of Luxinate is up to date!'), 'Ok')
        utils.runProcess(procCmd)
예제 #16
0
def checkUpdates():
    import ast
    import urllib2
    import webbrowser
    updateDict = ast.literal_eval(urllib2.urlopen('https://raw.github.com/Ritashugisha/luxinate/master/Updates/update.txt').read())
    if updateDict['version'] > utils.VERSION:
        procCmd = '%s msgbox --title %s --text %s --informative-text %s  --button1 %s --button2 %s --button3 %s --string-output --float' % (utils.COCOA, 
        utils.TITLE, utils.formatSpaces('Luxinate %s is available to update!' % updateInfo['version']),
        utils.formatSpaces('Choose which color of Luxinate you would like to update:'), 'Black', 'White', 'Cancel')
        updateResponse = utils.runProcess(procCmd)
        if updateResponse.lower() == 'cancel':
            sys.exit(0)
        else:
            if updateResponse.lower()[0] == 'w':
                webbrowser.open(updateInfo['white'])
            elif updateResponse.lower()[0] == 'b':
                webbrowser.open(updateInfo['black'])
    else:
        procCmd = '%s msgbox --title %s --text %s --button1 %s' % (utils.COCOA, 
        utils.TITLE, utils.formatSpaces('Your version of Luxinate is up to date!'), 'Ok')
        utils.runProcess(procCmd)
예제 #17
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)
예제 #18
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)
예제 #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 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)
예제 #21
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)
예제 #22
0
def getVideoFormats(url):
    formatCmd = '%s -F %s' % (utils.YOUTUBE_DL, url)
    format = utils.runProcess(formatCmd)
    formatDict = {}
    formatValues = []
    for i in format.split('\n'):
        if '[youtube]' in i.lower() or 'available' in i.lower() or 'format code' in i.lower():
            pass
        else:
            try:
                fileFormats = re.sub(' +', ':', i).split(':')
                formatDict[fileFormats[0]] = '%s  [%s]' % (fileFormats[1], fileFormats[2])
            except IndexError:
                pass
    for i in formatDict.iteritems():
        formatValues.append(i)
    return formatValues
예제 #23
0
def getVideoFormats(url):
    formatCmd = '%s -F %s' % (utils.YOUTUBE_DL, url)
    format = utils.runProcess(formatCmd)
    formatDict = {}
    formatValues = []
    for i in format.split('\n'):
        if '[youtube]' in i.lower() or 'available' in i.lower():
            pass
        else:
            try:
                formatDict[i.replace('\t', '').split(':')[0]] = i.replace(
                    '\t', '').split(':')[1].replace('[', ' [')
            except IndexError:
                pass
    for i in formatDict.iteritems():
        formatValues.append(i)
    return formatValues
예제 #24
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)
예제 #25
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)
예제 #26
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, '', '')
예제 #27
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, '', '')
예제 #28
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, '', '')
예제 #29
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, '', '')
예제 #30
0
def openLuxDefault(query):
    osaCmd = 'osascript -e \'tell application "Alfred 2" to search "lux ► " & "' + query[
        'url'] + '"\''
    utils.runProcess(osaCmd)
예제 #31
0
def process(browser):
    osaCmd = "osascript -e 'tell application \"%s\" to get URL of every Tab of every Window'" % browser
    return utils.runProcess(osaCmd).replace('\n', '').split(', ')
예제 #32
0
def displayAbout():
    proc = '%s textbox --title %s --informative-text %s --text-from-file %s --button1 %s --float' % (utils.COCOA,
    utils.TITLE, utils.formatSpaces('About Luxinate:'), utils.ABOUT, 'Ok')
    utils.runProcess(proc)
예제 #33
0
def openLuxDefault(query):
    osaCmd = 'osascript -e \'tell application "Alfred 2" to search "luxinate ► " & "' + query['url'] + '"\''
    utils.runProcess(osaCmd)
    
예제 #34
0
def process(browser):
    osaCmd = "osascript -e 'tell application \"%s\" to get URL of every Tab of every Window'" % browser
    return utils.runProcess(osaCmd).replace('\n', '').split(', ')
예제 #35
0
def displayAbout():
    proc = '%s textbox --title %s --informative-text %s --text-from-file %s --button1 %s --float' % (utils.COCOA,
    utils.TITLE, utils.formatSpaces('About Luxinate:'), utils.ABOUT, 'Ok')
    utils.runProcess(proc)