aboutsummaryrefslogtreecommitdiff
path: root/Emby.Server.Implementations/Playlists/PlaylistManager.cs
diff options
context:
space:
mode:
authorShadowghost <Shadowghost@users.noreply.github.com>2023-05-15 14:45:33 +0200
committerGitHub <noreply@github.com>2023-05-15 06:45:33 -0600
commiteb52af4e6ab0a81b026063b2dd43dd81a1a08b8e (patch)
tree2a60e11344cd1132eaa93878caf7f97e26b91d1e /Emby.Server.Implementations/Playlists/PlaylistManager.cs
parent603fce59df780626c3269eaa94d95504e823b2f6 (diff)
Fix playlists library and migration (#9770)
Diffstat (limited to 'Emby.Server.Implementations/Playlists/PlaylistManager.cs')
-rw-r--r--Emby.Server.Implementations/Playlists/PlaylistManager.cs25
1 files changed, 3 insertions, 22 deletions
diff --git a/Emby.Server.Implementations/Playlists/PlaylistManager.cs b/Emby.Server.Implementations/Playlists/PlaylistManager.cs
index adb8ac732..702f8d45b 100644
--- a/Emby.Server.Implementations/Playlists/PlaylistManager.cs
+++ b/Emby.Server.Implementations/Playlists/PlaylistManager.cs
@@ -67,9 +67,8 @@ namespace Emby.Server.Implementations.Playlists
public async Task<PlaylistCreationResult> CreatePlaylist(PlaylistCreationRequest options)
{
var name = options.Name;
-
var folderName = _fileSystem.GetValidFilename(name);
- var parentFolder = GetPlaylistsFolder(Guid.Empty);
+ var parentFolder = GetPlaylistsFolder(options.UserId);
if (parentFolder is null)
{
throw new ArgumentException(nameof(parentFolder));
@@ -80,7 +79,6 @@ namespace Emby.Server.Implementations.Playlists
foreach (var itemId in options.ItemIdList)
{
var item = _libraryManager.GetItemById(itemId);
-
if (item is null)
{
throw new ArgumentException("No item exists with the supplied Id");
@@ -121,7 +119,6 @@ namespace Emby.Server.Implementations.Playlists
}
var user = _userManager.GetUserById(options.UserId);
-
var path = Path.Combine(parentFolder.Path, folderName);
path = GetTargetPath(path);
@@ -130,7 +127,6 @@ namespace Emby.Server.Implementations.Playlists
try
{
Directory.CreateDirectory(path);
-
var playlist = new Playlist
{
Name = name,
@@ -140,7 +136,6 @@ namespace Emby.Server.Implementations.Playlists
};
playlist.SetMediaType(options.MediaType);
-
parentFolder.AddChild(playlist);
await playlist.RefreshMetadata(new MetadataRefreshOptions(new DirectoryService(_fileSystem)) { ForceSave = true }, CancellationToken.None)
@@ -326,7 +321,8 @@ namespace Emby.Server.Implementations.Playlists
}
}
- private void SavePlaylistFile(Playlist item)
+ /// <inheritdoc />
+ public void SavePlaylistFile(Playlist item)
{
// this is probably best done as a metadata provider
// saving a file over itself will require some work to prevent this from happening when not needed
@@ -564,20 +560,5 @@ namespace Emby.Server.Implementations.Playlists
}
}
}
-
- /// <inheritdoc />
- public async Task UpdatePlaylistAsync(Playlist playlist)
- {
- var currentPlaylist = (Playlist)_libraryManager.GetItemById(playlist.Id);
- currentPlaylist.OwnerUserId = playlist.OwnerUserId;
- currentPlaylist.Shares = playlist.Shares;
-
- await playlist.UpdateToRepositoryAsync(ItemUpdateType.MetadataEdit, CancellationToken.None).ConfigureAwait(false);
-
- if (currentPlaylist.IsFile)
- {
- SavePlaylistFile(currentPlaylist);
- }
- }
}
}