From fbe49a9a307fd868d5bd651fcf210822426eb699 Mon Sep 17 00:00:00 2001 From: blissful Date: Wed, 8 Nov 2023 15:04:01 -0500 Subject: [PATCH] turn off the unlink -> delete cover art virtual filesystem functionality --- docs/RELEASES.md | 18 +----------------- rose/virtualfs.py | 16 +++++----------- rose/virtualfs_test.py | 6 ------ 3 files changed, 6 insertions(+), 34 deletions(-) diff --git a/docs/RELEASES.md b/docs/RELEASES.md index 2efefa1..a5f4f57 100644 --- a/docs/RELEASES.md +++ b/docs/RELEASES.md @@ -177,7 +177,7 @@ $ tree "1. Releases/LOOΠΔ ODD EYE CIRCLE - 2017. Mix & Match - EP/" ## Delete Release Cover Art -Command line: +This operation is only supported on the command line. ```bash $ cd $fuse_mount_dir @@ -195,22 +195,6 @@ $ tree "1. Releases/LOOΠΔ ODD EYE CIRCLE - 2017. Mix & Match - EP/" └── 05. LOOΠΔ ODD EYE CIRCLE - Starlight.opus ``` -Virtual filesystem: - -```bash -$ cd $fuse_mount_dir - -$ rm "1. Releases/LOOΠΔ ODD EYE CIRCLE - 2017. Mix & Match - EP/cover.jpg" - -$ tree "1. Releases/LOOΠΔ ODD EYE CIRCLE - 2017. Mix & Match - EP/" -1. Releases/LOOΠΔ ODD EYE CIRCLE - 2017. Mix & Match - EP/ -├── 01. LOOΠΔ ODD EYE CIRCLE - ODD.opus -├── 02. LOOΠΔ ODD EYE CIRCLE - Girl Front.opus -├── 03. LOOΠΔ ODD EYE CIRCLE - LOONATIC.opus -├── 04. LOOΠΔ ODD EYE CIRCLE - Chaotic.opus -└── 05. LOOΠΔ ODD EYE CIRCLE - Starlight.opus -``` - ## Delete a Release _Deletion will move the release into the trashbin, following the diff --git a/rose/virtualfs.py b/rose/virtualfs.py index f011c87..7722f6c 100644 --- a/rose/virtualfs.py +++ b/rose/virtualfs.py @@ -94,7 +94,6 @@ ) from rose.releases import ( delete_release, - delete_release_cover_art, set_release_cover_art, toggle_release_new, ) @@ -873,7 +872,11 @@ def unlink(self, p: VirtualPath) -> None: # Possible actions: # 1. Delete a track from a playlist. # 2. Delete cover art from a playlist. - # 3. Delete cover art from a release. + # + # Note: We do not support deleting cover art from a release via the delete operation. This + # is because when removing a release from a collage via `rm -r`, `unlink` gets called + # recurisvely on every file, including each release's cover art. If we supported removing + # cover art, all cover art would be removed when we removed a release from a collage. if ( p.view == "Playlists" and p.playlist @@ -892,15 +895,6 @@ def unlink(self, p: VirtualPath) -> None: ): remove_track_from_playlist(self.config, p.playlist, track_id) return - if ( - p.release - and p.file - and p.file.lower() in self.config.valid_cover_arts - and (release_id := self.vnames.lookup_release(p)) - and (release := get_release(self.config, release_id)) - ): - delete_release_cover_art(self.config, release.id) - return # Otherwise, noop. If we return an error, that prevents rmdir from being called when we rm. diff --git a/rose/virtualfs_test.py b/rose/virtualfs_test.py index 2817228..9a97770 100644 --- a/rose/virtualfs_test.py +++ b/rose/virtualfs_test.py @@ -285,12 +285,6 @@ def test_virtual_filesystem_release_cover_art_actions( continue break - # Now delete the cover art. - (release_dir / "cover.png").unlink() - for _ in retry_for_sec(0.2): - if not (release_dir / "cover.png").exists(): - break - def test_virtual_filesystem_playlist_cover_art_actions( config: Config,