diff --git a/Jellyfin.Plugin.SmartPlaylist/PluginConfiguration.cs b/Jellyfin.Plugin.SmartPlaylist/PluginConfiguration.cs index ee2e7f6..cbfd04d 100644 --- a/Jellyfin.Plugin.SmartPlaylist/PluginConfiguration.cs +++ b/Jellyfin.Plugin.SmartPlaylist/PluginConfiguration.cs @@ -1,9 +1,4 @@ -using System; -using System.Collections.Generic; -using MediaBrowser.Common.Configuration; -using MediaBrowser.Common.Plugins; using MediaBrowser.Model.Plugins; -using MediaBrowser.Model.Serialization; namespace Jellyfin.Plugin.SmartPlaylist { public class PluginConfiguration : BasePluginConfiguration { diff --git a/Jellyfin.Plugin.SmartPlaylist/ScheduledTasks/GeneratePlaylist.cs b/Jellyfin.Plugin.SmartPlaylist/ScheduledTasks/GeneratePlaylist.cs index 1289de0..d303753 100644 --- a/Jellyfin.Plugin.SmartPlaylist/ScheduledTasks/GeneratePlaylist.cs +++ b/Jellyfin.Plugin.SmartPlaylist/ScheduledTasks/GeneratePlaylist.cs @@ -5,23 +5,11 @@ using MediaBrowser.Controller.Library; using MediaBrowser.Controller.Playlists; using MediaBrowser.Controller.Providers; using MediaBrowser.Model.IO; -using System; -using System.Collections.Generic; -using System.Linq; -using System.Threading; -using System.Threading.Tasks; using Jellyfin.Data.Entities; using Jellyfin.Data.Enums; using MediaBrowser.Model.Entities; -using MediaBrowser.Controller; using MediaBrowser.Controller.Entities; -using MediaBrowser.Controller.Library; -using MediaBrowser.Controller.Playlists; -using MediaBrowser.Controller.Providers; -using MediaBrowser.Model.IO; using MediaBrowser.Model.Playlists; -using MediaBrowser.Model.Tasks; -using Microsoft.Extensions.Logging; using Jellyfin.Plugin.SmartPlaylist.Lisp; using Jellyfin.Plugin.SmartPlaylist.Lisp.Compiler; @@ -93,7 +81,7 @@ namespace Jellyfin.Plugin.SmartPlaylist.ScheduledTasks { } } - private SmartPlaylistId CreateNewPlaylist(string name, UserId userId) { + private PlaylistId CreateNewPlaylist(string name, UserId userId) { _logger.LogDebug("Creating playlist '{0}'", name); var req = new PlaylistCreationRequest { Name = name, diff --git a/Jellyfin.Plugin.SmartPlaylist/SmartPlaylistDto.cs b/Jellyfin.Plugin.SmartPlaylist/SmartPlaylistDto.cs index 273eecf..57a3275 100644 --- a/Jellyfin.Plugin.SmartPlaylist/SmartPlaylistDto.cs +++ b/Jellyfin.Plugin.SmartPlaylist/SmartPlaylistDto.cs @@ -50,7 +50,7 @@ namespace Jellyfin.Plugin.SmartPlaylist { public bool Enabled { get; set; } public SmartPlaylistDto() { - Id = Guid.NewGuid(); + Id = ""; Playlists = []; Name = Id.ToString(); Program = DEFAULT_PROGRAM; @@ -62,7 +62,7 @@ namespace Jellyfin.Plugin.SmartPlaylist { if (info.GetValue("Id", typeof(SmartPlaylistId)) is SmartPlaylistId _Id) { Id = _Id; } else { - Id = Guid.NewGuid(); + Id = ""; } if (info.GetValue("Playlists", typeof(SmartPlaylistLinkDto[])) is SmartPlaylistLinkDto[] _Playlists) { Playlists = _Playlists; diff --git a/Jellyfin.Plugin.SmartPlaylist/Store.cs b/Jellyfin.Plugin.SmartPlaylist/Store.cs index 417592a..ede98dc 100644 --- a/Jellyfin.Plugin.SmartPlaylist/Store.cs +++ b/Jellyfin.Plugin.SmartPlaylist/Store.cs @@ -19,7 +19,12 @@ namespace Jellyfin.Plugin.SmartPlaylist { if (dto == null) { throw new ApplicationException(""); } - dto.Filename = filename; + if (dto.Id == Path.GetFileNameWithoutExtension(filename)) { + dto.Id = Path.GetFileNameWithoutExtension(filename); + } + if (dto.Filename != filename) { + dto.Filename = filename; + } return dto; } public async Task GetSmartPlaylistAsync(SmartPlaylistId smartPlaylistId) { diff --git a/Jellyfin.Plugin.SmartPlaylist/Types.cs b/Jellyfin.Plugin.SmartPlaylist/Types.cs index 4f17310..4e773e6 100644 --- a/Jellyfin.Plugin.SmartPlaylist/Types.cs +++ b/Jellyfin.Plugin.SmartPlaylist/Types.cs @@ -2,4 +2,4 @@ global using System; global using UserId = System.Guid; global using PlaylistId = System.Guid; -global using SmartPlaylistId = System.Guid; +global using SmartPlaylistId = string;