diff --git a/data/interfaces/brink/config.html b/data/interfaces/brink/config.html index f624f1f7..5a1c1620 100644 --- a/data/interfaces/brink/config.html +++ b/data/interfaces/brink/config.html @@ -504,7 +504,7 @@

Re-Encoding Options:

- + Re-encode downloads during postprocessing

@@ -757,7 +757,7 @@ $('#api_key').val(data); }); }); - if ($("#encode").is(":checked")) + if ($("#music_encoder").is(":checked")) { $("#encoderoptions").show(); } @@ -766,8 +766,8 @@ $("#encoderoptions").hide(); } - $("#encode").click(function(){ - if ($("#encode").is(":checked")) + $("#music_encoder").click(function(){ + if ($("#music_encoder").is(":checked")) { $("#encoderoptions").show("fast"); } diff --git a/data/interfaces/classic/config.html b/data/interfaces/classic/config.html index f75b5c50..4d2a4b16 100644 --- a/data/interfaces/classic/config.html +++ b/data/interfaces/classic/config.html @@ -349,7 +349,7 @@

Re-Encoding Options:

Note: this option requires the lame or ffmpeg encoder

-

Re-encode downloads during postprocessing

+

Re-encode downloads during postprocessing


Only re-encode lossless files (.flac)

@@ -580,7 +580,7 @@ $('#api_key').val(data); }); }); - if ($("#encode").is(":checked")) + if ($("#music_encoder").is(":checked")) { $("#encoderoptions").show(); } @@ -589,8 +589,8 @@ $("#encoderoptions").hide(); } - $("#encode").click(function(){ - if ($("#encode").is(":checked")) + $("#music_encoder").click(function(){ + if ($("#music_encoder").is(":checked")) { $("#encoderoptions").show("fast"); } diff --git a/data/interfaces/default/config.html b/data/interfaces/default/config.html index faa9597b..cb59b82a 100644 --- a/data/interfaces/default/config.html +++ b/data/interfaces/default/config.html @@ -327,7 +327,7 @@ Re-Encoding Options Note: this option requires the lame or ffmpeg encoder
- +
@@ -674,7 +674,7 @@ $('#api_key').val(data); }); }); - if ($("#encode").is(":checked")) + if ($("#music_encoder").is(":checked")) { $("#encoderoptions").show(); } @@ -683,8 +683,8 @@ $("#encoderoptions").hide(); } - $("#encode").click(function(){ - if ($("#encode").is(":checked")) + $("#music_encoder").click(function(){ + if ($("#music_encoder").is(":checked")) { $("#encoderoptions").slideDown(); } diff --git a/data/interfaces/remix/config.html b/data/interfaces/remix/config.html index f75b5c50..4d2a4b16 100644 --- a/data/interfaces/remix/config.html +++ b/data/interfaces/remix/config.html @@ -349,7 +349,7 @@

Re-Encoding Options:

Note: this option requires the lame or ffmpeg encoder

-

Re-encode downloads during postprocessing

+

Re-encode downloads during postprocessing


Only re-encode lossless files (.flac)

@@ -580,7 +580,7 @@ $('#api_key').val(data); }); }); - if ($("#encode").is(":checked")) + if ($("#music_encoder").is(":checked")) { $("#encoderoptions").show(); } @@ -589,8 +589,8 @@ $("#encoderoptions").hide(); } - $("#encode").click(function(){ - if ($("#encode").is(":checked")) + $("#music_encoder").click(function(){ + if ($("#music_encoder").is(":checked")) { $("#encoderoptions").show("fast"); } diff --git a/headphones/__init__.py b/headphones/__init__.py index 408e0a8f..14b02970 100644 --- a/headphones/__init__.py +++ b/headphones/__init__.py @@ -128,7 +128,7 @@ DOWNLOAD_TORRENT_DIR = None INTERFACE = None FOLDER_PERMISSIONS = None -ENCODE = False +MUSIC_ENCODER = False ENCODERFOLDER = None ENCODER = None BITRATE = None @@ -218,7 +218,7 @@ def initialize(): LIBRARYSCAN_INTERVAL, DOWNLOAD_SCAN_INTERVAL, SAB_HOST, SAB_USERNAME, SAB_PASSWORD, SAB_APIKEY, SAB_CATEGORY, \ NZBMATRIX, NZBMATRIX_USERNAME, NZBMATRIX_APIKEY, NEWZNAB, NEWZNAB_HOST, NEWZNAB_APIKEY, \ NZBSORG, NZBSORG_UID, NZBSORG_HASH, NEWZBIN, NEWZBIN_UID, NEWZBIN_PASSWORD, LASTFM_USERNAME, INTERFACE, FOLDER_PERMISSIONS, \ - ENCODERFOLDER, ENCODER, BITRATE, SAMPLINGFREQUENCY, ENCODE, ADVANCEDENCODER, ENCODEROUTPUTFORMAT, ENCODERQUALITY, ENCODERVBRCBR, \ + ENCODERFOLDER, ENCODER, BITRATE, SAMPLINGFREQUENCY, MUSIC_ENCODER, ADVANCEDENCODER, ENCODEROUTPUTFORMAT, ENCODERQUALITY, ENCODERVBRCBR, \ ENCODERLOSSLESS, PROWL_ENABLED, PROWL_PRIORITY, PROWL_KEYS, PROWL_ONSNATCH, MIRRORLIST, MIRROR, CUSTOMHOST, CUSTOMPORT, \ CUSTOMSLEEP, HPUSER, HPPASS, XBMC_ENABLED, XBMC_HOST, XBMC_USERNAME, XBMC_PASSWORD, XBMC_UPDATE, XBMC_NOTIFY, NMA_ENABLED, NMA_APIKEY, NMA_PRIORITY @@ -322,7 +322,7 @@ def initialize(): ENCODER = check_setting_str(CFG, 'General', 'encoder', 'ffmpeg') BITRATE = check_setting_int(CFG, 'General', 'bitrate', 192) SAMPLINGFREQUENCY= check_setting_int(CFG, 'General', 'samplingfrequency', 44100) - ENCODE = bool(check_setting_int(CFG, 'General', 'encode', 0)) + MUSIC_ENCODER = bool(check_setting_int(CFG, 'General', 'music_encoder', 0)) ADVANCEDENCODER = check_setting_str(CFG, 'General', 'advancedencoder', '') ENCODEROUTPUTFORMAT = check_setting_str(CFG, 'General', 'encoderoutputformat', 'mp3') ENCODERQUALITY = check_setting_int(CFG, 'General', 'encoderquality', 2) @@ -595,7 +595,7 @@ def config_write(): new_config['General']['interface'] = INTERFACE new_config['General']['folder_permissions'] = FOLDER_PERMISSIONS - new_config['General']['encode'] = int(ENCODE) + new_config['General']['music_encoder'] = int(MUSIC_ENCODER) new_config['General']['encoder'] = ENCODER new_config['General']['bitrate'] = int(BITRATE) new_config['General']['samplingfrequency'] = int(SAMPLINGFREQUENCY) diff --git a/headphones/encode.py b/headphones/music_encoder.py similarity index 95% rename from headphones/encode.py rename to headphones/music_encoder.py index 6dd5a1f9..110f912b 100644 --- a/headphones/encode.py +++ b/headphones/music_encoder.py @@ -18,7 +18,7 @@ def encode(albumPath): musicFinalFiles=[] musicTempFiles=[] encoder ="" - startAlbumTime=time.clock() + startAlbumTime=time.time() ifencoded=0 if not os.path.exists(tempDirEncode): @@ -89,7 +89,7 @@ def encode(albumPath): def command(encoder,musicSource,musicDest,albumPath): return_code=1 cmd='' - startMusicTime=time.clock() + startMusicTime=time.time() if headphones.ENCODER == 'lame': if headphones.ADVANCEDENCODER =='': cmd=encoder + ' -h' @@ -115,7 +115,7 @@ def command(encoder,musicSource,musicDest,albumPath): cmd=cmd+ ' -ar ' + str(headphones.SAMPLINGFREQUENCY) + ' -ab ' + str(headphones.BITRATE) + 'k' elif headphones.ENCODERVBRCBR=='vbr': cmd=cmd+' -aq ' + str(headphones.ENCODERQUALITY) - cmd=cmd+ ' -y -ac 2 -map_meta_data 0:0,s0 -vn' + cmd=cmd+ ' -y -ac 2 -vn' else: cmd=cmd+' '+ headphones.ADVANCEDENCODER cmd=cmd+ ' "' + musicDest + '"' @@ -128,7 +128,7 @@ def command(encoder,musicSource,musicDest,albumPath): logger.info('Music "%s" encoded in %s' % (musicSource,getTimeEncode(startMusicTime))) def getTimeEncode(start): - seconds =int(time.clock()-start) + seconds =int(time.time()-start) hours = seconds / 3600 seconds -= 3600*hours minutes = seconds / 60 diff --git a/headphones/postprocessor.py b/headphones/postprocessor.py index 9084fae3..5a494cf1 100644 --- a/headphones/postprocessor.py +++ b/headphones/postprocessor.py @@ -1,6 +1,6 @@ import os import time -import encode +import music_encoder import urllib, shutil, re from headphones import notifiers import lib.beets as beets @@ -209,8 +209,8 @@ def doPostProcessing(albumid, albumpath, release, tracks, downloaded_track_list) logger.info('Starting post-processing for: %s - %s' % (release['ArtistName'], release['AlbumTitle'])) #start enconding - if headphones.ENCODE: - downloaded_track_list=encode.encode(albumpath) + if headphones.MUSIC_ENCODER: + downloaded_track_list=music_encoder.encode(albumpath) album_art_path = albumart.getAlbumArt(albumid) diff --git a/headphones/webserve.py b/headphones/webserve.py index 32459a27..055d0964 100644 --- a/headphones/webserve.py +++ b/headphones/webserve.py @@ -387,7 +387,7 @@ class WebInterface(object): "autowant_all" : checked(headphones.AUTOWANT_ALL), "log_dir" : headphones.LOG_DIR, "interface_list" : interface_list, - "encode": checked(headphones.ENCODE), + "music_encoder": checked(headphones.MUSIC_ENCODER), "encoder": headphones.ENCODER, "bitrate": int(headphones.BITRATE), "encoderfolder": headphones.ENCODERFOLDER, @@ -428,7 +428,7 @@ class WebInterface(object): nzbsorg=0, nzbsorg_uid=None, nzbsorg_hash=None, newzbin=0, newzbin_uid=None, newzbin_password=None, preferred_quality=0, preferred_bitrate=None, detect_bitrate=0, move_files=0, torrentblackhole_dir=None, download_torrent_dir=None, numberofseeders=10, use_isohunt=0, use_kat=0, use_mininova=0, rename_files=0, correct_metadata=0, cleanup_files=0, add_album_art=0, embed_album_art=0, embed_lyrics=0, destination_dir=None, folder_format=None, file_format=None, include_extras=0, autowant_upcoming=False, autowant_all=False, interface=None, log_dir=None, - encode=0, encoder=None, bitrate=None, samplingfrequency=None, encoderfolder=None, advancedencoder=None, encoderoutputformat=None, encodervbrcbr=None, encoderquality=None, encoderlossless=0, + music_encoder=0, encoder=None, bitrate=None, samplingfrequency=None, encoderfolder=None, advancedencoder=None, encoderoutputformat=None, encodervbrcbr=None, encoderquality=None, encoderlossless=0, prowl_enabled=0, prowl_onsnatch=0, prowl_keys=None, prowl_priority=0, xbmc_enabled=0, xbmc_host=None, xbmc_username=None, xbmc_password=None, xbmc_update=0, xbmc_notify=0, nma_enabled=False, nma_apikey=None, nma_priority=0, mirror=None, customhost=None, customport=None, customsleep=None, hpuser=None, hppass=None): @@ -487,7 +487,7 @@ class WebInterface(object): headphones.AUTOWANT_ALL = autowant_all headphones.INTERFACE = interface headphones.LOG_DIR = log_dir - headphones.ENCODE = encode + headphones.MUSIC_ENCODER = music_encoder headphones.ENCODER = encoder headphones.BITRATE = int(bitrate) headphones.SAMPLINGFREQUENCY = int(samplingfrequency)