Tuple -> ValueTuple
This commit is contained in:
parent
64d5ec12e2
commit
41fb1e5106
|
@ -224,7 +224,7 @@ namespace Emby.Server.Implementations.Data
|
|||
});
|
||||
}
|
||||
|
||||
db.ExecuteAll(string.Join(";", queries.ToArray()));
|
||||
db.ExecuteAll(string.Join(";", queries));
|
||||
Logger.LogInformation("PRAGMA synchronous=" + db.Query("PRAGMA synchronous").SelectScalarString().First());
|
||||
}
|
||||
|
||||
|
@ -232,23 +232,6 @@ namespace Emby.Server.Implementations.Data
|
|||
|
||||
protected virtual int? CacheSize => null;
|
||||
|
||||
internal static void CheckOk(int rc)
|
||||
{
|
||||
string msg = "";
|
||||
|
||||
if (raw.SQLITE_OK != rc)
|
||||
{
|
||||
throw CreateException((ErrorCode)rc, msg);
|
||||
}
|
||||
}
|
||||
|
||||
internal static Exception CreateException(ErrorCode rc, string msg)
|
||||
{
|
||||
var exp = new Exception(msg);
|
||||
|
||||
return exp;
|
||||
}
|
||||
|
||||
private bool _disposed;
|
||||
protected void CheckDisposed()
|
||||
{
|
||||
|
@ -381,7 +364,7 @@ namespace Emby.Server.Implementations.Data
|
|||
//{
|
||||
// return new DummyToken();
|
||||
//}
|
||||
return new ReadLockToken(obj);
|
||||
return new WriteLockToken(obj); // TODO: fix segfault
|
||||
}
|
||||
|
||||
public static IDisposable Write(this ReaderWriterLockSlim obj)
|
||||
|
|
|
@ -2301,7 +2301,7 @@ namespace Emby.Server.Implementations.Data
|
|||
return query.IncludeItemTypes.Any(x => _seriesTypes.Contains(x));
|
||||
}
|
||||
|
||||
private string[] GetFinalColumnsToSelect(InternalItemsQuery query, string[] startColumns)
|
||||
private List<string> GetFinalColumnsToSelect(InternalItemsQuery query, IEnumerable<string> startColumns)
|
||||
{
|
||||
var list = startColumns.ToList();
|
||||
|
||||
|
@ -2431,7 +2431,7 @@ namespace Emby.Server.Implementations.Data
|
|||
list.Add(builder.ToString());
|
||||
}
|
||||
|
||||
return list.ToArray();
|
||||
return list;
|
||||
}
|
||||
|
||||
private void BindSearchParams(InternalItemsQuery query, IStatement statement)
|
||||
|
@ -5208,32 +5208,32 @@ where AncestorIdText not null and ItemValues.Value not null and ItemValues.Type
|
|||
}
|
||||
}
|
||||
|
||||
public QueryResult<Tuple<BaseItem, ItemCounts>> GetAllArtists(InternalItemsQuery query)
|
||||
public QueryResult<(BaseItem, ItemCounts)> GetAllArtists(InternalItemsQuery query)
|
||||
{
|
||||
return GetItemValues(query, new[] { 0, 1 }, typeof(MusicArtist).FullName);
|
||||
}
|
||||
|
||||
public QueryResult<Tuple<BaseItem, ItemCounts>> GetArtists(InternalItemsQuery query)
|
||||
public QueryResult<(BaseItem, ItemCounts)> GetArtists(InternalItemsQuery query)
|
||||
{
|
||||
return GetItemValues(query, new[] { 0 }, typeof(MusicArtist).FullName);
|
||||
}
|
||||
|
||||
public QueryResult<Tuple<BaseItem, ItemCounts>> GetAlbumArtists(InternalItemsQuery query)
|
||||
public QueryResult<(BaseItem, ItemCounts)> GetAlbumArtists(InternalItemsQuery query)
|
||||
{
|
||||
return GetItemValues(query, new[] { 1 }, typeof(MusicArtist).FullName);
|
||||
}
|
||||
|
||||
public QueryResult<Tuple<BaseItem, ItemCounts>> GetStudios(InternalItemsQuery query)
|
||||
public QueryResult<(BaseItem, ItemCounts)> GetStudios(InternalItemsQuery query)
|
||||
{
|
||||
return GetItemValues(query, new[] { 3 }, typeof(Studio).FullName);
|
||||
}
|
||||
|
||||
public QueryResult<Tuple<BaseItem, ItemCounts>> GetGenres(InternalItemsQuery query)
|
||||
public QueryResult<(BaseItem, ItemCounts)> GetGenres(InternalItemsQuery query)
|
||||
{
|
||||
return GetItemValues(query, new[] { 2 }, typeof(Genre).FullName);
|
||||
}
|
||||
|
||||
public QueryResult<Tuple<BaseItem, ItemCounts>> GetMusicGenres(InternalItemsQuery query)
|
||||
public QueryResult<(BaseItem, ItemCounts)> GetMusicGenres(InternalItemsQuery query)
|
||||
{
|
||||
return GetItemValues(query, new[] { 2 }, typeof(MusicGenre).FullName);
|
||||
}
|
||||
|
@ -5310,7 +5310,7 @@ where AncestorIdText not null and ItemValues.Value not null and ItemValues.Type
|
|||
}
|
||||
}
|
||||
|
||||
private QueryResult<Tuple<BaseItem, ItemCounts>> GetItemValues(InternalItemsQuery query, int[] itemValueTypes, string returnType)
|
||||
private QueryResult<(BaseItem, ItemCounts)> GetItemValues(InternalItemsQuery query, int[] itemValueTypes, string returnType)
|
||||
{
|
||||
if (query == null)
|
||||
{
|
||||
|
@ -5328,7 +5328,7 @@ where AncestorIdText not null and ItemValues.Value not null and ItemValues.Type
|
|||
|
||||
var typeClause = itemValueTypes.Length == 1 ?
|
||||
("Type=" + itemValueTypes[0].ToString(CultureInfo.InvariantCulture)) :
|
||||
("Type in (" + string.Join(",", itemValueTypes.Select(i => i.ToString(CultureInfo.InvariantCulture)).ToArray()) + ")");
|
||||
("Type in (" + string.Join(",", itemValueTypes.Select(i => i.ToString(CultureInfo.InvariantCulture))) + ")");
|
||||
|
||||
InternalItemsQuery typeSubQuery = null;
|
||||
|
||||
|
@ -5356,11 +5356,7 @@ where AncestorIdText not null and ItemValues.Value not null and ItemValues.Type
|
|||
|
||||
whereClauses.Add("guid in (select ItemId from ItemValues where ItemValues.CleanValue=A.CleanName AND " + typeClause + ")");
|
||||
|
||||
var typeWhereText = whereClauses.Count == 0 ?
|
||||
string.Empty :
|
||||
" where " + string.Join(" AND ", whereClauses);
|
||||
|
||||
itemCountColumnQuery += typeWhereText;
|
||||
itemCountColumnQuery += " where " + string.Join(" AND ", whereClauses);
|
||||
|
||||
itemCountColumns = new Dictionary<string, string>()
|
||||
{
|
||||
|
@ -5393,7 +5389,7 @@ where AncestorIdText not null and ItemValues.Value not null and ItemValues.Type
|
|||
IsSeries = query.IsSeries
|
||||
};
|
||||
|
||||
columns = GetFinalColumnsToSelect(query, columns.ToArray()).ToList();
|
||||
columns = GetFinalColumnsToSelect(query, columns);
|
||||
|
||||
var commandText = "select "
|
||||
+ string.Join(",", columns)
|
||||
|
@ -5485,8 +5481,8 @@ where AncestorIdText not null and ItemValues.Value not null and ItemValues.Type
|
|||
{
|
||||
return connection.RunInTransaction(db =>
|
||||
{
|
||||
var list = new List<Tuple<BaseItem, ItemCounts>>();
|
||||
var result = new QueryResult<Tuple<BaseItem, ItemCounts>>();
|
||||
var list = new List<(BaseItem, ItemCounts)>();
|
||||
var result = new QueryResult<(BaseItem, ItemCounts)>();
|
||||
|
||||
var statements = PrepareAllSafe(db, statementTexts);
|
||||
|
||||
|
@ -5524,7 +5520,7 @@ where AncestorIdText not null and ItemValues.Value not null and ItemValues.Type
|
|||
{
|
||||
var countStartColumn = columns.Count - 1;
|
||||
|
||||
list.Add(new Tuple<BaseItem, ItemCounts>(item, GetItemCounts(row, countStartColumn, typesToCount)));
|
||||
list.Add((item, GetItemCounts(row, countStartColumn, typesToCount)));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -6191,6 +6187,5 @@ where AncestorIdText not null and ItemValues.Value not null and ItemValues.Type
|
|||
|
||||
return item;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1331,7 +1331,7 @@ namespace Emby.Server.Implementations.Library
|
|||
return ItemRepository.GetItemIdsList(query);
|
||||
}
|
||||
|
||||
public QueryResult<Tuple<BaseItem, ItemCounts>> GetStudios(InternalItemsQuery query)
|
||||
public QueryResult<(BaseItem, ItemCounts)> GetStudios(InternalItemsQuery query)
|
||||
{
|
||||
if (query.User != null)
|
||||
{
|
||||
|
@ -1342,7 +1342,7 @@ namespace Emby.Server.Implementations.Library
|
|||
return ItemRepository.GetStudios(query);
|
||||
}
|
||||
|
||||
public QueryResult<Tuple<BaseItem, ItemCounts>> GetGenres(InternalItemsQuery query)
|
||||
public QueryResult<(BaseItem, ItemCounts)> GetGenres(InternalItemsQuery query)
|
||||
{
|
||||
if (query.User != null)
|
||||
{
|
||||
|
@ -1353,7 +1353,7 @@ namespace Emby.Server.Implementations.Library
|
|||
return ItemRepository.GetGenres(query);
|
||||
}
|
||||
|
||||
public QueryResult<Tuple<BaseItem, ItemCounts>> GetMusicGenres(InternalItemsQuery query)
|
||||
public QueryResult<(BaseItem, ItemCounts)> GetMusicGenres(InternalItemsQuery query)
|
||||
{
|
||||
if (query.User != null)
|
||||
{
|
||||
|
@ -1364,7 +1364,7 @@ namespace Emby.Server.Implementations.Library
|
|||
return ItemRepository.GetMusicGenres(query);
|
||||
}
|
||||
|
||||
public QueryResult<Tuple<BaseItem, ItemCounts>> GetAllArtists(InternalItemsQuery query)
|
||||
public QueryResult<(BaseItem, ItemCounts)> GetAllArtists(InternalItemsQuery query)
|
||||
{
|
||||
if (query.User != null)
|
||||
{
|
||||
|
@ -1375,7 +1375,7 @@ namespace Emby.Server.Implementations.Library
|
|||
return ItemRepository.GetAllArtists(query);
|
||||
}
|
||||
|
||||
public QueryResult<Tuple<BaseItem, ItemCounts>> GetArtists(InternalItemsQuery query)
|
||||
public QueryResult<(BaseItem, ItemCounts)> GetArtists(InternalItemsQuery query)
|
||||
{
|
||||
if (query.User != null)
|
||||
{
|
||||
|
@ -1419,7 +1419,7 @@ namespace Emby.Server.Implementations.Library
|
|||
}
|
||||
}
|
||||
|
||||
public QueryResult<Tuple<BaseItem, ItemCounts>> GetAlbumArtists(InternalItemsQuery query)
|
||||
public QueryResult<(BaseItem, ItemCounts)> GetAlbumArtists(InternalItemsQuery query)
|
||||
{
|
||||
if (query.User != null)
|
||||
{
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
<PropertyGroup>
|
||||
<AssemblyName>jellyfin</AssemblyName>
|
||||
<OutputType>Exe</OutputType>
|
||||
<TargetFramework>netcoreapp2.1</TargetFramework>
|
||||
<TargetFramework>netcoreapp3.0</TargetFramework>
|
||||
<GenerateAssemblyInfo>false</GenerateAssemblyInfo>
|
||||
</PropertyGroup>
|
||||
|
||||
|
|
|
@ -112,7 +112,7 @@ namespace MediaBrowser.Api.UserLibrary
|
|||
return ToOptimizedResult(result);
|
||||
}
|
||||
|
||||
protected override QueryResult<Tuple<BaseItem, ItemCounts>> GetItems(GetItemsByName request, InternalItemsQuery query)
|
||||
protected override QueryResult<(BaseItem, ItemCounts)> GetItems(GetItemsByName request, InternalItemsQuery query)
|
||||
{
|
||||
if (request is GetAlbumArtists)
|
||||
{
|
||||
|
|
|
@ -209,9 +209,9 @@ namespace MediaBrowser.Api.UserLibrary
|
|||
};
|
||||
}
|
||||
|
||||
protected virtual QueryResult<Tuple<BaseItem, ItemCounts>> GetItems(GetItemsByName request, InternalItemsQuery query)
|
||||
protected virtual QueryResult<(BaseItem, ItemCounts)> GetItems(GetItemsByName request, InternalItemsQuery query)
|
||||
{
|
||||
return new QueryResult<Tuple<BaseItem, ItemCounts>>();
|
||||
return new QueryResult<(BaseItem, ItemCounts)>();
|
||||
}
|
||||
|
||||
private void SetItemCounts(BaseItemDto dto, ItemCounts counts)
|
||||
|
|
|
@ -92,7 +92,7 @@ namespace MediaBrowser.Api.UserLibrary
|
|||
return ToOptimizedResult(result);
|
||||
}
|
||||
|
||||
protected override QueryResult<Tuple<BaseItem, ItemCounts>> GetItems(GetItemsByName request, InternalItemsQuery query)
|
||||
protected override QueryResult<(BaseItem, ItemCounts)> GetItems(GetItemsByName request, InternalItemsQuery query)
|
||||
{
|
||||
var viewType = GetParentItemViewType(request);
|
||||
|
||||
|
|
|
@ -83,7 +83,7 @@ namespace MediaBrowser.Api.UserLibrary
|
|||
return ToOptimizedResult(result);
|
||||
}
|
||||
|
||||
protected override QueryResult<Tuple<BaseItem, ItemCounts>> GetItems(GetItemsByName request, InternalItemsQuery query)
|
||||
protected override QueryResult<(BaseItem, ItemCounts)> GetItems(GetItemsByName request, InternalItemsQuery query)
|
||||
{
|
||||
return LibraryManager.GetMusicGenres(query);
|
||||
}
|
||||
|
|
|
@ -101,7 +101,7 @@ namespace MediaBrowser.Api.UserLibrary
|
|||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
protected override QueryResult<Tuple<BaseItem, ItemCounts>> GetItems(GetItemsByName request, InternalItemsQuery query)
|
||||
protected override QueryResult<(BaseItem, ItemCounts)> GetItems(GetItemsByName request, InternalItemsQuery query)
|
||||
{
|
||||
var items = LibraryManager.GetPeopleItems(new InternalPeopleQuery
|
||||
{
|
||||
|
@ -109,10 +109,10 @@ namespace MediaBrowser.Api.UserLibrary
|
|||
NameContains = query.NameContains ?? query.SearchTerm
|
||||
});
|
||||
|
||||
return new QueryResult<Tuple<BaseItem, ItemCounts>>
|
||||
return new QueryResult<(BaseItem, ItemCounts)>
|
||||
{
|
||||
TotalRecordCount = items.Count,
|
||||
Items = items.Take(query.Limit ?? int.MaxValue).Select(i => new Tuple<BaseItem, ItemCounts>(i, new ItemCounts())).ToArray()
|
||||
Items = items.Take(query.Limit ?? int.MaxValue).Select(i => (i as BaseItem, new ItemCounts())).ToArray()
|
||||
};
|
||||
}
|
||||
|
||||
|
|
|
@ -91,7 +91,7 @@ namespace MediaBrowser.Api.UserLibrary
|
|||
return ToOptimizedResult(result);
|
||||
}
|
||||
|
||||
protected override QueryResult<Tuple<BaseItem, ItemCounts>> GetItems(GetItemsByName request, InternalItemsQuery query)
|
||||
protected override QueryResult<(BaseItem, ItemCounts)> GetItems(GetItemsByName request, InternalItemsQuery query)
|
||||
{
|
||||
return LibraryManager.GetStudios(query);
|
||||
}
|
||||
|
|
|
@ -520,12 +520,12 @@ namespace MediaBrowser.Controller.Library
|
|||
void UpdateMediaPath(string virtualFolderName, MediaPathInfo path);
|
||||
void RemoveMediaPath(string virtualFolderName, string path);
|
||||
|
||||
QueryResult<Tuple<BaseItem, ItemCounts>> GetGenres(InternalItemsQuery query);
|
||||
QueryResult<Tuple<BaseItem, ItemCounts>> GetMusicGenres(InternalItemsQuery query);
|
||||
QueryResult<Tuple<BaseItem, ItemCounts>> GetStudios(InternalItemsQuery query);
|
||||
QueryResult<Tuple<BaseItem, ItemCounts>> GetArtists(InternalItemsQuery query);
|
||||
QueryResult<Tuple<BaseItem, ItemCounts>> GetAlbumArtists(InternalItemsQuery query);
|
||||
QueryResult<Tuple<BaseItem, ItemCounts>> GetAllArtists(InternalItemsQuery query);
|
||||
QueryResult<(BaseItem, ItemCounts)> GetGenres(InternalItemsQuery query);
|
||||
QueryResult<(BaseItem, ItemCounts)> GetMusicGenres(InternalItemsQuery query);
|
||||
QueryResult<(BaseItem, ItemCounts)> GetStudios(InternalItemsQuery query);
|
||||
QueryResult<(BaseItem, ItemCounts)> GetArtists(InternalItemsQuery query);
|
||||
QueryResult<(BaseItem, ItemCounts)> GetAlbumArtists(InternalItemsQuery query);
|
||||
QueryResult<(BaseItem, ItemCounts)> GetAllArtists(InternalItemsQuery query);
|
||||
|
||||
int GetCount(InternalItemsQuery query);
|
||||
|
||||
|
|
|
@ -141,12 +141,12 @@ namespace MediaBrowser.Controller.Persistence
|
|||
|
||||
int GetCount(InternalItemsQuery query);
|
||||
|
||||
QueryResult<Tuple<BaseItem, ItemCounts>> GetGenres(InternalItemsQuery query);
|
||||
QueryResult<Tuple<BaseItem, ItemCounts>> GetMusicGenres(InternalItemsQuery query);
|
||||
QueryResult<Tuple<BaseItem, ItemCounts>> GetStudios(InternalItemsQuery query);
|
||||
QueryResult<Tuple<BaseItem, ItemCounts>> GetArtists(InternalItemsQuery query);
|
||||
QueryResult<Tuple<BaseItem, ItemCounts>> GetAlbumArtists(InternalItemsQuery query);
|
||||
QueryResult<Tuple<BaseItem, ItemCounts>> GetAllArtists(InternalItemsQuery query);
|
||||
QueryResult<(BaseItem, ItemCounts)> GetGenres(InternalItemsQuery query);
|
||||
QueryResult<(BaseItem, ItemCounts)> GetMusicGenres(InternalItemsQuery query);
|
||||
QueryResult<(BaseItem, ItemCounts)> GetStudios(InternalItemsQuery query);
|
||||
QueryResult<(BaseItem, ItemCounts)> GetArtists(InternalItemsQuery query);
|
||||
QueryResult<(BaseItem, ItemCounts)> GetAlbumArtists(InternalItemsQuery query);
|
||||
QueryResult<(BaseItem, ItemCounts)> GetAllArtists(InternalItemsQuery query);
|
||||
|
||||
List<string> GetMusicGenreNames();
|
||||
List<string> GetStudioNames();
|
||||
|
|
Loading…
Reference in New Issue
Block a user