Example #1
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)
                          
Example #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)
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', '', '')
Example #4
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 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)
Example #6
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)
Example #7
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], '')
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], '')
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)
Example #10
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)
Example #11
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)
    
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, '', '')
Example #13
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, '', '')
Example #14
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)
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, '', '')
Example #16
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, '', '')
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)
Example #18
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)