aboutsummaryrefslogtreecommitdiff
path: root/MediaBrowser.Server.Implementations
diff options
context:
space:
mode:
authorLuke <luke.pulverenti@gmail.com>2016-10-17 12:32:57 -0400
committerGitHub <noreply@github.com>2016-10-17 12:32:57 -0400
commitfb9db5c3c36eca578369cb398c36efd6a15bbea9 (patch)
tree98e41f78dd5d7c474ce763157eb3503a165088ed /MediaBrowser.Server.Implementations
parentf8a248ffd805b810e90bc5ec0619e53f49ebcae5 (diff)
parentb0147c32f9122c6ce695d2919176ed8b50b94fda (diff)
Merge pull request #2240 from MediaBrowser/beta
Beta
Diffstat (limited to 'MediaBrowser.Server.Implementations')
-rw-r--r--MediaBrowser.Server.Implementations/EntryPoints/ExternalPortForwarding.cs52
-rw-r--r--MediaBrowser.Server.Implementations/Intros/DefaultIntroProvider.cs9
-rw-r--r--MediaBrowser.Server.Implementations/Library/MediaSourceManager.cs1
-rw-r--r--MediaBrowser.Server.Implementations/Library/Resolvers/TV/SeriesResolver.cs6
-rw-r--r--MediaBrowser.Server.Implementations/LiveTv/EmbyTV/EmbyTV.cs4
-rw-r--r--MediaBrowser.Server.Implementations/LiveTv/LiveTvManager.cs9
-rw-r--r--MediaBrowser.Server.Implementations/LiveTv/TunerHosts/M3UTunerHost.cs4
-rw-r--r--MediaBrowser.Server.Implementations/LiveTv/TunerHosts/M3uParser.cs2
-rw-r--r--MediaBrowser.Server.Implementations/Persistence/SqliteItemRepository.cs13
-rw-r--r--MediaBrowser.Server.Implementations/Session/SessionManager.cs7
10 files changed, 69 insertions, 38 deletions
diff --git a/MediaBrowser.Server.Implementations/EntryPoints/ExternalPortForwarding.cs b/MediaBrowser.Server.Implementations/EntryPoints/ExternalPortForwarding.cs
index 1021d8823..3274231ee 100644
--- a/MediaBrowser.Server.Implementations/EntryPoints/ExternalPortForwarding.cs
+++ b/MediaBrowser.Server.Implementations/EntryPoints/ExternalPortForwarding.cs
@@ -122,43 +122,55 @@ namespace MediaBrowser.Server.Implementations.EntryPoints
var identifier = string.IsNullOrWhiteSpace(usn) ? nt : usn;
- if (info.Location != null && !_usnsHandled.Contains(identifier))
+ if (info.Location == null)
{
+ return;
+ }
+
+ lock (_usnsHandled)
+ {
+ if (_usnsHandled.Contains(identifier))
+ {
+ return;
+ }
_usnsHandled.Add(identifier);
+ }
- _logger.Debug("Calling Nat.Handle on " + identifier);
+ _logger.Debug("Calling Nat.Handle on " + identifier);
- IPAddress address;
- if (IPAddress.TryParse(info.Location.Host, out address))
- {
- // The Handle method doesn't need the port
- var endpoint = new IPEndPoint(address, info.Location.Port);
+ IPAddress address;
+ if (IPAddress.TryParse(info.Location.Host, out address))
+ {
+ // The Handle method doesn't need the port
+ var endpoint = new IPEndPoint(address, info.Location.Port);
- IPAddress localAddress = null;
+ IPAddress localAddress = null;
- try
- {
- var localAddressString = await _appHost.GetLocalApiUrl().ConfigureAwait(false);
+ try
+ {
+ var localAddressString = await _appHost.GetLocalApiUrl().ConfigureAwait(false);
- if (!IPAddress.TryParse(localAddressString, out localAddress))
- {
- return;
- }
- }
- catch
+ if (!IPAddress.TryParse(localAddressString, out localAddress))
{
return;
}
-
- NatUtility.Handle(localAddress, info, endpoint, NatProtocol.Upnp);
}
+ catch
+ {
+ return;
+ }
+
+ NatUtility.Handle(localAddress, info, endpoint, NatProtocol.Upnp);
}
}
private void ClearCreatedRules(object state)
{
_createdRules = new List<string>();
- _usnsHandled = new List<string>();
+ lock (_usnsHandled)
+ {
+ _usnsHandled.Clear();
+ }
}
void NatUtility_UnhandledException(object sender, UnhandledExceptionEventArgs e)
diff --git a/MediaBrowser.Server.Implementations/Intros/DefaultIntroProvider.cs b/MediaBrowser.Server.Implementations/Intros/DefaultIntroProvider.cs
index 9b23d5be4..a1638f722 100644
--- a/MediaBrowser.Server.Implementations/Intros/DefaultIntroProvider.cs
+++ b/MediaBrowser.Server.Implementations/Intros/DefaultIntroProvider.cs
@@ -66,10 +66,12 @@ namespace MediaBrowser.Server.Implementations.Intros
var candidates = new List<ItemWithTrailer>();
var trailerTypes = new List<TrailerType>();
+ var sourceTypes = new List<SourceType>();
if (config.EnableIntrosFromMoviesInLibrary)
{
trailerTypes.Add(TrailerType.LocalTrailer);
+ sourceTypes.Add(SourceType.Library);
}
if (IsSupporter)
@@ -77,18 +79,22 @@ namespace MediaBrowser.Server.Implementations.Intros
if (config.EnableIntrosFromUpcomingTrailers)
{
trailerTypes.Add(TrailerType.ComingSoonToTheaters);
+ sourceTypes.Clear();
}
if (config.EnableIntrosFromUpcomingDvdMovies)
{
trailerTypes.Add(TrailerType.ComingSoonToDvd);
+ sourceTypes.Clear();
}
if (config.EnableIntrosFromUpcomingStreamingMovies)
{
trailerTypes.Add(TrailerType.ComingSoonToStreaming);
+ sourceTypes.Clear();
}
if (config.EnableIntrosFromSimilarMovies)
{
trailerTypes.Add(TrailerType.Archive);
+ sourceTypes.Clear();
}
}
@@ -102,7 +108,8 @@ namespace MediaBrowser.Server.Implementations.Intros
IsPlayed = config.EnableIntrosForWatchedContent ? (bool?)null : false,
MaxParentalRating = config.EnableIntrosParentalControl ? ratingLevel : null,
BlockUnratedItems = config.EnableIntrosParentalControl ? new[] { UnratedItem.Trailer } : new UnratedItem[] { },
- Limit = config.TrailerLimit
+ Limit = config.TrailerLimit,
+ SourceTypes = sourceTypes.ToArray()
});
candidates.AddRange(trailerResult.Select(i => new ItemWithTrailer
diff --git a/MediaBrowser.Server.Implementations/Library/MediaSourceManager.cs b/MediaBrowser.Server.Implementations/Library/MediaSourceManager.cs
index e7bfe56f2..716d627a9 100644
--- a/MediaBrowser.Server.Implementations/Library/MediaSourceManager.cs
+++ b/MediaBrowser.Server.Implementations/Library/MediaSourceManager.cs
@@ -360,6 +360,7 @@ namespace MediaBrowser.Server.Implementations.Library
public async Task<LiveStreamResponse> OpenLiveStream(LiveStreamRequest request, bool enableAutoClose, CancellationToken cancellationToken)
{
+ enableAutoClose = false;
await _liveStreamSemaphore.WaitAsync(cancellationToken).ConfigureAwait(false);
try
diff --git a/MediaBrowser.Server.Implementations/Library/Resolvers/TV/SeriesResolver.cs b/MediaBrowser.Server.Implementations/Library/Resolvers/TV/SeriesResolver.cs
index 1e480e265..3217cd67b 100644
--- a/MediaBrowser.Server.Implementations/Library/Resolvers/TV/SeriesResolver.cs
+++ b/MediaBrowser.Server.Implementations/Library/Resolvers/TV/SeriesResolver.cs
@@ -85,6 +85,12 @@ namespace MediaBrowser.Server.Implementations.Library.Resolvers.TV
{
if (args.ContainsFileSystemEntryByName("tvshow.nfo"))
{
+ if (args.Parent.IsRoot)
+ {
+ // For now, return null, but if we want to allow this in the future then add some additional checks to guard against a misplaced tvshow.nfo
+ return null;
+ }
+
return new Series
{
Path = args.Path,
diff --git a/MediaBrowser.Server.Implementations/LiveTv/EmbyTV/EmbyTV.cs b/MediaBrowser.Server.Implementations/LiveTv/EmbyTV/EmbyTV.cs
index 86d77982c..9b69b84d3 100644
--- a/MediaBrowser.Server.Implementations/LiveTv/EmbyTV/EmbyTV.cs
+++ b/MediaBrowser.Server.Implementations/LiveTv/EmbyTV/EmbyTV.cs
@@ -741,7 +741,7 @@ namespace MediaBrowser.Server.Implementations.LiveTv.EmbyTV
{
PostPaddingSeconds = Math.Max(config.PostPaddingSeconds, 0),
PrePaddingSeconds = Math.Max(config.PrePaddingSeconds, 0),
- RecordAnyChannel = true,
+ RecordAnyChannel = false,
RecordAnyTime = true,
RecordNewOnly = true,
@@ -764,7 +764,7 @@ namespace MediaBrowser.Server.Implementations.LiveTv.EmbyTV
defaults.RecordNewOnly = !program.IsRepeat;
}
- defaults.SkipEpisodesInLibrary = true;
+ defaults.SkipEpisodesInLibrary = defaults.RecordNewOnly;
defaults.KeepUntil = KeepUntil.UntilDeleted;
return Task.FromResult(defaults);
diff --git a/MediaBrowser.Server.Implementations/LiveTv/LiveTvManager.cs b/MediaBrowser.Server.Implementations/LiveTv/LiveTvManager.cs
index bac9789b5..aa404b37c 100644
--- a/MediaBrowser.Server.Implementations/LiveTv/LiveTvManager.cs
+++ b/MediaBrowser.Server.Implementations/LiveTv/LiveTvManager.cs
@@ -1752,7 +1752,7 @@ namespace MediaBrowser.Server.Implementations.LiveTv
public async Task AddInfoToProgramDto(List<Tuple<BaseItem, BaseItemDto>> tuples, List<ItemFields> fields, User user = null)
{
- var recordingTuples = new List<Tuple<BaseItemDto, string, string, string>>();
+ var programTuples = new List<Tuple<BaseItemDto, string, string, string>>();
foreach (var tuple in tuples)
{
@@ -1812,18 +1812,17 @@ namespace MediaBrowser.Server.Implementations.LiveTv
}
}
- var service = GetService(program);
- var serviceName = service == null ? null : service.Name;
+ var serviceName = program.ServiceName;
if (fields.Contains(ItemFields.ServiceName))
{
dto.ServiceName = serviceName;
}
- recordingTuples.Add(new Tuple<BaseItemDto, string, string, string>(dto, serviceName, program.ExternalId, program.ExternalSeriesIdLegacy));
+ programTuples.Add(new Tuple<BaseItemDto, string, string, string>(dto, serviceName, program.ExternalId, program.ExternalSeriesIdLegacy));
}
- await AddRecordingInfo(recordingTuples, CancellationToken.None).ConfigureAwait(false);
+ await AddRecordingInfo(programTuples, CancellationToken.None).ConfigureAwait(false);
}
public void AddInfoToRecordingDto(BaseItem item, BaseItemDto dto, User user = null)
diff --git a/MediaBrowser.Server.Implementations/LiveTv/TunerHosts/M3UTunerHost.cs b/MediaBrowser.Server.Implementations/LiveTv/TunerHosts/M3UTunerHost.cs
index b03feefe4..cedaf7ad8 100644
--- a/MediaBrowser.Server.Implementations/LiveTv/TunerHosts/M3UTunerHost.cs
+++ b/MediaBrowser.Server.Implementations/LiveTv/TunerHosts/M3UTunerHost.cs
@@ -114,6 +114,10 @@ namespace MediaBrowser.Server.Implementations.LiveTv.TunerHosts
{
protocol = MediaProtocol.Rtsp;
}
+ else if (path.StartsWith("udp", StringComparison.OrdinalIgnoreCase))
+ {
+ protocol = MediaProtocol.Udp;
+ }
var mediaSource = new MediaSourceInfo
{
diff --git a/MediaBrowser.Server.Implementations/LiveTv/TunerHosts/M3uParser.cs b/MediaBrowser.Server.Implementations/LiveTv/TunerHosts/M3uParser.cs
index c07c448db..38eb9bdd1 100644
--- a/MediaBrowser.Server.Implementations/LiveTv/TunerHosts/M3uParser.cs
+++ b/MediaBrowser.Server.Implementations/LiveTv/TunerHosts/M3uParser.cs
@@ -114,8 +114,8 @@ namespace MediaBrowser.Server.Implementations.LiveTv.TunerHosts
channel.ImageUrl = FindProperty("tvg-logo", extInf, null);
channel.Number = FindProperty("channel-id", extInf, channel.Number);
channel.Number = FindProperty("tvg-id", extInf, channel.Number);
- channel.Name = FindProperty("tvg-name", extInf, channel.Name);
channel.Name = FindProperty("tvg-id", extInf, channel.Name);
+ channel.Name = FindProperty("tvg-name", extInf, channel.Name);
return channel;
}
diff --git a/MediaBrowser.Server.Implementations/Persistence/SqliteItemRepository.cs b/MediaBrowser.Server.Implementations/Persistence/SqliteItemRepository.cs
index 2235bfe0d..f33b18389 100644
--- a/MediaBrowser.Server.Implementations/Persistence/SqliteItemRepository.cs
+++ b/MediaBrowser.Server.Implementations/Persistence/SqliteItemRepository.cs
@@ -1188,7 +1188,7 @@ namespace MediaBrowser.Server.Implementations.Persistence
public ItemImageInfo ItemImageInfoFromValueString(string value)
{
- var parts = value.Split(new[] { '*' }, StringSplitOptions.RemoveEmptyEntries);
+ var parts = value.Split(new[] { '*' }, StringSplitOptions.None);
var image = new ItemImageInfo();
@@ -1633,14 +1633,13 @@ namespace MediaBrowser.Server.Implementations.Persistence
}
index++;
- if (query.HasField(ItemFields.ServiceName))
+ // TODO: Even if not needed by apps, the server needs it internally
+ // But get this excluded from contexts where it is not needed
+ if (!reader.IsDBNull(index))
{
- if (!reader.IsDBNull(index))
- {
- item.ServiceName = reader.GetString(index);
- }
- index++;
+ item.ServiceName = reader.GetString(index);
}
+ index++;
if (!reader.IsDBNull(index))
{
diff --git a/MediaBrowser.Server.Implementations/Session/SessionManager.cs b/MediaBrowser.Server.Implementations/Session/SessionManager.cs
index e898a6abd..9326c4f43 100644
--- a/MediaBrowser.Server.Implementations/Session/SessionManager.cs
+++ b/MediaBrowser.Server.Implementations/Session/SessionManager.cs
@@ -633,9 +633,12 @@ namespace MediaBrowser.Server.Implementations.Session
data.PlayCount++;
data.LastPlayedDate = DateTime.UtcNow;
- if (!(item is Video) && item.SupportsPlayedStatus)
+ if (item.SupportsPlayedStatus)
{
- data.Played = true;
+ if (!(item is Video))
+ {
+ data.Played = true;
+ }
}
else
{