Skip to content
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

Merged
merged 4 commits into from
Mar 3, 2020
Merged

Conversation

mark-monteiro
Copy link
Member

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

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)))
Copy link
Member Author

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?
Copy link
Member Author

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

@mcarlton00
Copy link
Member

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

@dkanada dkanada added this to In progress in Release 10.5.0 via automation Mar 2, 2020
@Bond-009 Bond-009 merged commit 4640390 into jellyfin:master Mar 3, 2020
Release 10.5.0 automation moved this from In progress to Done Mar 3, 2020
@mark-monteiro mark-monteiro deleted the 2425-fix-playlists branch March 3, 2020 13:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
No open projects
Development

Successfully merging this pull request may close these issues.

Playlists getting deleted
4 participants