mirror of
https://github.com/jellyfin/jellyfin.git
synced 2024-09-07 20:08:59 +02:00
commit
d6d0bc7164
25 changed files with 582 additions and 232 deletions
|
@ -424,6 +424,7 @@ namespace Emby.Server.Core
|
||||||
ServiceStack.Text.JsConfig<Movie>.ExcludePropertyNames = new[] { "ProviderIds", "ImageInfos", "ProductionLocations", "ThemeSongIds", "ThemeVideoIds", "TotalBitrate", "ShortOverview", "Taglines", "Keywords", "ExtraType" };
|
ServiceStack.Text.JsConfig<Movie>.ExcludePropertyNames = new[] { "ProviderIds", "ImageInfos", "ProductionLocations", "ThemeSongIds", "ThemeVideoIds", "TotalBitrate", "ShortOverview", "Taglines", "Keywords", "ExtraType" };
|
||||||
ServiceStack.Text.JsConfig<Playlist>.ExcludePropertyNames = new[] { "ProviderIds", "ImageInfos", "ProductionLocations", "ThemeSongIds", "ThemeVideoIds", "TotalBitrate", "ShortOverview", "Taglines", "Keywords", "ExtraType" };
|
ServiceStack.Text.JsConfig<Playlist>.ExcludePropertyNames = new[] { "ProviderIds", "ImageInfos", "ProductionLocations", "ThemeSongIds", "ThemeVideoIds", "TotalBitrate", "ShortOverview", "Taglines", "Keywords", "ExtraType" };
|
||||||
ServiceStack.Text.JsConfig<AudioPodcast>.ExcludePropertyNames = new[] { "Artists", "AlbumArtists", "ChannelMediaSources", "ProviderIds", "ImageInfos", "ProductionLocations", "ThemeSongIds", "ThemeVideoIds", "TotalBitrate", "ShortOverview", "Taglines", "Keywords", "ExtraType" };
|
ServiceStack.Text.JsConfig<AudioPodcast>.ExcludePropertyNames = new[] { "Artists", "AlbumArtists", "ChannelMediaSources", "ProviderIds", "ImageInfos", "ProductionLocations", "ThemeSongIds", "ThemeVideoIds", "TotalBitrate", "ShortOverview", "Taglines", "Keywords", "ExtraType" };
|
||||||
|
ServiceStack.Text.JsConfig<AudioBook>.ExcludePropertyNames = new[] { "Artists", "AlbumArtists", "ChannelMediaSources", "ProviderIds", "ImageInfos", "ProductionLocations", "ThemeSongIds", "ThemeVideoIds", "TotalBitrate", "ShortOverview", "Taglines", "Keywords", "ExtraType" };
|
||||||
ServiceStack.Text.JsConfig<Trailer>.ExcludePropertyNames = new[] { "ProviderIds", "ImageInfos", "ProductionLocations", "ThemeSongIds", "ThemeVideoIds", "TotalBitrate", "ShortOverview", "Taglines", "Keywords", "ExtraType" };
|
ServiceStack.Text.JsConfig<Trailer>.ExcludePropertyNames = new[] { "ProviderIds", "ImageInfos", "ProductionLocations", "ThemeSongIds", "ThemeVideoIds", "TotalBitrate", "ShortOverview", "Taglines", "Keywords", "ExtraType" };
|
||||||
ServiceStack.Text.JsConfig<BoxSet>.ExcludePropertyNames = new[] { "ProviderIds", "ImageInfos", "ProductionLocations", "ThemeSongIds", "ThemeVideoIds", "TotalBitrate", "ShortOverview", "Taglines", "Keywords", "ExtraType" };
|
ServiceStack.Text.JsConfig<BoxSet>.ExcludePropertyNames = new[] { "ProviderIds", "ImageInfos", "ProductionLocations", "ThemeSongIds", "ThemeVideoIds", "TotalBitrate", "ShortOverview", "Taglines", "Keywords", "ExtraType" };
|
||||||
ServiceStack.Text.JsConfig<Episode>.ExcludePropertyNames = new[] { "ProviderIds", "ImageInfos", "ProductionLocations", "ThemeSongIds", "ThemeVideoIds", "TotalBitrate", "ShortOverview", "Taglines", "Keywords", "ExtraType" };
|
ServiceStack.Text.JsConfig<Episode>.ExcludePropertyNames = new[] { "ProviderIds", "ImageInfos", "ProductionLocations", "ThemeSongIds", "ThemeVideoIds", "TotalBitrate", "ShortOverview", "Taglines", "Keywords", "ExtraType" };
|
||||||
|
|
|
@ -84,6 +84,9 @@ namespace Emby.Server.Implementations.Activity
|
||||||
{
|
{
|
||||||
using (var connection = CreateConnection(true))
|
using (var connection = CreateConnection(true))
|
||||||
{
|
{
|
||||||
|
var list = new List<ActivityLogEntry>();
|
||||||
|
int totalRecordCount = 0;
|
||||||
|
|
||||||
var commandText = BaseActivitySelectText;
|
var commandText = BaseActivitySelectText;
|
||||||
var whereClauses = new List<string>();
|
var whereClauses = new List<string>();
|
||||||
|
|
||||||
|
@ -120,9 +123,15 @@ namespace Emby.Server.Implementations.Activity
|
||||||
commandText += " LIMIT " + limit.Value.ToString(_usCulture);
|
commandText += " LIMIT " + limit.Value.ToString(_usCulture);
|
||||||
}
|
}
|
||||||
|
|
||||||
var list = new List<ActivityLogEntry>();
|
var statementTexts = new List<string>();
|
||||||
|
statementTexts.Add(commandText);
|
||||||
|
statementTexts.Add("select count (Id) from ActivityLogEntries" + whereTextWithoutPaging);
|
||||||
|
|
||||||
using (var statement = connection.PrepareStatement(commandText))
|
connection.RunInTransaction(db =>
|
||||||
|
{
|
||||||
|
var statements = PrepareAllSafe(db, string.Join(";", statementTexts.ToArray())).ToList();
|
||||||
|
|
||||||
|
using (var statement = statements[0])
|
||||||
{
|
{
|
||||||
if (minDate.HasValue)
|
if (minDate.HasValue)
|
||||||
{
|
{
|
||||||
|
@ -135,9 +144,7 @@ namespace Emby.Server.Implementations.Activity
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
int totalRecordCount;
|
using (var statement = statements[1])
|
||||||
|
|
||||||
using (var statement = connection.PrepareStatement("select count (Id) from ActivityLogEntries" + whereTextWithoutPaging))
|
|
||||||
{
|
{
|
||||||
if (minDate.HasValue)
|
if (minDate.HasValue)
|
||||||
{
|
{
|
||||||
|
@ -146,6 +153,7 @@ namespace Emby.Server.Implementations.Activity
|
||||||
|
|
||||||
totalRecordCount = statement.ExecuteQuery().SelectScalarInt().First();
|
totalRecordCount = statement.ExecuteQuery().SelectScalarInt().First();
|
||||||
}
|
}
|
||||||
|
}, ReadTransactionMode);
|
||||||
|
|
||||||
return new QueryResult<ActivityLogEntry>()
|
return new QueryResult<ActivityLogEntry>()
|
||||||
{
|
{
|
||||||
|
|
|
@ -79,7 +79,7 @@ namespace Emby.Server.Implementations.Data
|
||||||
connectionFlags |= ConnectionFlags.ReadWrite;
|
connectionFlags |= ConnectionFlags.ReadWrite;
|
||||||
}
|
}
|
||||||
|
|
||||||
//connectionFlags |= ConnectionFlags.SharedCached;
|
connectionFlags |= ConnectionFlags.SharedCached;
|
||||||
connectionFlags |= ConnectionFlags.NoMutex;
|
connectionFlags |= ConnectionFlags.NoMutex;
|
||||||
|
|
||||||
var db = SQLite3.Open(DbFilePath, connectionFlags, null);
|
var db = SQLite3.Open(DbFilePath, connectionFlags, null);
|
||||||
|
|
|
@ -123,17 +123,10 @@ namespace Emby.Server.Implementations.Data
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private SQLiteDatabaseConnection _backgroundConnection;
|
|
||||||
protected override void CloseConnection()
|
protected override void CloseConnection()
|
||||||
{
|
{
|
||||||
base.CloseConnection();
|
base.CloseConnection();
|
||||||
|
|
||||||
if (_backgroundConnection != null)
|
|
||||||
{
|
|
||||||
_backgroundConnection.Dispose();
|
|
||||||
_backgroundConnection = null;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (_shrinkMemoryTimer != null)
|
if (_shrinkMemoryTimer != null)
|
||||||
{
|
{
|
||||||
_shrinkMemoryTimer.Dispose();
|
_shrinkMemoryTimer.Dispose();
|
||||||
|
@ -379,8 +372,6 @@ namespace Emby.Server.Implementations.Data
|
||||||
|
|
||||||
userDataRepo.Initialize(WriteLock);
|
userDataRepo.Initialize(WriteLock);
|
||||||
|
|
||||||
//_backgroundConnection = CreateConnection(true);
|
|
||||||
|
|
||||||
_shrinkMemoryTimer = _timerFactory.Create(OnShrinkMemoryTimerCallback, null, TimeSpan.FromMinutes(1), TimeSpan.FromMinutes(30));
|
_shrinkMemoryTimer = _timerFactory.Create(OnShrinkMemoryTimerCallback, null, TimeSpan.FromMinutes(1), TimeSpan.FromMinutes(30));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1370,6 +1361,10 @@ namespace Emby.Server.Implementations.Data
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
if (type == typeof(AudioBook))
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
if (type == typeof(MusicAlbum))
|
if (type == typeof(MusicAlbum))
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
|
@ -2691,7 +2686,9 @@ namespace Emby.Server.Implementations.Data
|
||||||
{
|
{
|
||||||
using (var connection = CreateConnection(true))
|
using (var connection = CreateConnection(true))
|
||||||
{
|
{
|
||||||
var statements = PrepareAllSafe(connection, string.Join(";", statementTexts.ToArray()))
|
connection.RunInTransaction(db =>
|
||||||
|
{
|
||||||
|
var statements = PrepareAllSafe(db, string.Join(";", statementTexts.ToArray()))
|
||||||
.ToList();
|
.ToList();
|
||||||
|
|
||||||
if (!isReturningZeroItems)
|
if (!isReturningZeroItems)
|
||||||
|
@ -2717,7 +2714,6 @@ namespace Emby.Server.Implementations.Data
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
if (query.EnableTotalRecordCount)
|
if (query.EnableTotalRecordCount)
|
||||||
{
|
{
|
||||||
|
@ -2736,6 +2732,9 @@ namespace Emby.Server.Implementations.Data
|
||||||
totalRecordCount = statement.ExecuteQuery().SelectScalarInt().First();
|
totalRecordCount = statement.ExecuteQuery().SelectScalarInt().First();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}, ReadTransactionMode);
|
||||||
|
|
||||||
LogQueryTime("GetItems", commandText, now);
|
LogQueryTime("GetItems", commandText, now);
|
||||||
|
|
||||||
|
@ -3095,11 +3094,13 @@ namespace Emby.Server.Implementations.Data
|
||||||
{
|
{
|
||||||
using (var connection = CreateConnection(true))
|
using (var connection = CreateConnection(true))
|
||||||
{
|
{
|
||||||
var statements = PrepareAllSafe(connection, string.Join(";", statementTexts.ToArray()))
|
|
||||||
.ToList();
|
|
||||||
|
|
||||||
var totalRecordCount = 0;
|
var totalRecordCount = 0;
|
||||||
|
|
||||||
|
connection.RunInTransaction(db =>
|
||||||
|
{
|
||||||
|
var statements = PrepareAllSafe(db, string.Join(";", statementTexts.ToArray()))
|
||||||
|
.ToList();
|
||||||
|
|
||||||
if (!isReturningZeroItems)
|
if (!isReturningZeroItems)
|
||||||
{
|
{
|
||||||
using (var statement = statements[0])
|
using (var statement = statements[0])
|
||||||
|
@ -3139,6 +3140,8 @@ namespace Emby.Server.Implementations.Data
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
}, ReadTransactionMode);
|
||||||
|
|
||||||
LogQueryTime("GetItemIds", commandText, now);
|
LogQueryTime("GetItemIds", commandText, now);
|
||||||
|
|
||||||
return new QueryResult<Guid>()
|
return new QueryResult<Guid>()
|
||||||
|
@ -4426,6 +4429,7 @@ namespace Emby.Server.Implementations.Data
|
||||||
typeof(Movie),
|
typeof(Movie),
|
||||||
typeof(Playlist),
|
typeof(Playlist),
|
||||||
typeof(AudioPodcast),
|
typeof(AudioPodcast),
|
||||||
|
typeof(AudioBook),
|
||||||
typeof(Trailer),
|
typeof(Trailer),
|
||||||
typeof(BoxSet),
|
typeof(BoxSet),
|
||||||
typeof(Episode),
|
typeof(Episode),
|
||||||
|
@ -4594,12 +4598,13 @@ namespace Emby.Server.Implementations.Data
|
||||||
commandText += " order by ListOrder";
|
commandText += " order by ListOrder";
|
||||||
|
|
||||||
var list = new List<string>();
|
var list = new List<string>();
|
||||||
|
|
||||||
using (WriteLock.Read())
|
using (WriteLock.Read())
|
||||||
{
|
{
|
||||||
using (var connection = CreateConnection(true))
|
using (var connection = CreateConnection(true))
|
||||||
{
|
{
|
||||||
using (var statement = PrepareStatementSafe(connection, commandText))
|
connection.RunInTransaction(db =>
|
||||||
|
{
|
||||||
|
using (var statement = PrepareStatementSafe(db, commandText))
|
||||||
{
|
{
|
||||||
// Run this again to bind the params
|
// Run this again to bind the params
|
||||||
GetPeopleWhereClauses(query, statement);
|
GetPeopleWhereClauses(query, statement);
|
||||||
|
@ -4609,6 +4614,7 @@ namespace Emby.Server.Implementations.Data
|
||||||
list.Add(row.GetString(0));
|
list.Add(row.GetString(0));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}, ReadTransactionMode);
|
||||||
}
|
}
|
||||||
return list;
|
return list;
|
||||||
}
|
}
|
||||||
|
@ -4640,7 +4646,9 @@ namespace Emby.Server.Implementations.Data
|
||||||
{
|
{
|
||||||
using (var connection = CreateConnection(true))
|
using (var connection = CreateConnection(true))
|
||||||
{
|
{
|
||||||
using (var statement = PrepareStatementSafe(connection, commandText))
|
connection.RunInTransaction(db =>
|
||||||
|
{
|
||||||
|
using (var statement = PrepareStatementSafe(db, commandText))
|
||||||
{
|
{
|
||||||
// Run this again to bind the params
|
// Run this again to bind the params
|
||||||
GetPeopleWhereClauses(query, statement);
|
GetPeopleWhereClauses(query, statement);
|
||||||
|
@ -4650,6 +4658,7 @@ namespace Emby.Server.Implementations.Data
|
||||||
list.Add(GetPerson(row));
|
list.Add(GetPerson(row));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}, ReadTransactionMode);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -4855,7 +4864,9 @@ namespace Emby.Server.Implementations.Data
|
||||||
{
|
{
|
||||||
using (var connection = CreateConnection(true))
|
using (var connection = CreateConnection(true))
|
||||||
{
|
{
|
||||||
using (var statement = PrepareStatementSafe(connection, commandText))
|
connection.RunInTransaction(db =>
|
||||||
|
{
|
||||||
|
using (var statement = PrepareStatementSafe(db, commandText))
|
||||||
{
|
{
|
||||||
foreach (var row in statement.ExecuteQuery())
|
foreach (var row in statement.ExecuteQuery())
|
||||||
{
|
{
|
||||||
|
@ -4865,6 +4876,7 @@ namespace Emby.Server.Implementations.Data
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}, ReadTransactionMode);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
LogQueryTime("GetItemValueNames", commandText, now);
|
LogQueryTime("GetItemValueNames", commandText, now);
|
||||||
|
@ -5034,7 +5046,9 @@ namespace Emby.Server.Implementations.Data
|
||||||
{
|
{
|
||||||
using (var connection = CreateConnection(true))
|
using (var connection = CreateConnection(true))
|
||||||
{
|
{
|
||||||
var statements = PrepareAllSafe(connection, string.Join(";", statementTexts.ToArray())).ToList();
|
connection.RunInTransaction(db =>
|
||||||
|
{
|
||||||
|
var statements = PrepareAllSafe(db, string.Join(";", statementTexts.ToArray())).ToList();
|
||||||
|
|
||||||
if (!isReturningZeroItems)
|
if (!isReturningZeroItems)
|
||||||
{
|
{
|
||||||
|
@ -5097,6 +5111,7 @@ namespace Emby.Server.Implementations.Data
|
||||||
LogQueryTime("GetItemValues", commandText, now);
|
LogQueryTime("GetItemValues", commandText, now);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}, ReadTransactionMode);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -5344,7 +5359,9 @@ namespace Emby.Server.Implementations.Data
|
||||||
{
|
{
|
||||||
using (var connection = CreateConnection(true))
|
using (var connection = CreateConnection(true))
|
||||||
{
|
{
|
||||||
using (var statement = PrepareStatementSafe(connection, cmdText))
|
connection.RunInTransaction(db =>
|
||||||
|
{
|
||||||
|
using (var statement = PrepareStatementSafe(db, cmdText))
|
||||||
{
|
{
|
||||||
statement.TryBind("@ItemId", query.ItemId.ToGuidParamValue());
|
statement.TryBind("@ItemId", query.ItemId.ToGuidParamValue());
|
||||||
|
|
||||||
|
@ -5363,6 +5380,7 @@ namespace Emby.Server.Implementations.Data
|
||||||
list.Add(GetMediaStream(row));
|
list.Add(GetMediaStream(row));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}, ReadTransactionMode);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -300,20 +300,26 @@ namespace Emby.Server.Implementations.Data
|
||||||
{
|
{
|
||||||
using (var connection = CreateConnection(true))
|
using (var connection = CreateConnection(true))
|
||||||
{
|
{
|
||||||
using (var statement = connection.PrepareStatement("select key,userid,rating,played,playCount,isFavorite,playbackPositionTicks,lastPlayedDate,AudioStreamIndex,SubtitleStreamIndex from userdata where key =@Key and userId=@UserId"))
|
UserItemData result = null;
|
||||||
|
|
||||||
|
connection.RunInTransaction(db =>
|
||||||
|
{
|
||||||
|
using (var statement = db.PrepareStatement("select key,userid,rating,played,playCount,isFavorite,playbackPositionTicks,lastPlayedDate,AudioStreamIndex,SubtitleStreamIndex from userdata where key =@Key and userId=@UserId"))
|
||||||
{
|
{
|
||||||
statement.TryBind("@UserId", userId.ToGuidParamValue());
|
statement.TryBind("@UserId", userId.ToGuidParamValue());
|
||||||
statement.TryBind("@Key", key);
|
statement.TryBind("@Key", key);
|
||||||
|
|
||||||
foreach (var row in statement.ExecuteQuery())
|
foreach (var row in statement.ExecuteQuery())
|
||||||
{
|
{
|
||||||
return ReadRow(row);
|
result = ReadRow(row);
|
||||||
}
|
break;
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}, ReadTransactionMode);
|
||||||
|
|
||||||
return null;
|
return result;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public UserItemData GetUserData(Guid userId, List<string> keys)
|
public UserItemData GetUserData(Guid userId, List<string> keys)
|
||||||
|
|
|
@ -119,6 +119,7 @@
|
||||||
<Compile Include="Library\Resolvers\Audio\MusicAlbumResolver.cs" />
|
<Compile Include="Library\Resolvers\Audio\MusicAlbumResolver.cs" />
|
||||||
<Compile Include="Library\Resolvers\Audio\MusicArtistResolver.cs" />
|
<Compile Include="Library\Resolvers\Audio\MusicArtistResolver.cs" />
|
||||||
<Compile Include="Library\Resolvers\BaseVideoResolver.cs" />
|
<Compile Include="Library\Resolvers\BaseVideoResolver.cs" />
|
||||||
|
<Compile Include="Library\Resolvers\Books\BookResolver.cs" />
|
||||||
<Compile Include="Library\Resolvers\FolderResolver.cs" />
|
<Compile Include="Library\Resolvers\FolderResolver.cs" />
|
||||||
<Compile Include="Library\Resolvers\ItemResolver.cs" />
|
<Compile Include="Library\Resolvers\ItemResolver.cs" />
|
||||||
<Compile Include="Library\Resolvers\Movies\BoxSetResolver.cs" />
|
<Compile Include="Library\Resolvers\Movies\BoxSetResolver.cs" />
|
||||||
|
|
|
@ -2,6 +2,7 @@
|
||||||
using MediaBrowser.Controller.Resolvers;
|
using MediaBrowser.Controller.Resolvers;
|
||||||
using MediaBrowser.Model.Entities;
|
using MediaBrowser.Model.Entities;
|
||||||
using System;
|
using System;
|
||||||
|
using MediaBrowser.Controller.Entities;
|
||||||
|
|
||||||
namespace Emby.Server.Implementations.Library.Resolvers.Audio
|
namespace Emby.Server.Implementations.Library.Resolvers.Audio
|
||||||
{
|
{
|
||||||
|
@ -59,6 +60,11 @@ namespace Emby.Server.Implementations.Library.Resolvers.Audio
|
||||||
{
|
{
|
||||||
return new MediaBrowser.Controller.Entities.Audio.Audio();
|
return new MediaBrowser.Controller.Entities.Audio.Audio();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (string.Equals(collectionType, CollectionType.Books, StringComparison.OrdinalIgnoreCase))
|
||||||
|
{
|
||||||
|
return new AudioBook();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,77 @@
|
||||||
|
using System;
|
||||||
|
using System.IO;
|
||||||
|
using System.Linq;
|
||||||
|
using MediaBrowser.Controller.Entities;
|
||||||
|
using MediaBrowser.Controller.Library;
|
||||||
|
using MediaBrowser.Model.Entities;
|
||||||
|
|
||||||
|
namespace Emby.Server.Implementations.Library.Resolvers.Books
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
|
public class BookResolver : MediaBrowser.Controller.Resolvers.ItemResolver<Book>
|
||||||
|
{
|
||||||
|
private readonly string[] _validExtensions = {".pdf", ".epub", ".mobi", ".cbr", ".cbz"};
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="args"></param>
|
||||||
|
/// <returns></returns>
|
||||||
|
protected override Book Resolve(ItemResolveArgs args)
|
||||||
|
{
|
||||||
|
var collectionType = args.GetCollectionType();
|
||||||
|
|
||||||
|
// Only process items that are in a collection folder containing books
|
||||||
|
if (!string.Equals(collectionType, CollectionType.Books, StringComparison.OrdinalIgnoreCase))
|
||||||
|
return null;
|
||||||
|
|
||||||
|
if (args.IsDirectory)
|
||||||
|
{
|
||||||
|
return GetBook(args);
|
||||||
|
}
|
||||||
|
|
||||||
|
var extension = Path.GetExtension(args.Path);
|
||||||
|
|
||||||
|
if (extension != null && _validExtensions.Contains(extension, StringComparer.OrdinalIgnoreCase))
|
||||||
|
{
|
||||||
|
// It's a book
|
||||||
|
return new Book
|
||||||
|
{
|
||||||
|
Path = args.Path,
|
||||||
|
IsInMixedFolder = true
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="args"></param>
|
||||||
|
/// <returns></returns>
|
||||||
|
private Book GetBook(ItemResolveArgs args)
|
||||||
|
{
|
||||||
|
var bookFiles = args.FileSystemChildren.Where(f =>
|
||||||
|
{
|
||||||
|
var fileExtension = Path.GetExtension(f.FullName) ??
|
||||||
|
string.Empty;
|
||||||
|
|
||||||
|
return _validExtensions.Contains(fileExtension,
|
||||||
|
StringComparer
|
||||||
|
.OrdinalIgnoreCase);
|
||||||
|
}).ToList();
|
||||||
|
|
||||||
|
// Don't return a Book if there is more (or less) than one document in the directory
|
||||||
|
if (bookFiles.Count != 1)
|
||||||
|
return null;
|
||||||
|
|
||||||
|
return new Book
|
||||||
|
{
|
||||||
|
Path = bookFiles[0].FullName
|
||||||
|
};
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -274,7 +274,7 @@ namespace Emby.Server.Implementations.Library
|
||||||
positionTicks = 0;
|
positionTicks = 0;
|
||||||
data.Played = false;
|
data.Played = false;
|
||||||
}
|
}
|
||||||
if (item is Audio)
|
if (!item.SupportsPositionTicksResume)
|
||||||
{
|
{
|
||||||
positionTicks = 0;
|
positionTicks = 0;
|
||||||
}
|
}
|
||||||
|
|
|
@ -201,12 +201,22 @@ namespace Emby.Server.Implementations.Security
|
||||||
}
|
}
|
||||||
|
|
||||||
var list = new List<AuthenticationInfo>();
|
var list = new List<AuthenticationInfo>();
|
||||||
|
int totalRecordCount = 0;
|
||||||
|
|
||||||
using (WriteLock.Read())
|
using (WriteLock.Read())
|
||||||
{
|
{
|
||||||
using (var connection = CreateConnection(true))
|
using (var connection = CreateConnection(true))
|
||||||
{
|
{
|
||||||
using (var statement = connection.PrepareStatement(commandText))
|
connection.RunInTransaction(db =>
|
||||||
|
{
|
||||||
|
var statementTexts = new List<string>();
|
||||||
|
statementTexts.Add(commandText);
|
||||||
|
statementTexts.Add("select count (Id) from AccessTokens" + whereTextWithoutPaging);
|
||||||
|
|
||||||
|
var statements = PrepareAllSafe(db, string.Join(";", statementTexts.ToArray()))
|
||||||
|
.ToList();
|
||||||
|
|
||||||
|
using (var statement = statements[0])
|
||||||
{
|
{
|
||||||
BindAuthenticationQueryParams(query, statement);
|
BindAuthenticationQueryParams(query, statement);
|
||||||
|
|
||||||
|
@ -215,24 +225,26 @@ namespace Emby.Server.Implementations.Security
|
||||||
list.Add(Get(row));
|
list.Add(Get(row));
|
||||||
}
|
}
|
||||||
|
|
||||||
using (var totalCountStatement = connection.PrepareStatement("select count (Id) from AccessTokens" + whereTextWithoutPaging))
|
using (var totalCountStatement = statements[1])
|
||||||
{
|
{
|
||||||
BindAuthenticationQueryParams(query, totalCountStatement);
|
BindAuthenticationQueryParams(query, totalCountStatement);
|
||||||
|
|
||||||
var count = totalCountStatement.ExecuteQuery()
|
totalRecordCount = totalCountStatement.ExecuteQuery()
|
||||||
.SelectScalarInt()
|
.SelectScalarInt()
|
||||||
.First();
|
.First();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}, ReadTransactionMode);
|
||||||
|
|
||||||
return new QueryResult<AuthenticationInfo>()
|
return new QueryResult<AuthenticationInfo>()
|
||||||
{
|
{
|
||||||
Items = list.ToArray(),
|
Items = list.ToArray(),
|
||||||
TotalRecordCount = count
|
TotalRecordCount = totalRecordCount
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public AuthenticationInfo Get(string id)
|
public AuthenticationInfo Get(string id)
|
||||||
{
|
{
|
||||||
|
|
|
@ -62,7 +62,14 @@ namespace Emby.Server.Implementations.TV
|
||||||
PresentationUniqueKey = presentationUniqueKey,
|
PresentationUniqueKey = presentationUniqueKey,
|
||||||
Limit = limit,
|
Limit = limit,
|
||||||
ParentId = parentIdGuid,
|
ParentId = parentIdGuid,
|
||||||
Recursive = true
|
Recursive = true,
|
||||||
|
DtoOptions = new MediaBrowser.Controller.Dto.DtoOptions
|
||||||
|
{
|
||||||
|
Fields = new List<ItemFields>
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
}).Cast<Series>();
|
}).Cast<Series>();
|
||||||
|
|
||||||
|
@ -104,7 +111,15 @@ namespace Emby.Server.Implementations.TV
|
||||||
IncludeItemTypes = new[] { typeof(Series).Name },
|
IncludeItemTypes = new[] { typeof(Series).Name },
|
||||||
SortOrder = SortOrder.Ascending,
|
SortOrder = SortOrder.Ascending,
|
||||||
PresentationUniqueKey = presentationUniqueKey,
|
PresentationUniqueKey = presentationUniqueKey,
|
||||||
Limit = limit
|
Limit = limit,
|
||||||
|
DtoOptions = new MediaBrowser.Controller.Dto.DtoOptions
|
||||||
|
{
|
||||||
|
Fields = new List<ItemFields>
|
||||||
|
{
|
||||||
|
|
||||||
|
},
|
||||||
|
EnableImages = false
|
||||||
|
}
|
||||||
|
|
||||||
}, parentsFolders.Cast<BaseItem>().ToList()).Cast<Series>();
|
}, parentsFolders.Cast<BaseItem>().ToList()).Cast<Series>();
|
||||||
|
|
||||||
|
@ -120,26 +135,32 @@ namespace Emby.Server.Implementations.TV
|
||||||
var currentUser = user;
|
var currentUser = user;
|
||||||
|
|
||||||
var allNextUp = series
|
var allNextUp = series
|
||||||
.Select(i => GetNextUp(i, currentUser))
|
.Select(i => GetNextUp(GetUniqueSeriesKey(i), currentUser))
|
||||||
// Include if an episode was found, and either the series is not unwatched or the specific series was requested
|
// Include if an episode was found, and either the series is not unwatched or the specific series was requested
|
||||||
.OrderByDescending(i => i.Item1)
|
.OrderByDescending(i => i.Item1);
|
||||||
.ToList();
|
|
||||||
|
|
||||||
// If viewing all next up for all series, remove first episodes
|
// If viewing all next up for all series, remove first episodes
|
||||||
if (string.IsNullOrWhiteSpace(request.SeriesId))
|
|
||||||
{
|
|
||||||
var withoutFirstEpisode = allNextUp
|
|
||||||
.Where(i => i.Item1 != DateTime.MinValue)
|
|
||||||
.ToList();
|
|
||||||
|
|
||||||
// But if that returns empty, keep those first episodes (avoid completely empty view)
|
// But if that returns empty, keep those first episodes (avoid completely empty view)
|
||||||
if (withoutFirstEpisode.Count > 0)
|
var alwaysEnableFirstEpisode = string.IsNullOrWhiteSpace(request.SeriesId);
|
||||||
{
|
var isFirstItemAFirstEpisode = true;
|
||||||
allNextUp = withoutFirstEpisode;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return allNextUp
|
return allNextUp
|
||||||
|
.Where(i =>
|
||||||
|
{
|
||||||
|
if (alwaysEnableFirstEpisode || i.Item1 != DateTime.MinValue)
|
||||||
|
{
|
||||||
|
isFirstItemAFirstEpisode = false;
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (isFirstItemAFirstEpisode)
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
|
})
|
||||||
|
.Take(request.Limit.HasValue ? (request.Limit.Value * 2) : int.MaxValue)
|
||||||
.Select(i => i.Item2())
|
.Select(i => i.Item2())
|
||||||
.Where(i => i != null)
|
.Where(i => i != null)
|
||||||
.Take(request.Limit ?? int.MaxValue);
|
.Take(request.Limit ?? int.MaxValue);
|
||||||
|
@ -153,13 +174,10 @@ namespace Emby.Server.Implementations.TV
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets the next up.
|
/// Gets the next up.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="series">The series.</param>
|
|
||||||
/// <param name="user">The user.</param>
|
|
||||||
/// <returns>Task{Episode}.</returns>
|
/// <returns>Task{Episode}.</returns>
|
||||||
private Tuple<DateTime, Func<Episode>> GetNextUp(Series series, User user)
|
private Tuple<DateTime, Func<Episode>> GetNextUp(string seriesKey, User user)
|
||||||
{
|
{
|
||||||
var enableSeriesPresentationKey = _config.Configuration.EnableSeriesPresentationUniqueKey;
|
var enableSeriesPresentationKey = _config.Configuration.EnableSeriesPresentationUniqueKey;
|
||||||
var seriesKey = GetUniqueSeriesKey(series);
|
|
||||||
|
|
||||||
var lastWatchedEpisode = _libraryManager.GetItemList(new InternalItemsQuery(user)
|
var lastWatchedEpisode = _libraryManager.GetItemList(new InternalItemsQuery(user)
|
||||||
{
|
{
|
||||||
|
@ -170,7 +188,15 @@ namespace Emby.Server.Implementations.TV
|
||||||
SortOrder = SortOrder.Descending,
|
SortOrder = SortOrder.Descending,
|
||||||
IsPlayed = true,
|
IsPlayed = true,
|
||||||
Limit = 1,
|
Limit = 1,
|
||||||
ParentIndexNumberNotEquals = 0
|
ParentIndexNumberNotEquals = 0,
|
||||||
|
DtoOptions = new MediaBrowser.Controller.Dto.DtoOptions
|
||||||
|
{
|
||||||
|
Fields = new List<ItemFields>
|
||||||
|
{
|
||||||
|
|
||||||
|
},
|
||||||
|
EnableImages = false
|
||||||
|
}
|
||||||
|
|
||||||
}).FirstOrDefault();
|
}).FirstOrDefault();
|
||||||
|
|
||||||
|
|
|
@ -12,6 +12,7 @@ using System.Linq;
|
||||||
using System.Threading;
|
using System.Threading;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
using MediaBrowser.Common.IO;
|
using MediaBrowser.Common.IO;
|
||||||
|
using MediaBrowser.Controller.Entities.Audio;
|
||||||
using MediaBrowser.Controller.IO;
|
using MediaBrowser.Controller.IO;
|
||||||
using MediaBrowser.Model.IO;
|
using MediaBrowser.Model.IO;
|
||||||
using MediaBrowser.Controller.Providers;
|
using MediaBrowser.Controller.Providers;
|
||||||
|
@ -324,7 +325,7 @@ namespace MediaBrowser.Api.UserLibrary
|
||||||
var item = i.Item2[0];
|
var item = i.Item2[0];
|
||||||
var childCount = 0;
|
var childCount = 0;
|
||||||
|
|
||||||
if (i.Item1 != null && i.Item2.Count > 1)
|
if (i.Item1 != null && (i.Item2.Count > 1 || i.Item1 is MusicAlbum))
|
||||||
{
|
{
|
||||||
item = i.Item1;
|
item = i.Item1;
|
||||||
childCount = i.Item2.Count;
|
childCount = i.Item2.Count;
|
||||||
|
|
|
@ -1,6 +1,16 @@
|
||||||
namespace MediaBrowser.Controller.Entities.Audio
|
using MediaBrowser.Model.Serialization;
|
||||||
|
|
||||||
|
namespace MediaBrowser.Controller.Entities.Audio
|
||||||
{
|
{
|
||||||
public class AudioPodcast : Audio
|
public class AudioPodcast : Audio
|
||||||
{
|
{
|
||||||
|
[IgnoreDataMember]
|
||||||
|
public override bool SupportsPositionTicksResume
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
64
MediaBrowser.Controller/Entities/AudioBook.cs
Normal file
64
MediaBrowser.Controller/Entities/AudioBook.cs
Normal file
|
@ -0,0 +1,64 @@
|
||||||
|
using System;
|
||||||
|
using MediaBrowser.Model.Configuration;
|
||||||
|
using MediaBrowser.Model.Serialization;
|
||||||
|
using MediaBrowser.Model.Entities;
|
||||||
|
|
||||||
|
namespace MediaBrowser.Controller.Entities
|
||||||
|
{
|
||||||
|
public class AudioBook : Audio.Audio, IHasSeries
|
||||||
|
{
|
||||||
|
[IgnoreDataMember]
|
||||||
|
public override bool SupportsPositionTicksResume
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
[IgnoreDataMember]
|
||||||
|
public string SeriesPresentationUniqueKey { get; set; }
|
||||||
|
[IgnoreDataMember]
|
||||||
|
public string SeriesName { get; set; }
|
||||||
|
[IgnoreDataMember]
|
||||||
|
public Guid? SeriesId { get; set; }
|
||||||
|
[IgnoreDataMember]
|
||||||
|
public string SeriesSortName { get; set; }
|
||||||
|
|
||||||
|
public string FindSeriesSortName()
|
||||||
|
{
|
||||||
|
return SeriesSortName;
|
||||||
|
}
|
||||||
|
public string FindSeriesName()
|
||||||
|
{
|
||||||
|
return SeriesName;
|
||||||
|
}
|
||||||
|
public string FindSeriesPresentationUniqueKey()
|
||||||
|
{
|
||||||
|
return SeriesPresentationUniqueKey;
|
||||||
|
}
|
||||||
|
|
||||||
|
[IgnoreDataMember]
|
||||||
|
public override bool EnableRefreshOnDateModifiedChange
|
||||||
|
{
|
||||||
|
get { return true; }
|
||||||
|
}
|
||||||
|
|
||||||
|
public Guid? FindSeriesId()
|
||||||
|
{
|
||||||
|
return SeriesId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public override bool CanDownload()
|
||||||
|
{
|
||||||
|
var locationType = LocationType;
|
||||||
|
return locationType != LocationType.Remote &&
|
||||||
|
locationType != LocationType.Virtual;
|
||||||
|
}
|
||||||
|
|
||||||
|
public override UnratedItem GetBlockUnratedType()
|
||||||
|
{
|
||||||
|
return UnratedItem.Book;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -142,6 +142,15 @@ namespace MediaBrowser.Controller.Entities
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[IgnoreDataMember]
|
||||||
|
public virtual bool SupportsPositionTicksResume
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public bool DetectIsInMixedFolder()
|
public bool DetectIsInMixedFolder()
|
||||||
{
|
{
|
||||||
if (SupportsIsInMixedFolderDetection)
|
if (SupportsIsInMixedFolderDetection)
|
||||||
|
|
|
@ -264,6 +264,7 @@ namespace MediaBrowser.Controller.Entities
|
||||||
/// Our children are actually just references to the ones in the physical root...
|
/// Our children are actually just references to the ones in the physical root...
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <value>The linked children.</value>
|
/// <value>The linked children.</value>
|
||||||
|
[IgnoreDataMember]
|
||||||
public override List<LinkedChild> LinkedChildren
|
public override List<LinkedChild> LinkedChildren
|
||||||
{
|
{
|
||||||
get { return GetLinkedChildrenInternal(); }
|
get { return GetLinkedChildrenInternal(); }
|
||||||
|
|
|
@ -193,9 +193,10 @@ namespace MediaBrowser.Controller.Entities.TV
|
||||||
{
|
{
|
||||||
return "Season " + ParentIndexNumber.Value.ToString(CultureInfo.InvariantCulture);
|
return "Season " + ParentIndexNumber.Value.ToString(CultureInfo.InvariantCulture);
|
||||||
}
|
}
|
||||||
|
return "Season Unknown";
|
||||||
}
|
}
|
||||||
|
|
||||||
return season == null ? SeasonName : season.Name;
|
return season.Name;
|
||||||
}
|
}
|
||||||
|
|
||||||
public string FindSeriesName()
|
public string FindSeriesName()
|
||||||
|
|
|
@ -44,6 +44,15 @@ namespace MediaBrowser.Controller.Entities
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[IgnoreDataMember]
|
||||||
|
public override bool SupportsPositionTicksResume
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
[IgnoreDataMember]
|
[IgnoreDataMember]
|
||||||
protected override bool SupportsIsInMixedFolderDetection
|
protected override bool SupportsIsInMixedFolderDetection
|
||||||
{
|
{
|
||||||
|
|
|
@ -46,6 +46,15 @@ namespace MediaBrowser.Controller.LiveTv
|
||||||
set { }
|
set { }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[IgnoreDataMember]
|
||||||
|
public override bool SupportsPositionTicksResume
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets a value indicating whether this instance is owned item.
|
/// Gets a value indicating whether this instance is owned item.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
|
|
@ -38,6 +38,15 @@ namespace MediaBrowser.Controller.LiveTv
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[IgnoreDataMember]
|
||||||
|
public override bool SupportsPositionTicksResume
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
[IgnoreDataMember]
|
[IgnoreDataMember]
|
||||||
public override SourceType SourceType
|
public override SourceType SourceType
|
||||||
{
|
{
|
||||||
|
|
|
@ -96,6 +96,7 @@
|
||||||
<Compile Include="Drawing\ImageStream.cs" />
|
<Compile Include="Drawing\ImageStream.cs" />
|
||||||
<Compile Include="Dto\DtoOptions.cs" />
|
<Compile Include="Dto\DtoOptions.cs" />
|
||||||
<Compile Include="Dto\IDtoService.cs" />
|
<Compile Include="Dto\IDtoService.cs" />
|
||||||
|
<Compile Include="Entities\AudioBook.cs" />
|
||||||
<Compile Include="Entities\Audio\AudioPodcast.cs" />
|
<Compile Include="Entities\Audio\AudioPodcast.cs" />
|
||||||
<Compile Include="Entities\Audio\IHasAlbumArtist.cs" />
|
<Compile Include="Entities\Audio\IHasAlbumArtist.cs" />
|
||||||
<Compile Include="Entities\Audio\IHasMusicGenres.cs" />
|
<Compile Include="Entities\Audio\IHasMusicGenres.cs" />
|
||||||
|
|
41
MediaBrowser.Providers/Books/AudioBookMetadataService.cs
Normal file
41
MediaBrowser.Providers/Books/AudioBookMetadataService.cs
Normal file
|
@ -0,0 +1,41 @@
|
||||||
|
using MediaBrowser.Controller.Configuration;
|
||||||
|
using MediaBrowser.Controller.Entities;
|
||||||
|
using MediaBrowser.Controller.Library;
|
||||||
|
using MediaBrowser.Controller.Providers;
|
||||||
|
using MediaBrowser.Model.Entities;
|
||||||
|
using MediaBrowser.Model.Logging;
|
||||||
|
using MediaBrowser.Providers.Manager;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using MediaBrowser.Common.IO;
|
||||||
|
using MediaBrowser.Controller.Entities.Audio;
|
||||||
|
using MediaBrowser.Controller.IO;
|
||||||
|
using MediaBrowser.Model.IO;
|
||||||
|
|
||||||
|
namespace MediaBrowser.Providers.Books
|
||||||
|
{
|
||||||
|
public class AudioBookMetadataService : MetadataService<AudioBook, SongInfo>
|
||||||
|
{
|
||||||
|
protected override void MergeData(MetadataResult<AudioBook> source, MetadataResult<AudioBook> target, List<MetadataFields> lockedFields, bool replaceData, bool mergeMetadataSettings)
|
||||||
|
{
|
||||||
|
ProviderUtils.MergeBaseItemData(source, target, lockedFields, replaceData, mergeMetadataSettings);
|
||||||
|
|
||||||
|
var sourceItem = source.Item;
|
||||||
|
var targetItem = target.Item;
|
||||||
|
|
||||||
|
if (replaceData || targetItem.Artists.Count == 0)
|
||||||
|
{
|
||||||
|
targetItem.Artists = sourceItem.Artists.ToList();
|
||||||
|
}
|
||||||
|
|
||||||
|
if (replaceData || string.IsNullOrEmpty(targetItem.Album))
|
||||||
|
{
|
||||||
|
targetItem.Album = sourceItem.Album;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public AudioBookMetadataService(IServerConfigurationManager serverConfigurationManager, ILogger logger, IProviderManager providerManager, IFileSystem fileSystem, IUserDataManager userDataManager, ILibraryManager libraryManager) : base(serverConfigurationManager, logger, providerManager, fileSystem, userDataManager, libraryManager)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
41
MediaBrowser.Providers/Books/AudioPodcastMetadataService.cs
Normal file
41
MediaBrowser.Providers/Books/AudioPodcastMetadataService.cs
Normal file
|
@ -0,0 +1,41 @@
|
||||||
|
using MediaBrowser.Controller.Configuration;
|
||||||
|
using MediaBrowser.Controller.Entities;
|
||||||
|
using MediaBrowser.Controller.Library;
|
||||||
|
using MediaBrowser.Controller.Providers;
|
||||||
|
using MediaBrowser.Model.Entities;
|
||||||
|
using MediaBrowser.Model.Logging;
|
||||||
|
using MediaBrowser.Providers.Manager;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using MediaBrowser.Common.IO;
|
||||||
|
using MediaBrowser.Controller.Entities.Audio;
|
||||||
|
using MediaBrowser.Controller.IO;
|
||||||
|
using MediaBrowser.Model.IO;
|
||||||
|
|
||||||
|
namespace MediaBrowser.Providers.Books
|
||||||
|
{
|
||||||
|
public class AudioPodcastMetadataService : MetadataService<AudioPodcast, SongInfo>
|
||||||
|
{
|
||||||
|
protected override void MergeData(MetadataResult<AudioPodcast> source, MetadataResult<AudioPodcast> target, List<MetadataFields> lockedFields, bool replaceData, bool mergeMetadataSettings)
|
||||||
|
{
|
||||||
|
ProviderUtils.MergeBaseItemData(source, target, lockedFields, replaceData, mergeMetadataSettings);
|
||||||
|
|
||||||
|
var sourceItem = source.Item;
|
||||||
|
var targetItem = target.Item;
|
||||||
|
|
||||||
|
if (replaceData || targetItem.Artists.Count == 0)
|
||||||
|
{
|
||||||
|
targetItem.Artists = sourceItem.Artists.ToList();
|
||||||
|
}
|
||||||
|
|
||||||
|
if (replaceData || string.IsNullOrEmpty(targetItem.Album))
|
||||||
|
{
|
||||||
|
targetItem.Album = sourceItem.Album;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public AudioPodcastMetadataService(IServerConfigurationManager serverConfigurationManager, ILogger logger, IProviderManager providerManager, IFileSystem fileSystem, IUserDataManager userDataManager, ILibraryManager libraryManager) : base(serverConfigurationManager, logger, providerManager, fileSystem, userDataManager, libraryManager)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -46,6 +46,8 @@
|
||||||
<Compile Include="..\SharedVersion.cs">
|
<Compile Include="..\SharedVersion.cs">
|
||||||
<Link>Properties\SharedVersion.cs</Link>
|
<Link>Properties\SharedVersion.cs</Link>
|
||||||
</Compile>
|
</Compile>
|
||||||
|
<Compile Include="Books\AudioBookMetadataService.cs" />
|
||||||
|
<Compile Include="Books\AudioPodcastMetadataService.cs" />
|
||||||
<Compile Include="Books\BookMetadataService.cs" />
|
<Compile Include="Books\BookMetadataService.cs" />
|
||||||
<Compile Include="BoxSets\BoxSetMetadataService.cs" />
|
<Compile Include="BoxSets\BoxSetMetadataService.cs" />
|
||||||
<Compile Include="BoxSets\MovieDbBoxSetImageProvider.cs" />
|
<Compile Include="BoxSets\MovieDbBoxSetImageProvider.cs" />
|
||||||
|
|
|
@ -1400,9 +1400,6 @@
|
||||||
<Content Include="dashboard-ui\css\images\clients\dlna.png">
|
<Content Include="dashboard-ui\css\images\clients\dlna.png">
|
||||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||||
</Content>
|
</Content>
|
||||||
<Content Include="dashboard-ui\about.html">
|
|
||||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
|
||||||
</Content>
|
|
||||||
<Content Include="dashboard-ui\scripts\mediaplayer.js">
|
<Content Include="dashboard-ui\scripts\mediaplayer.js">
|
||||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||||
</Content>
|
</Content>
|
||||||
|
|
Loading…
Reference in a new issue