mirror of
https://github.com/jellyfin/jellyfin.git
synced 2026-04-22 10:04:44 +01:00
fixes #838 - Support rtmp protocol with channels
This commit is contained in:
@@ -8,8 +8,8 @@ using MediaBrowser.Controller.Configuration;
|
||||
using MediaBrowser.Controller.Library;
|
||||
using MediaBrowser.Model.Channels;
|
||||
using MediaBrowser.Model.Dto;
|
||||
using MediaBrowser.Model.Entities;
|
||||
using MediaBrowser.Model.Logging;
|
||||
using MediaBrowser.Model.MediaInfo;
|
||||
using MediaBrowser.Model.Querying;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
@@ -182,7 +182,7 @@ namespace MediaBrowser.Server.Implementations.Channels
|
||||
|
||||
var list = sources.ToList();
|
||||
|
||||
var cachedVersions = list.Where(i => i.LocationType == LocationType.FileSystem).ToList();
|
||||
var cachedVersions = list.Where(i => i.Protocol == MediaProtocol.File).ToList();
|
||||
|
||||
if (cachedVersions.Count > 0)
|
||||
{
|
||||
@@ -190,7 +190,12 @@ namespace MediaBrowser.Server.Implementations.Channels
|
||||
return;
|
||||
}
|
||||
|
||||
var source = list.First();
|
||||
var source = list.FirstOrDefault(i => i.Protocol == MediaProtocol.Http);
|
||||
|
||||
if (source == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
var options = new HttpRequestOptions
|
||||
{
|
||||
|
||||
@@ -280,7 +280,7 @@ namespace MediaBrowser.Server.Implementations.Channels
|
||||
MediaStreams = GetMediaStreams(info).ToList(),
|
||||
|
||||
Container = info.Container,
|
||||
LocationType = info.IsRemote ? LocationType.Remote : LocationType.FileSystem,
|
||||
Protocol = info.Protocol,
|
||||
Path = info.Path,
|
||||
RequiredHttpHeaders = info.RequiredHttpHeaders,
|
||||
RunTimeTicks = item.RunTimeTicks,
|
||||
@@ -555,17 +555,18 @@ namespace MediaBrowser.Server.Implementations.Channels
|
||||
return GetChannelItemEntity(i.Item2, channelProvider, channel, token);
|
||||
});
|
||||
|
||||
IEnumerable<BaseItem> internalItems = await Task.WhenAll(itemTasks).ConfigureAwait(false);
|
||||
var internalItems = await Task.WhenAll(itemTasks).ConfigureAwait(false);
|
||||
|
||||
internalItems = ApplyFilters(internalItems, query.Filters, user);
|
||||
internalItems = ApplyFilters(internalItems, query.Filters, user).ToArray();
|
||||
await RefreshIfNeeded(internalItems, cancellationToken).ConfigureAwait(false);
|
||||
|
||||
if (query.StartIndex.HasValue)
|
||||
{
|
||||
internalItems = internalItems.Skip(query.StartIndex.Value);
|
||||
internalItems = internalItems.Skip(query.StartIndex.Value).ToArray();
|
||||
}
|
||||
if (query.Limit.HasValue)
|
||||
{
|
||||
internalItems = internalItems.Take(query.Limit.Value);
|
||||
internalItems = internalItems.Take(query.Limit.Value).ToArray();
|
||||
}
|
||||
|
||||
var returnItemArray = internalItems.Select(i => _dtoService.GetBaseItemDto(i, query.Fields, user))
|
||||
@@ -658,6 +659,7 @@ namespace MediaBrowser.Server.Implementations.Channels
|
||||
});
|
||||
|
||||
var internalItems = await Task.WhenAll(itemTasks).ConfigureAwait(false);
|
||||
await RefreshIfNeeded(internalItems, cancellationToken).ConfigureAwait(false);
|
||||
|
||||
var returnItemArray = internalItems.Select(i => _dtoService.GetBaseItemDto(i, query.Fields, user))
|
||||
.ToArray();
|
||||
|
||||
@@ -1111,7 +1111,7 @@ namespace MediaBrowser.Server.Implementations.Dto
|
||||
|
||||
if (tvChannel != null)
|
||||
{
|
||||
dto.MediaSources = GetMediaSources(tvChannel);
|
||||
dto.MediaSources = tvChannel.GetMediaSources(true).ToList();
|
||||
}
|
||||
|
||||
var channelItem = item as IChannelItem;
|
||||
@@ -1123,43 +1123,6 @@ namespace MediaBrowser.Server.Implementations.Dto
|
||||
}
|
||||
}
|
||||
|
||||
public List<MediaSourceInfo> GetMediaSources(BaseItem item)
|
||||
{
|
||||
var video = item as Video;
|
||||
|
||||
if (video != null)
|
||||
{
|
||||
return video.GetMediaSources(true).ToList();
|
||||
}
|
||||
|
||||
var audio = item as Audio;
|
||||
|
||||
if (audio != null)
|
||||
{
|
||||
return audio.GetMediaSources(true).ToList();
|
||||
}
|
||||
|
||||
var result = new List<MediaSourceInfo>
|
||||
{
|
||||
new MediaSourceInfo
|
||||
{
|
||||
Id = item.Id.ToString("N"),
|
||||
LocationType = item.LocationType,
|
||||
Name = item.Name,
|
||||
Path = GetMappedPath(item),
|
||||
MediaStreams = _itemRepo.GetMediaStreams(new MediaStreamQuery
|
||||
{
|
||||
ItemId = item.Id
|
||||
|
||||
}).ToList(),
|
||||
|
||||
RunTimeTicks = item.RunTimeTicks
|
||||
}
|
||||
};
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
private string GetMappedPath(IHasMetadata item)
|
||||
{
|
||||
var path = item.Path;
|
||||
|
||||
@@ -222,7 +222,7 @@ namespace MediaBrowser.Server.Implementations.LiveTv
|
||||
RunTimeTicks = (info.EndDate - info.StartDate).Ticks,
|
||||
OriginalAirDate = info.OriginalAirDate,
|
||||
|
||||
MediaSources = _dtoService.GetMediaSources((BaseItem)recording)
|
||||
MediaSources = recording.GetMediaSources(true).ToList()
|
||||
};
|
||||
|
||||
dto.MediaStreams = dto.MediaSources.SelectMany(i => i.MediaStreams).ToList();
|
||||
@@ -317,7 +317,7 @@ namespace MediaBrowser.Server.Implementations.LiveTv
|
||||
Id = info.Id.ToString("N"),
|
||||
MediaType = info.MediaType,
|
||||
ExternalId = info.ExternalId,
|
||||
MediaSources = _dtoService.GetMediaSources(info)
|
||||
MediaSources = info.GetMediaSources(true).ToList()
|
||||
};
|
||||
|
||||
if (user != null)
|
||||
|
||||
@@ -148,5 +148,27 @@
|
||||
"LabelChapterDownloaders": "Chapter downloaders:",
|
||||
"LabelChapterDownloadersHelp": "Enable and rank your preferred chapter downloaders in order of priority. Lower priority downloaders will only be used to fill in missing information.",
|
||||
"HeaderFavoriteAlbums": "Favorite Albums",
|
||||
"HeaderLatestChannelMedia": "Latest Channel Items"
|
||||
"HeaderLatestChannelMedia": "Latest Channel Items",
|
||||
"ButtonOrganizeFile": "Organize File",
|
||||
"ButtonDeleteFile": "Delete File",
|
||||
"HeaderOrganizeFile": "Organize File",
|
||||
"HeaderDeleteFile": "Delete File",
|
||||
"StatusSkipped": "Skipped",
|
||||
"StatusFailed": "Failed",
|
||||
"StatusSuccess": "Success",
|
||||
"MessageFileWillBeDeleted": "The following file will be deleted:",
|
||||
"MessageSureYouWishToProceed": "Are you sure you wish to proceed?",
|
||||
"MessageDuplicatesWillBeDeleted": "In addition the following dupliates will be deleted:",
|
||||
"MessageFollowingFileWillBeMovedFrom": "The following file will be moved from:",
|
||||
"MessageDestinationTo": "to:",
|
||||
"HeaderSelectWatchFolder": "Select Watch Folder",
|
||||
"HeaderSelectWatchFolderHelp": "Browse or enter the path to your watch folder. The folder must be writeable.",
|
||||
"OrganizePatternResult": "Result: {0}",
|
||||
"HeaderRestart": "Restart",
|
||||
"HeaderShutdown": "Shutdown",
|
||||
"MessageConfirmRestart": "Are you sure you wish to restart Media Browser Server?",
|
||||
"MessageConfirmShutdown": "Are you sure you wish to shutdown Media Browser Server?",
|
||||
"ButtonUpdateNow": "Update Now",
|
||||
"NewVersionOfSomethingAvailable": "A new version of {0} is available!",
|
||||
"VersionXIsAvailableForDownload": "Version {0} is now available for download."
|
||||
}
|
||||
@@ -14,6 +14,7 @@ using System.IO;
|
||||
using System.Linq;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
using MediaBrowser.Model.MediaInfo;
|
||||
|
||||
namespace MediaBrowser.Server.Implementations.MediaEncoder
|
||||
{
|
||||
@@ -133,15 +134,15 @@ namespace MediaBrowser.Server.Implementations.MediaEncoder
|
||||
// Add some time for the first chapter to make sure we don't end up with a black image
|
||||
var time = chapter.StartPositionTicks == 0 ? TimeSpan.FromTicks(Math.Min(FirstChapterTicks, video.RunTimeTicks ?? 0)) : TimeSpan.FromTicks(chapter.StartPositionTicks);
|
||||
|
||||
InputType type;
|
||||
var protocol = MediaProtocol.File;
|
||||
|
||||
var inputPath = MediaEncoderHelpers.GetInputArgument(video.Path, false, video.VideoType, video.IsoType, null, video.PlayableStreamFileNames, out type);
|
||||
var inputPath = MediaEncoderHelpers.GetInputArgument(video.Path, protocol, null, video.PlayableStreamFileNames);
|
||||
|
||||
try
|
||||
{
|
||||
Directory.CreateDirectory(Path.GetDirectoryName(path));
|
||||
|
||||
using (var stream = await _encoder.ExtractVideoImage(inputPath, type, video.Video3DFormat, time, cancellationToken).ConfigureAwait(false))
|
||||
using (var stream = await _encoder.ExtractVideoImage(inputPath, protocol, video.Video3DFormat, time, cancellationToken).ConfigureAwait(false))
|
||||
{
|
||||
using (var fileStream = _fileSystem.GetFileStream(path, FileMode.Create, FileAccess.Write, FileShare.Read, true))
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user