Merge pull request #1512 from MediaBrowser/dev

Dev
pull/702/head
Luke 9 years ago
commit 6eaf10679e

@ -148,6 +148,11 @@ namespace MediaBrowser.Api.Playback.Progressive
args += " -bsf:v h264_mp4toannexb"; args += " -bsf:v h264_mp4toannexb";
} }
if (state.RunTimeTicks.HasValue && state.VideoRequest.CopyTimestamps)
{
args += " -copyts -avoid_negative_ts disabled -start_at_zero";
}
return args; return args;
} }

@ -1359,7 +1359,7 @@ namespace MediaBrowser.Controller.Entities
{ {
if (!string.IsNullOrEmpty(info.Path)) if (!string.IsNullOrEmpty(info.Path))
{ {
var itemByPath = LibraryManager.RootFolder.FindByPath(info.Path); var itemByPath = LibraryManager.FindByPath(info.Path);
if (itemByPath == null) if (itemByPath == null)
{ {

@ -45,6 +45,8 @@ namespace MediaBrowser.Controller.Entities
public string NameLessThan { get; set; } public string NameLessThan { get; set; }
public string NameContains { get; set; } public string NameContains { get; set; }
public string Path { get; set; }
public string Person { get; set; } public string Person { get; set; }
public string[] PersonIds { get; set; } public string[] PersonIds { get; set; }
public string[] ItemIds { get; set; } public string[] ItemIds { get; set; }

@ -56,6 +56,13 @@ namespace MediaBrowser.Controller.Library
/// <returns>Task{Person}.</returns> /// <returns>Task{Person}.</returns>
Person GetPerson(string name); Person GetPerson(string name);
/// <summary>
/// Finds the by path.
/// </summary>
/// <param name="path">The path.</param>
/// <returns>BaseItem.</returns>
BaseItem FindByPath(string path);
/// <summary> /// <summary>
/// Gets the artist. /// Gets the artist.
/// </summary> /// </summary>

@ -25,8 +25,7 @@ namespace MediaBrowser.Providers.Folders
{ {
return new List<ImageType> return new List<ImageType>
{ {
ImageType.Primary, ImageType.Primary
ImageType.Thumb
}; };
} }
@ -57,13 +56,6 @@ namespace MediaBrowser.Providers.Folders
ProviderName = Name, ProviderName = Name,
Url = url, Url = url,
Type = ImageType.Primary Type = ImageType.Primary
},
new RemoteImageInfo
{
ProviderName = Name,
Url = url,
Type = ImageType.Thumb
} }
}); });
} }

@ -664,7 +664,7 @@ namespace MediaBrowser.Server.Implementations.IO
while (item == null && !string.IsNullOrEmpty(path)) while (item == null && !string.IsNullOrEmpty(path))
{ {
item = LibraryManager.RootFolder.FindByPath(path); item = LibraryManager.FindByPath(path);
path = Path.GetDirectoryName(path); path = Path.GetDirectoryName(path);
} }

@ -788,6 +788,29 @@ namespace MediaBrowser.Server.Implementations.Library
return _userRootFolder; return _userRootFolder;
} }
public BaseItem FindByPath(string path)
{
var query = new InternalItemsQuery
{
Path = path
};
// Only use the database result if there's exactly one item, otherwise we run the risk of returning old data that hasn't been cleaned yet.
var items = GetItemIds(query).Select(GetItemById).Where(i => i != null).ToArray();
if (items.Length == 1)
{
return items[0];
}
if (items.Length == 0)
{
return null;
}
return RootFolder.FindByPath(path);
}
/// <summary> /// <summary>
/// Gets a Person /// Gets a Person
/// </summary> /// </summary>

@ -130,6 +130,7 @@ namespace MediaBrowser.Server.Implementations.Persistence
"create table if not exists TypedBaseItems (guid GUID primary key, type TEXT, data BLOB, ParentId GUID)", "create table if not exists TypedBaseItems (guid GUID primary key, type TEXT, data BLOB, ParentId GUID)",
"create index if not exists idx_TypedBaseItems on TypedBaseItems(guid)", "create index if not exists idx_TypedBaseItems on TypedBaseItems(guid)",
"create index if not exists idx_PathTypedBaseItems on TypedBaseItems(Path)",
"create index if not exists idx_ParentIdTypedBaseItems on TypedBaseItems(ParentId)", "create index if not exists idx_ParentIdTypedBaseItems on TypedBaseItems(ParentId)",
"create table if not exists AncestorIds (ItemId GUID, AncestorId GUID, AncestorIdText TEXT, PRIMARY KEY (ItemId, AncestorId))", "create table if not exists AncestorIds (ItemId GUID, AncestorId GUID, AncestorIdText TEXT, PRIMARY KEY (ItemId, AncestorId))",
@ -1804,6 +1805,12 @@ namespace MediaBrowser.Server.Implementations.Persistence
cmd.Parameters.Add(cmd, "@ParentId", DbType.Guid).Value = query.ParentId.Value; cmd.Parameters.Add(cmd, "@ParentId", DbType.Guid).Value = query.ParentId.Value;
} }
if (!string.IsNullOrWhiteSpace(query.Path))
{
whereClauses.Add("Path=@Path");
cmd.Parameters.Add(cmd, "@Path", DbType.String).Value = query.Path;
}
if (query.MinEndDate.HasValue) if (query.MinEndDate.HasValue)
{ {
whereClauses.Add("EndDate>=@MinEndDate"); whereClauses.Add("EndDate>=@MinEndDate");

@ -10,11 +10,11 @@ namespace MediaBrowser.Server.Implementations.Sync
{ {
if (string.Equals(quality, "medium", StringComparison.OrdinalIgnoreCase)) if (string.Equals(quality, "medium", StringComparison.OrdinalIgnoreCase))
{ {
profileBitrate = Math.Min(Convert.ToInt32(profileBitrate.Value * .7), 4000000); profileBitrate = Math.Min(profileBitrate.Value, 4000000);
} }
else if (string.Equals(quality, "low", StringComparison.OrdinalIgnoreCase)) else if (string.Equals(quality, "low", StringComparison.OrdinalIgnoreCase))
{ {
profileBitrate = Math.Min(Convert.ToInt32(profileBitrate.Value * .5), 1500000); profileBitrate = Math.Min(profileBitrate.Value, 1500000);
} }
} }

Loading…
Cancel
Save