mirror of
https://github.com/jellyfin/jellyfin.git
synced 2024-09-06 11:34:57 +02:00
commit
75a1f74f94
22 changed files with 139 additions and 121 deletions
|
@ -17,7 +17,12 @@ namespace MediaBrowser.Controller.Entities.Audio
|
|||
/// </summary>
|
||||
public class MusicArtist : Folder, IMetadataContainer, IItemByName, IHasMusicGenres, IHasDualAccess, IHasProductionLocations, IHasLookupInfo<ArtistInfo>
|
||||
{
|
||||
public bool IsAccessedByName { get; set; }
|
||||
[IgnoreDataMember]
|
||||
public bool IsAccessedByName
|
||||
{
|
||||
get { return ParentId == Guid.Empty; }
|
||||
}
|
||||
|
||||
public List<string> ProductionLocations { get; set; }
|
||||
|
||||
[IgnoreDataMember]
|
||||
|
@ -40,6 +45,20 @@ namespace MediaBrowser.Controller.Entities.Audio
|
|||
return !IsAccessedByName;
|
||||
}
|
||||
|
||||
public IEnumerable<BaseItem> GetTaggedItems(InternalItemsQuery query)
|
||||
{
|
||||
var itemByNameFilter = GetItemFilter();
|
||||
|
||||
if (query.User != null)
|
||||
{
|
||||
return query.User.RootFolder
|
||||
.GetRecursiveChildren(query.User, i => !i.IsFolder && itemByNameFilter(i));
|
||||
}
|
||||
|
||||
return LibraryManager.RootFolder
|
||||
.GetRecursiveChildren(i => !i.IsFolder && itemByNameFilter(i));
|
||||
}
|
||||
|
||||
protected override IEnumerable<BaseItem> ActualChildren
|
||||
{
|
||||
get
|
||||
|
|
|
@ -79,5 +79,13 @@ namespace MediaBrowser.Controller.Entities.Audio
|
|||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
public IEnumerable<BaseItem> GetTaggedItems(InternalItemsQuery query)
|
||||
{
|
||||
query.Genres = new[] { Name };
|
||||
query.ExcludeItemTypes = new[] { typeof(MusicVideo).Name, typeof(Audio).Name, typeof(MusicAlbum).Name, typeof(MusicArtist).Name };
|
||||
|
||||
return LibraryManager.GetItemList(query);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -62,6 +62,14 @@ namespace MediaBrowser.Controller.Entities
|
|||
return i => i is Game && i.Genres.Contains(Name, StringComparer.OrdinalIgnoreCase);
|
||||
}
|
||||
|
||||
public IEnumerable<BaseItem> GetTaggedItems(InternalItemsQuery query)
|
||||
{
|
||||
query.Genres = new[] { Name };
|
||||
query.IncludeItemTypes = new[] { typeof(Game).Name };
|
||||
|
||||
return LibraryManager.GetItemList(query);
|
||||
}
|
||||
|
||||
[IgnoreDataMember]
|
||||
public override bool SupportsPeople
|
||||
{
|
||||
|
|
|
@ -66,6 +66,14 @@ namespace MediaBrowser.Controller.Entities
|
|||
return i => !(i is Game) && !(i is IHasMusicGenres) && i.Genres.Contains(Name, StringComparer.OrdinalIgnoreCase);
|
||||
}
|
||||
|
||||
public IEnumerable<BaseItem> GetTaggedItems(InternalItemsQuery query)
|
||||
{
|
||||
query.Genres = new[] { Name };
|
||||
query.ExcludeItemTypes = new[] { typeof(Game).Name, typeof(MusicVideo).Name, typeof(Audio.Audio).Name, typeof(MusicAlbum).Name, typeof(MusicArtist).Name };
|
||||
|
||||
return LibraryManager.GetItemList(query);
|
||||
}
|
||||
|
||||
[IgnoreDataMember]
|
||||
public override bool SupportsPeople
|
||||
{
|
||||
|
|
|
@ -20,6 +20,8 @@ namespace MediaBrowser.Controller.Entities
|
|||
/// </summary>
|
||||
/// <returns>Func<BaseItem, System.Boolean>.</returns>
|
||||
Func<BaseItem, bool> GetItemFilter();
|
||||
|
||||
IEnumerable<BaseItem> GetTaggedItems(InternalItemsQuery query);
|
||||
}
|
||||
|
||||
public interface IHasDualAccess : IItemByName
|
||||
|
|
|
@ -134,6 +134,7 @@ namespace MediaBrowser.Controller.Entities
|
|||
|
||||
public string[] AlbumNames { get; set; }
|
||||
public string[] ArtistNames { get; set; }
|
||||
public string AncestorWithPresentationUniqueKey { get; set; }
|
||||
|
||||
public bool GroupByPresentationUniqueKey { get; set; }
|
||||
|
||||
|
|
|
@ -31,6 +31,13 @@ namespace MediaBrowser.Controller.Entities
|
|||
return GetItemLookupInfo<PersonLookupInfo>();
|
||||
}
|
||||
|
||||
public IEnumerable<BaseItem> GetTaggedItems(InternalItemsQuery query)
|
||||
{
|
||||
query.Person = Name;
|
||||
|
||||
return LibraryManager.GetItemList(query);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Returns the folder containing the item.
|
||||
/// If the item is a folder, it returns the folder itself
|
||||
|
|
|
@ -7,15 +7,6 @@ namespace MediaBrowser.Controller.Entities
|
|||
{
|
||||
public class PhotoAlbum : Folder
|
||||
{
|
||||
[IgnoreDataMember]
|
||||
public override bool SupportsLocalMetadata
|
||||
{
|
||||
get
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
[IgnoreDataMember]
|
||||
public override bool AlwaysScanInternalMetadataPath
|
||||
{
|
||||
|
|
|
@ -65,6 +65,13 @@ namespace MediaBrowser.Controller.Entities
|
|||
return i => i.Studios.Contains(Name, StringComparer.OrdinalIgnoreCase);
|
||||
}
|
||||
|
||||
public IEnumerable<BaseItem> GetTaggedItems(InternalItemsQuery query)
|
||||
{
|
||||
query.Studios = new[] { Name };
|
||||
|
||||
return LibraryManager.GetItemList(query);
|
||||
}
|
||||
|
||||
[IgnoreDataMember]
|
||||
public override bool SupportsPeople
|
||||
{
|
||||
|
|
|
@ -9,6 +9,7 @@ using System.Linq;
|
|||
using System.Runtime.Serialization;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
using MoreLinq;
|
||||
|
||||
namespace MediaBrowser.Controller.Entities.TV
|
||||
{
|
||||
|
@ -180,7 +181,7 @@ namespace MediaBrowser.Controller.Entities.TV
|
|||
else
|
||||
{
|
||||
items = query.Recursive
|
||||
? GetRecursiveChildren(user, filter)
|
||||
? GetSeasons(user).Cast<BaseItem>().Concat(GetEpisodes(user)).Where(filter)
|
||||
: GetSeasons(user).Where(filter);
|
||||
}
|
||||
|
||||
|
@ -211,7 +212,7 @@ namespace MediaBrowser.Controller.Entities.TV
|
|||
}
|
||||
else
|
||||
{
|
||||
seasons = base.GetChildren(user, true).OfType<Season>();
|
||||
seasons = LibraryManager.Sort(base.GetChildren(user, true), user, new[] { ItemSortBy.SortName }, SortOrder.Ascending).OfType<Season>();
|
||||
}
|
||||
|
||||
if (!includeMissingSeasons && !includeVirtualUnaired)
|
||||
|
@ -250,17 +251,8 @@ namespace MediaBrowser.Controller.Entities.TV
|
|||
// Specials could appear twice based on above - once in season 0, once in the aired season
|
||||
// This depends on settings for that series
|
||||
// When this happens, remove the duplicate from season 0
|
||||
var returnList = new List<Episode>();
|
||||
|
||||
foreach (var episode in allEpisodes)
|
||||
{
|
||||
if (!returnList.Contains(episode))
|
||||
{
|
||||
returnList.Insert(0, episode);
|
||||
}
|
||||
}
|
||||
|
||||
return returnList;
|
||||
return allEpisodes.DistinctBy(i => i.Id).Reverse();
|
||||
}
|
||||
|
||||
public async Task RefreshAllMetadata(MetadataRefreshOptions refreshOptions, IProgress<double> progress, CancellationToken cancellationToken)
|
||||
|
|
|
@ -70,6 +70,22 @@ namespace MediaBrowser.Controller.Entities
|
|||
return inputItems.Where(i => i.ProductionYear.HasValue && i.ProductionYear.Value == year);
|
||||
}
|
||||
|
||||
public IEnumerable<BaseItem> GetTaggedItems(InternalItemsQuery query)
|
||||
{
|
||||
int year;
|
||||
|
||||
var usCulture = new CultureInfo("en-US");
|
||||
|
||||
if (!int.TryParse(Name, NumberStyles.Integer, usCulture, out year))
|
||||
{
|
||||
return new List<BaseItem>();
|
||||
}
|
||||
|
||||
query.Years = new[] { year };
|
||||
|
||||
return LibraryManager.GetItemList(query);
|
||||
}
|
||||
|
||||
public int? GetYearValue()
|
||||
{
|
||||
int i;
|
||||
|
|
|
@ -99,11 +99,12 @@ namespace MediaBrowser.Controller.Playlists
|
|||
var musicGenre = item as MusicGenre;
|
||||
if (musicGenre != null)
|
||||
{
|
||||
Func<BaseItem, bool> filter = i => i is Audio && i.Genres.Contains(musicGenre.Name, StringComparer.OrdinalIgnoreCase);
|
||||
|
||||
var items = user == null
|
||||
? LibraryManager.RootFolder.GetRecursiveChildren(filter)
|
||||
: user.RootFolder.GetRecursiveChildren(user, filter);
|
||||
var items = LibraryManager.GetItemList(new InternalItemsQuery(user)
|
||||
{
|
||||
Recursive = true,
|
||||
IncludeItemTypes = new[] { typeof(Audio).Name },
|
||||
Genres = new[] { musicGenre.Name }
|
||||
});
|
||||
|
||||
return LibraryManager.Sort(items, user, new[] { ItemSortBy.AlbumArtist, ItemSortBy.Album, ItemSortBy.SortName }, SortOrder.Ascending);
|
||||
}
|
||||
|
|
|
@ -662,9 +662,6 @@
|
|||
<Compile Include="..\MediaBrowser.Model\FileOrganization\TvFileOrganizationOptions.cs">
|
||||
<Link>FileOrganization\TvFileOrganizationOptions.cs</Link>
|
||||
</Compile>
|
||||
<Compile Include="..\MediaBrowser.Model\Games\GameSystem.cs">
|
||||
<Link>Games\GameSystem.cs</Link>
|
||||
</Compile>
|
||||
<Compile Include="..\MediaBrowser.Model\Globalization\CountryInfo.cs">
|
||||
<Link>Globalization\CountryInfo.cs</Link>
|
||||
</Compile>
|
||||
|
|
|
@ -636,9 +636,6 @@
|
|||
<Compile Include="..\MediaBrowser.Model\FileOrganization\TvFileOrganizationOptions.cs">
|
||||
<Link>FileOrganization\TvFileOrganizationOptions.cs</Link>
|
||||
</Compile>
|
||||
<Compile Include="..\MediaBrowser.Model\Games\GameSystem.cs">
|
||||
<Link>Games\GameSystem.cs</Link>
|
||||
</Compile>
|
||||
<Compile Include="..\MediaBrowser.Model\Globalization\CountryInfo.cs">
|
||||
<Link>Globalization\CountryInfo.cs</Link>
|
||||
</Compile>
|
||||
|
|
|
@ -1,48 +0,0 @@
|
|||
|
||||
namespace MediaBrowser.Model.Games
|
||||
{
|
||||
public class GameSystem
|
||||
{
|
||||
public const string Nintendo = "Nintendo";
|
||||
public const string SuperNintendo = "Super Nintendo";
|
||||
public const string Panasonic3DO = "3DO";
|
||||
public const string Amiga = "Amiga";
|
||||
public const string Arcade = "Arcade";
|
||||
public const string Atari2600 = "Atari 2600";
|
||||
public const string Atari5200 = "Atari 5200";
|
||||
public const string Atari7800 = "Atari 7800";
|
||||
public const string AtariXE = "Atari XE";
|
||||
public const string AtariJaguar = "Atari Jaguar";
|
||||
public const string AtariJaguarCD = "Atari Jaguar CD";
|
||||
public const string Colecovision = "Colecovision";
|
||||
public const string Commodore64 = "Commodore 64";
|
||||
public const string CommodoreVic20 = "Commodore Vic-20";
|
||||
public const string Intellivision = "Intellivision";
|
||||
public const string MicrosoftXBox = "Xbox";
|
||||
public const string NeoGeo = "Neo Geo";
|
||||
public const string Nintendo64 = "Nintendo 64";
|
||||
public const string NintendoDS = "Nintendo DS";
|
||||
public const string NintendoGameBoy = "Game Boy";
|
||||
public const string NintendoGameBoyAdvance = "Game Boy Advance";
|
||||
public const string NintendoGameBoyColor = "Game Boy Color";
|
||||
public const string NintendoGameCube = "Gamecube";
|
||||
public const string VirtualBoy = "Virtual Boy";
|
||||
public const string Wii = "Nintendo Wii";
|
||||
public const string DOS = "DOS";
|
||||
public const string Windows = "Windows";
|
||||
public const string Sega32X = "Sega 32X";
|
||||
public const string SegaCD = "Sega CD";
|
||||
public const string SegaDreamcast = "Dreamcast";
|
||||
public const string SegaGameGear = "Game Gear";
|
||||
public const string SegaGenesis = "Sega Genesis";
|
||||
public const string SegaMasterSystem = "Sega Master System";
|
||||
public const string SegaMegaDrive = "Sega Mega Drive";
|
||||
public const string SegaSaturn = "Sega Saturn";
|
||||
public const string SonyPlaystation = "Sony Playstation";
|
||||
public const string SonyPlaystation2 = "PS2";
|
||||
public const string SonyPSP = "PSP";
|
||||
public const string TurboGrafx16 = "TurboGrafx 16";
|
||||
public const string TurboGrafxCD = "TurboGrafx CD";
|
||||
public const string ZxSpectrum = "ZX Spectrum";
|
||||
}
|
||||
}
|
|
@ -287,7 +287,6 @@
|
|||
<Compile Include="Entities\MetadataFields.cs" />
|
||||
<Compile Include="Entities\UserDataSaveReason.cs" />
|
||||
<Compile Include="Entities\Video3DFormat.cs" />
|
||||
<Compile Include="Games\GameSystem.cs" />
|
||||
<Compile Include="IO\IIsoManager.cs" />
|
||||
<Compile Include="IO\IIsoMount.cs" />
|
||||
<Compile Include="IO\IIsoMounter.cs" />
|
||||
|
|
|
@ -961,7 +961,7 @@ namespace MediaBrowser.Server.Implementations.Library
|
|||
Name = name
|
||||
|
||||
}).Cast<MusicArtist>()
|
||||
.Where(i => !i.IsAccessedByName)
|
||||
.OrderBy(i => i.IsAccessedByName ? 1 : 0)
|
||||
.Cast<T>()
|
||||
.FirstOrDefault();
|
||||
|
||||
|
@ -984,11 +984,6 @@ namespace MediaBrowser.Server.Implementations.Library
|
|||
Path = path
|
||||
};
|
||||
|
||||
if (isArtist)
|
||||
{
|
||||
(item as MusicArtist).IsAccessedByName = true;
|
||||
}
|
||||
|
||||
var task = CreateItem(item, CancellationToken.None);
|
||||
Task.WaitAll(task);
|
||||
}
|
||||
|
|
|
@ -82,7 +82,7 @@ namespace MediaBrowser.Server.Implementations.Persistence
|
|||
private IDbCommand _updateInheritedRatingCommand;
|
||||
private IDbCommand _updateInheritedTagsCommand;
|
||||
|
||||
public const int LatestSchemaVersion = 72;
|
||||
public const int LatestSchemaVersion = 73;
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="SqliteItemRepository"/> class.
|
||||
|
@ -2334,6 +2334,12 @@ namespace MediaBrowser.Server.Implementations.Persistence
|
|||
var inClause = string.Join(",", query.AncestorIds.Select(i => "'" + new Guid(i).ToString("N") + "'").ToArray());
|
||||
whereClauses.Add(string.Format("Guid in (select itemId from AncestorIds where AncestorIdText in ({0}))", inClause));
|
||||
}
|
||||
if (!string.IsNullOrWhiteSpace(query.AncestorWithPresentationUniqueKey))
|
||||
{
|
||||
var inClause = "select guid from TypedBaseItems where PresentationUniqueKey=@AncestorWithPresentationUniqueKey";
|
||||
whereClauses.Add(string.Format("Guid in (select itemId from AncestorIds where AncestorId in ({0}))", inClause));
|
||||
cmd.Parameters.Add(cmd, "@AncestorWithPresentationUniqueKey", DbType.String).Value = query.AncestorWithPresentationUniqueKey;
|
||||
}
|
||||
|
||||
if (query.BlockUnratedItems.Length == 1)
|
||||
{
|
||||
|
|
|
@ -109,6 +109,21 @@ namespace MediaBrowser.Server.Implementations.Photos
|
|||
|
||||
protected async Task<ItemUpdateType> FetchAsync(IHasImages item, ImageType imageType, MetadataRefreshOptions options, CancellationToken cancellationToken)
|
||||
{
|
||||
var image = item.GetImageInfo(imageType, 0);
|
||||
|
||||
if (image != null)
|
||||
{
|
||||
if (!image.IsLocalFile)
|
||||
{
|
||||
return ItemUpdateType.None;
|
||||
}
|
||||
|
||||
if (!FileSystem.ContainsSubPath(item.GetInternalMetadataPath(), image.Path))
|
||||
{
|
||||
return ItemUpdateType.None;
|
||||
}
|
||||
}
|
||||
|
||||
var items = await GetItemsWithImages(item).ConfigureAwait(false);
|
||||
|
||||
return await FetchToFileInternal(item, items, imageType, cancellationToken).ConfigureAwait(false);
|
||||
|
|
|
@ -1026,11 +1026,11 @@ namespace MediaBrowser.Server.Implementations.Session
|
|||
|
||||
if (byName != null)
|
||||
{
|
||||
var itemFilter = byName.GetItemFilter();
|
||||
|
||||
var items = user == null ?
|
||||
_libraryManager.RootFolder.GetRecursiveChildren(i => !i.IsFolder && itemFilter(i)) :
|
||||
user.RootFolder.GetRecursiveChildren(user, i => !i.IsFolder && itemFilter(i));
|
||||
var items = byName.GetTaggedItems(new InternalItemsQuery(user)
|
||||
{
|
||||
IsFolder = false,
|
||||
Recursive = true
|
||||
});
|
||||
|
||||
return FilterToSingleMediaType(items)
|
||||
.OrderBy(i => i.SortName);
|
||||
|
@ -1040,9 +1040,12 @@ namespace MediaBrowser.Server.Implementations.Session
|
|||
{
|
||||
var folder = (Folder)item;
|
||||
|
||||
var items = user == null ?
|
||||
folder.GetRecursiveChildren(i => !i.IsFolder) :
|
||||
folder.GetRecursiveChildren(user, i => !i.IsFolder);
|
||||
var items = folder.GetItems(new InternalItemsQuery(user)
|
||||
{
|
||||
Recursive = true,
|
||||
IsFolder = false
|
||||
|
||||
}).Result.Items;
|
||||
|
||||
return FilterToSingleMediaType(items)
|
||||
.OrderBy(i => i.SortName);
|
||||
|
|
|
@ -326,32 +326,26 @@ namespace MediaBrowser.Server.Implementations.Sync
|
|||
var itemByName = item as IItemByName;
|
||||
if (itemByName != null)
|
||||
{
|
||||
var itemByNameFilter = itemByName.GetItemFilter();
|
||||
|
||||
return user.RootFolder
|
||||
.GetRecursiveChildren(user, i => !i.IsFolder && itemByNameFilter(i));
|
||||
}
|
||||
|
||||
var series = item as Series;
|
||||
if (series != null)
|
||||
return itemByName.GetTaggedItems(new InternalItemsQuery(user)
|
||||
{
|
||||
return series.GetEpisodes(user, false, false);
|
||||
}
|
||||
|
||||
var season = item as Season;
|
||||
if (season != null)
|
||||
{
|
||||
return season.GetEpisodes(user, false, false);
|
||||
IsFolder = false,
|
||||
Recursive = true
|
||||
});
|
||||
}
|
||||
|
||||
if (item.IsFolder)
|
||||
{
|
||||
var folder = (Folder)item;
|
||||
var items = folder.GetRecursiveChildren(user, i => !i.IsFolder);
|
||||
var items = folder.GetItems(new InternalItemsQuery(user)
|
||||
{
|
||||
Recursive = true,
|
||||
IsFolder = false
|
||||
|
||||
}).Result.Items;
|
||||
|
||||
if (!folder.IsPreSorted)
|
||||
{
|
||||
items = items.OrderBy(i => i.SortName);
|
||||
items = items.OrderBy(i => i.SortName).ToArray();
|
||||
}
|
||||
|
||||
return items;
|
||||
|
|
Loading…
Reference in a new issue