aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLuke Pulverenti <luke.pulverenti@gmail.com>2017-04-28 15:17:26 -0400
committerLuke Pulverenti <luke.pulverenti@gmail.com>2017-04-28 15:17:26 -0400
commitaf4473e27fcc8654912f032b9b12c30a1b2c682c (patch)
tree1860df760ae8760f85cb4cbebb1eadcb71d33ab4
parentbf07a47132088884eb053d90a6a7a0fc7e1058c2 (diff)
add error handling
-rw-r--r--MediaBrowser.Api/Playback/BaseStreamingService.cs12
-rw-r--r--MediaBrowser.Controller/Entities/Video.cs51
-rw-r--r--MediaBrowser.Controller/MediaEncoding/EncodingHelper.cs3
3 files changed, 35 insertions, 31 deletions
diff --git a/MediaBrowser.Api/Playback/BaseStreamingService.cs b/MediaBrowser.Api/Playback/BaseStreamingService.cs
index 6935073a9..464c39d35 100644
--- a/MediaBrowser.Api/Playback/BaseStreamingService.cs
+++ b/MediaBrowser.Api/Playback/BaseStreamingService.cs
@@ -720,12 +720,12 @@ namespace MediaBrowser.Api.Playback
state.IsInputVideo = string.Equals(item.MediaType, MediaType.Video, StringComparison.OrdinalIgnoreCase);
- var primaryImage = item.GetImageInfo(ImageType.Primary, 0) ??
- item.Parents.Select(i => i.GetImageInfo(ImageType.Primary, 0)).FirstOrDefault(i => i != null);
- if (primaryImage != null)
- {
- state.AlbumCoverPath = primaryImage.Path;
- }
+ //var primaryImage = item.GetImageInfo(ImageType.Primary, 0) ??
+ // item.Parents.Select(i => i.GetImageInfo(ImageType.Primary, 0)).FirstOrDefault(i => i != null);
+ //if (primaryImage != null)
+ //{
+ // state.AlbumCoverPath = primaryImage.Path;
+ //}
MediaSourceInfo mediaSource = null;
if (string.IsNullOrWhiteSpace(request.LiveStreamId))
diff --git a/MediaBrowser.Controller/Entities/Video.cs b/MediaBrowser.Controller/Entities/Video.cs
index 0618fc489..5f5be1670 100644
--- a/MediaBrowser.Controller/Entities/Video.cs
+++ b/MediaBrowser.Controller/Entities/Video.cs
@@ -591,41 +591,46 @@ namespace MediaBrowser.Controller.Entities
.ToList();
}
- private static MediaSourceInfo GetVersionInfo(bool enablePathSubstitution, Video i, MediaSourceType type)
+ private static MediaSourceInfo GetVersionInfo(bool enablePathSubstitution, Video media, MediaSourceType type)
{
- var mediaStreams = MediaSourceManager.GetMediaStreams(i.Id)
+ if (media == null)
+ {
+ throw new ArgumentNullException("media");
+ }
+
+ var mediaStreams = MediaSourceManager.GetMediaStreams(media.Id)
.ToList();
- var locationType = i.LocationType;
+ var locationType = media.LocationType;
var info = new MediaSourceInfo
{
- Id = i.Id.ToString("N"),
- IsoType = i.IsoType,
+ Id = media.Id.ToString("N"),
+ IsoType = media.IsoType,
Protocol = locationType == LocationType.Remote ? MediaProtocol.Http : MediaProtocol.File,
MediaStreams = mediaStreams,
- Name = GetMediaSourceName(i, mediaStreams),
- Path = enablePathSubstitution ? GetMappedPath(i, i.Path, locationType) : i.Path,
- RunTimeTicks = i.RunTimeTicks,
- Video3DFormat = i.Video3DFormat,
- VideoType = i.VideoType,
- Container = i.Container,
- Size = i.Size,
- Timestamp = i.Timestamp,
+ Name = GetMediaSourceName(media, mediaStreams),
+ Path = enablePathSubstitution ? GetMappedPath(media, media.Path, locationType) : media.Path,
+ RunTimeTicks = media.RunTimeTicks,
+ Video3DFormat = media.Video3DFormat,
+ VideoType = media.VideoType,
+ Container = media.Container,
+ Size = media.Size,
+ Timestamp = media.Timestamp,
Type = type,
- PlayableStreamFileNames = i.PlayableStreamFileNames.ToList(),
- SupportsDirectStream = i.VideoType == VideoType.VideoFile,
- IsRemote = i.IsShortcut
+ PlayableStreamFileNames = media.PlayableStreamFileNames.ToList(),
+ SupportsDirectStream = media.VideoType == VideoType.VideoFile,
+ IsRemote = media.IsShortcut
};
if (info.Protocol == MediaProtocol.File)
{
- info.ETag = i.DateModified.Ticks.ToString(CultureInfo.InvariantCulture).GetMD5().ToString("N");
+ info.ETag = media.DateModified.Ticks.ToString(CultureInfo.InvariantCulture).GetMD5().ToString("N");
}
- if (i.IsShortcut)
+ if (media.IsShortcut)
{
- info.Path = i.ShortcutPath;
+ info.Path = media.ShortcutPath;
if (info.Path.StartsWith("Http", StringComparison.OrdinalIgnoreCase))
{
@@ -647,16 +652,16 @@ namespace MediaBrowser.Controller.Entities
if (string.IsNullOrEmpty(info.Container))
{
- if (i.VideoType == VideoType.VideoFile || i.VideoType == VideoType.Iso)
+ if (media.VideoType == VideoType.VideoFile || media.VideoType == VideoType.Iso)
{
- if (!string.IsNullOrWhiteSpace(i.Path) && locationType != LocationType.Remote && locationType != LocationType.Virtual)
+ if (!string.IsNullOrWhiteSpace(media.Path) && locationType != LocationType.Remote && locationType != LocationType.Virtual)
{
- info.Container = System.IO.Path.GetExtension(i.Path).TrimStart('.');
+ info.Container = System.IO.Path.GetExtension(media.Path).TrimStart('.');
}
}
}
- info.Bitrate = i.TotalBitrate;
+ info.Bitrate = media.TotalBitrate;
info.InferTotalBitrate();
return info;
diff --git a/MediaBrowser.Controller/MediaEncoding/EncodingHelper.cs b/MediaBrowser.Controller/MediaEncoding/EncodingHelper.cs
index 3824813f1..8821b6f1f 100644
--- a/MediaBrowser.Controller/MediaEncoding/EncodingHelper.cs
+++ b/MediaBrowser.Controller/MediaEncoding/EncodingHelper.cs
@@ -2011,12 +2011,11 @@ namespace MediaBrowser.Controller.MediaEncoding
var vn = string.Empty;
var hasArt = !string.IsNullOrWhiteSpace(state.AlbumCoverPath);
- hasArt = false;
if (hasArt)
{
albumCoverInput = " -i \"" + state.AlbumCoverPath + "\"";
- mapArgs = " -map 0:a -map 1:v -c:v copy";
+ mapArgs = " -map 0:a -map 1:v -c:1:v copy";
metadata = " -metadata:s:v title=\"Album cover\" -metadata:s:v comment=\"Cover(Front)\"";
}
else