Merge pull request #2406 from MediaBrowser/dev

Dev
This commit is contained in:
Luke 2017-01-20 13:48:32 -05:00 committed by GitHub
commit d0ce1cc319
9 changed files with 80 additions and 23 deletions

View File

@ -2648,7 +2648,7 @@ namespace Emby.Server.Implementations.Data
{
//Logger.Debug("{2} query time: {0}ms. Query: {1}",
// Convert.ToInt32(elapsed),
// cmd.CommandText,
// commandText,
// methodName);
}
}
@ -3617,10 +3617,12 @@ namespace Emby.Server.Implementations.Data
var index = 0;
foreach (var type in query.TrailerTypes)
{
clauses.Add("TrailerTypes like @TrailerTypes" + index);
var paramName = "@TrailerTypes" + index;
clauses.Add("TrailerTypes like " + paramName);
if (statement != null)
{
statement.TryBind("@TrailerTypes" + index, "%" + type + "%");
statement.TryBind(paramName, "%" + type + "%");
}
index++;
}
@ -4201,7 +4203,7 @@ namespace Emby.Server.Implementations.Data
var paramName = "@ExcludeProviderId" + index;
//excludeIds.Add("(COALESCE((select value from ProviderIds where ItemId=Guid and Name = '" + pair.Key + "'), '') <> " + paramName + ")");
excludeIds.Add("ProviderIds not like " + paramName);
excludeIds.Add("(ProviderIds is null or ProviderIds not like " + paramName + ")");
if (statement != null)
{
statement.TryBind(paramName, "%" + pair.Key + "=" + pair.Value + "%");

View File

@ -105,21 +105,26 @@ namespace Emby.Server.Implementations.Intros
trailerTypes.Clear();
}
var trailerResult = _libraryManager.GetItemList(new InternalItemsQuery(user)
// hack - can't filter by user library because local trailers get TopParentId =null in the db.
// for now we have to use a post-query filter afterwards to solve that
var trailerResult = _libraryManager.GetItemList(new InternalItemsQuery
{
IncludeItemTypes = new[] { typeof(Trailer).Name },
TrailerTypes = trailerTypes.ToArray(),
SimilarTo = item,
IsPlayed = config.EnableIntrosForWatchedContent ? (bool?)null : false,
//IsPlayed = config.EnableIntrosForWatchedContent ? (bool?)null : false,
MaxParentalRating = config.EnableIntrosParentalControl ? ratingLevel : null,
BlockUnratedItems = config.EnableIntrosParentalControl ? new[] { UnratedItem.Trailer } : new UnratedItem[] { },
// Account for duplicates by imdb id, since the database doesn't support this yet
Limit = config.TrailerLimit * 2,
Limit = config.TrailerLimit * 4,
SourceTypes = sourceTypes.ToArray(),
MinSimilarityScore = 0
}).Where(i => string.IsNullOrWhiteSpace(i.GetProviderId(MetadataProviders.Imdb)) || !string.Equals(i.GetProviderId(MetadataProviders.Imdb), item.GetProviderId(MetadataProviders.Imdb), StringComparison.OrdinalIgnoreCase)).Take(config.TrailerLimit);
})
.Where(i => string.IsNullOrWhiteSpace(i.GetProviderId(MetadataProviders.Imdb)) || !string.Equals(i.GetProviderId(MetadataProviders.Imdb), item.GetProviderId(MetadataProviders.Imdb), StringComparison.OrdinalIgnoreCase))
.Where(i => i.IsVisibleStandalone(user))
.Where(i => config.EnableIntrosForWatchedContent || !i.IsPlayed(user))
.Take(config.TrailerLimit);
candidates.AddRange(trailerResult.Select(i => new ItemWithTrailer
{

View File

@ -240,14 +240,49 @@ namespace Emby.Server.Implementations.LiveTv.EmbyTV
{
try
{
_logger.Info("Killing ffmpeg recording process for {0}", _targetPath);
_logger.Info("Stopping ffmpeg recording process for {0}", _targetPath);
//process.Kill();
_process.StandardInput.WriteLine("q");
}
catch (Exception ex)
{
_logger.ErrorException("Error killing transcoding job for {0}", ex, _targetPath);
_logger.ErrorException("Error stopping recording transcoding job for {0}", ex, _targetPath);
}
if (_hasExited)
{
return;
}
try
{
_logger.Info("Calling recording process.WaitForExit for {0}", _targetPath);
if (_process.WaitForExit(5000))
{
return;
}
}
catch (Exception ex)
{
_logger.ErrorException("Error waiting for recording process to exit for {0}", ex, _targetPath);
}
if (_hasExited)
{
return;
}
try
{
_logger.Info("Killing ffmpeg recording process for {0}", _targetPath);
_process.Kill();
}
catch (Exception ex)
{
_logger.ErrorException("Error killing recording transcoding job for {0}", ex, _targetPath);
}
}
}

View File

@ -160,7 +160,8 @@ namespace Emby.Server.Implementations.LiveTv.TunerHosts
Id = channel.Path.GetMD5().ToString("N"),
IsInfiniteStream = true,
SupportsDirectStream = false
SupportsDirectStream = false,
IsRemote = true
};
return new List<MediaSourceInfo> { mediaSource };

View File

@ -68,7 +68,8 @@ namespace MediaBrowser.Controller.Channels
Id = id,
ReadAtNativeFramerate = ReadAtNativeFramerate,
SupportsDirectStream = false,
SupportsDirectPlay = SupportsDirectPlay
SupportsDirectPlay = SupportsDirectPlay,
IsRemote = true
};
var bitrate = (AudioBitrate ?? 0) + (VideoBitrate ?? 0);

View File

@ -1590,14 +1590,17 @@ namespace MediaBrowser.Controller.Entities
return true;
}
var userCollectionFolders = user.RootFolder.GetChildren(user, true).Select(i => i.Id).ToList();
var itemCollectionFolders = LibraryManager.GetCollectionFolders(this).Select(i => i.Id);
var itemCollectionFolders = LibraryManager.GetCollectionFolders(this).Select(i => i.Id).ToList();
if (itemCollectionFolders.Count > 0)
{
var userCollectionFolders = user.RootFolder.GetChildren(user, true).Select(i => i.Id).ToList();
if (!itemCollectionFolders.Any(userCollectionFolders.Contains))
{
return false;
}
}
}
return true;
}

View File

@ -1250,8 +1250,8 @@ namespace MediaBrowser.MediaEncoding.Encoder
lock (_runningProcesses)
{
proceses = _runningProcesses.ToList();
}
_runningProcesses.Clear();
}
foreach (var process in proceses)
{
@ -1321,16 +1321,16 @@ namespace MediaBrowser.MediaEncoding.Encoder
{
}
lock (_mediaEncoder._runningProcesses)
{
_mediaEncoder._runningProcesses.Remove(this);
}
DisposeProcess(process);
}
private void DisposeProcess(IProcess process)
{
lock (_mediaEncoder._runningProcesses)
{
_mediaEncoder._runningProcesses.Remove(this);
}
try
{
process.Dispose();

View File

@ -21,6 +21,11 @@ namespace MediaBrowser.Model.Dto
public string Name { get; set; }
/// <summary>
/// Differentiate internet url vs local network
/// </summary>
public bool IsRemote { get; set; }
public string ETag { get; set; }
public long? RunTimeTicks { get; set; }
public bool ReadAtNativeFramerate { get; set; }

View File

@ -92,6 +92,11 @@ namespace MediaBrowser.Model.Entities
{
attributes.Add(StringHelper.FirstToUpper(Language));
}
else
{
attributes.Add("Und");
}
if (IsDefault)
{
attributes.Add("Default");