aboutsummaryrefslogtreecommitdiff
path: root/Emby.Server.Implementations
diff options
context:
space:
mode:
authorLuke <luke.pulverenti@gmail.com>2016-12-08 01:54:16 -0500
committerGitHub <noreply@github.com>2016-12-08 01:54:16 -0500
commit862018b5c20e27dc67619b8c0c212507685e8120 (patch)
tree3afc3ec162582d6dfd5a9b6feb60caefca6d5f2d /Emby.Server.Implementations
parentfa6b90eb745c2491ae50ce4fe1e2fb5700f87399 (diff)
parent9ed3c311757a615ae32296da4b43f772370d1143 (diff)
Merge pull request #2333 from MediaBrowser/dev
Dev
Diffstat (limited to 'Emby.Server.Implementations')
-rw-r--r--Emby.Server.Implementations/Dto/DtoService.cs21
-rw-r--r--Emby.Server.Implementations/Library/LibraryManager.cs4
-rw-r--r--Emby.Server.Implementations/LiveTv/EmbyTV/EmbyTV.cs12
-rw-r--r--Emby.Server.Implementations/LiveTv/TunerHosts/HdHomerun/HdHomerunHost.cs21
-rw-r--r--Emby.Server.Implementations/LiveTv/TunerHosts/M3uParser.cs82
5 files changed, 113 insertions, 27 deletions
diff --git a/Emby.Server.Implementations/Dto/DtoService.cs b/Emby.Server.Implementations/Dto/DtoService.cs
index 438fc55d77..2b2c3e000d 100644
--- a/Emby.Server.Implementations/Dto/DtoService.cs
+++ b/Emby.Server.Implementations/Dto/DtoService.cs
@@ -1351,6 +1351,27 @@ namespace Emby.Server.Implementations.Dto
if (episodeSeries != null)
{
dto.SeriesStudio = episodeSeries.Studios.FirstOrDefault();
+ if (!string.IsNullOrWhiteSpace(dto.SeriesStudio))
+ {
+ try
+ {
+ var studio = _libraryManager.GetStudio(dto.SeriesStudio);
+
+ if (studio != null)
+ {
+ dto.SeriesStudioInfo = new StudioDto
+ {
+ Name = dto.SeriesStudio,
+ Id = studio.Id.ToString("N"),
+ PrimaryImageTag = GetImageCacheTag(studio, ImageType.Primary)
+ };
+ }
+ }
+ catch (Exception ex)
+ {
+
+ }
+ }
}
}
}
diff --git a/Emby.Server.Implementations/Library/LibraryManager.cs b/Emby.Server.Implementations/Library/LibraryManager.cs
index d96756ce1b..3db8c7213c 100644
--- a/Emby.Server.Implementations/Library/LibraryManager.cs
+++ b/Emby.Server.Implementations/Library/LibraryManager.cs
@@ -341,13 +341,13 @@ namespace Emby.Server.Implementations.Library
}
if (item is IItemByName)
{
- if (!(item is MusicArtist))
+ if (!(item is MusicArtist) && !(item is Studio))
{
return;
}
}
- if (item.IsFolder)
+ else if (item.IsFolder)
{
//if (!(item is ICollectionFolder) && !(item is UserView) && !(item is Channel) && !(item is AggregateFolder))
//{
diff --git a/Emby.Server.Implementations/LiveTv/EmbyTV/EmbyTV.cs b/Emby.Server.Implementations/LiveTv/EmbyTV/EmbyTV.cs
index 4e5b8d34f0..4e2b3f661f 100644
--- a/Emby.Server.Implementations/LiveTv/EmbyTV/EmbyTV.cs
+++ b/Emby.Server.Implementations/LiveTv/EmbyTV/EmbyTV.cs
@@ -1594,7 +1594,17 @@ namespace Emby.Server.Implementations.LiveTv.EmbyTV
private void Process_Exited(object sender, EventArgs e)
{
- ((IProcess)sender).Dispose();
+ var process = (IProcess)sender;
+ try
+ {
+ _logger.Info("Recording post-processing script completed with exit code {0}", process.ExitCode);
+ }
+ catch
+ {
+
+ }
+
+ process.Dispose();
}
private async Task SaveRecordingImage(string recordingPath, LiveTvProgram program, ItemImageInfo image)
diff --git a/Emby.Server.Implementations/LiveTv/TunerHosts/HdHomerun/HdHomerunHost.cs b/Emby.Server.Implementations/LiveTv/TunerHosts/HdHomerun/HdHomerunHost.cs
index 2d75367d96..77efe8585b 100644
--- a/Emby.Server.Implementations/LiveTv/TunerHosts/HdHomerun/HdHomerunHost.cs
+++ b/Emby.Server.Implementations/LiveTv/TunerHosts/HdHomerun/HdHomerunHost.cs
@@ -377,7 +377,9 @@ namespace Emby.Server.Implementations.LiveTv.TunerHosts.HdHomerun
var url = GetApiUrl(info, true) + "/auto/v" + channelId;
- if (!string.IsNullOrWhiteSpace(profile) && !string.Equals(profile, "native", StringComparison.OrdinalIgnoreCase))
+ // If raw was used, the tuner doesn't support params
+ if (!string.IsNullOrWhiteSpace(profile)
+ && !string.Equals(profile, "native", StringComparison.OrdinalIgnoreCase))
{
url += "?transcode=" + profile;
}
@@ -451,16 +453,16 @@ namespace Emby.Server.Implementations.LiveTv.TunerHosts.HdHomerun
}
var hdhrId = GetHdHrIdFromChannelId(channelId);
- list.Add(await GetMediaSource(info, hdhrId, "native").ConfigureAwait(false));
-
try
{
- if (info.AllowHWTranscoding)
+ var model = await GetModelInfo(info, cancellationToken).ConfigureAwait(false);
+ model = model ?? string.Empty;
+
+ if ((model.IndexOf("hdtc", StringComparison.OrdinalIgnoreCase) != -1))
{
- string model = await GetModelInfo(info, cancellationToken).ConfigureAwait(false);
- model = model ?? string.Empty;
+ list.Add(await GetMediaSource(info, hdhrId, "native").ConfigureAwait(false));
- if ((model.IndexOf("hdtc", StringComparison.OrdinalIgnoreCase) != -1))
+ if (info.AllowHWTranscoding)
{
list.Add(await GetMediaSource(info, hdhrId, "heavy").ConfigureAwait(false));
@@ -477,6 +479,11 @@ namespace Emby.Server.Implementations.LiveTv.TunerHosts.HdHomerun
}
+ if (list.Count == 0)
+ {
+ list.Add(await GetMediaSource(info, hdhrId, "native").ConfigureAwait(false));
+ }
+
return list;
}
diff --git a/Emby.Server.Implementations/LiveTv/TunerHosts/M3uParser.cs b/Emby.Server.Implementations/LiveTv/TunerHosts/M3uParser.cs
index e4e0519de3..e0f0402813 100644
--- a/Emby.Server.Implementations/LiveTv/TunerHosts/M3uParser.cs
+++ b/Emby.Server.Implementations/LiveTv/TunerHosts/M3uParser.cs
@@ -1,5 +1,6 @@
using System;
using System.Collections.Generic;
+using System.Globalization;
using System.IO;
using System.Linq;
using System.Text.RegularExpressions;
@@ -100,16 +101,23 @@ namespace Emby.Server.Implementations.LiveTv.TunerHosts
extInf = extInf.Trim();
- channel.ImageUrl = FindProperty("tvg-logo", extInf);
+ string remaining;
+ var attributes = ParseExtInf(extInf, out remaining);
+ extInf = remaining;
- channel.Name = GetChannelName(extInf);
+ string value;
+ if (attributes.TryGetValue("tvg-logo", out value))
+ {
+ channel.ImageUrl = value;
+ }
- channel.Number = GetChannelNumber(extInf, mediaUrl);
+ channel.Name = GetChannelName(extInf, attributes);
+ channel.Number = GetChannelNumber(extInf, attributes, mediaUrl);
return channel;
}
- private string GetChannelNumber(string extInf, string mediaUrl)
+ private string GetChannelNumber(string extInf, Dictionary<string, string> attributes, string mediaUrl)
{
var nameParts = extInf.Split(new[] { ',' }, StringSplitOptions.RemoveEmptyEntries);
var nameInExtInf = nameParts.Length > 1 ? nameParts.Last().Trim() : null;
@@ -130,18 +138,41 @@ namespace Emby.Server.Implementations.LiveTv.TunerHosts
}
}
- if (string.IsNullOrWhiteSpace(numberString) ||
+ if (!string.IsNullOrWhiteSpace(numberString))
+ {
+ numberString = numberString.Trim();
+ }
+
+ if (string.IsNullOrWhiteSpace(numberString) ||
string.Equals(numberString, "-1", StringComparison.OrdinalIgnoreCase) ||
string.Equals(numberString, "0", StringComparison.OrdinalIgnoreCase))
{
- numberString = FindProperty("tvg-id", extInf);
+ string value;
+ if (attributes.TryGetValue("tvg-id", out value))
+ {
+ numberString = value;
+ }
+ }
+
+ if (!string.IsNullOrWhiteSpace(numberString))
+ {
+ numberString = numberString.Trim();
}
if (string.IsNullOrWhiteSpace(numberString) ||
string.Equals(numberString, "-1", StringComparison.OrdinalIgnoreCase) ||
string.Equals(numberString, "0", StringComparison.OrdinalIgnoreCase))
{
- numberString = FindProperty("channel-id", extInf);
+ string value;
+ if (attributes.TryGetValue("channel-id", out value))
+ {
+ numberString = value;
+ }
+ }
+
+ if (!string.IsNullOrWhiteSpace(numberString))
+ {
+ numberString = numberString.Trim();
}
if (string.IsNullOrWhiteSpace(numberString) ||
@@ -160,13 +191,19 @@ namespace Emby.Server.Implementations.LiveTv.TunerHosts
else
{
numberString = Path.GetFileNameWithoutExtension(mediaUrl.Split('/').Last());
+
+ double value;
+ if (!double.TryParse(numberString, NumberStyles.Any, CultureInfo.InvariantCulture, out value))
+ {
+ numberString = null;
+ }
}
}
return numberString;
}
- private string GetChannelName(string extInf)
+ private string GetChannelName(string extInf, Dictionary<string, string> attributes)
{
var nameParts = extInf.Split(new[] { ',' }, StringSplitOptions.RemoveEmptyEntries);
var nameInExtInf = nameParts.Length > 1 ? nameParts.Last().Trim() : null;
@@ -186,7 +223,9 @@ namespace Emby.Server.Implementations.LiveTv.TunerHosts
}
}
- var name = FindProperty("tvg-name", extInf);
+ string name;
+ attributes.TryGetValue("tvg-name", out name);
+
if (string.IsNullOrWhiteSpace(name))
{
name = nameInExtInf;
@@ -194,7 +233,7 @@ namespace Emby.Server.Implementations.LiveTv.TunerHosts
if (string.IsNullOrWhiteSpace(name))
{
- name = FindProperty("tvg-id", extInf);
+ attributes.TryGetValue("tvg-id", out name);
}
if (string.IsNullOrWhiteSpace(name))
@@ -205,18 +244,27 @@ namespace Emby.Server.Implementations.LiveTv.TunerHosts
return name;
}
- private string FindProperty(string property, string properties)
+ private Dictionary<string, string> ParseExtInf(string line, out string remaining)
{
+ var dict = new Dictionary<string, string>(StringComparer.OrdinalIgnoreCase);
+
var reg = new Regex(@"([a-z0-9\-_]+)=\""([^""]+)\""", RegexOptions.IgnoreCase);
- var matches = reg.Matches(properties);
+ var matches = reg.Matches(line);
+ var minIndex = int.MaxValue;
foreach (Match match in matches)
{
- if (match.Groups[1].Value == property)
- {
- return match.Groups[2].Value;
- }
+ dict[match.Groups[1].Value] = match.Groups[2].Value;
+ minIndex = Math.Min(minIndex, match.Index);
}
- return null;
+
+ if (minIndex > 0 && minIndex < line.Length)
+ {
+ line = line.Substring(0, minIndex);
+ }
+
+ remaining = line;
+
+ return dict;
}
}