mirror of
https://github.com/beetbox/beets.git
synced 2026-01-09 01:15:38 +01:00
Use item.filepath instead of displayable_path in logging
This commit is contained in:
parent
d6b6ac3387
commit
e334e81d40
13 changed files with 45 additions and 86 deletions
|
|
@ -38,11 +38,7 @@ def get_art(log, item):
|
|||
try:
|
||||
mf = mediafile.MediaFile(syspath(item.path))
|
||||
except mediafile.UnreadableFileError as exc:
|
||||
log.warning(
|
||||
"Could not extract art from {}: {}",
|
||||
displayable_path(item.path),
|
||||
exc,
|
||||
)
|
||||
log.warning("Could not extract art from {}: {}", item.filepath, exc)
|
||||
return
|
||||
|
||||
return mf.art
|
||||
|
|
@ -189,7 +185,7 @@ def extract(log, outpath, item):
|
|||
# Add an extension to the filename.
|
||||
ext = mediafile.image_extension(art)
|
||||
if not ext:
|
||||
log.warning("Unknown image type in {}.", displayable_path(item.path))
|
||||
log.warning("Unknown image type in {}.", item.filepath)
|
||||
return
|
||||
outpath += bytestring_path(f".{ext}")
|
||||
|
||||
|
|
|
|||
|
|
@ -271,9 +271,7 @@ class ImportTask(BaseImportTask):
|
|||
for item in duplicate_items:
|
||||
item.remove()
|
||||
if lib.directory in util.ancestry(item.path):
|
||||
log.debug(
|
||||
"deleting duplicate {}", util.displayable_path(item.path)
|
||||
)
|
||||
log.debug("deleting duplicate {}", item.filepath)
|
||||
util.remove(item.path)
|
||||
util.prune_dirs(os.path.dirname(item.path), lib.directory)
|
||||
|
||||
|
|
@ -559,7 +557,7 @@ class ImportTask(BaseImportTask):
|
|||
noun,
|
||||
new_obj.id,
|
||||
overwritten_fields,
|
||||
util.displayable_path(new_obj.path),
|
||||
new_obj.filepath,
|
||||
)
|
||||
for key in overwritten_fields:
|
||||
del existing_fields[key]
|
||||
|
|
@ -581,14 +579,14 @@ class ImportTask(BaseImportTask):
|
|||
"Reimported album {}. Preserving attribute ['added']. "
|
||||
"Path: {}",
|
||||
self.album.id,
|
||||
util.displayable_path(self.album.path),
|
||||
self.album.filepath,
|
||||
)
|
||||
log.debug(
|
||||
"Reimported album {}. Preserving flexible attributes {}. "
|
||||
"Path: {}",
|
||||
self.album.id,
|
||||
list(album_fields.keys()),
|
||||
util.displayable_path(self.album.path),
|
||||
self.album.filepath,
|
||||
)
|
||||
|
||||
for item in self.imported_items():
|
||||
|
|
@ -600,7 +598,7 @@ class ImportTask(BaseImportTask):
|
|||
"Reimported item {}. Preserving attribute ['added']. "
|
||||
"Path: {}",
|
||||
item.id,
|
||||
util.displayable_path(item.path),
|
||||
item.filepath,
|
||||
)
|
||||
item_fields = _reduce_and_log(
|
||||
item, dup_item._values_flex, REIMPORT_FRESH_FIELDS_ITEM
|
||||
|
|
@ -611,7 +609,7 @@ class ImportTask(BaseImportTask):
|
|||
"Path: {}",
|
||||
item.id,
|
||||
list(item_fields.keys()),
|
||||
util.displayable_path(item.path),
|
||||
item.filepath,
|
||||
)
|
||||
item.store()
|
||||
|
||||
|
|
@ -621,11 +619,7 @@ class ImportTask(BaseImportTask):
|
|||
"""
|
||||
for item in self.imported_items():
|
||||
for dup_item in self.replaced_items[item]:
|
||||
log.debug(
|
||||
"Replacing item {}: {}",
|
||||
dup_item.id,
|
||||
util.displayable_path(item.path),
|
||||
)
|
||||
log.debug("Replacing item {}: {}", dup_item.id, item.filepath)
|
||||
dup_item.remove()
|
||||
log.debug(
|
||||
"{} of {} items replaced",
|
||||
|
|
|
|||
|
|
@ -1012,10 +1012,7 @@ class Item(LibModel):
|
|||
if move:
|
||||
# Check whether this file is inside the library directory.
|
||||
if self._db and self._db.directory in util.ancestry(self.path):
|
||||
log.debug(
|
||||
"moving {} to synchronize path",
|
||||
util.displayable_path(self.path),
|
||||
)
|
||||
log.debug("moving {} to synchronize path", self.filepath)
|
||||
self.move(with_album=with_album)
|
||||
self.store()
|
||||
|
||||
|
|
|
|||
|
|
@ -1640,7 +1640,7 @@ def update_items(lib, query, album, move, pretend, fields, exclude_fields=None):
|
|||
if item.current_mtime() <= item.mtime:
|
||||
log.debug(
|
||||
"skipping {} because mtime is up to date ({})",
|
||||
displayable_path(item.path),
|
||||
item.filepath,
|
||||
item.mtime,
|
||||
)
|
||||
continue
|
||||
|
|
@ -1649,9 +1649,7 @@ def update_items(lib, query, album, move, pretend, fields, exclude_fields=None):
|
|||
try:
|
||||
item.read()
|
||||
except library.ReadError as exc:
|
||||
log.error(
|
||||
"error reading {}: {}", displayable_path(item.path), exc
|
||||
)
|
||||
log.error("error reading {}: {}", item.filepath, exc)
|
||||
continue
|
||||
|
||||
# Special-case album artist when it matches track artist. (Hacky
|
||||
|
|
@ -2175,7 +2173,7 @@ def move_items(
|
|||
)
|
||||
|
||||
for obj in objs:
|
||||
log.debug("moving: {}", util.displayable_path(obj.path))
|
||||
log.debug("moving: {}", obj.filepath)
|
||||
|
||||
if export:
|
||||
# Copy without affecting the database.
|
||||
|
|
@ -2258,14 +2256,14 @@ def write_items(lib, query, pretend, force):
|
|||
for item in items:
|
||||
# Item deleted?
|
||||
if not os.path.exists(syspath(item.path)):
|
||||
log.info("missing file: {}", util.displayable_path(item.path))
|
||||
log.info("missing file: {}", item.filepath)
|
||||
continue
|
||||
|
||||
# Get an Item object reflecting the "clean" (on-disk) state.
|
||||
try:
|
||||
clean_item = library.Item.from_path(item.path)
|
||||
except library.ReadError as exc:
|
||||
log.error("error reading {}: {}", displayable_path(item.path), exc)
|
||||
log.error("error reading {}: {}", item.filepath, exc)
|
||||
continue
|
||||
|
||||
# Check for and display changes.
|
||||
|
|
|
|||
|
|
@ -343,28 +343,20 @@ def fingerprint_item(log, item, write=False):
|
|||
"""
|
||||
# Get a fingerprint and length for this track.
|
||||
if not item.length:
|
||||
log.info("{}: no duration available", util.displayable_path(item.path))
|
||||
log.info("{}: no duration available", item.filepath)
|
||||
elif item.acoustid_fingerprint:
|
||||
if write:
|
||||
log.info(
|
||||
"{}: fingerprint exists, skipping",
|
||||
util.displayable_path(item.path),
|
||||
)
|
||||
log.info("{}: fingerprint exists, skipping", item.filepath)
|
||||
else:
|
||||
log.info(
|
||||
"{}: using existing fingerprint",
|
||||
util.displayable_path(item.path),
|
||||
)
|
||||
log.info("{}: using existing fingerprint", item.filepath)
|
||||
return item.acoustid_fingerprint
|
||||
else:
|
||||
log.info("{}: fingerprinting", util.displayable_path(item.path))
|
||||
log.info("{}: fingerprinting", item.filepath)
|
||||
try:
|
||||
_, fp = acoustid.fingerprint_file(util.syspath(item.path))
|
||||
item.acoustid_fingerprint = fp.decode()
|
||||
if write:
|
||||
log.info(
|
||||
"{}: writing fingerprint", util.displayable_path(item.path)
|
||||
)
|
||||
log.info("{}: writing fingerprint", item.filepath)
|
||||
item.try_write()
|
||||
if item._db:
|
||||
item.store()
|
||||
|
|
|
|||
|
|
@ -388,8 +388,7 @@ class ConvertPlugin(BeetsPlugin):
|
|||
|
||||
if os.path.exists(util.syspath(dest)):
|
||||
self._log.info(
|
||||
"Skipping {} (target file exists)",
|
||||
util.displayable_path(item.path),
|
||||
"Skipping {} (target file exists)", item.filepath
|
||||
)
|
||||
continue
|
||||
|
||||
|
|
@ -397,7 +396,7 @@ class ConvertPlugin(BeetsPlugin):
|
|||
if pretend:
|
||||
self._log.info(
|
||||
"mv {} {}",
|
||||
util.displayable_path(item.path),
|
||||
item.filepath,
|
||||
util.displayable_path(original),
|
||||
)
|
||||
else:
|
||||
|
|
@ -431,9 +430,7 @@ class ConvertPlugin(BeetsPlugin):
|
|||
else ("Linking" if link else "Copying")
|
||||
)
|
||||
|
||||
self._log.info(
|
||||
"{} {}", msg, util.displayable_path(item.path)
|
||||
)
|
||||
self._log.info("{} {}", msg, item.filepath)
|
||||
|
||||
if hardlink:
|
||||
util.hardlink(original, converted)
|
||||
|
|
@ -464,8 +461,7 @@ class ConvertPlugin(BeetsPlugin):
|
|||
if album and album.artpath:
|
||||
maxwidth = self._get_art_resize(album.artpath)
|
||||
self._log.debug(
|
||||
"embedding album art from {}",
|
||||
util.displayable_path(album.artpath),
|
||||
"embedding album art from {}", album.art_filepath
|
||||
)
|
||||
art.embed_item(
|
||||
self._log,
|
||||
|
|
@ -523,8 +519,7 @@ class ConvertPlugin(BeetsPlugin):
|
|||
|
||||
if os.path.exists(util.syspath(dest)):
|
||||
self._log.info(
|
||||
"Skipping {} (target file exists)",
|
||||
util.displayable_path(album.artpath),
|
||||
"Skipping {} (target file exists)", album.art_filepath
|
||||
)
|
||||
return
|
||||
|
||||
|
|
@ -535,7 +530,7 @@ class ConvertPlugin(BeetsPlugin):
|
|||
if maxwidth is not None:
|
||||
self._log.info(
|
||||
"Resizing cover art from {} to {}",
|
||||
util.displayable_path(album.artpath),
|
||||
album.art_filepath,
|
||||
util.displayable_path(dest),
|
||||
)
|
||||
if not pretend:
|
||||
|
|
@ -547,7 +542,7 @@ class ConvertPlugin(BeetsPlugin):
|
|||
self._log.info(
|
||||
"{} {} {}",
|
||||
msg,
|
||||
util.displayable_path(album.artpath),
|
||||
album.art_filepath,
|
||||
util.displayable_path(dest),
|
||||
)
|
||||
else:
|
||||
|
|
@ -560,7 +555,7 @@ class ConvertPlugin(BeetsPlugin):
|
|||
self._log.info(
|
||||
"{} cover art from {} to {}",
|
||||
msg,
|
||||
util.displayable_path(album.artpath),
|
||||
album.art_filepath,
|
||||
util.displayable_path(dest),
|
||||
)
|
||||
if hardlink:
|
||||
|
|
|
|||
|
|
@ -256,7 +256,7 @@ class DuplicatesPlugin(BeetsPlugin):
|
|||
self._log.debug(
|
||||
"key {} on item {} not cached:computing checksum",
|
||||
key,
|
||||
displayable_path(item.path),
|
||||
item.filepath,
|
||||
)
|
||||
try:
|
||||
checksum = command_output(args).stdout
|
||||
|
|
@ -266,16 +266,12 @@ class DuplicatesPlugin(BeetsPlugin):
|
|||
"computed checksum for {} using {}", item.title, key
|
||||
)
|
||||
except subprocess.CalledProcessError as e:
|
||||
self._log.debug(
|
||||
"failed to checksum {}: {}",
|
||||
displayable_path(item.path),
|
||||
e,
|
||||
)
|
||||
self._log.debug("failed to checksum {}: {}", item.filepath, e)
|
||||
else:
|
||||
self._log.debug(
|
||||
"key {} on item {} cached:not computing checksum",
|
||||
key,
|
||||
displayable_path(item.path),
|
||||
item.filepath,
|
||||
)
|
||||
return key, checksum
|
||||
|
||||
|
|
@ -295,13 +291,13 @@ class DuplicatesPlugin(BeetsPlugin):
|
|||
self._log.debug(
|
||||
"some keys {} on item {} are null or empty: skipping",
|
||||
keys,
|
||||
displayable_path(obj.path),
|
||||
obj.filepath,
|
||||
)
|
||||
elif not strict and not len(values):
|
||||
self._log.debug(
|
||||
"all keys {} on item {} are null or empty: skipping",
|
||||
keys,
|
||||
displayable_path(obj.path),
|
||||
obj.filepath,
|
||||
)
|
||||
else:
|
||||
key = tuple(values)
|
||||
|
|
@ -363,7 +359,7 @@ class DuplicatesPlugin(BeetsPlugin):
|
|||
"or empty: setting from item {}",
|
||||
f,
|
||||
displayable_path(objs[0].path),
|
||||
displayable_path(o.path),
|
||||
o.filepath,
|
||||
)
|
||||
setattr(objs[0], f, value)
|
||||
objs[0].store()
|
||||
|
|
@ -387,7 +383,7 @@ class DuplicatesPlugin(BeetsPlugin):
|
|||
" merging from {} into {}",
|
||||
missing,
|
||||
objs[0],
|
||||
displayable_path(o.path),
|
||||
o.filepath,
|
||||
displayable_path(missing.destination()),
|
||||
)
|
||||
missing.move(operation=MoveOperation.COPY)
|
||||
|
|
|
|||
|
|
@ -1541,9 +1541,7 @@ class FetchArtPlugin(plugins.BeetsPlugin, RequestMixin):
|
|||
out = candidate
|
||||
assert out.path is not None # help mypy
|
||||
self._log.debug(
|
||||
"using {.LOC} image {}",
|
||||
source,
|
||||
util.displayable_path(out.path),
|
||||
"using {.LOC} image {}", source, out.path
|
||||
)
|
||||
break
|
||||
# Remove temporary files for invalid candidates.
|
||||
|
|
|
|||
|
|
@ -20,7 +20,6 @@ import re
|
|||
from typing import TYPE_CHECKING
|
||||
|
||||
from beets import plugins, ui
|
||||
from beets.util import displayable_path
|
||||
|
||||
if TYPE_CHECKING:
|
||||
from beets.importer import ImportSession, ImportTask
|
||||
|
|
@ -195,7 +194,7 @@ class FtInTitlePlugin(plugins.BeetsPlugin):
|
|||
if not featured:
|
||||
return False
|
||||
|
||||
self._log.info("{}", displayable_path(item.path))
|
||||
self._log.info("{}", item.filepath)
|
||||
|
||||
# Attempt to find the featured artist.
|
||||
feat_part = find_feat_part(artist, albumartist)
|
||||
|
|
|
|||
|
|
@ -105,7 +105,7 @@ class ImportAddedPlugin(BeetsPlugin):
|
|||
self._log.debug(
|
||||
"Album '{}' is reimported, skipping import of "
|
||||
"added dates for the album and its items.",
|
||||
util.displayable_path(album.path),
|
||||
album.filepath,
|
||||
)
|
||||
return
|
||||
|
||||
|
|
@ -130,7 +130,7 @@ class ImportAddedPlugin(BeetsPlugin):
|
|||
if self.reimported_item(item):
|
||||
self._log.debug(
|
||||
"Item '{}' is reimported, skipping import of added date.",
|
||||
util.displayable_path(item.path),
|
||||
item.filepath,
|
||||
)
|
||||
return
|
||||
mtime = self.item_mtime.pop(item.path, None)
|
||||
|
|
@ -140,7 +140,7 @@ class ImportAddedPlugin(BeetsPlugin):
|
|||
self.write_item_mtime(item, mtime)
|
||||
self._log.debug(
|
||||
"Import of item '{}', selected item.added={}",
|
||||
util.displayable_path(item.path),
|
||||
item.filepath,
|
||||
item.added,
|
||||
)
|
||||
item.store()
|
||||
|
|
@ -154,6 +154,6 @@ class ImportAddedPlugin(BeetsPlugin):
|
|||
self.write_item_mtime(item, item.added)
|
||||
self._log.debug(
|
||||
"Write of item '{}', selected item.added={}",
|
||||
util.displayable_path(item.path),
|
||||
item.filepath,
|
||||
item.added,
|
||||
)
|
||||
|
|
|
|||
|
|
@ -84,9 +84,7 @@ class KeyFinderPlugin(BeetsPlugin):
|
|||
|
||||
item["initial_key"] = key
|
||||
self._log.info(
|
||||
"added computed initial key {} for {}",
|
||||
key,
|
||||
util.displayable_path(item.path),
|
||||
"added computed initial key {} for {}", key, item.filepath
|
||||
)
|
||||
|
||||
if write:
|
||||
|
|
|
|||
|
|
@ -191,7 +191,7 @@ class MPDStats:
|
|||
"updated: {} = {} [{}]",
|
||||
attribute,
|
||||
item[attribute],
|
||||
displayable_path(item.path),
|
||||
item.filepath,
|
||||
)
|
||||
|
||||
def update_rating(self, item, skipped):
|
||||
|
|
|
|||
|
|
@ -59,9 +59,7 @@ class ScrubPlugin(BeetsPlugin):
|
|||
def scrub_func(lib, opts, args):
|
||||
# Walk through matching files and remove tags.
|
||||
for item in lib.items(args):
|
||||
self._log.info(
|
||||
"scrubbing: {}", util.displayable_path(item.path)
|
||||
)
|
||||
self._log.info("scrubbing: {}", item.filepath)
|
||||
self._scrub_item(item, opts.write)
|
||||
|
||||
scrub_cmd = ui.Subcommand("scrub", help="clean audio tags")
|
||||
|
|
@ -149,7 +147,5 @@ class ScrubPlugin(BeetsPlugin):
|
|||
def import_task_files(self, session, task):
|
||||
"""Automatically scrub imported files."""
|
||||
for item in task.imported_items():
|
||||
self._log.debug(
|
||||
"auto-scrubbing {}", util.displayable_path(item.path)
|
||||
)
|
||||
self._log.debug("auto-scrubbing {}", item.filepath)
|
||||
self._scrub_item(item, ui.should_write())
|
||||
|
|
|
|||
Loading…
Reference in a new issue