Also look for pyfpcalc

This commit is contained in:
Lukáš Lalinský
2012-09-30 18:52:29 +02:00
parent 4eb945cd99
commit d246d57093
4 changed files with 7 additions and 7 deletions

View File

@@ -19,7 +19,7 @@
from collections import deque
from PyQt4 import QtCore
from picard.const import ACOUSTID_KEY
from picard.const import ACOUSTID_KEY, FPCALC_NAMES
from picard.util import partial, call_next, find_executable
from picard.webservice import XmlNode
@@ -33,7 +33,7 @@ class AcoustIDClient(QtCore.QObject):
self._max_processes = 2
if not self.config.setting["acoustid_fpcalc"]:
fpcalc_path = find_executable("fpcalc")
fpcalc_path = find_executable(*FPCALC_NAMES)
if fpcalc_path:
self.config.setting["acoustid_fpcalc"] = fpcalc_path

View File

@@ -23,6 +23,7 @@ __builtin__.__dict__['N_'] = lambda a: a
# AcoustID client API key
ACOUSTID_KEY = '0zClDiGo'
FPCALC_NAMES = ['fpcalc', 'pyfpcalc']
# Various Artists MBID
VARIOUS_ARTISTS_ID = '89ad4ac3-39f7-470e-963a-56509c546377'

View File

@@ -20,6 +20,7 @@
import os
from PyQt4 import QtCore, QtGui
from picard.util import webbrowser2, find_executable
from picard.const import FPCALC_NAMES
from picard.config import BoolOption, TextOption
from picard.ui.options import OptionsPage, register_options_page
from picard.ui.ui_options_fingerprinting import Ui_FingerprintingOptionsPage
@@ -70,7 +71,7 @@ class FingerprintingOptionsPage(OptionsPage):
if self.ui.use_acoustid.isChecked():
self.ui.acoustid_settings.setEnabled(True)
if self.ui.acoustid_fpcalc.text().isEmpty():
fpcalc_path = find_executable("fpcalc")
fpcalc_path = find_executable(*FPCALC_NAMES)
if fpcalc_path:
self.ui.acoustid_fpcalc.setText(fpcalc_path)
else:

View File

@@ -274,11 +274,9 @@ def find_existing_path(path):
return decode_filename(path)
def find_executable(name):
def find_executable(*executables):
if sys.platform == 'win32':
executables = [name + '.exe']
else:
executables = [name]
executables = [e + '.exe' for e in executables]
paths = [os.path.dirname(sys.executable)] if sys.executable else []
paths += os.environ.get('PATH', '').split(os.pathsep)
for path in paths: