feat: allow to initialize empty playlist file.

This commit is contained in:
redxef 2024-11-08 03:41:24 +01:00
parent 4537a3aee3
commit f41485cecf
Signed by: redxef
GPG key ID: 7DAC3AA211CBD921

View file

@ -15,6 +15,9 @@ namespace Jellyfin.Plugin.SmartPlaylist {
} }
private async Task<SmartPlaylistDto> LoadPlaylistAsync(string filename) { private async Task<SmartPlaylistDto> LoadPlaylistAsync(string filename) {
var r = File.ReadAllText(filename); var r = File.ReadAllText(filename);
if (r.Equals("")) {
r = "{}";
}
var dto = new DeserializerBuilder().Build().Deserialize<SmartPlaylistDto>(r); var dto = new DeserializerBuilder().Build().Deserialize<SmartPlaylistDto>(r);
if (dto == null) if (dto == null)
{ {