当前位置: 首页>>代码示例>>Python>>正文


Python log.debug函数代码示例

本文整理汇总了Python中picard.log.debug函数的典型用法代码示例。如果您正苦于以下问题:Python debug函数的具体用法?Python debug怎么用?Python debug使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了debug函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: drop_urls

 def drop_urls(urls, target):
     files = []
     new_files = []
     for url in urls:
         log.debug("Dropped the URL: %r", url.toString(QtCore.QUrl.RemoveUserInfo))
         if url.scheme() == "file" or not url.scheme():
             filename = os.path.normpath(os.path.realpath(url.toLocalFile().rstrip("\0")))
             file = BaseTreeView.tagger.files.get(filename)
             if file:
                 files.append(file)
             elif os.path.isdir(encode_filename(filename)):
                 BaseTreeView.tagger.add_directory(filename)
             else:
                 new_files.append(filename)
         elif url.scheme() in ("http", "https"):
             path = url.path()
             match = re.search(r"/(release|recording)/([0-9a-z\-]{36})", path)
             if match:
                 entity = match.group(1)
                 mbid = match.group(2)
                 if entity == "release":
                     BaseTreeView.tagger.load_album(mbid)
                 elif entity == "recording":
                     BaseTreeView.tagger.load_nat(mbid)
     if files:
         BaseTreeView.tagger.move_files(files, target)
     if new_files:
         BaseTreeView.tagger.add_files(new_files, target=target)
开发者ID:zas,项目名称:picard,代码行数:28,代码来源:itemviews.py

示例2: restore_header_state

 def restore_header_state(self):
     if self.ui.release_list:
         header = self.ui.release_list.header()
         state = config.persist[self.dialog_header_state]
         if state:
             header.restoreState(state)
             log.debug("restore_state: %s" % self.dialog_header_state)
开发者ID:Jormangeud,项目名称:picard,代码行数:7,代码来源:cdlookup.py

示例3: _move

 def _move(self, parent):
     if parent != self.parent:
         log.debug("Moving %r from %r to %r", self, self.parent, parent)
         if self.parent:
             self.parent.remove_file(self)
         self.parent = parent
         self.tagger.acoustidmanager.update(self, self.metadata['musicbrainz_recordingid'])
开发者ID:Freso,项目名称:picard,代码行数:7,代码来源:file.py

示例4: coverart

def coverart(album, metadata, release):
    """Gets all cover art URLs from the metadata and then attempts to
    download the album art. """

    coverart = CoverArt(album, metadata, release)
    log.debug("New %r", coverart)
    coverart.retrieve()
开发者ID:Freso,项目名称:picard,代码行数:7,代码来源:__init__.py

示例5: add_files

 def add_files(self, filenames, target=None):
     """Add files to the tagger."""
     ignoreregex = None
     pattern = config.setting['ignore_regex']
     if pattern:
         ignoreregex = re.compile(pattern)
     ignore_hidden = not config.persist["show_hidden_files"]
     new_files = []
     for filename in filenames:
         filename = os.path.normpath(os.path.realpath(filename))
         if ignore_hidden and is_hidden_path(filename):
             log.debug("File ignored (hidden): %s" % (filename))
             continue
         if ignoreregex is not None and ignoreregex.search(filename):
             log.info("File ignored (matching %s): %s" % (pattern, filename))
             continue
         if filename not in self.files:
             file = open_file(filename)
             if file:
                 self.files[filename] = file
                 new_files.append(file)
     if new_files:
         log.debug("Adding files %r", new_files)
         new_files.sort(key=lambda x: x.filename)
         if target is None or target is self.unmatched_files:
             self.unmatched_files.add_files(new_files)
             target = None
         for file in new_files:
             file.load(partial(self._file_loaded, target=target))
开发者ID:SRITANU,项目名称:picard,代码行数:29,代码来源:tagger.py

示例6: _finished

 def _finished(self, kind, ids, callback, document, reply, error):
     self.pending -= ids
     statusbar = self.tagger.window.set_statusbar_message
     if not error:
         count = len(ids)
         if kind == self.COLLECTION_ADD:
             self.releases |= ids
             self.size += count
             status_msg = ngettext(
                 'Added %(count)i release to collection "%(name)s"',
                 'Added %(count)i releases to collection "%(name)s"',
                 count)
             debug_msg = 'Added %(count)i releases to collection "%(name)s"'
         else:
             self.releases -= ids
             self.size -= count
             status_msg = ngettext(
                 'Removed %(count)i release from collection "%(name)s"',
                 'Removed %(count)i releases from collection "%(name)s"',
                 count)
             debug_msg = 'Removed %(count)i releases from collection "%(name)s"'
         callback()
         mparms = {'count': count, 'name': self.name}
         log.debug(debug_msg % mparms)
         statusbar(status_msg, mparms, translate=None, echo=None)
     else:
         statusbar(
             N_("Error while modifying collections: %(error)s"),
             {'error': reply.errorString()},
             echo=log.error
         )
开发者ID:zas,项目名称:picard,代码行数:31,代码来源:collection.py

示例7: dropMimeData

 def dropMimeData(self, parent, index, data, action):
     target = None
     if parent:
         if index == parent.childCount():
             item = parent
         else:
             item = parent.child(index)
         if item is not None:
             target = item.obj
     log.debug("Drop target = %r", target)
     handled = False
     # text/uri-list
     urls = data.urls()
     if urls:
         if target is None:
             target = self.tagger.unmatched_files
         self.drop_urls(urls, target)
         handled = True
     # application/picard.album-list
     albums = data.data("application/picard.album-list")
     if albums:
         if isinstance(self, FileTreeView) and target is None:
             target = self.tagger.unmatched_files
         albums = [self.tagger.load_album(id) for id in str(albums).split("\n")]
         self.tagger.move_files(self.tagger.get_files_from_objects(albums), target)
         handled = True
     return handled
开发者ID:Versatilus,项目名称:picard,代码行数:27,代码来源:itemviews.py

示例8: _save

    def _save(self, filename, metadata):
        log.debug("Saving file %r", filename)
        file = ASF(encode_filename(filename))

        if config.setting['clear_existing_tags']:
            file.tags.clear()
        cover = []
        for image in metadata.images_to_be_saved_to_tags:
            tag_data = pack_image(image.mimetype, image.data,
                                    image_type_as_id3_num(image.maintype),
                                    image.comment)
            cover.append(ASFByteArrayAttribute(tag_data))
        if cover:
            file.tags['WM/Picture'] = cover

        for name, values in metadata.rawitems():
            if name.startswith('lyrics:'):
                name = 'lyrics'
            elif name == '~rating':
                values[0] = int(values[0]) * 99 / (config.setting['rating_steps'] - 1)
            elif name == 'discnumber' and 'totaldiscs' in metadata:
                values[0] = '%s/%s' % (metadata['discnumber'], metadata['totaldiscs'])
            if name not in self.__TRANS:
                continue
            name = self.__TRANS[name]
            file.tags[name] = map(unicode, values)
        file.save()
开发者ID:LordSputnik,项目名称:picard,代码行数:27,代码来源:asf.py

示例9: _save

    def _save(self, filename, metadata):
        log.debug("Saving file %r", filename)
        file = ASF(encode_filename(filename))

        if config.setting['clear_existing_tags']:
            file.tags.clear()
        if config.setting['save_images_to_tags']:
            cover = []
            for image in metadata.images:
                if not save_this_image_to_tags(image):
                    continue
                tag_data = pack_image(image.mimetype, image.data,
                                      image_type_as_id3_num(image.maintype()),
                                      image.description)
                cover.append(ASFByteArrayAttribute(tag_data))
            if cover:
                file.tags['WM/Picture'] = cover

        for name, values in metadata.rawitems():
            if name.startswith('lyrics:'):
                name = 'lyrics'
            elif name == '~rating':
                values[0] = int(values[0]) * 99 / (config.setting['rating_steps'] - 1)
            if name not in self.__TRANS:
                continue
            name = self.__TRANS[name]
            file.tags[name] = map(unicode, values)
        file.save()
开发者ID:m42i,项目名称:picard,代码行数:28,代码来源:asf.py

示例10: load_plugindir

 def load_plugindir(self, plugindir):
     plugindir = os.path.normpath(plugindir)
     if not os.path.isdir(plugindir):
         log.info("Plugin directory %r doesn't exist", plugindir)
         return
     # first, handle eventual plugin updates
     for updatepath in [os.path.join(plugindir, file) for file in
                        os.listdir(plugindir) if file.endswith('.update')]:
         path = os.path.splitext(updatepath)[0]
         name = is_zip(path)
         if not name:
             name = _plugin_name_from_path(path)
         if name:
             self._remove_plugin(name)
             os.rename(updatepath, path)
             log.debug('Updating plugin %r (%r))', name, path)
         else:
             log.error('Cannot get plugin name from %r', updatepath)
     # now load found plugins
     names = set()
     for path in [os.path.join(plugindir, file) for file in os.listdir(plugindir)]:
         name = is_zip(path)
         if not name:
             name = _plugin_name_from_path(path)
         if name:
             names.add(name)
     log.debug("Looking for plugins in directory %r, %d names found",
               plugindir,
               len(names))
     for name in sorted(names):
         try:
             self.load_plugin(name, plugindir)
         except Exception as e:
             log.error('Unable to load plugin: %s.\nError occured: %s', name, e)
开发者ID:zas,项目名称:picard,代码行数:34,代码来源:plugin.py

示例11: _save

    def _save(self, filename, metadata):
        log.debug("Saving file %r", filename)
        file = ASF(encode_filename(filename))

        if config.setting["clear_existing_tags"]:
            file.tags.clear()
        if config.setting["save_images_to_tags"]:
            cover = []
            for image in metadata.images:
                if not save_this_image_to_tags(image):
                    continue
                tag_data = pack_image(image["mime"], image["data"], image_type_as_id3_num(image["type"]), image["desc"])
                cover.append(ASFByteArrayAttribute(tag_data))
            if cover:
                file.tags["WM/Picture"] = cover

        for name, values in metadata.rawitems():
            if name.startswith("lyrics:"):
                name = "lyrics"
            elif name == "~rating":
                values[0] = int(values[0]) * 99 / (config.setting["rating_steps"] - 1)
            if name not in self.__TRANS:
                continue
            name = self.__TRANS[name]
            file.tags[name] = map(unicode, values)
        file.save()
开发者ID:TushRaj,项目名称:picard,代码行数:26,代码来源:asf.py

示例12: _load

    def _load(self, filename):
        log.debug("Loading file %r", filename)
        file = ASF(encode_filename(filename))
        metadata = Metadata()
        for name, values in file.tags.items():
            if name == 'WM/Picture':
                for image in values:
                    (mime, data, type, description) = unpack_image(image.value)
                    try:
                        coverartimage = TagCoverArtImage(
                            file=filename,
                            tag=name,
                            types=types_from_id3(type),
                            comment=description,
                            support_types=True,
                            data=data,
                        )
                    except CoverArtImageError as e:
                        log.error('Cannot load image from %r: %s' %
                                  (filename, e))
                    else:
                        metadata.append_image(coverartimage)

                continue
            elif name not in self.__RTRANS:
                continue
            elif name == 'WM/SharedUserRating':
                # Rating in WMA ranges from 0 to 99, normalize this to the range 0 to 5
                values[0] = int(round(int(unicode(values[0])) / 99.0 * (config.setting['rating_steps'] - 1)))
            name = self.__RTRANS[name]
            values = filter(bool, map(unicode, values))
            if values:
                metadata[name] = values
        self._info(metadata, file)
        return metadata
开发者ID:Murat-Tulek,项目名称:picard,代码行数:35,代码来源:asf.py

示例13: restore_table_header_state

 def restore_table_header_state(self):
     header = self.table.horizontalHeader()
     state = config.persist[self.dialog_header_state]
     if state:
         header.restoreState(state)
     header.setSectionResizeMode(QtWidgets.QHeaderView.Interactive)
     log.debug("restore_state: %s" % self.dialog_header_state)
开发者ID:Jormangeud,项目名称:picard,代码行数:7,代码来源:__init__.py

示例14: fetch_username

 def fetch_username(self, callback):
     log.debug("OAuth: fetching username")
     host, port = config.setting['server_host'], config.setting['server_port']
     path = "/oauth2/userinfo"
     self.webservice.get(host, port, path,
                     partial(self.on_fetch_username_finished, callback),
                     parse_response_type=None, mblogin=True, priority=True, important=True)
开发者ID:Sophist-UK,项目名称:Sophist_picard,代码行数:7,代码来源:oauth.py

示例15: _caa_json_downloaded

def _caa_json_downloaded(album, metadata, release, try_list, data, http, error):
    album._requests -= 1
    caa_front_found = False
    if error:
        log.error(str(http.errorString()))
    else:
        try:
            caa_data = json.loads(data)
        except ValueError:
            log.debug("Invalid JSON: %s", http.url().toString())
        else:
            caa_types = config.setting["caa_image_types"].split()
            caa_types = map(unicode.lower, caa_types)
            for image in caa_data["images"]:
                if config.setting["caa_approved_only"] and not image["approved"]:
                    continue
                if not image["types"] and "unknown" in caa_types:
                    image["types"] = [u"Unknown"]
                imagetypes = map(unicode.lower, image["types"])
                for imagetype in imagetypes:
                    if imagetype == "front":
                        caa_front_found = True
                    if imagetype in caa_types:
                        _caa_append_image_to_trylist(try_list, image)
                        break

    if error or not caa_front_found:
        _fill_try_list(album, release, try_list)
    _walk_try_list(album, metadata, release, try_list)
开发者ID:hartzell,项目名称:picard,代码行数:29,代码来源:coverart.py


注:本文中的picard.log.debug函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。