-
-
Notifications
You must be signed in to change notification settings - Fork 2.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix Playlist Deletion #2491
Fix Playlist Deletion #2491
Conversation
if (filename.IndexOf("[playlist]", StringComparison.OrdinalIgnoreCase) != -1) | ||
// It's a directory-based playlist if the directory contains a playlist file | ||
var filePaths = Directory.EnumerateFiles(args.Path); | ||
if (filePaths.Any(f => f.EndsWith(PlaylistXmlSaver.DefaultPlaylistFilename, StringComparison.OrdinalIgnoreCase))) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This diff is a bit messy because I also cleaned up the surrounding code, but the main change in this PR is that I added this if
block
|
||
if (string.IsNullOrEmpty(filename)) | ||
// It's a boxset if the path is a directory with [playlist] in it's the name | ||
// TODO: Should this use Path.GetDirectoryName() instead? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The use of Path.GetFileName()
here seems incorrect, but I just left a TODO instead of changing it in order to not expand the scope of this PR. Can remove the TODO if it would be preferred to just leave it as-is
I'll leave the review of the code to people who know what they're doing, but this does prevent playlists from being deleted when the scheduled task runs. It also seems to restore the existing playlists that had stopped appearing before, so double 🎉 points |
This fixes the issue with playlists being removed from the library during library scans.
Changes
Updated the
PlaylistResolver
to correctly resolve playlist items that are stored in the library using a directory.Issues
Fixes #2425