Removed vf collection type
This commit is contained in:
parent
81c16c305b
commit
42a2835633
|
@ -107,13 +107,6 @@ namespace MediaBrowser.Api
|
|||
dto.Type = item.GetType().Name;
|
||||
dto.UserRating = item.UserRating;
|
||||
|
||||
VirtualFolder virtualFolder = item.VirtualFolder;
|
||||
|
||||
if (virtualFolder != null)
|
||||
{
|
||||
dto.VfType = virtualFolder.CollectionType;
|
||||
}
|
||||
|
||||
dto.UserData = item.GetUserData(user);
|
||||
|
||||
Folder folder = item as Folder;
|
||||
|
@ -123,7 +116,7 @@ namespace MediaBrowser.Api
|
|||
dto.SpecialCounts = folder.GetSpecialCounts(user);
|
||||
|
||||
dto.IsRoot = folder.IsRoot;
|
||||
dto.IsVirtualFolder = folder is VirtualFolder;
|
||||
dto.IsVirtualFolder = folder.Parent != null && folder.Parent.IsRoot;
|
||||
}
|
||||
|
||||
Audio audio = item as Audio;
|
||||
|
|
|
@ -227,9 +227,40 @@ namespace MediaBrowser.Controller
|
|||
|
||||
user.Name = "Default User";
|
||||
user.Id = Guid.Parse("5d1cf7fce25943b790d140095457a42b");
|
||||
user.PrimaryImagePath = "D:\\Video\\TV\\Archer (2009)\\folder.jpg";
|
||||
|
||||
list.Add(user);
|
||||
|
||||
user = new User();
|
||||
user.Name = "Test User 1";
|
||||
user.Id = Guid.NewGuid();
|
||||
list.Add(user);
|
||||
|
||||
user = new User();
|
||||
user.Name = "Test User 2";
|
||||
user.Id = Guid.NewGuid();
|
||||
list.Add(user);
|
||||
|
||||
user = new User();
|
||||
user.Name = "Test User 3";
|
||||
user.Id = Guid.NewGuid();
|
||||
list.Add(user);
|
||||
|
||||
user = new User();
|
||||
user.Name = "Test User 4";
|
||||
user.Id = Guid.NewGuid();
|
||||
list.Add(user);
|
||||
|
||||
user = new User();
|
||||
user.Name = "Test User 5";
|
||||
user.Id = Guid.NewGuid();
|
||||
list.Add(user);
|
||||
|
||||
user = new User();
|
||||
user.Name = "Test User 6";
|
||||
user.Id = Guid.NewGuid();
|
||||
list.Add(user);
|
||||
|
||||
return list;
|
||||
}
|
||||
|
||||
|
|
|
@ -31,7 +31,7 @@ namespace MediaBrowser.Controller.Library
|
|||
{
|
||||
for (int i = 0; i < FileSystemChildren.Length; i++)
|
||||
{
|
||||
if (System.IO.Path.GetFileName(FileSystemChildren[i].Path).Equals(name, StringComparison.OrdinalIgnoreCase))
|
||||
if (FileSystemChildren[i].cFileName.Equals(name, StringComparison.OrdinalIgnoreCase))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
@ -42,15 +42,7 @@ namespace MediaBrowser.Controller.Library
|
|||
|
||||
public bool ContainsFolder(string name)
|
||||
{
|
||||
for (int i = 0; i < FileSystemChildren.Length; i++)
|
||||
{
|
||||
if (System.IO.Path.GetFileName(FileSystemChildren[i].Path).Equals(name, StringComparison.OrdinalIgnoreCase))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
return ContainsFile(name);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -77,34 +69,6 @@ namespace MediaBrowser.Controller.Library
|
|||
}
|
||||
}
|
||||
|
||||
public VirtualFolder VirtualFolder
|
||||
{
|
||||
get
|
||||
{
|
||||
if (Parent != null)
|
||||
{
|
||||
return Parent.VirtualFolder;
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
public string VirtualFolderCollectionType
|
||||
{
|
||||
get
|
||||
{
|
||||
VirtualFolder vf = VirtualFolder;
|
||||
|
||||
if (vf == null)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
return vf.CollectionType;
|
||||
}
|
||||
}
|
||||
|
||||
public bool IsHidden
|
||||
{
|
||||
get
|
||||
|
|
|
@ -77,7 +77,6 @@
|
|||
<Compile Include="Resolvers\BaseItemResolver.cs" />
|
||||
<Compile Include="Resolvers\FolderResolver.cs" />
|
||||
<Compile Include="Resolvers\VideoResolver.cs" />
|
||||
<Compile Include="Resolvers\VirtualFolderResolver.cs" />
|
||||
<Compile Include="Xml\BaseItemXmlParser.cs" />
|
||||
<Compile Include="Xml\XmlExtensions.cs" />
|
||||
</ItemGroup>
|
||||
|
|
|
@ -1,46 +0,0 @@
|
|||
using System.ComponentModel.Composition;
|
||||
using System.IO;
|
||||
using MediaBrowser.Controller.Library;
|
||||
using MediaBrowser.Model.Entities;
|
||||
|
||||
namespace MediaBrowser.Controller.Resolvers
|
||||
{
|
||||
[Export(typeof(IBaseItemResolver))]
|
||||
public class VirtualFolderResolver : BaseFolderResolver<VirtualFolder>
|
||||
{
|
||||
public override ResolverPriority Priority
|
||||
{
|
||||
get { return ResolverPriority.Third; }
|
||||
}
|
||||
|
||||
protected override VirtualFolder Resolve(ItemResolveEventArgs args)
|
||||
{
|
||||
if (args.IsDirectory && args.Parent != null && args.Parent.IsRoot)
|
||||
{
|
||||
return new VirtualFolder();
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
protected override void SetInitialItemValues(VirtualFolder item, ItemResolveEventArgs args)
|
||||
{
|
||||
// Set the name initially by stripping off the [CollectionType=...]
|
||||
// The name can always be overridden later by folder.xml
|
||||
string pathName = Path.GetFileNameWithoutExtension(args.Path);
|
||||
|
||||
string srch = "[collectiontype=";
|
||||
int index = pathName.IndexOf(srch, System.StringComparison.OrdinalIgnoreCase);
|
||||
|
||||
if (index != -1)
|
||||
{
|
||||
item.Name = pathName.Substring(0, index).Trim();
|
||||
|
||||
item.CollectionType = pathName.Substring(index + srch.Length).TrimEnd(']');
|
||||
}
|
||||
|
||||
base.SetInitialItemValues(item, args);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
|
@ -83,11 +83,6 @@ namespace MediaBrowser.Model.DTO
|
|||
public IEnumerable<DTOBaseItem> LocalTrailers { get; set; }
|
||||
public int LocalTrailerCount { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Holds the virtual folder collection type
|
||||
/// </summary>
|
||||
public string VfType { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// User data for this item based on the user it's being requested for
|
||||
/// </summary>
|
||||
|
|
|
@ -6,29 +6,6 @@ namespace MediaBrowser.Model.Entities
|
|||
{
|
||||
public abstract class BaseItem : BaseEntity, IHasProviderIds
|
||||
{
|
||||
/// <summary>
|
||||
/// Goes up the tree to find the virtual folder parent
|
||||
/// </summary>
|
||||
public VirtualFolder VirtualFolder
|
||||
{
|
||||
get
|
||||
{
|
||||
var vf = this as VirtualFolder;
|
||||
|
||||
if (vf != null)
|
||||
{
|
||||
return vf;
|
||||
}
|
||||
|
||||
if (Parent != null)
|
||||
{
|
||||
return Parent.VirtualFolder;
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
public string SortName { get; set; }
|
||||
|
||||
/// <summary>
|
||||
|
|
|
@ -1,8 +0,0 @@
|
|||
|
||||
namespace MediaBrowser.Model.Entities
|
||||
{
|
||||
public class VirtualFolder : Folder
|
||||
{
|
||||
public string CollectionType { get; set; }
|
||||
}
|
||||
}
|
|
@ -48,7 +48,6 @@
|
|||
<Compile Include="Entities\Person.cs" />
|
||||
<Compile Include="Entities\Studio.cs" />
|
||||
<Compile Include="Entities\Video.cs" />
|
||||
<Compile Include="Entities\VirtualFolder.cs" />
|
||||
<Compile Include="Entities\Year.cs" />
|
||||
<Compile Include="Plugins\BasePluginConfiguration.cs" />
|
||||
<Compile Include="DTO\PluginInfo.cs" />
|
||||
|
|
|
@ -13,10 +13,9 @@ namespace MediaBrowser.Movies.Resolvers
|
|||
protected override BoxSet Resolve(ItemResolveEventArgs args)
|
||||
{
|
||||
// It's a boxset if all of the following conditions are met:
|
||||
// It's under a 'Movies' VF
|
||||
// Is a Directory
|
||||
// Contains [boxset] in the path
|
||||
if ((args.VirtualFolderCollectionType ?? string.Empty).Equals("Movies", StringComparison.OrdinalIgnoreCase) && args.IsDirectory)
|
||||
if (args.IsDirectory)
|
||||
{
|
||||
if (Path.GetFileName(args.Path).IndexOf("[boxset]", StringComparison.OrdinalIgnoreCase) != -1)
|
||||
{
|
||||
|
|
|
@ -1,5 +1,4 @@
|
|||
using System;
|
||||
using System.ComponentModel.Composition;
|
||||
using System.ComponentModel.Composition;
|
||||
using MediaBrowser.Controller.IO;
|
||||
using MediaBrowser.Controller.Library;
|
||||
using MediaBrowser.Controller.Resolvers;
|
||||
|
@ -14,8 +13,17 @@ namespace MediaBrowser.Movies.Resolvers
|
|||
protected override Movie Resolve(ItemResolveEventArgs args)
|
||||
{
|
||||
// Must be a directory and under a 'Movies' VF
|
||||
if ((args.VirtualFolderCollectionType ?? string.Empty).Equals("Movies", StringComparison.OrdinalIgnoreCase) && args.IsDirectory)
|
||||
if (args.IsDirectory)
|
||||
{
|
||||
// If the parent is not a boxset, the only other allowed parent type is Folder
|
||||
if (!(args.Parent is BoxSet))
|
||||
{
|
||||
if (args.Parent != null && args.Parent.GetType() != typeof(Folder))
|
||||
{
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
// Return a movie if the video resolver finds something in the folder
|
||||
return GetMovie(args);
|
||||
}
|
||||
|
@ -73,25 +81,5 @@ namespace MediaBrowser.Movies.Resolvers
|
|||
|
||||
return null;
|
||||
}
|
||||
|
||||
/*private void PopulateBonusFeatures(Movie item, ItemResolveEventArgs args)
|
||||
{
|
||||
if (args.ContainsFolder("specials"))
|
||||
{
|
||||
List<Video> items = new List<Video>();
|
||||
|
||||
foreach (WIN32_FIND_DATA file in FileData.GetFileSystemEntries(Path.Combine(args.Path, "specials"), "*"))
|
||||
{
|
||||
Video video = await Kernel.Instance.ItemController.GetItem(file.Path, fileInfo: file).ConfigureAwait(false) as Video;
|
||||
|
||||
if (video != null)
|
||||
{
|
||||
items.Add(video);
|
||||
}
|
||||
}
|
||||
|
||||
(item as BaseItem).LocalTrailers = items;
|
||||
}
|
||||
}*/
|
||||
}
|
||||
}
|
||||
|
|
|
@ -15,6 +15,8 @@ namespace MediaBrowser.TV.Resolvers
|
|||
{
|
||||
Season season = new Season();
|
||||
|
||||
season.IndexNumber = TVUtils.GetSeasonNumberFromPath(args.Path);
|
||||
|
||||
// Gather these now so that the episode provider classes can utilize them instead of having to make their own file system calls
|
||||
if (args.ContainsFolder("metadata"))
|
||||
{
|
||||
|
|
|
@ -13,7 +13,7 @@ namespace MediaBrowser.TV.Resolvers
|
|||
{
|
||||
protected override Series Resolve(ItemResolveEventArgs args)
|
||||
{
|
||||
if (args.IsDirectory && (args.VirtualFolderCollectionType ?? string.Empty).Equals("TV", StringComparison.OrdinalIgnoreCase))
|
||||
if (args.IsDirectory)
|
||||
{
|
||||
// Optimization to avoid running these tests against Seasons
|
||||
if (args.Parent is Series)
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
using System.Linq;
|
||||
using System;
|
||||
using System.Text.RegularExpressions;
|
||||
using MediaBrowser.Controller.IO;
|
||||
|
||||
|
@ -6,15 +6,15 @@ namespace MediaBrowser.TV
|
|||
{
|
||||
public static class TVUtils
|
||||
{
|
||||
private static readonly Regex[] seasonPathExpressions = new Regex[] {
|
||||
new Regex(@".+\\[s|S]eason\s?(?<seasonnumber>\d{1,2})$"),
|
||||
new Regex(@".+\\[s|S]æson\s?(?<seasonnumber>\d{1,2})$"),
|
||||
new Regex(@".+\\[t|T]emporada\s?(?<seasonnumber>\d{1,2})$"),
|
||||
new Regex(@".+\\[s|S]aison\s?(?<seasonnumber>\d{1,2})$"),
|
||||
new Regex(@".+\\[s|S]taffel\s?(?<seasonnumber>\d{1,2})$"),
|
||||
new Regex(@".+\\[s|S](?<seasonnumber>\d{1,2})$"),
|
||||
new Regex(@".+\\[s|S]eason\s?(?<seasonnumber>\d{1,2})[^\\]*$")
|
||||
|
||||
/// <summary>
|
||||
/// A season folder must contain one of these somewhere in the name
|
||||
/// </summary>
|
||||
private static string[] SeasonFolderNames = new string[] {
|
||||
"season",
|
||||
"sæson",
|
||||
"temporada",
|
||||
"saison",
|
||||
"staffel"
|
||||
};
|
||||
|
||||
/// <summary>
|
||||
|
@ -28,27 +28,74 @@ namespace MediaBrowser.TV
|
|||
/// The most restrictive expressions should appear first
|
||||
/// </remarks>
|
||||
private static readonly Regex[] episodeExpressions = new Regex[] {
|
||||
new Regex(@".*\\[s|S]?(?<seasonnumber>\d{1,2})[x|X](?<epnumber>\d{1,3})[^\\]*$"), // 01x02 blah.avi S01x01 balh.avi
|
||||
new Regex(@".*\\[s|S](?<seasonnumber>\d{1,2})x?[e|E](?<epnumber>\d{1,3})[^\\]*$"), // S01E02 blah.avi, S01xE01 blah.avi
|
||||
new Regex(@".*\\(?<seriesname>[^\\]*)[s|S]?(?<seasonnumber>\d{1,2})[x|X](?<epnumber>\d{1,3})[^\\]*$"), // 01x02 blah.avi S01x01 balh.avi
|
||||
new Regex(@".*\\(?<seriesname>[^\\]*)[s|S](?<seasonnumber>\d{1,2})[x|X|\.]?[e|E](?<epnumber>\d{1,3})[^\\]*$") // S01E02 blah.avi, S01xE01 blah.avi
|
||||
new Regex(@".*\\[s|S]?(?<seasonnumber>\d{1,2})[x|X](?<epnumber>\d{1,3})[^\\]*$", RegexOptions.Compiled), // 01x02 blah.avi S01x01 balh.avi
|
||||
new Regex(@".*\\[s|S](?<seasonnumber>\d{1,2})x?[e|E](?<epnumber>\d{1,3})[^\\]*$", RegexOptions.Compiled), // S01E02 blah.avi, S01xE01 blah.avi
|
||||
new Regex(@".*\\(?<seriesname>[^\\]*)[s|S]?(?<seasonnumber>\d{1,2})[x|X](?<epnumber>\d{1,3})[^\\]*$", RegexOptions.Compiled), // 01x02 blah.avi S01x01 balh.avi
|
||||
new Regex(@".*\\(?<seriesname>[^\\]*)[s|S](?<seasonnumber>\d{1,2})[x|X|\.]?[e|E](?<epnumber>\d{1,3})[^\\]*$", RegexOptions.Compiled) // S01E02 blah.avi, S01xE01 blah.avi
|
||||
};
|
||||
/// <summary>
|
||||
/// To avoid the following matching movies they are only valid when contained in a folder which has been matched as a being season
|
||||
/// </summary>
|
||||
private static readonly Regex[] episodeExpressionsInASeasonFolder = new Regex[] {
|
||||
new Regex(@".*\\(?<epnumber>\d{1,2})\s?-\s?[^\\]*$"), // 01 - blah.avi, 01-blah.avi
|
||||
new Regex(@".*\\(?<epnumber>\d{1,2})[^\d\\]*[^\\]*$"), // 01.avi, 01.blah.avi "01 - 22 blah.avi"
|
||||
new Regex(@".*\\(?<seasonnumber>\d)(?<epnumber>\d{1,2})[^\d\\]+[^\\]*$"), // 01.avi, 01.blah.avi
|
||||
new Regex(@".*\\\D*\d+(?<epnumber>\d{2})") // hell0 - 101 - hello.avi
|
||||
new Regex(@".*\\(?<epnumber>\d{1,2})\s?-\s?[^\\]*$", RegexOptions.Compiled), // 01 - blah.avi, 01-blah.avi
|
||||
new Regex(@".*\\(?<epnumber>\d{1,2})[^\d\\]*[^\\]*$", RegexOptions.Compiled), // 01.avi, 01.blah.avi "01 - 22 blah.avi"
|
||||
new Regex(@".*\\(?<seasonnumber>\d)(?<epnumber>\d{1,2})[^\d\\]+[^\\]*$", RegexOptions.Compiled), // 01.avi, 01.blah.avi
|
||||
new Regex(@".*\\\D*\d+(?<epnumber>\d{2})", RegexOptions.Compiled) // hell0 - 101 - hello.avi
|
||||
|
||||
};
|
||||
|
||||
public static int? GetSeasonNumberFromPath(string path)
|
||||
{
|
||||
// Look for one of the season folder names
|
||||
foreach (string name in SeasonFolderNames)
|
||||
{
|
||||
int index = path.IndexOf(name, StringComparison.OrdinalIgnoreCase);
|
||||
|
||||
if (index != -1)
|
||||
{
|
||||
return GetSeasonNumberFromPathSubstring(path.Substring(index + name.Length));
|
||||
}
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Extracts the season number from the second half of the Season folder name (everything after "Season", or "Staffel")
|
||||
/// </summary>
|
||||
private static int? GetSeasonNumberFromPathSubstring(string path)
|
||||
{
|
||||
int numericStart = -1;
|
||||
int length = 0;
|
||||
|
||||
// Find out where the numbers start, and then keep going until they end
|
||||
for (int i = 0; i < path.Length; i++)
|
||||
{
|
||||
if (char.IsNumber(path, i))
|
||||
{
|
||||
if (numericStart == -1)
|
||||
{
|
||||
numericStart = i;
|
||||
}
|
||||
length++;
|
||||
}
|
||||
else if (numericStart != -1)
|
||||
{
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (numericStart == -1)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
return int.Parse(path.Substring(numericStart, length));
|
||||
}
|
||||
|
||||
public static bool IsSeasonFolder(string path)
|
||||
{
|
||||
path = path.ToLower();
|
||||
|
||||
return seasonPathExpressions.Any(r => r.IsMatch(path));
|
||||
return GetSeasonNumberFromPath(path) != null;
|
||||
}
|
||||
|
||||
public static bool IsSeriesFolder(string path, WIN32_FIND_DATA[] fileSystemChildren)
|
||||
|
|
Loading…
Reference in New Issue
Block a user