remove dead code
This commit is contained in:
parent
5833aedb15
commit
a1ca5e3ecc
|
@ -79,21 +79,6 @@ namespace Emby.Server.Implementations.Channels
|
||||||
_channels = channels.ToArray();
|
_channels = channels.ToArray();
|
||||||
}
|
}
|
||||||
|
|
||||||
public string ChannelDownloadPath
|
|
||||||
{
|
|
||||||
get
|
|
||||||
{
|
|
||||||
var options = _config.GetChannelsConfiguration();
|
|
||||||
|
|
||||||
if (!string.IsNullOrWhiteSpace(options.DownloadPath))
|
|
||||||
{
|
|
||||||
return options.DownloadPath;
|
|
||||||
}
|
|
||||||
|
|
||||||
return Path.Combine(_config.ApplicationPaths.ProgramDataPath, "channels");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private IEnumerable<IChannel> GetAllChannels()
|
private IEnumerable<IChannel> GetAllChannels()
|
||||||
{
|
{
|
||||||
return _channels
|
return _channels
|
||||||
|
@ -288,7 +273,7 @@ namespace Emby.Server.Implementations.Channels
|
||||||
_jsonSerializer.SerializeToFile(mediaSources, path);
|
_jsonSerializer.SerializeToFile(mediaSources, path);
|
||||||
}
|
}
|
||||||
|
|
||||||
public async Task<IEnumerable<MediaSourceInfo>> GetStaticMediaSources(BaseItem item, bool includeCachedVersions, CancellationToken cancellationToken)
|
public async Task<IEnumerable<MediaSourceInfo>> GetStaticMediaSources(BaseItem item, CancellationToken cancellationToken)
|
||||||
{
|
{
|
||||||
IEnumerable<ChannelMediaInfo> results = new List<ChannelMediaInfo>();
|
IEnumerable<ChannelMediaInfo> results = new List<ChannelMediaInfo>();
|
||||||
var video = item as Video;
|
var video = item as Video;
|
||||||
|
@ -302,17 +287,9 @@ namespace Emby.Server.Implementations.Channels
|
||||||
results = audio.ChannelMediaSources ?? GetSavedMediaSources(audio);
|
results = audio.ChannelMediaSources ?? GetSavedMediaSources(audio);
|
||||||
}
|
}
|
||||||
|
|
||||||
var sources = SortMediaInfoResults(results)
|
return SortMediaInfoResults(results)
|
||||||
.Select(i => GetMediaSource(item, i))
|
.Select(i => GetMediaSource(item, i))
|
||||||
.ToList();
|
.ToList();
|
||||||
|
|
||||||
if (includeCachedVersions)
|
|
||||||
{
|
|
||||||
var cachedVersions = GetCachedChannelItemMediaSources(item);
|
|
||||||
sources.InsertRange(0, cachedVersions);
|
|
||||||
}
|
|
||||||
|
|
||||||
return sources;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public async Task<IEnumerable<MediaSourceInfo>> GetDynamicMediaSources(BaseItem item, CancellationToken cancellationToken)
|
public async Task<IEnumerable<MediaSourceInfo>> GetDynamicMediaSources(BaseItem item, CancellationToken cancellationToken)
|
||||||
|
@ -334,14 +311,9 @@ namespace Emby.Server.Implementations.Channels
|
||||||
results = new List<ChannelMediaInfo>();
|
results = new List<ChannelMediaInfo>();
|
||||||
}
|
}
|
||||||
|
|
||||||
var list = SortMediaInfoResults(results)
|
return SortMediaInfoResults(results)
|
||||||
.Select(i => GetMediaSource(item, i))
|
.Select(i => GetMediaSource(item, i))
|
||||||
.ToList();
|
.ToList();
|
||||||
|
|
||||||
var cachedVersions = GetCachedChannelItemMediaSources(item);
|
|
||||||
list.InsertRange(0, cachedVersions);
|
|
||||||
|
|
||||||
return list;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private readonly ConcurrentDictionary<string, Tuple<DateTime, List<ChannelMediaInfo>>> _channelItemMediaInfo =
|
private readonly ConcurrentDictionary<string, Tuple<DateTime, List<ChannelMediaInfo>>> _channelItemMediaInfo =
|
||||||
|
@ -369,55 +341,6 @@ namespace Emby.Server.Implementations.Channels
|
||||||
return list;
|
return list;
|
||||||
}
|
}
|
||||||
|
|
||||||
private IEnumerable<MediaSourceInfo> GetCachedChannelItemMediaSources(BaseItem item)
|
|
||||||
{
|
|
||||||
var filenamePrefix = item.Id.ToString("N");
|
|
||||||
var parentPath = Path.Combine(ChannelDownloadPath, item.ChannelId);
|
|
||||||
|
|
||||||
try
|
|
||||||
{
|
|
||||||
var files = _fileSystem.GetFiles(parentPath);
|
|
||||||
|
|
||||||
if (string.Equals(item.MediaType, MediaType.Video, StringComparison.OrdinalIgnoreCase))
|
|
||||||
{
|
|
||||||
files = files.Where(i => _libraryManager.IsVideoFile(i.FullName));
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
files = files.Where(i => _libraryManager.IsAudioFile(i.FullName));
|
|
||||||
}
|
|
||||||
|
|
||||||
var file = files
|
|
||||||
.FirstOrDefault(i => i.Name.StartsWith(filenamePrefix, StringComparison.OrdinalIgnoreCase));
|
|
||||||
|
|
||||||
if (file != null)
|
|
||||||
{
|
|
||||||
var cachedItem = _libraryManager.ResolvePath(file);
|
|
||||||
|
|
||||||
if (cachedItem != null)
|
|
||||||
{
|
|
||||||
var hasMediaSources = _libraryManager.GetItemById(cachedItem.Id) as IHasMediaSources;
|
|
||||||
|
|
||||||
if (hasMediaSources != null)
|
|
||||||
{
|
|
||||||
var source = hasMediaSources.GetMediaSources(true).FirstOrDefault();
|
|
||||||
|
|
||||||
if (source != null)
|
|
||||||
{
|
|
||||||
return new[] { source };
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
catch (IOException)
|
|
||||||
{
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
return new List<MediaSourceInfo>();
|
|
||||||
}
|
|
||||||
|
|
||||||
private MediaSourceInfo GetMediaSource(BaseItem item, ChannelMediaInfo info)
|
private MediaSourceInfo GetMediaSource(BaseItem item, ChannelMediaInfo info)
|
||||||
{
|
{
|
||||||
var source = info.ToMediaSource();
|
var source = info.ToMediaSource();
|
||||||
|
|
|
@ -15,15 +15,8 @@ namespace MediaBrowser.Controller.Channels
|
||||||
/// Adds the parts.
|
/// Adds the parts.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="channels">The channels.</param>
|
/// <param name="channels">The channels.</param>
|
||||||
/// <param name="factories">The factories.</param>
|
|
||||||
void AddParts(IEnumerable<IChannel> channels);
|
void AddParts(IEnumerable<IChannel> channels);
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Gets the channel download path.
|
|
||||||
/// </summary>
|
|
||||||
/// <value>The channel download path.</value>
|
|
||||||
string ChannelDownloadPath { get; }
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets the channel features.
|
/// Gets the channel features.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
@ -115,10 +108,9 @@ namespace MediaBrowser.Controller.Channels
|
||||||
/// Gets the channel item media sources.
|
/// Gets the channel item media sources.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="item">The item.</param>
|
/// <param name="item">The item.</param>
|
||||||
/// <param name="includeCachedVersions">if set to <c>true</c> [include cached versions].</param>
|
|
||||||
/// <param name="cancellationToken">The cancellation token.</param>
|
/// <param name="cancellationToken">The cancellation token.</param>
|
||||||
/// <returns>Task{IEnumerable{MediaSourceInfo}}.</returns>
|
/// <returns>Task{IEnumerable{MediaSourceInfo}}.</returns>
|
||||||
Task<IEnumerable<MediaSourceInfo>> GetStaticMediaSources(BaseItem item, bool includeCachedVersions, CancellationToken cancellationToken);
|
Task<IEnumerable<MediaSourceInfo>> GetStaticMediaSources(BaseItem item, CancellationToken cancellationToken);
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets the channel folder.
|
/// Gets the channel folder.
|
||||||
|
|
|
@ -206,7 +206,7 @@ namespace MediaBrowser.Controller.Entities.Audio
|
||||||
{
|
{
|
||||||
if (SourceType == SourceType.Channel)
|
if (SourceType == SourceType.Channel)
|
||||||
{
|
{
|
||||||
var sources = ChannelManager.GetStaticMediaSources(this, false, CancellationToken.None)
|
var sources = ChannelManager.GetStaticMediaSources(this, CancellationToken.None)
|
||||||
.Result.ToList();
|
.Result.ToList();
|
||||||
|
|
||||||
if (sources.Count > 0)
|
if (sources.Count > 0)
|
||||||
|
|
|
@ -549,7 +549,7 @@ namespace MediaBrowser.Controller.Entities
|
||||||
{
|
{
|
||||||
if (SourceType == SourceType.Channel)
|
if (SourceType == SourceType.Channel)
|
||||||
{
|
{
|
||||||
var sources = ChannelManager.GetStaticMediaSources(this, false, CancellationToken.None)
|
var sources = ChannelManager.GetStaticMediaSources(this, CancellationToken.None)
|
||||||
.Result.ToList();
|
.Result.ToList();
|
||||||
|
|
||||||
if (sources.Count > 0)
|
if (sources.Count > 0)
|
||||||
|
|
Loading…
Reference in New Issue
Block a user