Merge pull request #2240 from MediaBrowser/beta

Beta
This commit is contained in:
Luke
2016-10-17 12:32:57 -04:00
committed by GitHub
30 changed files with 229 additions and 86 deletions

View File

@@ -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)
{
_usnsHandled.Add(identifier);
return;
}
_logger.Debug("Calling Nat.Handle on " + identifier);
IPAddress address;
if (IPAddress.TryParse(info.Location.Host, out address))
lock (_usnsHandled)
{
if (_usnsHandled.Contains(identifier))
{
// The Handle method doesn't need the port
var endpoint = new IPEndPoint(address, info.Location.Port);
return;
}
_usnsHandled.Add(identifier);
}
IPAddress localAddress = null;
_logger.Debug("Calling Nat.Handle on " + identifier);
try
{
var localAddressString = await _appHost.GetLocalApiUrl().ConfigureAwait(false);
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);
if (!IPAddress.TryParse(localAddressString, out localAddress))
{
return;
}
}
catch
IPAddress localAddress = null;
try
{
var localAddressString = await _appHost.GetLocalApiUrl().ConfigureAwait(false);
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)

View File

@@ -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

View File

@@ -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

View File

@@ -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,

View File

@@ -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);

View File

@@ -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)

View File

@@ -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
{

View File

@@ -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;
}

View File

@@ -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))
{

View File

@@ -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
{