diff --git a/data/interfaces/default/config.html b/data/interfaces/default/config.html index 4c39f17d..5e513e4b 100644 --- a/data/interfaces/default/config.html +++ b/data/interfaces/default/config.html @@ -260,16 +260,24 @@

Re-Encoding Options:


-

Convert Lossless to mp3

+

Convert Lossless to mp3

Note: this option requires the lame or ffdshow encoder

+ <% + if config['encoder'] == 'lame': + lameselect = 'selected="selected"' + ffdshowselect = '' + else: + lameselect = '' + ffdshowselect = 'selected="selected"' + %>

Encoder: - Bitrate: kbps
+ Bitrate: kbps

-

Path to Encoder:

+

Path to Encoder:

diff --git a/headphones/__init__.py b/headphones/__init__.py index ed642a8c..a602f53e 100644 --- a/headphones/__init__.py +++ b/headphones/__init__.py @@ -109,7 +109,7 @@ MEDIA_FORMATS = ["mp3", "flac", "aac", "ogg", "ape", "m4a"] INTERFACE = None FOLDER_PERMISSIONS = None -ENCODE = None +ENCODE = False ENCODERFOLDER = None ENCODER = None BITRATE = None @@ -256,9 +256,9 @@ def initialize(): ENCODERFOLDER = check_setting_str(CFG, 'General', 'encoderfolder', '') ENCODER = check_setting_str(CFG, 'General', 'encoder', 'ffmpeg') - BITRATE = check_setting_str(CFG, 'General', 'bitrate', '128') - SAMPLINGFREQUENCY= check_setting_str(CFG, 'General', 'samplingfrequency', '44100') - ENCODE = check_setting_str(CFG, 'General', 'encode', 'false') + BITRATE = check_setting_int(CFG, 'General', 'bitrate', 128) + SAMPLINGFREQUENCY= check_setting_int(CFG, 'General', 'samplingfrequency', 44100) + ENCODE = bool(check_setting_int(CFG, 'General', 'encode', 0)) @@ -431,7 +431,7 @@ def config_write(): new_config['General']['interface'] = INTERFACE new_config['General']['folder_permissions'] = FOLDER_PERMISSIONS - new_config['General']['encode'] = ENCODE + new_config['General']['encode'] = int(ENCODE) new_config['General']['encoder'] = ENCODER new_config['General']['bitrate'] = BITRATE new_config['General']['samplingfrequency'] = SAMPLINGFREQUENCY diff --git a/headphones/webserve.py b/headphones/webserve.py index d5fe8006..e77f6eb2 100644 --- a/headphones/webserve.py +++ b/headphones/webserve.py @@ -349,7 +349,11 @@ class WebInterface(object): "file_format" : headphones.FILE_FORMAT, "include_extras" : checked(headphones.INCLUDE_EXTRAS), "log_dir" : headphones.LOG_DIR, - "interface_list" : interface_list + "interface_list" : interface_list, + "encode": checked(headphones.ENCODE), + "encoder": headphones.ENCODER, + "bitrate": headphones.BITRATE, + "encoderfolder": headphones.ENCODERFOLDER } return serve_template(templatename="config.html", title="Settings", config=config) config.exposed = True @@ -359,7 +363,8 @@ class WebInterface(object): sab_host=None, sab_username=None, sab_apikey=None, sab_password=None, sab_category=None, download_dir=None, blackhole=0, blackhole_dir=None, usenet_retention=None, nzbmatrix=0, nzbmatrix_username=None, nzbmatrix_apikey=None, newznab=0, newznab_host=None, newznab_apikey=None, 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, - rename_files=0, correct_metadata=0, cleanup_files=0, add_album_art=0, embed_album_art=0, destination_dir=None, folder_format=None, file_format=None, include_extras=0, interface=None, log_dir=None): + rename_files=0, correct_metadata=0, cleanup_files=0, add_album_art=0, embed_album_art=0, destination_dir=None, folder_format=None, file_format=None, include_extras=0, interface=None, log_dir=None, + encode=0, encoder=None, bitrate=None, encoderfolder=None): headphones.HTTP_HOST = http_host headphones.HTTP_PORT = http_port @@ -402,6 +407,10 @@ class WebInterface(object): headphones.INCLUDE_EXTRAS = include_extras headphones.INTERFACE = interface headphones.LOG_DIR = log_dir + headphones.ENCODE = encode + headphones.ENCODER = encoder + headphones.BITRATE = bitrate + headphones.ENCODERFOLDER = encoderfolder headphones.config_write()