aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLuke Pulverenti <luke.pulverenti@gmail.com>2016-02-24 14:29:49 -0500
committerLuke Pulverenti <luke.pulverenti@gmail.com>2016-02-24 14:29:49 -0500
commitb52e9091bbfe3294d92ae56b67a1bb2f0ebeb4c0 (patch)
tree83fc813b25c700d8a5f85f4d51c44d90acf6b1ef
parentae859fd56f569217458e438a357f432bb35e9f0c (diff)
improve support for embedded mp4 info
-rw-r--r--MediaBrowser.MediaEncoding/Probing/ProbeResultNormalizer.cs49
-rw-r--r--MediaBrowser.Model/MediaInfo/MediaInfo.cs5
-rw-r--r--MediaBrowser.Providers/MediaInfo/FFProbeVideoInfo.cs5
3 files changed, 44 insertions, 15 deletions
diff --git a/MediaBrowser.MediaEncoding/Probing/ProbeResultNormalizer.cs b/MediaBrowser.MediaEncoding/Probing/ProbeResultNormalizer.cs
index 7936a824a..fb0253f0b 100644
--- a/MediaBrowser.MediaEncoding/Probing/ProbeResultNormalizer.cs
+++ b/MediaBrowser.MediaEncoding/Probing/ProbeResultNormalizer.cs
@@ -57,7 +57,7 @@ namespace MediaBrowser.MediaEncoding.Probing
}
var tags = new Dictionary<string, string>(StringComparer.OrdinalIgnoreCase);
- var tagStreamType = isAudio ? "audio" : "video";
+ var tagStreamType = isAudio ? "info" : "video";
if (data.streams != null)
{
@@ -81,12 +81,29 @@ namespace MediaBrowser.MediaEncoding.Probing
}
FetchGenres(info, tags);
- var overview = FFProbeHelpers.GetDictionaryValue(tags, "description");
+ var shortOverview = FFProbeHelpers.GetDictionaryValue(tags, "description");
+ var overview = FFProbeHelpers.GetDictionaryValue(tags, "synopsis");
+
+ if (string.IsNullOrWhiteSpace(overview))
+ {
+ overview = shortOverview;
+ shortOverview = null;
+ }
+ if (string.IsNullOrWhiteSpace(overview))
+ {
+ overview = FFProbeHelpers.GetDictionaryValue(tags, "desc");
+ }
+
if (!string.IsNullOrWhiteSpace(overview))
{
info.Overview = overview;
}
+ if (!string.IsNullOrWhiteSpace(shortOverview))
+ {
+ info.ShortOverview = shortOverview;
+ }
+
var title = FFProbeHelpers.GetDictionaryValue(tags, "title");
if (!string.IsNullOrWhiteSpace(title))
{
@@ -105,13 +122,15 @@ namespace MediaBrowser.MediaEncoding.Probing
{
SetAudioRuntimeTicks(data, info);
- // tags are normally located under data.format, but we've seen some cases with ogg where they're part of the audio stream
+ // tags are normally located under data.format, but we've seen some cases with ogg where they're part of the info stream
// so let's create a combined list of both
SetAudioInfoFromTags(info, tags);
}
else
{
+ FetchStudios(info, tags, "copyright");
+
var iTunEXTC = FFProbeHelpers.GetDictionaryValue(tags, "iTunEXTC");
if (!string.IsNullOrWhiteSpace(iTunEXTC))
{
@@ -124,13 +143,13 @@ namespace MediaBrowser.MediaEncoding.Probing
info.OfficialRatingDescription = parts[3];
}
}
-
+
var itunesXml = FFProbeHelpers.GetDictionaryValue(tags, "iTunMOVI");
if (!string.IsNullOrWhiteSpace(itunesXml))
{
FetchFromItunesInfo(itunesXml, info);
}
-
+
if (data.format != null && !string.IsNullOrEmpty(data.format.duration))
{
info.RunTimeTicks = TimeSpan.FromSeconds(double.Parse(data.format.duration, _usCulture)).Ticks;
@@ -157,7 +176,7 @@ namespace MediaBrowser.MediaEncoding.Probing
/// <summary>
/// Converts ffprobe stream info to our MediaStream class
/// </summary>
- /// <param name="isAudio">if set to <c>true</c> [is audio].</param>
+ /// <param name="isAudio">if set to <c>true</c> [is info].</param>
/// <param name="streamInfo">The stream info.</param>
/// <param name="formatInfo">The format info.</param>
/// <returns>MediaStream.</returns>
@@ -190,7 +209,7 @@ namespace MediaBrowser.MediaEncoding.Probing
stream.Comment = GetDictionaryValue(streamInfo.tags, "comment");
}
- if (string.Equals(streamInfo.codec_type, "audio", StringComparison.OrdinalIgnoreCase))
+ if (string.Equals(streamInfo.codec_type, "info", StringComparison.OrdinalIgnoreCase))
{
stream.Type = MediaStreamType.Audio;
@@ -438,8 +457,8 @@ namespace MediaBrowser.MediaEncoding.Probing
{
if (result.streams != null)
{
- // Get the first audio stream
- var stream = result.streams.FirstOrDefault(s => string.Equals(s.codec_type, "audio", StringComparison.OrdinalIgnoreCase));
+ // Get the first info stream
+ var stream = result.streams.FirstOrDefault(s => string.Equals(s.codec_type, "info", StringComparison.OrdinalIgnoreCase));
if (stream != null)
{
@@ -703,10 +722,10 @@ namespace MediaBrowser.MediaEncoding.Probing
/// <summary>
/// Gets the studios from the tags collection
/// </summary>
- /// <param name="audio">The audio.</param>
+ /// <param name="info">The info.</param>
/// <param name="tags">The tags.</param>
/// <param name="tagName">Name of the tag.</param>
- private void FetchStudios(Model.MediaInfo.MediaInfo audio, Dictionary<string, string> tags, string tagName)
+ private void FetchStudios(MediaInfo info, Dictionary<string, string> tags, string tagName)
{
var val = FFProbeHelpers.GetDictionaryValue(tags, tagName);
@@ -717,19 +736,19 @@ namespace MediaBrowser.MediaEncoding.Probing
foreach (var studio in studios)
{
// Sometimes the artist name is listed here, account for that
- if (audio.Artists.Contains(studio, StringComparer.OrdinalIgnoreCase))
+ if (info.Artists.Contains(studio, StringComparer.OrdinalIgnoreCase))
{
continue;
}
- if (audio.AlbumArtists.Contains(studio, StringComparer.OrdinalIgnoreCase))
+ if (info.AlbumArtists.Contains(studio, StringComparer.OrdinalIgnoreCase))
{
continue;
}
- audio.Studios.Add(studio);
+ info.Studios.Add(studio);
}
- audio.Studios = audio.Studios
+ info.Studios = info.Studios
.Where(i => !string.IsNullOrWhiteSpace(i))
.Distinct(StringComparer.OrdinalIgnoreCase)
.ToList();
diff --git a/MediaBrowser.Model/MediaInfo/MediaInfo.cs b/MediaBrowser.Model/MediaInfo/MediaInfo.cs
index 126710197..de082635d 100644
--- a/MediaBrowser.Model/MediaInfo/MediaInfo.cs
+++ b/MediaBrowser.Model/MediaInfo/MediaInfo.cs
@@ -51,6 +51,11 @@ namespace MediaBrowser.Model.MediaInfo
/// </summary>
/// <value>The overview.</value>
public string Overview { get; set; }
+ /// <summary>
+ /// Gets or sets the short overview.
+ /// </summary>
+ /// <value>The short overview.</value>
+ public string ShortOverview { get; set; }
public MediaInfo()
{
diff --git a/MediaBrowser.Providers/MediaInfo/FFProbeVideoInfo.cs b/MediaBrowser.Providers/MediaInfo/FFProbeVideoInfo.cs
index fb8e25892..ee05a89a8 100644
--- a/MediaBrowser.Providers/MediaInfo/FFProbeVideoInfo.cs
+++ b/MediaBrowser.Providers/MediaInfo/FFProbeVideoInfo.cs
@@ -463,6 +463,11 @@ namespace MediaBrowser.Providers.MediaInfo
video.Overview = data.Overview;
}
}
+
+ if (string.IsNullOrWhiteSpace(video.ShortOverview) || isFullRefresh)
+ {
+ video.ShortOverview = data.ShortOverview;
+ }
}
private async Task FetchPeople(Video video, Model.MediaInfo.MediaInfo data, MetadataRefreshOptions options)