diff --git a/beets/art.py b/beets/art.py index c829787c2..73e875202 100644 --- a/beets/art.py +++ b/beets/art.py @@ -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}") diff --git a/beets/importer/tasks.py b/beets/importer/tasks.py index 2c653c4ce..7fa11c972 100644 --- a/beets/importer/tasks.py +++ b/beets/importer/tasks.py @@ -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", diff --git a/beets/library/models.py b/beets/library/models.py index 3c93d0cb7..cd7bc1e92 100644 --- a/beets/library/models.py +++ b/beets/library/models.py @@ -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() diff --git a/beets/ui/commands.py b/beets/ui/commands.py index 64819d781..1c92186d2 100755 --- a/beets/ui/commands.py +++ b/beets/ui/commands.py @@ -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. diff --git a/beetsplug/chroma.py b/beetsplug/chroma.py index 1e04d51f5..43f556f05 100644 --- a/beetsplug/chroma.py +++ b/beetsplug/chroma.py @@ -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() diff --git a/beetsplug/convert.py b/beetsplug/convert.py index 93b66d976..25c3a6f0c 100644 --- a/beetsplug/convert.py +++ b/beetsplug/convert.py @@ -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: diff --git a/beetsplug/duplicates.py b/beetsplug/duplicates.py index c16348c17..03714ab81 100644 --- a/beetsplug/duplicates.py +++ b/beetsplug/duplicates.py @@ -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) diff --git a/beetsplug/fetchart.py b/beetsplug/fetchart.py index 38a0996cc..156dd6132 100644 --- a/beetsplug/fetchart.py +++ b/beetsplug/fetchart.py @@ -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. diff --git a/beetsplug/ftintitle.py b/beetsplug/ftintitle.py index 5d5db2e92..6571c9c90 100644 --- a/beetsplug/ftintitle.py +++ b/beetsplug/ftintitle.py @@ -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) diff --git a/beetsplug/importadded.py b/beetsplug/importadded.py index 3dcfe1cc2..b6244c518 100644 --- a/beetsplug/importadded.py +++ b/beetsplug/importadded.py @@ -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, ) diff --git a/beetsplug/keyfinder.py b/beetsplug/keyfinder.py index e95e999d0..43f04e263 100644 --- a/beetsplug/keyfinder.py +++ b/beetsplug/keyfinder.py @@ -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: diff --git a/beetsplug/mpdstats.py b/beetsplug/mpdstats.py index a4e9fb843..f4fe21a13 100644 --- a/beetsplug/mpdstats.py +++ b/beetsplug/mpdstats.py @@ -191,7 +191,7 @@ class MPDStats: "updated: {} = {} [{}]", attribute, item[attribute], - displayable_path(item.path), + item.filepath, ) def update_rating(self, item, skipped): diff --git a/beetsplug/scrub.py b/beetsplug/scrub.py index 5f971ea38..66d5aeea3 100644 --- a/beetsplug/scrub.py +++ b/beetsplug/scrub.py @@ -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())