commit
04de5b15e6
|
@ -156,7 +156,9 @@ namespace MediaBrowser.Api.Movies
|
|||
typeof(LiveTvProgram).Name
|
||||
},
|
||||
IsMovie = true,
|
||||
SimilarTo = item
|
||||
SimilarTo = item,
|
||||
EnableGroupByMetadataKey = true
|
||||
|
||||
}).ToList();
|
||||
|
||||
var dtoOptions = GetDtoOptions(request);
|
||||
|
@ -205,7 +207,8 @@ namespace MediaBrowser.Api.Movies
|
|||
SortOrder = SortOrder.Descending,
|
||||
Limit = 10,
|
||||
IsFavoriteOrLiked = true,
|
||||
ExcludeItemIds = recentlyPlayedMovies.Select(i => i.Id.ToString("N")).ToArray()
|
||||
ExcludeItemIds = recentlyPlayedMovies.Select(i => i.Id.ToString("N")).ToArray(),
|
||||
EnableGroupByMetadataKey = true
|
||||
|
||||
}, parentIds).ToList();
|
||||
|
||||
|
@ -283,7 +286,8 @@ namespace MediaBrowser.Api.Movies
|
|||
typeof(Trailer).Name,
|
||||
typeof(LiveTvProgram).Name
|
||||
},
|
||||
IsMovie = true
|
||||
IsMovie = true,
|
||||
EnableGroupByMetadataKey = true
|
||||
|
||||
}).DistinctBy(i => i.GetProviderId(MetadataProviders.Imdb) ?? Guid.NewGuid().ToString("N"))
|
||||
.Take(itemLimit)
|
||||
|
@ -317,7 +321,8 @@ namespace MediaBrowser.Api.Movies
|
|||
typeof(Trailer).Name,
|
||||
typeof(LiveTvProgram).Name
|
||||
},
|
||||
IsMovie = true
|
||||
IsMovie = true,
|
||||
EnableGroupByMetadataKey = true
|
||||
|
||||
}).DistinctBy(i => i.GetProviderId(MetadataProviders.Imdb) ?? Guid.NewGuid().ToString("N"))
|
||||
.Take(itemLimit)
|
||||
|
@ -350,7 +355,8 @@ namespace MediaBrowser.Api.Movies
|
|||
typeof(LiveTvProgram).Name
|
||||
},
|
||||
IsMovie = true,
|
||||
SimilarTo = item
|
||||
SimilarTo = item,
|
||||
EnableGroupByMetadataKey = true
|
||||
|
||||
}).ToList();
|
||||
|
||||
|
|
|
@ -143,7 +143,7 @@ namespace MediaBrowser.Controller.Entities
|
|||
public bool EnableTotalRecordCount { get; set; }
|
||||
public bool ForceDirect { get; set; }
|
||||
public Dictionary<string, string> ExcludeProviderIds { get; set; }
|
||||
public string GroupByAncestorOfType { get; set; }
|
||||
public bool EnableGroupByMetadataKey { get; set; }
|
||||
|
||||
public InternalItemsQuery()
|
||||
{
|
||||
|
|
|
@ -112,9 +112,18 @@ namespace MediaBrowser.MediaEncoding.Encoder
|
|||
// If the path was passed in, save it into config now.
|
||||
var encodingOptions = GetEncodingOptions();
|
||||
var appPath = encodingOptions.EncoderAppPath;
|
||||
if (!string.IsNullOrWhiteSpace(FFMpegPath) && !string.Equals(FFMpegPath, appPath, StringComparison.Ordinal))
|
||||
|
||||
var valueToSave = FFMpegPath;
|
||||
|
||||
// if using system variable, don't save this.
|
||||
if (string.Equals(valueToSave, "ffmpeg", StringComparison.OrdinalIgnoreCase))
|
||||
{
|
||||
encodingOptions.EncoderAppPath = FFMpegPath;
|
||||
valueToSave = null;
|
||||
}
|
||||
|
||||
if (!string.Equals(valueToSave, appPath, StringComparison.Ordinal))
|
||||
{
|
||||
encodingOptions.EncoderAppPath = valueToSave;
|
||||
ConfigurationManager.SaveConfiguration("encoding", encodingOptions);
|
||||
}
|
||||
}
|
||||
|
@ -161,7 +170,12 @@ namespace MediaBrowser.MediaEncoding.Encoder
|
|||
{
|
||||
appPath = Path.Combine(ConfigurationManager.ApplicationPaths.ProgramDataPath, "ffmpeg");
|
||||
}
|
||||
|
||||
var newPaths = GetEncoderPaths(appPath);
|
||||
if (string.IsNullOrWhiteSpace(newPaths.Item1) || string.IsNullOrWhiteSpace(newPaths.Item2))
|
||||
{
|
||||
newPaths = TestForInstalledVersions();
|
||||
}
|
||||
|
||||
if (!string.IsNullOrWhiteSpace(newPaths.Item1) && !string.IsNullOrWhiteSpace(newPaths.Item2))
|
||||
{
|
||||
|
@ -192,6 +206,52 @@ namespace MediaBrowser.MediaEncoding.Encoder
|
|||
return new Tuple<string, string>(null, null);
|
||||
}
|
||||
|
||||
private Tuple<string, string> TestForInstalledVersions()
|
||||
{
|
||||
string encoderPath = null;
|
||||
string probePath = null;
|
||||
|
||||
if (TestSystemInstalled("ffmpeg"))
|
||||
{
|
||||
encoderPath = "ffmpeg";
|
||||
}
|
||||
if (TestSystemInstalled("ffprobe"))
|
||||
{
|
||||
probePath = "ffprobe";
|
||||
}
|
||||
|
||||
return new Tuple<string, string>(encoderPath, probePath);
|
||||
}
|
||||
|
||||
private bool TestSystemInstalled(string app)
|
||||
{
|
||||
try
|
||||
{
|
||||
var startInfo = new ProcessStartInfo
|
||||
{
|
||||
FileName = app,
|
||||
Arguments = "-v",
|
||||
UseShellExecute = false,
|
||||
CreateNoWindow = true,
|
||||
WindowStyle = ProcessWindowStyle.Hidden,
|
||||
ErrorDialog = false
|
||||
};
|
||||
|
||||
using (var process = Process.Start(startInfo))
|
||||
{
|
||||
process.WaitForExit();
|
||||
}
|
||||
|
||||
_logger.Debug("System app installed: " + app);
|
||||
return true;
|
||||
}
|
||||
catch
|
||||
{
|
||||
_logger.Debug("System app not installed: " + app);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
private Tuple<string,string> GetPathsFromDirectory(string path)
|
||||
{
|
||||
// Since we can't predict the file extension, first try directly within the folder
|
||||
|
|
|
@ -1622,7 +1622,7 @@ namespace MediaBrowser.Server.Implementations.Persistence
|
|||
return false;
|
||||
}
|
||||
|
||||
if (query.SimilarTo != null)
|
||||
if (query.SimilarTo != null && query.User != null)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
@ -1757,11 +1757,6 @@ namespace MediaBrowser.Server.Implementations.Persistence
|
|||
{
|
||||
var groups = new List<string>();
|
||||
|
||||
if (!string.IsNullOrWhiteSpace(query.GroupByAncestorOfType))
|
||||
{
|
||||
groups.Add("(Select PresentationUniqueKey from TypedBaseItems B where B.Type = 'MediaBrowser.Controller.Entities.TV.Series' And B.Guid in (Select AncestorId from AncestorIds where ItemId=A.Guid))");
|
||||
}
|
||||
|
||||
if (EnableGroupByPresentationUniqueKey(query))
|
||||
{
|
||||
groups.Add("PresentationUniqueKey");
|
||||
|
@ -1793,6 +1788,12 @@ namespace MediaBrowser.Server.Implementations.Persistence
|
|||
|
||||
var list = new List<BaseItem>();
|
||||
|
||||
// Hack for right now since we currently don't support filtering out these duplicates within a query
|
||||
if (query.Limit.HasValue && query.EnableGroupByMetadataKey)
|
||||
{
|
||||
query.Limit = query.Limit.Value + 4;
|
||||
}
|
||||
|
||||
using (var cmd = _connection.CreateCommand())
|
||||
{
|
||||
cmd.CommandText = "select " + string.Join(",", GetFinalColumnsToSelect(query, _retriveItemColumns, cmd)) + GetFromText();
|
||||
|
@ -1845,9 +1846,57 @@ namespace MediaBrowser.Server.Implementations.Persistence
|
|||
}
|
||||
}
|
||||
|
||||
// Hack for right now since we currently don't support filtering out these duplicates within a query
|
||||
if (query.EnableGroupByMetadataKey)
|
||||
{
|
||||
var limit = query.Limit ?? int.MaxValue;
|
||||
limit -= 4;
|
||||
var newList = new List<BaseItem>();
|
||||
|
||||
foreach (var item in list)
|
||||
{
|
||||
AddItem(newList, item);
|
||||
|
||||
if (newList.Count >= limit)
|
||||
{
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
list = newList;
|
||||
}
|
||||
|
||||
return list;
|
||||
}
|
||||
|
||||
private void AddItem(List<BaseItem> items, BaseItem newItem)
|
||||
{
|
||||
var providerIds = newItem.ProviderIds.ToList();
|
||||
|
||||
for (var i = 0; i < items.Count; i++)
|
||||
{
|
||||
var item = items[i];
|
||||
|
||||
foreach (var providerId in providerIds)
|
||||
{
|
||||
if (providerId.Key == MetadataProviders.TmdbCollection.ToString())
|
||||
{
|
||||
continue;
|
||||
}
|
||||
if (item.GetProviderId(providerId.Key) == providerId.Value)
|
||||
{
|
||||
if (newItem.SourceType == SourceType.Library)
|
||||
{
|
||||
items[i] = newItem;
|
||||
}
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
items.Add(newItem);
|
||||
}
|
||||
|
||||
private void LogQueryTime(string methodName, IDbCommand cmd, DateTime startDate)
|
||||
{
|
||||
var elapsed = (DateTime.UtcNow - startDate).TotalMilliseconds;
|
||||
|
@ -3869,7 +3918,7 @@ namespace MediaBrowser.Server.Implementations.Persistence
|
|||
return counts;
|
||||
}
|
||||
|
||||
var allTypes = typeString.Split(new[] {'|'}, StringSplitOptions.RemoveEmptyEntries)
|
||||
var allTypes = typeString.Split(new[] { '|' }, StringSplitOptions.RemoveEmptyEntries)
|
||||
.ToLookup(i => i).ToList();
|
||||
|
||||
foreach (var type in allTypes)
|
||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -10,6 +10,7 @@ using MediaBrowser.Controller.Power;
|
|||
using MediaBrowser.Server.Implementations.Persistence;
|
||||
using MediaBrowser.Server.Startup.Common.FFMpeg;
|
||||
using System.Diagnostics;
|
||||
using MediaBrowser.Model.System;
|
||||
|
||||
namespace MediaBrowser.Server.Mac
|
||||
{
|
||||
|
@ -166,7 +167,7 @@ namespace MediaBrowser.Server.Mac
|
|||
|
||||
switch (environment.SystemArchitecture)
|
||||
{
|
||||
case Architecture.X86_X64:
|
||||
case Architecture.X64:
|
||||
info.Version = "20160124";
|
||||
break;
|
||||
case Architecture.X86:
|
||||
|
@ -183,16 +184,11 @@ namespace MediaBrowser.Server.Mac
|
|||
{
|
||||
switch (environment.SystemArchitecture)
|
||||
{
|
||||
case Architecture.X86_X64:
|
||||
case Architecture.X64:
|
||||
return new[]
|
||||
{
|
||||
"https://github.com/MediaBrowser/Emby.Resources/raw/master/ffmpeg/osx/ffmpeg-x64-2.8.5.7z"
|
||||
};
|
||||
case Architecture.X86:
|
||||
return new[]
|
||||
{
|
||||
"https://github.com/MediaBrowser/Emby.Resources/raw/master/ffmpeg/osx/ffmpeg-x86-2.5.3.7z"
|
||||
};
|
||||
}
|
||||
|
||||
// No version available
|
||||
|
@ -230,7 +226,7 @@ namespace MediaBrowser.Server.Mac
|
|||
}
|
||||
else if (string.Equals(uname.machine, "x86_64", StringComparison.OrdinalIgnoreCase))
|
||||
{
|
||||
info.SystemArchitecture = Architecture.X86_X64;
|
||||
info.SystemArchitecture = Architecture.X64;
|
||||
}
|
||||
else if (uname.machine.StartsWith("arm", StringComparison.OrdinalIgnoreCase))
|
||||
{
|
||||
|
|
24
MediaBrowser.Server.Mac/Native/DbConnector.cs
Normal file
24
MediaBrowser.Server.Mac/Native/DbConnector.cs
Normal file
|
@ -0,0 +1,24 @@
|
|||
using System;
|
||||
using System.Data;
|
||||
using System.Data.SQLite;
|
||||
using System.Threading.Tasks;
|
||||
using MediaBrowser.Model.Logging;
|
||||
using MediaBrowser.Server.Implementations.Persistence;
|
||||
|
||||
namespace MediaBrowser.Server.Mac
|
||||
{
|
||||
public class DbConnector : IDbConnector
|
||||
{
|
||||
private readonly ILogger _logger;
|
||||
|
||||
public DbConnector(ILogger logger)
|
||||
{
|
||||
_logger = logger;
|
||||
}
|
||||
|
||||
public Task<IDbConnection> Connect(string dbPath, bool isReadOnly, bool enablePooling = false, int? cacheSize = null)
|
||||
{
|
||||
return SqliteExtensions.ConnectToDb(dbPath, isReadOnly, enablePooling, cacheSize, _logger);
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,62 +0,0 @@
|
|||
using System;
|
||||
using System.Data;
|
||||
using System.Data.SQLite;
|
||||
using System.Threading.Tasks;
|
||||
using MediaBrowser.Model.Logging;
|
||||
using MediaBrowser.Server.Implementations.Persistence;
|
||||
|
||||
namespace MediaBrowser.Server.Mac
|
||||
{
|
||||
/// <summary>
|
||||
/// Class SQLiteExtensions
|
||||
/// </summary>
|
||||
static class SqliteExtensions
|
||||
{
|
||||
/// <summary>
|
||||
/// Connects to db.
|
||||
/// </summary>
|
||||
/// <param name="dbPath">The db path.</param>
|
||||
/// <param name="logger">The logger.</param>
|
||||
/// <returns>Task{IDbConnection}.</returns>
|
||||
/// <exception cref="System.ArgumentNullException">dbPath</exception>
|
||||
public static async Task<IDbConnection> ConnectToDb(string dbPath, ILogger logger)
|
||||
{
|
||||
if (string.IsNullOrEmpty(dbPath))
|
||||
{
|
||||
throw new ArgumentNullException("dbPath");
|
||||
}
|
||||
|
||||
logger.Info("Sqlite {0} opening {1}", SQLiteConnection.SQLiteVersion, dbPath);
|
||||
|
||||
var connectionstr = new SQLiteConnectionStringBuilder
|
||||
{
|
||||
PageSize = 4096,
|
||||
CacheSize = 2000,
|
||||
SyncMode = SynchronizationModes.Full,
|
||||
DataSource = dbPath,
|
||||
JournalMode = SQLiteJournalModeEnum.Wal
|
||||
};
|
||||
|
||||
var connection = new SQLiteConnection(connectionstr.ConnectionString);
|
||||
|
||||
await connection.OpenAsync().ConfigureAwait(false);
|
||||
|
||||
return connection;
|
||||
}
|
||||
}
|
||||
|
||||
public class DbConnector : IDbConnector
|
||||
{
|
||||
private readonly ILogger _logger;
|
||||
|
||||
public DbConnector(ILogger logger)
|
||||
{
|
||||
_logger = logger;
|
||||
}
|
||||
|
||||
public Task<IDbConnection> Connect(string dbPath)
|
||||
{
|
||||
return SqliteExtensions.ConnectToDb(dbPath, _logger);
|
||||
}
|
||||
}
|
||||
}
|
|
@ -248,6 +248,7 @@ namespace MediaBrowser.Server.Mono.Native
|
|||
|
||||
switch (environment.OperatingSystem)
|
||||
{
|
||||
case OperatingSystem.Osx:
|
||||
case OperatingSystem.Bsd:
|
||||
break;
|
||||
case OperatingSystem.Linux:
|
||||
|
@ -255,20 +256,6 @@ namespace MediaBrowser.Server.Mono.Native
|
|||
info.ArchiveType = "7z";
|
||||
info.Version = "20160215";
|
||||
break;
|
||||
case OperatingSystem.Osx:
|
||||
|
||||
info.ArchiveType = "7z";
|
||||
|
||||
switch (environment.SystemArchitecture)
|
||||
{
|
||||
case Architecture.X64:
|
||||
info.Version = "20160124";
|
||||
break;
|
||||
case Architecture.X86:
|
||||
info.Version = "20150110";
|
||||
break;
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
info.DownloadUrls = GetDownloadUrls(environment);
|
||||
|
@ -280,23 +267,6 @@ namespace MediaBrowser.Server.Mono.Native
|
|||
{
|
||||
switch (environment.OperatingSystem)
|
||||
{
|
||||
case OperatingSystem.Osx:
|
||||
|
||||
switch (environment.SystemArchitecture)
|
||||
{
|
||||
case Architecture.X64:
|
||||
return new[]
|
||||
{
|
||||
"https://github.com/MediaBrowser/Emby.Resources/raw/master/ffmpeg/osx/ffmpeg-x64-2.8.5.7z"
|
||||
};
|
||||
case Architecture.X86:
|
||||
return new[]
|
||||
{
|
||||
"https://github.com/MediaBrowser/Emby.Resources/raw/master/ffmpeg/osx/ffmpeg-x86-2.5.3.7z"
|
||||
};
|
||||
}
|
||||
break;
|
||||
|
||||
case OperatingSystem.Linux:
|
||||
|
||||
switch (environment.SystemArchitecture)
|
||||
|
@ -306,16 +276,6 @@ namespace MediaBrowser.Server.Mono.Native
|
|||
{
|
||||
"https://github.com/MediaBrowser/Emby.Resources/raw/master/ffmpeg/linux/ffmpeg-git-20160215-64bit-static.7z"
|
||||
};
|
||||
case Architecture.X86:
|
||||
return new[]
|
||||
{
|
||||
"https://github.com/MediaBrowser/Emby.Resources/raw/master/ffmpeg/linux/ffmpeg-git-20160215-32bit-static.7z"
|
||||
};
|
||||
case Architecture.Arm:
|
||||
return new[]
|
||||
{
|
||||
"https://github.com/MediaBrowser/Emby.Resources/raw/master/ffmpeg/linux/ffmpeg-arm.7z"
|
||||
};
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue
Block a user