mirror of
https://github.com/beetbox/beets.git
synced 2026-01-30 12:02:41 +01:00
replaygain: Fix TypeError if command option is not set
This commit is contained in:
parent
f2ab26d6a4
commit
4ebc5237d0
1 changed files with 8 additions and 6 deletions
|
|
@ -61,14 +61,16 @@ class ReplayGainPlugin(BeetsPlugin):
|
|||
'targetlevel', DEFAULT_REFERENCE_LOUDNESS))
|
||||
self.gain_offset = int(target_level-DEFAULT_REFERENCE_LOUDNESS)
|
||||
self.command = ui.config_val(config,'replaygain','command', None)
|
||||
if not os.path.isfile(self.command):
|
||||
raise ui.UserError('no valid rgain command filepath given')
|
||||
if not self.command:
|
||||
if self.command:
|
||||
if not os.path.isfile(self.command):
|
||||
raise ui.UserError('no valid rgain command filepath given')
|
||||
else:
|
||||
for cmd in ['mp3gain','aacgain']:
|
||||
proc = subprocess.Popen([cmd,'-v'])
|
||||
retcode = proc.poll()
|
||||
if not retcode:
|
||||
try:
|
||||
subprocess.call([cmd,'-v'], stderr=subprocess.PIPE)
|
||||
self.command = cmd
|
||||
except OSError:
|
||||
pass
|
||||
if not self.command:
|
||||
raise ui.UserError('no valid rgain command found')
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue