Skip to content

Commit

Permalink
turn off the unlink -> delete cover art virtual filesystem functionality
Browse files Browse the repository at this point in the history
  • Loading branch information
azuline committed Nov 8, 2023
1 parent abe58fc commit fbe49a9
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 34 deletions.
18 changes: 1 addition & 17 deletions docs/RELEASES.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down
16 changes: 5 additions & 11 deletions rose/virtualfs.py
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,6 @@
)
from rose.releases import (
delete_release,
delete_release_cover_art,
set_release_cover_art,
toggle_release_new,
)
Expand Down Expand Up @@ -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
Expand All @@ -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.

Expand Down
6 changes: 0 additions & 6 deletions rose/virtualfs_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down

0 comments on commit fbe49a9

Please sign in to comment.