mirror of
https://github.com/jellyfin/jellyfin.git
synced 2026-01-15 15:48:03 +00:00
Convert string MediaType to enum MediaType
This commit is contained in:
@@ -1,5 +1,7 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Xml;
|
||||
using Jellyfin.Data.Enums;
|
||||
using MediaBrowser.Controller.Entities;
|
||||
using MediaBrowser.Controller.Extensions;
|
||||
using MediaBrowser.Controller.Playlists;
|
||||
@@ -31,7 +33,11 @@ namespace MediaBrowser.LocalMetadata.Parsers
|
||||
switch (reader.Name)
|
||||
{
|
||||
case "PlaylistMediaType":
|
||||
item.PlaylistMediaType = reader.ReadNormalizedString();
|
||||
if (Enum.TryParse<MediaType>(reader.ReadNormalizedString(), out var mediaType))
|
||||
{
|
||||
item.PlaylistMediaType = mediaType;
|
||||
}
|
||||
|
||||
break;
|
||||
case "PlaylistItems":
|
||||
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
using System.IO;
|
||||
using System.Threading.Tasks;
|
||||
using System.Xml;
|
||||
using Jellyfin.Data.Enums;
|
||||
using MediaBrowser.Controller.Configuration;
|
||||
using MediaBrowser.Controller.Entities;
|
||||
using MediaBrowser.Controller.Library;
|
||||
@@ -48,12 +49,12 @@ namespace MediaBrowser.LocalMetadata.Savers
|
||||
{
|
||||
var game = (Playlist)item;
|
||||
|
||||
if (string.IsNullOrEmpty(game.PlaylistMediaType))
|
||||
if (game.PlaylistMediaType == MediaType.Unknown)
|
||||
{
|
||||
return Task.CompletedTask;
|
||||
}
|
||||
|
||||
return writer.WriteElementStringAsync(null, "PlaylistMediaType", null, game.PlaylistMediaType);
|
||||
return writer.WriteElementStringAsync(null, "PlaylistMediaType", null, game.PlaylistMediaType.ToString());
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
|
||||
Reference in New Issue
Block a user