Skip to content

Commit

Permalink
Merge pull request #3316 from MediaBrowser/dev
Browse files Browse the repository at this point in the history
3.4.1.14
  • Loading branch information
LukePulverenti authored Jun 10, 2018
2 parents 6d5fbe7 + c3d39d5 commit 9101634
Show file tree
Hide file tree
Showing 126 changed files with 554 additions and 627 deletions.
4 changes: 2 additions & 2 deletions BDInfo/BDInfo.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -34,10 +34,10 @@
</PropertyGroup>
<ItemGroup>
<Reference Include="MediaBrowser.Common, Version=1.0.0.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\MediaBrowser.Common.3.3.47-beta\lib\netstandard2.0\MediaBrowser.Common.dll</HintPath>
<HintPath>..\packages\MediaBrowser.Common.3.3.48-beta\lib\netstandard2.0\MediaBrowser.Common.dll</HintPath>
</Reference>
<Reference Include="MediaBrowser.Model, Version=1.0.0.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\MediaBrowser.Common.3.3.47-beta\lib\netstandard2.0\MediaBrowser.Model.dll</HintPath>
<HintPath>..\packages\MediaBrowser.Common.3.3.48-beta\lib\netstandard2.0\MediaBrowser.Model.dll</HintPath>
</Reference>
<Reference Include="System" />
<Reference Include="System.Configuration" />
Expand Down
2 changes: 1 addition & 1 deletion BDInfo/packages.config
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="MediaBrowser.Common" version="3.3.47-beta" targetFramework="net47" />
<package id="MediaBrowser.Common" version="3.3.48-beta" targetFramework="net47" />
</packages>
4 changes: 2 additions & 2 deletions DvdLib/DvdLib.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -49,10 +49,10 @@
<Compile Include="Ifo\VideoAttributes.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
<Reference Include="MediaBrowser.Common, Version=1.0.0.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\MediaBrowser.Common.3.3.47-beta\lib\netstandard2.0\MediaBrowser.Common.dll</HintPath>
<HintPath>..\packages\MediaBrowser.Common.3.3.48-beta\lib\netstandard2.0\MediaBrowser.Common.dll</HintPath>
</Reference>
<Reference Include="MediaBrowser.Model, Version=1.0.0.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\MediaBrowser.Common.3.3.47-beta\lib\netstandard2.0\MediaBrowser.Model.dll</HintPath>
<HintPath>..\packages\MediaBrowser.Common.3.3.48-beta\lib\netstandard2.0\MediaBrowser.Model.dll</HintPath>
</Reference>
<Reference Include="System" />
<Reference Include="System.Configuration" />
Expand Down
2 changes: 1 addition & 1 deletion DvdLib/packages.config
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="MediaBrowser.Common" version="3.3.47-beta" targetFramework="net47" />
<package id="MediaBrowser.Common" version="3.3.48-beta" targetFramework="net47" />
</packages>
26 changes: 13 additions & 13 deletions Emby.Dlna/ContentDirectory/ControlHandler.cs
Original file line number Diff line number Diff line change
Expand Up @@ -481,17 +481,17 @@ private QueryResult<ServerItem> GetUserItems(BaseItem item, StubType? stubType,
{
if (item is MusicGenre)
{
return GetMusicGenreItems(item, null, user, sort, startIndex, limit);
return GetMusicGenreItems(item, Guid.Empty, user, sort, startIndex, limit);
}

if (item is MusicArtist)
{
return GetMusicArtistItems(item, null, user, sort, startIndex, limit);
return GetMusicArtistItems(item, Guid.Empty, user, sort, startIndex, limit);
}

if (item is Genre)
{
return GetGenreItems(item, null, user, sort, startIndex, limit);
return GetGenreItems(item, Guid.Empty, user, sort, startIndex, limit);
}

if (!stubType.HasValue || stubType.Value != StubType.Folder)
Expand Down Expand Up @@ -1124,10 +1124,10 @@ private QueryResult<ServerItem> GetMusicLatest(BaseItem parent, User user, Inter

var items = _userViewManager.GetLatestItems(new LatestItemsQuery
{
UserId = user.Id.ToString("N"),
UserId = user.Id,
Limit = 50,
IncludeItemTypes = new[] { typeof(Audio).Name },
ParentId = parent == null ? null : parent.Id.ToString("N"),
ParentId = parent == null ? Guid.Empty : parent.Id,
GroupItems = true

}, query.DtoOptions).Select(i => i.Item1 ?? i.Item2.FirstOrDefault()).Where(i => i != null).ToArray();
Expand All @@ -1143,7 +1143,7 @@ private QueryResult<ServerItem> GetNextUp(BaseItem parent, User user, InternalIt
{
Limit = query.Limit,
StartIndex = query.StartIndex,
UserId = query.User.Id.ToString("N")
UserId = query.User.Id

}, new [] { parent }, query.DtoOptions);

Expand All @@ -1156,10 +1156,10 @@ private QueryResult<ServerItem> GetTvLatest(BaseItem parent, User user, Internal

var items = _userViewManager.GetLatestItems(new LatestItemsQuery
{
UserId = user.Id.ToString("N"),
UserId = user.Id,
Limit = 50,
IncludeItemTypes = new[] { typeof(Episode).Name },
ParentId = parent == null ? null : parent.Id.ToString("N"),
ParentId = parent == null ? Guid.Empty : parent.Id,
GroupItems = false

}, query.DtoOptions).Select(i => i.Item1 ?? i.Item2.FirstOrDefault()).Where(i => i != null).ToArray();
Expand All @@ -1173,18 +1173,18 @@ private QueryResult<ServerItem> GetMovieLatest(BaseItem parent, User user, Inter

var items = _userViewManager.GetLatestItems(new LatestItemsQuery
{
UserId = user.Id.ToString("N"),
UserId = user.Id,
Limit = 50,
IncludeItemTypes = new[] { typeof(Movie).Name },
ParentId = parent == null ? null : parent.Id.ToString("N"),
ParentId = parent == null ? Guid.Empty : parent.Id,
GroupItems = true

}, query.DtoOptions).Select(i => i.Item1 ?? i.Item2.FirstOrDefault()).Where(i => i != null).ToArray();

return ToResult(items);
}

private QueryResult<ServerItem> GetMusicArtistItems(BaseItem item, Guid? parentId, User user, SortCriteria sort, int? startIndex, int? limit)
private QueryResult<ServerItem> GetMusicArtistItems(BaseItem item, Guid parentId, User user, SortCriteria sort, int? startIndex, int? limit)
{
var query = new InternalItemsQuery(user)
{
Expand All @@ -1204,7 +1204,7 @@ private QueryResult<ServerItem> GetMusicArtistItems(BaseItem item, Guid? parentI
return ToResult(result);
}

private QueryResult<ServerItem> GetGenreItems(BaseItem item, Guid? parentId, User user, SortCriteria sort, int? startIndex, int? limit)
private QueryResult<ServerItem> GetGenreItems(BaseItem item, Guid parentId, User user, SortCriteria sort, int? startIndex, int? limit)
{
var query = new InternalItemsQuery(user)
{
Expand All @@ -1224,7 +1224,7 @@ private QueryResult<ServerItem> GetGenreItems(BaseItem item, Guid? parentId, Use
return ToResult(result);
}

private QueryResult<ServerItem> GetMusicGenreItems(BaseItem item, Guid? parentId, User user, SortCriteria sort, int? startIndex, int? limit)
private QueryResult<ServerItem> GetMusicGenreItems(BaseItem item, Guid parentId, User user, SortCriteria sort, int? startIndex, int? limit)
{
var query = new InternalItemsQuery(user)
{
Expand Down
25 changes: 9 additions & 16 deletions Emby.Dlna/Didl/DidlBuilder.cs
Original file line number Diff line number Diff line change
Expand Up @@ -142,9 +142,9 @@ public void WriteItemElement(DlnaOptions options,
else
{
var parent = item.DisplayParentId;
if (parent.HasValue)
if (!parent.Equals(Guid.Empty))
{
writer.WriteAttributeString("parentID", GetClientId(parent.Value, null));
writer.WriteAttributeString("parentID", GetClientId(parent, null));
}
}

Expand Down Expand Up @@ -204,7 +204,7 @@ private void AddVideoResource(DlnaOptions options, XmlWriter writer, BaseItem vi

streamInfo = new StreamBuilder(_mediaEncoder, GetStreamBuilderLogger(options)).BuildVideoItem(new VideoOptions
{
ItemId = GetClientId(video),
ItemId = video.Id,
MediaSources = sources.ToArray(sources.Count),
Profile = _profile,
DeviceId = deviceId,
Expand Down Expand Up @@ -517,7 +517,7 @@ private void AddAudioResource(DlnaOptions options, XmlWriter writer, BaseItem au

streamInfo = new StreamBuilder(_mediaEncoder, GetStreamBuilderLogger(options)).BuildAudioItem(new AudioOptions
{
ItemId = GetClientId(audio),
ItemId = audio.Id,
MediaSources = sources.ToArray(sources.Count),
Profile = _profile,
DeviceId = deviceId
Expand Down Expand Up @@ -641,13 +641,13 @@ public void WriteFolderElement(XmlWriter writer, BaseItem folder, StubType? stub
else
{
var parent = folder.DisplayParentId;
if (!parent.HasValue)
if (parent.Equals(Guid.Empty))
{
writer.WriteAttributeString("parentID", "0");
}
else
{
writer.WriteAttributeString("parentID", GetClientId(parent.Value, null));
writer.WriteAttributeString("parentID", GetClientId(parent, null));
}
}
}
Expand Down Expand Up @@ -1138,7 +1138,7 @@ private ImageDownloadInfo GetImageInfo(BaseItem item, ImageType type)

return new ImageDownloadInfo
{
ItemId = item.Id.ToString("N"),
ItemId = item.Id,
Type = type,
ImageTag = tag,
Width = width,
Expand All @@ -1150,7 +1150,7 @@ private ImageDownloadInfo GetImageInfo(BaseItem item, ImageType type)

class ImageDownloadInfo
{
internal string ItemId;
internal Guid ItemId;
internal string ImageTag;
internal ImageType Type;

Expand Down Expand Up @@ -1189,18 +1189,11 @@ public static string GetClientId(Guid idValue, StubType? stubType)
return id;
}

public static string GetClientId(BaseItem item)
{
var id = item.Id.ToString("N");

return id;
}

private ImageUrlInfo GetImageUrl(ImageDownloadInfo info, int maxWidth, int maxHeight, string format)
{
var url = string.Format("{0}/Items/{1}/Images/{2}/0/{3}/{4}/{5}/{6}/0/0",
_serverAddress,
info.ItemId,
info.ItemId.ToString("N"),
info.Type,
info.ImageTag,
format,
Expand Down
6 changes: 3 additions & 3 deletions Emby.Dlna/Emby.Dlna.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -174,13 +174,13 @@
</ItemGroup>
<ItemGroup>
<Reference Include="MediaBrowser.Common, Version=1.0.0.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\MediaBrowser.Common.3.3.47-beta\lib\netstandard2.0\MediaBrowser.Common.dll</HintPath>
<HintPath>..\packages\MediaBrowser.Common.3.3.48-beta\lib\netstandard2.0\MediaBrowser.Common.dll</HintPath>
</Reference>
<Reference Include="MediaBrowser.Controller, Version=1.0.0.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\MediaBrowser.Server.Core.3.3.47-beta\lib\netstandard2.0\MediaBrowser.Controller.dll</HintPath>
<HintPath>..\packages\MediaBrowser.Server.Core.3.3.48-beta\lib\netstandard2.0\MediaBrowser.Controller.dll</HintPath>
</Reference>
<Reference Include="MediaBrowser.Model, Version=1.0.0.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\MediaBrowser.Common.3.3.47-beta\lib\netstandard2.0\MediaBrowser.Model.dll</HintPath>
<HintPath>..\packages\MediaBrowser.Common.3.3.48-beta\lib\netstandard2.0\MediaBrowser.Model.dll</HintPath>
</Reference>
<Reference Include="System" />
<Reference Include="System.Configuration" />
Expand Down
36 changes: 16 additions & 20 deletions Emby.Dlna/PlayTo/PlayToController.cs
Original file line number Diff line number Diff line change
Expand Up @@ -321,12 +321,12 @@ public async Task SendPlayCommand(PlayRequest command, CancellationToken cancell
{
_logger.Debug("{0} - Received PlayRequest: {1}", this._session.DeviceName, command.PlayCommand);

var user = String.IsNullOrEmpty(command.ControllingUserId) ? null : _userManager.GetUserById(command.ControllingUserId);
var user = command.ControllingUserId.Equals(Guid.Empty) ? null : _userManager.GetUserById(command.ControllingUserId);

var items = new List<BaseItem>();
foreach (string id in command.ItemIds)
foreach (var id in command.ItemIds)
{
AddItemFromId(Guid.Parse(id), items);
AddItemFromId(id, items);
}

var startIndex = command.StartIndex ?? 0;
Expand Down Expand Up @@ -362,9 +362,9 @@ public async Task SendPlayCommand(PlayRequest command, CancellationToken cancell
Playlist.AddRange(playlist);
}

if (!String.IsNullOrEmpty(command.ControllingUserId))
if (!command.ControllingUserId.Equals(Guid.Empty))
{
_sessionManager.LogSessionActivity(_session.AppName, _session.ApplicationVersion, _session.DeviceId,
_sessionManager.LogSessionActivity(_session.Client, _session.ApplicationVersion, _session.DeviceId,
_session.DeviceName, _session.RemoteEndPoint, user);
}

Expand Down Expand Up @@ -413,7 +413,7 @@ private async Task Seek(long newPosition)

if (info.Item != null && !EnableClientSideSeek(info))
{
var user = _session.UserId.HasValue ? _userManager.GetUserById(_session.UserId.Value) : null;
var user = !_session.UserId.Equals(Guid.Empty) ? _userManager.GetUserById(_session.UserId) : null;
var newItem = CreatePlaylistItem(info.Item, user, newPosition, info.MediaSourceId, info.AudioStreamIndex, info.SubtitleStreamIndex);

await _device.SetAvTransport(newItem.StreamUrl, GetDlnaHeaders(newItem), newItem.Didl, CancellationToken.None).ConfigureAwait(false);
Expand Down Expand Up @@ -550,7 +550,7 @@ private PlaylistItem GetPlaylistItem(BaseItem item, List<MediaSourceInfo> mediaS
{
StreamInfo = new StreamBuilder(_mediaEncoder, GetStreamBuilderLogger()).BuildVideoItem(new VideoOptions
{
ItemId = item.Id.ToString("N"),
ItemId = item.Id,
MediaSources = mediaSources.ToArray(mediaSources.Count),
Profile = profile,
DeviceId = deviceId,
Expand All @@ -570,7 +570,7 @@ private PlaylistItem GetPlaylistItem(BaseItem item, List<MediaSourceInfo> mediaS
{
StreamInfo = new StreamBuilder(_mediaEncoder, GetStreamBuilderLogger()).BuildAudioItem(new AudioOptions
{
ItemId = item.Id.ToString("N"),
ItemId = item.Id,
MediaSources = mediaSources.ToArray(mediaSources.Count),
Profile = profile,
DeviceId = deviceId,
Expand Down Expand Up @@ -741,7 +741,7 @@ private async Task SetAudioStreamIndex(int? newIndex)
{
var newPosition = GetProgressPositionTicks(media, info) ?? 0;

var user = _session.UserId.HasValue ? _userManager.GetUserById(_session.UserId.Value) : null;
var user = !_session.UserId.Equals(Guid.Empty) ? _userManager.GetUserById(_session.UserId) : null;
var newItem = CreatePlaylistItem(info.Item, user, newPosition, info.MediaSourceId, newIndex, info.SubtitleStreamIndex);

await _device.SetAvTransport(newItem.StreamUrl, GetDlnaHeaders(newItem), newItem.Didl, CancellationToken.None).ConfigureAwait(false);
Expand All @@ -766,7 +766,7 @@ private async Task SetSubtitleStreamIndex(int? newIndex)
{
var newPosition = GetProgressPositionTicks(media, info) ?? 0;

var user = _session.UserId.HasValue ? _userManager.GetUserById(_session.UserId.Value) : null;
var user = !_session.UserId.Equals(Guid.Empty) ? _userManager.GetUserById(_session.UserId) : null;
var newItem = CreatePlaylistItem(info.Item, user, newPosition, info.MediaSourceId, info.AudioStreamIndex, newIndex);

await _device.SetAvTransport(newItem.StreamUrl, GetDlnaHeaders(newItem), newItem.Didl, CancellationToken.None).ConfigureAwait(false);
Expand Down Expand Up @@ -795,7 +795,7 @@ private async Task SeekAfterTransportChange(long positionTicks, CancellationToke

private class StreamParams
{
public string ItemId { get; set; }
public Guid ItemId { get; set; }

public bool IsDirectStream { get; set; }

Expand Down Expand Up @@ -835,7 +835,7 @@ public async Task<MediaSourceInfo> GetMediaSource(CancellationToken cancellation
return MediaSource;
}

private static string GetItemId(string url)
private static Guid GetItemId(string url)
{
if (string.IsNullOrEmpty(url))
{
Expand All @@ -853,12 +853,12 @@ private static string GetItemId(string url)
{
if (parts.Length > i + 1)
{
return parts[i + 1];
return Guid.Parse(parts[i + 1]);
}
}
}

return null;
return Guid.Empty;
}

public static StreamParams ParseFromUrl(string url, ILibraryManager libraryManager, IMediaSourceManager mediaSourceManager)
Expand All @@ -873,9 +873,7 @@ public static StreamParams ParseFromUrl(string url, ILibraryManager libraryManag
ItemId = GetItemId(url)
};

Guid parsedId;

if (string.IsNullOrWhiteSpace(request.ItemId) || !Guid.TryParse(request.ItemId, out parsedId))
if (request.ItemId.Equals(Guid.Empty))
{
return request;
}
Expand All @@ -896,9 +894,7 @@ public static StreamParams ParseFromUrl(string url, ILibraryManager libraryManag
request.SubtitleStreamIndex = GetIntValue(values, "SubtitleStreamIndex");
request.StartPositionTicks = GetLongValue(values, "StartPositionTicks");

request.Item = string.IsNullOrEmpty(request.ItemId)
? null
: libraryManager.GetItemById(parsedId);
request.Item = libraryManager.GetItemById(request.ItemId);

request._mediaSourceManager = mediaSourceManager;

Expand Down
2 changes: 1 addition & 1 deletion Emby.Dlna/PlayTo/PlaylistItemFactory.cs
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ public PlaylistItem Create(Photo item, DeviceProfile profile)
{
StreamInfo = new StreamInfo
{
ItemId = item.Id.ToString("N"),
ItemId = item.Id,
MediaType = DlnaProfileType.Photo,
DeviceProfile = profile
},
Expand Down
4 changes: 2 additions & 2 deletions Emby.Dlna/packages.config
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="MediaBrowser.Common" version="3.3.47-beta" targetFramework="net47" />
<package id="MediaBrowser.Server.Core" version="3.3.47-beta" targetFramework="net47" />
<package id="MediaBrowser.Common" version="3.3.48-beta" targetFramework="net47" />
<package id="MediaBrowser.Server.Core" version="3.3.48-beta" targetFramework="net47" />
<package id="System.Runtime.CompilerServices.Unsafe" version="4.5.0" targetFramework="net47" />
</packages>
Loading

0 comments on commit 9101634

Please sign in to comment.