mirror of
https://github.com/jellyfin/jellyfin.git
synced 2026-06-05 07:18:47 +01:00
Fix all warnings in Emby.Dlna
This commit is contained in:
@@ -40,6 +40,11 @@ namespace Emby.Dlna.ContentDirectory
|
||||
{
|
||||
public class ControlHandler : BaseControlHandler
|
||||
{
|
||||
private const string NsDc = "http://purl.org/dc/elements/1.1/";
|
||||
private const string NsDidl = "urn:schemas-upnp-org:metadata-1-0/DIDL-Lite/";
|
||||
private const string NsDlna = "urn:schemas-dlna-org:metadata-1-0/";
|
||||
private const string NsUpnp = "urn:schemas-upnp-org:metadata-1-0/upnp/";
|
||||
|
||||
private readonly ILibraryManager _libraryManager;
|
||||
private readonly IUserDataManager _userDataManager;
|
||||
private readonly IServerConfigurationManager _config;
|
||||
@@ -47,11 +52,6 @@ namespace Emby.Dlna.ContentDirectory
|
||||
private readonly IUserViewManager _userViewManager;
|
||||
private readonly ITVSeriesManager _tvSeriesManager;
|
||||
|
||||
private const string NS_DC = "http://purl.org/dc/elements/1.1/";
|
||||
private const string NS_DIDL = "urn:schemas-upnp-org:metadata-1-0/DIDL-Lite/";
|
||||
private const string NS_DLNA = "urn:schemas-dlna-org:metadata-1-0/";
|
||||
private const string NS_UPNP = "urn:schemas-upnp-org:metadata-1-0/upnp/";
|
||||
|
||||
private readonly int _systemUpdateId;
|
||||
|
||||
private readonly DidlBuilder _didlBuilder;
|
||||
@@ -181,7 +181,11 @@ namespace Emby.Dlna.ContentDirectory
|
||||
|
||||
userdata.PlaybackPositionTicks = TimeSpan.FromSeconds(newbookmark).Ticks;
|
||||
|
||||
_userDataManager.SaveUserData(_user, item, userdata, UserDataSaveReason.TogglePlayed,
|
||||
_userDataManager.SaveUserData(
|
||||
_user,
|
||||
item,
|
||||
userdata,
|
||||
UserDataSaveReason.TogglePlayed,
|
||||
CancellationToken.None);
|
||||
}
|
||||
|
||||
@@ -286,18 +290,17 @@ namespace Emby.Dlna.ContentDirectory
|
||||
|
||||
using (var writer = XmlWriter.Create(builder, settings))
|
||||
{
|
||||
writer.WriteStartElement(string.Empty, "DIDL-Lite", NS_DIDL);
|
||||
writer.WriteStartElement(string.Empty, "DIDL-Lite", NsDidl);
|
||||
|
||||
writer.WriteAttributeString("xmlns", "dc", null, NS_DC);
|
||||
writer.WriteAttributeString("xmlns", "dlna", null, NS_DLNA);
|
||||
writer.WriteAttributeString("xmlns", "upnp", null, NS_UPNP);
|
||||
writer.WriteAttributeString("xmlns", "dc", null, NsDc);
|
||||
writer.WriteAttributeString("xmlns", "dlna", null, NsDlna);
|
||||
writer.WriteAttributeString("xmlns", "upnp", null, NsUpnp);
|
||||
|
||||
DidlBuilder.WriteXmlRootAttributes(_profile, writer);
|
||||
|
||||
var serverItem = GetItemFromObjectId(id);
|
||||
var item = serverItem.Item;
|
||||
|
||||
|
||||
if (string.Equals(flag, "BrowseMetadata", StringComparison.Ordinal))
|
||||
{
|
||||
totalCount = 1;
|
||||
@@ -397,11 +400,11 @@ namespace Emby.Dlna.ContentDirectory
|
||||
|
||||
using (var writer = XmlWriter.Create(builder, settings))
|
||||
{
|
||||
writer.WriteStartElement(string.Empty, "DIDL-Lite", NS_DIDL);
|
||||
writer.WriteStartElement(string.Empty, "DIDL-Lite", NsDidl);
|
||||
|
||||
writer.WriteAttributeString("xmlns", "dc", null, NS_DC);
|
||||
writer.WriteAttributeString("xmlns", "dlna", null, NS_DLNA);
|
||||
writer.WriteAttributeString("xmlns", "upnp", null, NS_UPNP);
|
||||
writer.WriteAttributeString("xmlns", "dc", null, NsDc);
|
||||
writer.WriteAttributeString("xmlns", "dlna", null, NsDlna);
|
||||
writer.WriteAttributeString("xmlns", "upnp", null, NsUpnp);
|
||||
|
||||
DidlBuilder.WriteXmlRootAttributes(_profile, writer);
|
||||
|
||||
@@ -783,11 +786,14 @@ namespace Emby.Dlna.ContentDirectory
|
||||
})
|
||||
.ToArray();
|
||||
|
||||
return ApplyPaging(new QueryResult<ServerItem>
|
||||
{
|
||||
Items = folders,
|
||||
TotalRecordCount = folders.Length
|
||||
}, startIndex, limit);
|
||||
return ApplyPaging(
|
||||
new QueryResult<ServerItem>
|
||||
{
|
||||
Items = folders,
|
||||
TotalRecordCount = folders.Length
|
||||
},
|
||||
startIndex,
|
||||
limit);
|
||||
}
|
||||
|
||||
private QueryResult<ServerItem> GetTvFolders(BaseItem item, User user, StubType? stubType, SortCriteria sort, int? startIndex, int? limit)
|
||||
@@ -1135,14 +1141,16 @@ namespace Emby.Dlna.ContentDirectory
|
||||
{
|
||||
query.OrderBy = Array.Empty<(string, SortOrder)>();
|
||||
|
||||
var items = _userViewManager.GetLatestItems(new LatestItemsQuery
|
||||
{
|
||||
UserId = user.Id,
|
||||
Limit = 50,
|
||||
IncludeItemTypes = new[] { nameof(Audio) },
|
||||
ParentId = parent?.Id ?? Guid.Empty,
|
||||
GroupItems = true
|
||||
}, query.DtoOptions).Select(i => i.Item1 ?? i.Item2.FirstOrDefault()).Where(i => i != null).ToArray();
|
||||
var items = _userViewManager.GetLatestItems(
|
||||
new LatestItemsQuery
|
||||
{
|
||||
UserId = user.Id,
|
||||
Limit = 50,
|
||||
IncludeItemTypes = new[] { nameof(Audio) },
|
||||
ParentId = parent?.Id ?? Guid.Empty,
|
||||
GroupItems = true
|
||||
},
|
||||
query.DtoOptions).Select(i => i.Item1 ?? i.Item2.FirstOrDefault()).Where(i => i != null).ToArray();
|
||||
|
||||
return ToResult(items);
|
||||
}
|
||||
@@ -1151,12 +1159,15 @@ namespace Emby.Dlna.ContentDirectory
|
||||
{
|
||||
query.OrderBy = Array.Empty<(string, SortOrder)>();
|
||||
|
||||
var result = _tvSeriesManager.GetNextUp(new NextUpQuery
|
||||
{
|
||||
Limit = query.Limit,
|
||||
StartIndex = query.StartIndex,
|
||||
UserId = query.User.Id
|
||||
}, new[] { parent }, query.DtoOptions);
|
||||
var result = _tvSeriesManager.GetNextUp(
|
||||
new NextUpQuery
|
||||
{
|
||||
Limit = query.Limit,
|
||||
StartIndex = query.StartIndex,
|
||||
UserId = query.User.Id
|
||||
},
|
||||
new[] { parent },
|
||||
query.DtoOptions);
|
||||
|
||||
return ToResult(result);
|
||||
}
|
||||
@@ -1165,14 +1176,16 @@ namespace Emby.Dlna.ContentDirectory
|
||||
{
|
||||
query.OrderBy = Array.Empty<(string, SortOrder)>();
|
||||
|
||||
var items = _userViewManager.GetLatestItems(new LatestItemsQuery
|
||||
{
|
||||
UserId = user.Id,
|
||||
Limit = 50,
|
||||
IncludeItemTypes = new[] { typeof(Episode).Name },
|
||||
ParentId = parent == null ? Guid.Empty : parent.Id,
|
||||
GroupItems = false
|
||||
}, query.DtoOptions).Select(i => i.Item1 ?? i.Item2.FirstOrDefault()).Where(i => i != null).ToArray();
|
||||
var items = _userViewManager.GetLatestItems(
|
||||
new LatestItemsQuery
|
||||
{
|
||||
UserId = user.Id,
|
||||
Limit = 50,
|
||||
IncludeItemTypes = new[] { typeof(Episode).Name },
|
||||
ParentId = parent == null ? Guid.Empty : parent.Id,
|
||||
GroupItems = false
|
||||
},
|
||||
query.DtoOptions).Select(i => i.Item1 ?? i.Item2.FirstOrDefault()).Where(i => i != null).ToArray();
|
||||
|
||||
return ToResult(items);
|
||||
}
|
||||
@@ -1183,13 +1196,14 @@ namespace Emby.Dlna.ContentDirectory
|
||||
|
||||
var items = _userViewManager.GetLatestItems(
|
||||
new LatestItemsQuery
|
||||
{
|
||||
UserId = user.Id,
|
||||
Limit = 50,
|
||||
IncludeItemTypes = new[] { nameof(Movie) },
|
||||
ParentId = parent?.Id ?? Guid.Empty,
|
||||
GroupItems = true
|
||||
}, query.DtoOptions).Select(i => i.Item1 ?? i.Item2.FirstOrDefault()).Where(i => i != null).ToArray();
|
||||
{
|
||||
UserId = user.Id,
|
||||
Limit = 50,
|
||||
IncludeItemTypes = new[] { nameof(Movie) },
|
||||
ParentId = parent?.Id ?? Guid.Empty,
|
||||
GroupItems = true
|
||||
},
|
||||
query.DtoOptions).Select(i => i.Item1 ?? i.Item2.FirstOrDefault()).Where(i => i != null).ToArray();
|
||||
|
||||
return ToResult(items);
|
||||
}
|
||||
@@ -1354,44 +1368,4 @@ namespace Emby.Dlna.ContentDirectory
|
||||
return new ServerItem(_libraryManager.GetUserRootFolder());
|
||||
}
|
||||
}
|
||||
|
||||
internal class ServerItem
|
||||
{
|
||||
public BaseItem Item { get; set; }
|
||||
|
||||
public StubType? StubType { get; set; }
|
||||
|
||||
public ServerItem(BaseItem item)
|
||||
{
|
||||
Item = item;
|
||||
|
||||
if (item is IItemByName && !(item is Folder))
|
||||
{
|
||||
StubType = Dlna.ContentDirectory.StubType.Folder;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public enum StubType
|
||||
{
|
||||
Folder = 0,
|
||||
Latest = 2,
|
||||
Playlists = 3,
|
||||
Albums = 4,
|
||||
AlbumArtists = 5,
|
||||
Artists = 6,
|
||||
Songs = 7,
|
||||
Genres = 8,
|
||||
FavoriteSongs = 9,
|
||||
FavoriteArtists = 10,
|
||||
FavoriteAlbums = 11,
|
||||
ContinueWatching = 12,
|
||||
Movies = 13,
|
||||
Collections = 14,
|
||||
Favorites = 15,
|
||||
NextUp = 16,
|
||||
Series = 17,
|
||||
FavoriteSeries = 18,
|
||||
FavoriteEpisodes = 19
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user