mirror of
https://github.com/jellyfin/jellyfin.git
synced 2024-07-08 23:00:51 +02:00
update playlist query
This commit is contained in:
parent
a45831cdcf
commit
72a0c2afeb
|
@ -112,6 +112,11 @@ namespace MediaBrowser.Api.UserLibrary
|
||||||
user == null ? _libraryManager.RootFolder : user.RootFolder :
|
user == null ? _libraryManager.RootFolder : user.RootFolder :
|
||||||
parentItem;
|
parentItem;
|
||||||
|
|
||||||
|
if (string.Equals(request.IncludeItemTypes, "Playlist", StringComparison.OrdinalIgnoreCase))
|
||||||
|
{
|
||||||
|
item = user == null ? _libraryManager.RootFolder : user.RootFolder;
|
||||||
|
}
|
||||||
|
|
||||||
// Default list type = children
|
// Default list type = children
|
||||||
|
|
||||||
if (!string.IsNullOrEmpty(request.Ids))
|
if (!string.IsNullOrEmpty(request.Ids))
|
||||||
|
|
|
@ -31,6 +31,7 @@ namespace MediaBrowser.Controller.Entities
|
||||||
public string[] MediaTypes { get; set; }
|
public string[] MediaTypes { get; set; }
|
||||||
public string[] IncludeItemTypes { get; set; }
|
public string[] IncludeItemTypes { get; set; }
|
||||||
public string[] ExcludeItemTypes { get; set; }
|
public string[] ExcludeItemTypes { get; set; }
|
||||||
|
public string[] ExcludeTags { get; set; }
|
||||||
public string[] Genres { get; set; }
|
public string[] Genres { get; set; }
|
||||||
|
|
||||||
public bool? IsMissing { get; set; }
|
public bool? IsMissing { get; set; }
|
||||||
|
@ -133,6 +134,7 @@ namespace MediaBrowser.Controller.Entities
|
||||||
ItemIds = new string[] { };
|
ItemIds = new string[] { };
|
||||||
AncestorIds = new string[] { };
|
AncestorIds = new string[] { };
|
||||||
TopParentIds = new string[] { };
|
TopParentIds = new string[] { };
|
||||||
|
ExcludeTags = new string[] { };
|
||||||
ExcludeLocationTypes = new LocationType[] { };
|
ExcludeLocationTypes = new LocationType[] { };
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -144,6 +146,13 @@ namespace MediaBrowser.Controller.Entities
|
||||||
var policy = user.Policy;
|
var policy = user.Policy;
|
||||||
MaxParentalRating = policy.MaxParentalRating;
|
MaxParentalRating = policy.MaxParentalRating;
|
||||||
|
|
||||||
|
if (policy.MaxParentalRating.HasValue)
|
||||||
|
{
|
||||||
|
BlockUnratedItems = policy.BlockUnratedItems;
|
||||||
|
}
|
||||||
|
|
||||||
|
ExcludeTags = policy.BlockedTags;
|
||||||
|
|
||||||
User = user;
|
User = user;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -175,6 +175,11 @@ namespace MediaBrowser.Providers.TV
|
||||||
/// <returns>Task.</returns>
|
/// <returns>Task.</returns>
|
||||||
internal async Task DownloadSeriesZip(string seriesId, string seriesDataPath, long? lastTvDbUpdateTime, string preferredMetadataLanguage, CancellationToken cancellationToken)
|
internal async Task DownloadSeriesZip(string seriesId, string seriesDataPath, long? lastTvDbUpdateTime, string preferredMetadataLanguage, CancellationToken cancellationToken)
|
||||||
{
|
{
|
||||||
|
if (string.IsNullOrWhiteSpace(seriesId))
|
||||||
|
{
|
||||||
|
throw new ArgumentNullException("seriesId");
|
||||||
|
}
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
await DownloadSeriesZip(seriesId, seriesDataPath, lastTvDbUpdateTime, preferredMetadataLanguage, preferredMetadataLanguage, cancellationToken).ConfigureAwait(false);
|
await DownloadSeriesZip(seriesId, seriesDataPath, lastTvDbUpdateTime, preferredMetadataLanguage, preferredMetadataLanguage, cancellationToken).ConfigureAwait(false);
|
||||||
|
@ -196,6 +201,11 @@ namespace MediaBrowser.Providers.TV
|
||||||
|
|
||||||
private async Task DownloadSeriesZip(string seriesId, string seriesDataPath, long? lastTvDbUpdateTime, string preferredMetadataLanguage, string saveAsMetadataLanguage, CancellationToken cancellationToken)
|
private async Task DownloadSeriesZip(string seriesId, string seriesDataPath, long? lastTvDbUpdateTime, string preferredMetadataLanguage, string saveAsMetadataLanguage, CancellationToken cancellationToken)
|
||||||
{
|
{
|
||||||
|
if (string.IsNullOrWhiteSpace(seriesId))
|
||||||
|
{
|
||||||
|
throw new ArgumentNullException("seriesId");
|
||||||
|
}
|
||||||
|
|
||||||
var url = string.Format(SeriesGetZip, TVUtils.TvdbApiKey, seriesId, preferredMetadataLanguage);
|
var url = string.Format(SeriesGetZip, TVUtils.TvdbApiKey, seriesId, preferredMetadataLanguage);
|
||||||
|
|
||||||
using (var zipStream = await _httpClient.Get(new HttpRequestOptions
|
using (var zipStream = await _httpClient.Get(new HttpRequestOptions
|
||||||
|
@ -247,7 +257,11 @@ namespace MediaBrowser.Providers.TV
|
||||||
string id;
|
string id;
|
||||||
if (seriesProviderIds.TryGetValue(MetadataProviders.Tvdb.ToString(), out id))
|
if (seriesProviderIds.TryGetValue(MetadataProviders.Tvdb.ToString(), out id))
|
||||||
{
|
{
|
||||||
return true;
|
// This check should ideally never be necessary but we're seeing some cases of this and haven't tracked them down yet.
|
||||||
|
if (string.IsNullOrWhiteSpace(id))
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
//if (seriesProviderIds.TryGetValue(MetadataProviders.Imdb.ToString(), out id))
|
//if (seriesProviderIds.TryGetValue(MetadataProviders.Imdb.ToString(), out id))
|
||||||
//{
|
//{
|
||||||
|
|
|
@ -1345,16 +1345,7 @@ namespace MediaBrowser.Server.Implementations.Library
|
||||||
|
|
||||||
}, CancellationToken.None).Result.ToList();
|
}, CancellationToken.None).Result.ToList();
|
||||||
|
|
||||||
query.TopParentIds = userViews.SelectMany(GetTopParentsForQuery).Select(i => i.Id.ToString("N")).ToArray();
|
//query.TopParentIds = userViews.SelectMany(GetTopParentsForQuery).Select(i => i.Id.ToString("N")).ToArray();
|
||||||
}
|
|
||||||
|
|
||||||
// TODO: handle blocking by tags
|
|
||||||
|
|
||||||
query.MaxParentalRating = user.Policy.MaxParentalRating;
|
|
||||||
|
|
||||||
if (user.Policy.MaxParentalRating.HasValue)
|
|
||||||
{
|
|
||||||
query.BlockUnratedItems = user.Policy.BlockUnratedItems;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1985,6 +1985,14 @@ namespace MediaBrowser.Server.Implementations.Persistence
|
||||||
var inClause = string.Join(",", query.BlockUnratedItems.Select(i => "'" + i.ToString() + "'").ToArray());
|
var inClause = string.Join(",", query.BlockUnratedItems.Select(i => "'" + i.ToString() + "'").ToArray());
|
||||||
whereClauses.Add(string.Format("(InheritedParentalRatingValue > 0 or UnratedType not in ({0}))", inClause));
|
whereClauses.Add(string.Format("(InheritedParentalRatingValue > 0 or UnratedType not in ({0}))", inClause));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//var excludeTagIndex = 0;
|
||||||
|
//foreach (var excludeTag in query.ExcludeTags)
|
||||||
|
//{
|
||||||
|
// whereClauses.Add("Tags not like @excludeTag" + excludeTagIndex);
|
||||||
|
// cmd.Parameters.Add(cmd, "@excludeTag" + excludeTagIndex, DbType.String).Value = "%" + excludeTag + "%";
|
||||||
|
// excludeTagIndex++;
|
||||||
|
//}
|
||||||
|
|
||||||
if (addPaging)
|
if (addPaging)
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in a new issue