mirror of
https://github.com/rembo10/headphones.git
synced 2026-04-04 12:09:27 +01:00
- Add vbr encoder
This commit is contained in:
@@ -289,6 +289,31 @@
|
||||
%endfor
|
||||
</select></h4>
|
||||
|
||||
<br>
|
||||
<h4>VBR/CBR: <select name="encodervbrcbr">
|
||||
%for x in ['cbr', 'vbr']:
|
||||
<%
|
||||
if config['encodervbrcbr'] == x:
|
||||
outputselect = 'selected'
|
||||
else:
|
||||
outputselect = ''
|
||||
%>
|
||||
<option value=${x} ${outputselect}>${x}</option>
|
||||
%endfor
|
||||
</select>
|
||||
|
||||
Quality: <select name="encoderquality">
|
||||
%for x in [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]:
|
||||
<%
|
||||
if config['encoderquality'] == x:
|
||||
outputselect = 'selected'
|
||||
else:
|
||||
outputselect = ''
|
||||
%>
|
||||
<option value=${x} ${outputselect}>${x}</option>
|
||||
%endfor
|
||||
</select></h4>
|
||||
|
||||
<br>
|
||||
<h4>Bitrate: <select name="bitrate">
|
||||
%for x in [64, 128, 192, 256, 320]:
|
||||
|
||||
@@ -289,6 +289,31 @@
|
||||
%endfor
|
||||
</select></h4>
|
||||
|
||||
<br>
|
||||
<h4>VBR/CBR: <select name="encodervbrcbr">
|
||||
%for x in ['cbr', 'vbr']:
|
||||
<%
|
||||
if config['encodervbrcbr'] == x:
|
||||
outputselect = 'selected'
|
||||
else:
|
||||
outputselect = ''
|
||||
%>
|
||||
<option value=${x} ${outputselect}>${x}</option>
|
||||
%endfor
|
||||
</select>
|
||||
|
||||
Quality: <select name="encoderquality">
|
||||
%for x in [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]:
|
||||
<%
|
||||
if config['encoderquality'] == x:
|
||||
outputselect = 'selected'
|
||||
else:
|
||||
outputselect = ''
|
||||
%>
|
||||
<option value=${x} ${outputselect}>${x}</option>
|
||||
%endfor
|
||||
</select></h4>
|
||||
|
||||
<br>
|
||||
<h4>Bitrate: <select name="bitrate">
|
||||
%for x in [64, 128, 192, 256, 320]:
|
||||
|
||||
@@ -270,7 +270,7 @@ def initialize():
|
||||
ENCODE = bool(check_setting_int(CFG, 'General', 'encode', 0))
|
||||
ADVANCEDENCODER = check_setting_str(CFG, 'General', 'advancedencoder', '')
|
||||
ENCODEROUTPUTFORMAT = check_setting_str(CFG, 'General', 'encoderoutputformat', 'mp3')
|
||||
ENCODERQUALITY = check_setting_int(CFG, 'General', 'vorbisquality', 60)
|
||||
ENCODERQUALITY = check_setting_int(CFG, 'General', 'vorbisquality', 5)
|
||||
ENCODERVBRCBR = check_setting_str(CFG, 'General', 'encodervbrcbr', 'cbr')
|
||||
|
||||
if not LOG_DIR:
|
||||
|
||||
@@ -90,7 +90,12 @@ def command(encoder,musicSource,musicDest,albumPath):
|
||||
if headphones.ENCODERVBRCBR=='cbr':
|
||||
cmd=cmd+ ' --resample ' + str(headphones.SAMPLINGFREQUENCY) + ' -b ' + str(headphones.BITRATE)
|
||||
elif headphones.ENCODERVBRCBR=='vbr':
|
||||
cmd=cmd+''
|
||||
if (ENCODERQUALITY>=0 and ENCODERQUALITY<=9):
|
||||
cmd=cmd+' -V'+str(ENCODERQUALITY)
|
||||
elif (ENCODERQUALITY<0):
|
||||
cmd=cmd+' -V0'
|
||||
elif (ENCODERQUALITY>9):
|
||||
cmd=cmd+' -V9'
|
||||
cmd=cmd+ ' ' + headphones.ADVANCEDENCODER
|
||||
cmd=cmd+ ' "' + musicSource + '"'
|
||||
cmd=cmd+ ' "' + musicDest +'"'
|
||||
@@ -104,7 +109,12 @@ def command(encoder,musicSource,musicDest,albumPath):
|
||||
if headphones.ENCODERVBRCBR=='cbr':
|
||||
cmd=cmd+ ' -ar ' + str(headphones.SAMPLINGFREQUENCY) + ' -ab ' + str(headphones.BITRATE) + 'k'
|
||||
elif headphones.ENCODERVBRCBR=='vbr':
|
||||
cmd=cmd+''
|
||||
if (ENCODERQUALITY>=0 and ENCODERQUALITY<=9):
|
||||
cmd=cmd+' -V'+str(ENCODERQUALITY)
|
||||
elif (ENCODERQUALITY<0):
|
||||
cmd=cmd+' -V0'
|
||||
elif (ENCODERQUALITY>9):
|
||||
cmd=cmd+' -V9'
|
||||
cmd=cmd+ ' -y -ac 2 -map_metadata 0:0,s0 -vn'
|
||||
cmd=cmd+ ' ' + headphones.ADVANCEDENCODER
|
||||
cmd=cmd+ ' "' + musicDest + '"'
|
||||
|
||||
@@ -357,7 +357,9 @@ class WebInterface(object):
|
||||
"encoderfolder": headphones.ENCODERFOLDER,
|
||||
"advancedencoder": headphones.ADVANCEDENCODER,
|
||||
"encoderoutputformat": headphones.ENCODEROUTPUTFORMAT,
|
||||
"samplingfrequency": int(headphones.SAMPLINGFREQUENCY)
|
||||
"samplingfrequency": int(headphones.SAMPLINGFREQUENCY),
|
||||
"encodervbrcbr": (headphones.ENCODERVBRCBR),
|
||||
"encoderquality": int(headphones.ENCODERQUALITY)
|
||||
}
|
||||
return serve_template(templatename="config.html", title="Settings", config=config)
|
||||
config.exposed = True
|
||||
@@ -368,7 +370,7 @@ class WebInterface(object):
|
||||
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, embed_lyrics=0, destination_dir=None, folder_format=None, file_format=None, include_extras=0, interface=None, log_dir=None,
|
||||
encode=0, encoder=None, bitrate=None, samplingfrequency=None, encoderfolder=None, advancedencoder=None, encoderoutputformat=None):
|
||||
encode=0, encoder=None, bitrate=None, samplingfrequency=None, encoderfolder=None, advancedencoder=None, encoderoutputformat=None, encodervbrcbr=None, encoderquality=None):
|
||||
|
||||
headphones.HTTP_HOST = http_host
|
||||
headphones.HTTP_PORT = http_port
|
||||
@@ -419,6 +421,8 @@ class WebInterface(object):
|
||||
headphones.ENCODERFOLDER = encoderfolder
|
||||
headphones.ADVANCEDENCODER = advancedencoder
|
||||
headphones.ENCODEROUTPUTFORMAT = encoderoutputformat
|
||||
headphones.ENCODERVBRCBR = encodervbrcbr
|
||||
headphones.ENCODERQUALITY = int(encoderquality)
|
||||
|
||||
headphones.config_write()
|
||||
|
||||
|
||||
Reference in New Issue
Block a user