示例#1
0
 def update_groupboxes(self):
     if self.ui.use_acoustid.isChecked():
         self.ui.acoustid_settings.setEnabled(True)
         if not self.ui.acoustid_fpcalc.text():
             fpcalc_path = find_executable(*FPCALC_NAMES)
             if fpcalc_path:
                 self.ui.acoustid_fpcalc.setText(fpcalc_path)
     else:
         self.ui.acoustid_settings.setEnabled(False)
示例#2
0
 def update_groupboxes(self):
     if self.ui.use_acoustid.isChecked():
         self.ui.acoustid_settings.setEnabled(True)
         if self.ui.acoustid_fpcalc.text().isEmpty():
             fpcalc_path = find_executable(*FPCALC_NAMES)
             if fpcalc_path:
                 self.ui.acoustid_fpcalc.setText(fpcalc_path)
     else:
         self.ui.acoustid_settings.setEnabled(False)
示例#3
0
def get_extractor(config=None):
    if not config:
        config = get_config()
    extractor_path = config.setting["acousticbrainz_extractor"]
    if not extractor_path:
        extractor_path = find_extractor()
    else:
        extractor_path = find_executable(extractor_path)
    return extractor_path
示例#4
0
 def update_groupboxes(self):
     if self.ui.enable_fingerprinting.isChecked() and self.ui.use_acoustid.isChecked():
         self.ui.acoustid_settings.setEnabled(True)
         if self.ui.acoustid_fpcalc.text().isEmpty():
             fpcalc_path = find_executable("fpcalc")
             if fpcalc_path:
                 self.ui.acoustid_fpcalc.setText(fpcalc_path)
     else:
         self.ui.acoustid_settings.setEnabled(False)
示例#5
0
    def __init__(self):
        QtCore.QObject.__init__(self)
        self._queue = deque()
        self._running = 0
        self._max_processes = 2

        if not self.config.setting["acoustid_fpcalc"]:
            fpcalc_path = find_executable(*FPCALC_NAMES)
            if fpcalc_path:
                self.config.setting["acoustid_fpcalc"] = fpcalc_path
示例#6
0
    def __init__(self):
        QtCore.QObject.__init__(self)
        self._queue = deque()
        self._running = 0
        self._max_processes = 2

        if not config.setting["acoustid_fpcalc"]:
            fpcalc_path = find_executable(*FPCALC_NAMES)
            if fpcalc_path:
                config.setting["acoustid_fpcalc"] = fpcalc_path
示例#7
0
 def update_groupboxes(self):
     if self.ui.enable_fingerprinting.isChecked(
     ) and self.ui.use_acoustid.isChecked():
         self.ui.acoustid_settings.setEnabled(True)
         if self.ui.acoustid_fpcalc.text().isEmpty():
             fpcalc_path = find_executable("fpcalc")
             if fpcalc_path:
                 self.ui.acoustid_fpcalc.setText(fpcalc_path)
     else:
         self.ui.acoustid_settings.setEnabled(False)
示例#8
0
    def __init__(self):
        super().__init__()
        self._queue = deque()
        self._running = 0
        self._max_processes = 2

        # The second condition is checked because in case of a packaged build of picard
        # the temp directory that pyinstaller decompresses picard into changes on every
        # launch, thus we need to ignore the existing config values.
        if not config.setting["acoustid_fpcalc"] or IS_FROZEN:
            fpcalc_path = find_executable(*FPCALC_NAMES)
            if fpcalc_path:
                config.setting["acoustid_fpcalc"] = fpcalc_path
示例#9
0
文件: __init__.py 项目: mineo/picard
    def __init__(self):
        super().__init__()
        self._queue = deque()
        self._running = 0
        self._max_processes = 2

        # The second condition is checked because in case of a packaged build of picard
        # the temp directory that pyinstaller decompresses picard into changes on every
        # launch, thus we need to ignore the existing config values.
        if not config.setting["acoustid_fpcalc"] or is_frozen:
            fpcalc_path = find_executable(*FPCALC_NAMES)
            if fpcalc_path:
                config.setting["acoustid_fpcalc"] = fpcalc_path
示例#10
0
文件: __init__.py 项目: ruipin/picard
    def get(self, config=None):
        if not config:
            config = get_config()
        if not config.setting["use_acousticbrainz"]:
            log.debug('ABExtractor: AcousticBrainz disabled')
            return None

        extractor_path = config.setting["acousticbrainz_extractor"]
        if not extractor_path:
            extractor_path = find_extractor()
        else:
            extractor_path = find_executable(extractor_path)
        if not extractor_path:
            log.debug('ABExtractor: cannot find a path to extractor binary')
            return None

        try:
            statinfo = os.stat(extractor_path)
            mtime_ns = statinfo.st_mtime_ns
        except OSError as exc:
            log.warning('ABExtractor: cannot stat extractor: %s', exc)
            return None

        # check if we have this in cache already
        cached = self.cache[(extractor_path, mtime_ns)]
        if cached is not None:
            log.debug('ABExtractor: cached: %r', cached)
            return cached

        # create a new cache entry
        try:
            version = check_extractor_version(extractor_path)
            if version:
                sha = precompute_extractor_sha(extractor_path)
                result = ABExtractorProperties(path=extractor_path,
                                               version=version,
                                               sha=sha,
                                               mtime_ns=mtime_ns)
                # clear the cache, we keep only one entry
                self._init_cache()
                self.cache[(result.path, result.mtime_ns)] = result
                log.debug('ABExtractor: caching: %r', result)
                return result
            else:
                raise Exception("check_extractor_version(%r) returned None" %
                                extractor_path)
        except Exception as exc:
            log.warning('ABExtractor: failed to get version or sha: %s', exc)
        return None
示例#11
0
文件: __init__.py 项目: ruipin/picard
def ab_check_version(extractor):
    extractor_path = find_executable(extractor)
    return check_extractor_version(extractor_path)
示例#12
0
文件: __init__.py 项目: ruipin/picard
def find_extractor():
    return find_executable(*EXTRACTOR_NAMES)
示例#13
0
def find_fpcalc():
    return find_executable(*FPCALC_NAMES)