Skip to content

Commit

Permalink
Merge pull request #3224 from MediaBrowser/dev
Browse files Browse the repository at this point in the history
Dev
  • Loading branch information
LukePulverenti authored Apr 2, 2018
2 parents 8c12f41 + 078b6d1 commit 832807b
Show file tree
Hide file tree
Showing 247 changed files with 1,108 additions and 1,323 deletions.
18 changes: 9 additions & 9 deletions Emby.Dlna/ContentDirectory/ControlHandler.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1024,7 +1024,7 @@ private QueryResult<ServerItem> GetGenres(BaseItem parent, User user, InternalIt
{
var genresResult = _libraryManager.GetGenres(new InternalItemsQuery(user)
{
AncestorIds = new[] { parent.Id.ToString("N") },
AncestorIds = new[] { parent.Id },
StartIndex = query.StartIndex,
Limit = query.Limit
});
Expand All @@ -1042,7 +1042,7 @@ private QueryResult<ServerItem> GetMusicGenres(BaseItem parent, User user, Inter
{
var genresResult = _libraryManager.GetMusicGenres(new InternalItemsQuery(user)
{
AncestorIds = new[] { parent.Id.ToString("N") },
AncestorIds = new[] { parent.Id },
StartIndex = query.StartIndex,
Limit = query.Limit
});
Expand All @@ -1060,7 +1060,7 @@ private QueryResult<ServerItem> GetMusicAlbumArtists(BaseItem parent, User user,
{
var artists = _libraryManager.GetAlbumArtists(new InternalItemsQuery(user)
{
AncestorIds = new[] { parent.Id.ToString("N") },
AncestorIds = new[] { parent.Id },
StartIndex = query.StartIndex,
Limit = query.Limit
});
Expand All @@ -1078,7 +1078,7 @@ private QueryResult<ServerItem> GetMusicArtists(BaseItem parent, User user, Inte
{
var artists = _libraryManager.GetArtists(new InternalItemsQuery(user)
{
AncestorIds = new[] { parent.Id.ToString("N") },
AncestorIds = new[] { parent.Id },
StartIndex = query.StartIndex,
Limit = query.Limit
});
Expand All @@ -1096,7 +1096,7 @@ private QueryResult<ServerItem> GetFavoriteArtists(BaseItem parent, User user, I
{
var artists = _libraryManager.GetArtists(new InternalItemsQuery(user)
{
AncestorIds = new[] { parent.Id.ToString("N") },
AncestorIds = new[] { parent.Id },
StartIndex = query.StartIndex,
Limit = query.Limit,
IsFavorite = true
Expand Down Expand Up @@ -1195,7 +1195,7 @@ private QueryResult<ServerItem> GetMusicArtistItems(BaseItem item, Guid? parentI
{
Recursive = true,
ParentId = parentId,
ArtistIds = new[] { item.Id.ToString("N") },
ArtistIds = new[] { item.Id },
IncludeItemTypes = new[] { typeof(MusicAlbum).Name },
Limit = limit,
StartIndex = startIndex,
Expand All @@ -1215,7 +1215,7 @@ private QueryResult<ServerItem> GetGenreItems(BaseItem item, Guid? parentId, Use
{
Recursive = true,
ParentId = parentId,
GenreIds = new[] { item.Id.ToString("N") },
GenreIds = new[] { item.Id },
IncludeItemTypes = new[] { typeof(Movie).Name, typeof(Series).Name },
Limit = limit,
StartIndex = startIndex,
Expand All @@ -1235,7 +1235,7 @@ private QueryResult<ServerItem> GetMusicGenreItems(BaseItem item, Guid? parentId
{
Recursive = true,
ParentId = parentId,
GenreIds = new[] { item.Id.ToString("N") },
GenreIds = new[] { item.Id },
IncludeItemTypes = new[] { typeof(MusicAlbum).Name },
Limit = limit,
StartIndex = startIndex,
Expand Down Expand Up @@ -1291,7 +1291,7 @@ private QueryResult<ServerItem> GetItemsFromPerson(Person person, User user, int
{
var itemsResult = _libraryManager.GetItemsResult(new InternalItemsQuery(user)
{
PersonIds = new[] { person.Id.ToString("N") },
PersonIds = new[] { person.Id },
IncludeItemTypes = new[] { typeof(Movie).Name, typeof(Series).Name, typeof(Trailer).Name },
OrderBy = new[] { ItemSortBy.SortName }.Select(i => new Tuple<string, SortOrder>(i, SortOrder.Ascending)).ToArray(),
Limit = limit,
Expand Down
12 changes: 6 additions & 6 deletions Emby.Dlna/Didl/DidlBuilder.cs
Original file line number Diff line number Diff line change
Expand Up @@ -161,11 +161,11 @@ public void WriteItemElement(DlnaOptions options,
{
if (string.Equals(item.MediaType, MediaType.Audio, StringComparison.OrdinalIgnoreCase))
{
AddAudioResource(options, writer, hasMediaSources, deviceId, filter, streamInfo);
AddAudioResource(options, writer, item, deviceId, filter, streamInfo);
}
else if (string.Equals(item.MediaType, MediaType.Video, StringComparison.OrdinalIgnoreCase))
{
AddVideoResource(options, writer, hasMediaSources, deviceId, filter, streamInfo);
AddVideoResource(options, writer, item, deviceId, filter, streamInfo);
}
}

Expand Down Expand Up @@ -196,7 +196,7 @@ private string GetMimeType(string input)
return mime;
}

private void AddVideoResource(DlnaOptions options, XmlWriter writer, IHasMediaSources video, string deviceId, Filter filter, StreamInfo streamInfo = null)
private void AddVideoResource(DlnaOptions options, XmlWriter writer, BaseItem video, string deviceId, Filter filter, StreamInfo streamInfo = null)
{
if (streamInfo == null)
{
Expand Down Expand Up @@ -303,7 +303,7 @@ private bool AddSubtitleElement(XmlWriter writer, SubtitleStreamInfo info)
return true;
}

private void AddVideoResource(XmlWriter writer, IHasMediaSources video, string deviceId, Filter filter, string contentFeatures, StreamInfo streamInfo)
private void AddVideoResource(XmlWriter writer, BaseItem video, string deviceId, Filter filter, string contentFeatures, StreamInfo streamInfo)
{
writer.WriteStartElement(string.Empty, "res", NS_DIDL);

Expand Down Expand Up @@ -501,7 +501,7 @@ private string GetDisplayName(BaseItem item, StubType? itemStubType, BaseItem co
return item.Name;
}

private void AddAudioResource(DlnaOptions options, XmlWriter writer, IHasMediaSources audio, string deviceId, Filter filter, StreamInfo streamInfo = null)
private void AddAudioResource(DlnaOptions options, XmlWriter writer, BaseItem audio, string deviceId, Filter filter, StreamInfo streamInfo = null)
{
writer.WriteStartElement(string.Empty, "res", NS_DIDL);

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

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

Expand Down
1 change: 0 additions & 1 deletion Emby.Dlna/DlnaManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -595,7 +595,6 @@ private void DumpProfiles()

public void Dispose()
{
GC.SuppressFinalize(this);
}
}
}
1 change: 0 additions & 1 deletion Emby.Dlna/Main/DlnaEntryPoint.cs
Original file line number Diff line number Diff line change
Expand Up @@ -364,7 +364,6 @@ public void Dispose()
_communicationsServer.Dispose();
_communicationsServer = null;
}
GC.SuppressFinalize(this);
}

public void DisposeDevicePublisher()
Expand Down
1 change: 0 additions & 1 deletion Emby.Dlna/PlayTo/Device.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1147,7 +1147,6 @@ public void Dispose()
_disposed = true;

DisposeTimer();
GC.SuppressFinalize(this);
}
}

Expand Down
5 changes: 2 additions & 3 deletions Emby.Dlna/PlayTo/PlayToController.cs
Original file line number Diff line number Diff line change
Expand Up @@ -465,7 +465,7 @@ private PlaylistItem CreatePlaylistItem(BaseItem item, User user, long startPost

var hasMediaSources = item as IHasMediaSources;
var mediaSources = hasMediaSources != null
? (_mediaSourceManager.GetStaticMediaSources(hasMediaSources, true, user))
? (_mediaSourceManager.GetStaticMediaSources(item, true, user))
: new List<MediaSourceInfo>();

var playlistItem = GetPlaylistItem(item, mediaSources, profile, _session.DeviceId, mediaSourceId, audioStreamIndex, subtitleStreamIndex);
Expand Down Expand Up @@ -644,7 +644,6 @@ public void Dispose()
_device.OnDeviceUnavailable = null;

_device.Dispose();
GC.SuppressFinalize(this);
}
}

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

MediaSource = await _mediaSourceManager.GetMediaSource(hasMediaSources, MediaSourceId, LiveStreamId, false, cancellationToken).ConfigureAwait(false);
MediaSource = await _mediaSourceManager.GetMediaSource(Item, MediaSourceId, LiveStreamId, false, cancellationToken).ConfigureAwait(false);

return MediaSource;
}
Expand Down
1 change: 0 additions & 1 deletion Emby.Dlna/PlayTo/PlayToManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -258,7 +258,6 @@ public void Dispose()
}

_disposed = true;
GC.SuppressFinalize(this);
}
}
}
2 changes: 1 addition & 1 deletion Emby.Dlna/Profiles/SamsungSmartTvProfile.cs
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ public SamsungSmartTvProfile()
},
new TranscodingProfile
{
Container = "ts,mpegts",
Container = "ts",
AudioCodec = "ac3",
VideoCodec = "h264",
Type = DlnaProfileType.Video,
Expand Down
2 changes: 1 addition & 1 deletion Emby.Dlna/Profiles/Xml/Samsung Smart TV.xml
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@
</DirectPlayProfiles>
<TranscodingProfiles>
<TranscodingProfile container="mp3" type="Audio" audioCodec="mp3" estimateContentLength="false" enableMpegtsM2TsMode="false" transcodeSeekInfo="Auto" copyTimestamps="false" context="Streaming" enableSubtitlesInManifest="false" minSegments="0" segmentLength="0" breakOnNonKeyFrames="false" />
<TranscodingProfile container="ts,mpegts" type="Video" videoCodec="h264" audioCodec="ac3" estimateContentLength="false" enableMpegtsM2TsMode="false" transcodeSeekInfo="Auto" copyTimestamps="false" context="Streaming" enableSubtitlesInManifest="false" minSegments="0" segmentLength="0" breakOnNonKeyFrames="false" />
<TranscodingProfile container="ts" type="Video" videoCodec="h264" audioCodec="ac3" estimateContentLength="false" enableMpegtsM2TsMode="false" transcodeSeekInfo="Auto" copyTimestamps="false" context="Streaming" enableSubtitlesInManifest="false" minSegments="0" segmentLength="0" breakOnNonKeyFrames="false" />
<TranscodingProfile container="jpeg" type="Photo" estimateContentLength="false" enableMpegtsM2TsMode="false" transcodeSeekInfo="Auto" copyTimestamps="false" context="Streaming" enableSubtitlesInManifest="false" minSegments="0" segmentLength="0" breakOnNonKeyFrames="false" />
</TranscodingProfiles>
<ContainerProfiles>
Expand Down
1 change: 0 additions & 1 deletion Emby.Drawing.ImageMagick/ImageMagickEncoder.cs
Original file line number Diff line number Diff line change
Expand Up @@ -328,7 +328,6 @@ public void Dispose()
{
_disposed = true;
Wand.CloseEnvironment();
GC.SuppressFinalize(this);
}

private void CheckDisposed()
Expand Down
8 changes: 6 additions & 2 deletions Emby.Drawing.Skia/StripCollageBuilder.cs
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,6 @@ private SKBitmap BuildThumbCollageBitmap(string[] paths, int width, int height)

for (int i = 0; i < 4; i++)
{
SKCodecOrigin origin;
int newIndex;

using (var currentBitmap = GetNextValidImage(paths, imageIndex, out newIndex))
Expand All @@ -108,7 +107,12 @@ private SKBitmap BuildThumbCollageBitmap(string[] paths, int width, int height)
using (var subset = image.Subset(SKRectI.Create(ix, 0, iSlice, iHeight)))
{
// draw image onto canvas
canvas.DrawImage(subset, (horizontalImagePadding * (i + 1)) + (iSlice * i), verticalSpacing);
canvas.DrawImage(subset ?? image, (horizontalImagePadding * (i + 1)) + (iSlice * i), verticalSpacing);

if (subset == null)
{
continue;
}

using (var croppedBitmap = SKBitmap.FromImage(subset))
{
Expand Down
2 changes: 0 additions & 2 deletions Emby.Drawing/ImageProcessor.cs
Original file line number Diff line number Diff line change
Expand Up @@ -912,8 +912,6 @@ public void Dispose()
{
disposable.Dispose();
}

GC.SuppressFinalize(this);
}

private void CheckDisposed()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -491,7 +491,6 @@ public void Dispose()
//_logManager.LoggerLoaded -= _logManager_LoggerLoaded;

_appHost.ApplicationUpdated -= _appHost_ApplicationUpdated;
GC.SuppressFinalize(this);
}

/// <summary>
Expand Down
5 changes: 2 additions & 3 deletions Emby.Server.Implementations/ApplicationHost.cs
Original file line number Diff line number Diff line change
Expand Up @@ -974,7 +974,7 @@ protected void RegisterResources()

var deviceRepo = new SqliteDeviceRepository(LogManager.GetLogger("DeviceManager"), ServerConfigurationManager, FileSystemManager, JsonSerializer);
deviceRepo.Initialize();
DeviceManager = new DeviceManager(deviceRepo, UserManager, FileSystemManager, LibraryMonitor, ServerConfigurationManager, LogManager.GetLogger("DeviceManager"), NetworkManager);
DeviceManager = new DeviceManager(deviceRepo, LibraryManager, LocalizationManager, UserManager, FileSystemManager, LibraryMonitor, ServerConfigurationManager, LogManager.GetLogger("DeviceManager"), NetworkManager);
RegisterSingleInstance<IDeviceRepository>(deviceRepo);
RegisterSingleInstance(DeviceManager);

Expand All @@ -996,7 +996,7 @@ protected void RegisterResources()
var connectionManager = new ConnectionManager(dlnaManager, ServerConfigurationManager, LogManager.GetLogger("UpnpConnectionManager"), HttpClient, new XmlReaderSettingsFactory());
RegisterSingleInstance<IConnectionManager>(connectionManager);

CollectionManager = new CollectionManager(LibraryManager, FileSystemManager, LibraryMonitor, LogManager.GetLogger("CollectionManager"), ProviderManager);
CollectionManager = new CollectionManager(LibraryManager, ApplicationPaths, LocalizationManager, FileSystemManager, LibraryMonitor, LogManager.GetLogger("CollectionManager"), ProviderManager);
RegisterSingleInstance(CollectionManager);

PlaylistManager = new PlaylistManager(LibraryManager, FileSystemManager, LibraryMonitor, LogManager.GetLogger("PlaylistManager"), UserManager, ProviderManager);
Expand Down Expand Up @@ -2379,7 +2379,6 @@ public void Dispose()
_disposed = true;

Dispose(true);
GC.SuppressFinalize(this);
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,13 +18,11 @@ public ChannelDynamicMediaSourceProvider(IChannelManager channelManager)
_channelManager = (ChannelManager)channelManager;
}

public Task<IEnumerable<MediaSourceInfo>> GetMediaSources(IHasMediaSources item, CancellationToken cancellationToken)
public Task<IEnumerable<MediaSourceInfo>> GetMediaSources(BaseItem item, CancellationToken cancellationToken)
{
var baseItem = (BaseItem)item;

if (baseItem.SourceType == SourceType.Channel)
if (item.SourceType == SourceType.Channel)
{
return _channelManager.GetDynamicMediaSources(baseItem, cancellationToken);
return _channelManager.GetDynamicMediaSources(item, cancellationToken);
}

return Task.FromResult<IEnumerable<MediaSourceInfo>>(new List<MediaSourceInfo>());
Expand Down
15 changes: 10 additions & 5 deletions Emby.Server.Implementations/Channels/ChannelManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -313,7 +313,7 @@ public async Task RefreshChannels(IProgress<double> progress, CancellationToken

private Channel GetChannelEntity(IChannel channel)
{
var item = GetChannel(GetInternalChannelId(channel.Name).ToString("N"));
var item = GetChannel(GetInternalChannelId(channel.Name));

if (item == null)
{
Expand Down Expand Up @@ -510,6 +510,11 @@ private string GetOfficialRating(ChannelParentalRating rating)
}
}

public Channel GetChannel(Guid id)
{
return _libraryManager.GetItemById(id) as Channel;
}

public Channel GetChannel(string id)
{
return _libraryManager.GetItemById(id) as Channel;
Expand Down Expand Up @@ -610,7 +615,7 @@ public async Task<QueryResult<BaseItem>> GetLatestChannelItemsInternal(InternalI
// Avoid implicitly captured closure
var ids = query.ChannelIds;
channels = channels
.Where(i => ids.Contains(GetInternalChannelId(i.Name).ToString("N")))
.Where(i => ids.Contains(GetInternalChannelId(i.Name)))
.ToArray();
}

Expand Down Expand Up @@ -656,7 +661,7 @@ private async Task RefreshLatestChannelItems(IChannel channel, CancellationToken
var query = new InternalItemsQuery();
query.Parent = internalChannel;
query.EnableTotalRecordCount = false;
query.ChannelIds = new string[] { internalChannel.Id.ToString("N") };
query.ChannelIds = new Guid[] { internalChannel.Id };

var result = await GetChannelItemsInternal(query, new SimpleProgress<double>(), cancellationToken).ConfigureAwait(false);

Expand All @@ -670,7 +675,7 @@ await GetChannelItemsInternal(new InternalItemsQuery
{
Parent = folder,
EnableTotalRecordCount = false,
ChannelIds = new string[] { internalChannel.Id.ToString("N") }
ChannelIds = new Guid[] { internalChannel.Id }

}, new SimpleProgress<double>(), cancellationToken).ConfigureAwait(false);
}
Expand Down Expand Up @@ -704,7 +709,7 @@ public async Task<QueryResult<BaseItem>> GetChannelItemsInternal(InternalItemsQu
{
query.Parent = channel;
}
query.ChannelIds = new string[] { };
query.ChannelIds = new Guid[] { };

// Not yet sure why this is causing a problem
query.GroupByPresentationUniqueKey = false;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ private void CleanChannel(Guid id, CancellationToken cancellationToken)
// Delete all channel items
var allIds = _libraryManager.GetItemIds(new InternalItemsQuery
{
ChannelIds = new[] { id.ToString("N") }
ChannelIds = new[] { id }
});

foreach (var deleteId in allIds)
Expand Down
Loading

0 comments on commit 832807b

Please sign in to comment.