mirror of
https://github.com/jellyfin/jellyfin.git
synced 2025-07-09 03:04:24 -04:00
update naming methods
This commit is contained in:
parent
5fdd7ec672
commit
049ef9b4ec
@ -333,7 +333,7 @@ namespace MediaBrowser.Api.UserLibrary
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
var items = result.Item1.Items.Where(i => ApplyAdditionalFilters(request, i, user, false));
|
var items = result.Item1.Items.Where(i => ApplyAdditionalFilters(request, i, user, false, _libraryManager));
|
||||||
|
|
||||||
// Apply filters
|
// Apply filters
|
||||||
// Run them starting with the ones that are likely to reduce the list the most
|
// Run them starting with the ones that are likely to reduce the list the most
|
||||||
@ -467,7 +467,7 @@ namespace MediaBrowser.Api.UserLibrary
|
|||||||
SortBy = request.GetOrderBy(),
|
SortBy = request.GetOrderBy(),
|
||||||
SortOrder = request.SortOrder ?? SortOrder.Ascending,
|
SortOrder = request.SortOrder ?? SortOrder.Ascending,
|
||||||
|
|
||||||
Filter = (i, u) => ApplyAdditionalFilters(request, i, u, true),
|
Filter = (i, u) => ApplyAdditionalFilters(request, i, u, true, _libraryManager),
|
||||||
|
|
||||||
Limit = request.Limit,
|
Limit = request.Limit,
|
||||||
StartIndex = request.StartIndex,
|
StartIndex = request.StartIndex,
|
||||||
@ -635,7 +635,7 @@ namespace MediaBrowser.Api.UserLibrary
|
|||||||
return items;
|
return items;
|
||||||
}
|
}
|
||||||
|
|
||||||
private bool ApplyAdditionalFilters(GetItems request, BaseItem i, User user, bool isPreFiltered)
|
private bool ApplyAdditionalFilters(GetItems request, BaseItem i, User user, bool isPreFiltered, ILibraryManager libraryManager)
|
||||||
{
|
{
|
||||||
if (!isPreFiltered)
|
if (!isPreFiltered)
|
||||||
{
|
{
|
||||||
@ -773,7 +773,7 @@ namespace MediaBrowser.Api.UserLibrary
|
|||||||
{
|
{
|
||||||
var filterValue = request.IsYearMismatched.Value;
|
var filterValue = request.IsYearMismatched.Value;
|
||||||
|
|
||||||
if (UserViewBuilder.IsYearMismatched(i) != filterValue)
|
if (UserViewBuilder.IsYearMismatched(i, libraryManager) != filterValue)
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -186,15 +186,18 @@ namespace MediaBrowser.Common.Implementations.Security
|
|||||||
string mb2Equivalent = null,
|
string mb2Equivalent = null,
|
||||||
string version = null)
|
string version = null)
|
||||||
{
|
{
|
||||||
|
var lastChecked = LicenseFile.LastChecked(feature);
|
||||||
|
|
||||||
//check the reg file first to alleviate strain on the MB admin server - must actually check in every 30 days tho
|
//check the reg file first to alleviate strain on the MB admin server - must actually check in every 30 days tho
|
||||||
var reg = new RegRecord
|
var reg = new RegRecord
|
||||||
{
|
{
|
||||||
registered = LicenseFile.LastChecked(feature) > DateTime.UtcNow.AddDays(-3)
|
// Cache the result for up to a week
|
||||||
|
registered = lastChecked > DateTime.UtcNow.AddDays(-7)
|
||||||
};
|
};
|
||||||
|
|
||||||
var success = reg.registered;
|
var success = reg.registered;
|
||||||
|
|
||||||
if (!reg.registered)
|
if (!(lastChecked > DateTime.UtcNow.AddDays(-1)))
|
||||||
{
|
{
|
||||||
var mac = _networkManager.GetMacAddress();
|
var mac = _networkManager.GetMacAddress();
|
||||||
var data = new Dictionary<string, string>
|
var data = new Dictionary<string, string>
|
||||||
|
@ -1,5 +1,4 @@
|
|||||||
using MediaBrowser.Controller.Providers;
|
using System;
|
||||||
using System;
|
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
|
|
||||||
namespace MediaBrowser.Controller.Entities
|
namespace MediaBrowser.Controller.Entities
|
||||||
@ -16,26 +15,5 @@ namespace MediaBrowser.Controller.Entities
|
|||||||
Taglines = new List<string>();
|
Taglines = new List<string>();
|
||||||
ProductionLocations = new List<string>();
|
ProductionLocations = new List<string>();
|
||||||
}
|
}
|
||||||
|
|
||||||
public override bool BeforeMetadataRefresh()
|
|
||||||
{
|
|
||||||
var hasChanges = base.BeforeMetadataRefresh();
|
|
||||||
|
|
||||||
if (!ProductionYear.HasValue)
|
|
||||||
{
|
|
||||||
int? yearInName = null;
|
|
||||||
string name;
|
|
||||||
|
|
||||||
NameParser.ParseName(Name, out name, out yearInName);
|
|
||||||
|
|
||||||
if (yearInName.HasValue)
|
|
||||||
{
|
|
||||||
ProductionYear = yearInName;
|
|
||||||
hasChanges = true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return hasChanges;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -149,10 +149,9 @@ namespace MediaBrowser.Controller.Entities.Movies
|
|||||||
|
|
||||||
if (!ProductionYear.HasValue)
|
if (!ProductionYear.HasValue)
|
||||||
{
|
{
|
||||||
int? yearInName = null;
|
var info = LibraryManager.ParseName(Name);
|
||||||
string name;
|
|
||||||
|
|
||||||
NameParser.ParseName(Name, out name, out yearInName);
|
var yearInName = info.Year;
|
||||||
|
|
||||||
if (yearInName.HasValue)
|
if (yearInName.HasValue)
|
||||||
{
|
{
|
||||||
|
@ -255,10 +255,9 @@ namespace MediaBrowser.Controller.Entities.TV
|
|||||||
|
|
||||||
if (!ProductionYear.HasValue)
|
if (!ProductionYear.HasValue)
|
||||||
{
|
{
|
||||||
int? yearInName = null;
|
var info = LibraryManager.ParseName(Name);
|
||||||
string name;
|
|
||||||
|
|
||||||
NameParser.ParseName(Name, out name, out yearInName);
|
var yearInName = info.Year;
|
||||||
|
|
||||||
if (yearInName.HasValue)
|
if (yearInName.HasValue)
|
||||||
{
|
{
|
||||||
|
@ -740,7 +740,7 @@ namespace MediaBrowser.Controller.Entities
|
|||||||
{
|
{
|
||||||
var user = query.User;
|
var user = query.User;
|
||||||
|
|
||||||
items = items.Where(i => Filter(i, user, query, userDataManager));
|
items = items.Where(i => Filter(i, user, query, userDataManager, libraryManager));
|
||||||
|
|
||||||
items = FilterVirtualEpisodes(items,
|
items = FilterVirtualEpisodes(items,
|
||||||
query.IsMissing,
|
query.IsMissing,
|
||||||
@ -1140,7 +1140,7 @@ namespace MediaBrowser.Controller.Entities
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
private static bool Filter(BaseItem item, User user, InternalItemsQuery query, IUserDataManager userDataManager)
|
private static bool Filter(BaseItem item, User user, InternalItemsQuery query, IUserDataManager userDataManager, ILibraryManager libraryManager)
|
||||||
{
|
{
|
||||||
if (query.MediaTypes.Length > 0 && !query.MediaTypes.Contains(item.MediaType ?? string.Empty, StringComparer.OrdinalIgnoreCase))
|
if (query.MediaTypes.Length > 0 && !query.MediaTypes.Contains(item.MediaType ?? string.Empty, StringComparer.OrdinalIgnoreCase))
|
||||||
{
|
{
|
||||||
@ -1321,7 +1321,7 @@ namespace MediaBrowser.Controller.Entities
|
|||||||
{
|
{
|
||||||
var filterValue = query.IsYearMismatched.Value;
|
var filterValue = query.IsYearMismatched.Value;
|
||||||
|
|
||||||
if (IsYearMismatched(item) != filterValue)
|
if (IsYearMismatched(item, libraryManager) != filterValue)
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@ -1641,7 +1641,7 @@ namespace MediaBrowser.Controller.Entities
|
|||||||
return view;
|
return view;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static bool IsYearMismatched(BaseItem item)
|
public static bool IsYearMismatched(BaseItem item, ILibraryManager libraryManager)
|
||||||
{
|
{
|
||||||
if (item.ProductionYear.HasValue)
|
if (item.ProductionYear.HasValue)
|
||||||
{
|
{
|
||||||
@ -1649,14 +1649,14 @@ namespace MediaBrowser.Controller.Entities
|
|||||||
|
|
||||||
if (!string.IsNullOrEmpty(path))
|
if (!string.IsNullOrEmpty(path))
|
||||||
{
|
{
|
||||||
int? yearInName;
|
var info = libraryManager.ParseName(Path.GetFileName(path));
|
||||||
string name;
|
var yearInName = info.Year;
|
||||||
NameParser.ParseName(Path.GetFileName(path), out name, out yearInName);
|
|
||||||
|
|
||||||
// Go up a level if we didn't get a year
|
// Go up a level if we didn't get a year
|
||||||
if (!yearInName.HasValue)
|
if (!yearInName.HasValue)
|
||||||
{
|
{
|
||||||
NameParser.ParseName(Path.GetFileName(Path.GetDirectoryName(path)), out name, out yearInName);
|
info = libraryManager.ParseName(Path.GetFileName(Path.GetDirectoryName(path)));
|
||||||
|
yearInName = info.Year;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (yearInName.HasValue)
|
if (yearInName.HasValue)
|
||||||
|
@ -361,6 +361,11 @@ namespace MediaBrowser.Controller.Library
|
|||||||
/// <returns><c>true</c> if [is video file] [the specified path]; otherwise, <c>false</c>.</returns>
|
/// <returns><c>true</c> if [is video file] [the specified path]; otherwise, <c>false</c>.</returns>
|
||||||
bool IsVideoFile(string path);
|
bool IsVideoFile(string path);
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Determines whether [is audio file] [the specified path].
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="path">The path.</param>
|
||||||
|
/// <returns><c>true</c> if [is audio file] [the specified path]; otherwise, <c>false</c>.</returns>
|
||||||
bool IsAudioFile(string path);
|
bool IsAudioFile(string path);
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@ -405,5 +410,12 @@ namespace MediaBrowser.Controller.Library
|
|||||||
/// <param name="considerSeasonless">if set to <c>true</c> [consider seasonless].</param>
|
/// <param name="considerSeasonless">if set to <c>true</c> [consider seasonless].</param>
|
||||||
/// <returns>System.Nullable<System.Int32>.</returns>
|
/// <returns>System.Nullable<System.Int32>.</returns>
|
||||||
int? GetEpisodeNumberFromFile(string path, bool considerSeasonless);
|
int? GetEpisodeNumberFromFile(string path, bool considerSeasonless);
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Parses the name.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="name">The name.</param>
|
||||||
|
/// <returns>ItemInfo.</returns>
|
||||||
|
ItemLookupInfo ParseName(string name);
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -266,7 +266,6 @@
|
|||||||
<Compile Include="Providers\ItemIdentities.cs" />
|
<Compile Include="Providers\ItemIdentities.cs" />
|
||||||
<Compile Include="Providers\ItemLookupInfo.cs" />
|
<Compile Include="Providers\ItemLookupInfo.cs" />
|
||||||
<Compile Include="Providers\MetadataRefreshOptions.cs" />
|
<Compile Include="Providers\MetadataRefreshOptions.cs" />
|
||||||
<Compile Include="Providers\NameParser.cs" />
|
|
||||||
<Compile Include="Providers\MetadataStatus.cs" />
|
<Compile Include="Providers\MetadataStatus.cs" />
|
||||||
<Compile Include="Providers\ISeriesOrderManager.cs" />
|
<Compile Include="Providers\ISeriesOrderManager.cs" />
|
||||||
<Compile Include="Session\ISessionManager.cs" />
|
<Compile Include="Session\ISessionManager.cs" />
|
||||||
|
@ -1,39 +0,0 @@
|
|||||||
using System;
|
|
||||||
using System.Text.RegularExpressions;
|
|
||||||
|
|
||||||
namespace MediaBrowser.Controller.Providers
|
|
||||||
{
|
|
||||||
public static class NameParser
|
|
||||||
{
|
|
||||||
static readonly Regex[] NameMatches =
|
|
||||||
{
|
|
||||||
new Regex(@"(?<name>.*)\((?<year>\d{4})\)"), // matches "My Movie (2001)" and gives us the name and the year
|
|
||||||
new Regex(@"(?<name>.*)(\.(?<year>\d{4})(\.|$)).*$"),
|
|
||||||
new Regex(@"(?<name>.*)") // last resort matches the whole string as the name
|
|
||||||
};
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Parses the name.
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="name">The name.</param>
|
|
||||||
/// <param name="justName">Name of the just.</param>
|
|
||||||
/// <param name="year">The year.</param>
|
|
||||||
public static void ParseName(string name, out string justName, out int? year)
|
|
||||||
{
|
|
||||||
justName = null;
|
|
||||||
year = null;
|
|
||||||
foreach (var re in NameMatches)
|
|
||||||
{
|
|
||||||
Match m = re.Match(name);
|
|
||||||
if (m.Success)
|
|
||||||
{
|
|
||||||
justName = m.Groups["name"].Value.Trim();
|
|
||||||
string y = m.Groups["year"] != null ? m.Groups["year"].Value : null;
|
|
||||||
int temp;
|
|
||||||
year = Int32.TryParse(y, out temp) ? temp : (int?)null;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
@ -55,7 +55,7 @@
|
|||||||
</Reference>
|
</Reference>
|
||||||
<Reference Include="MediaBrowser.Naming, Version=1.0.0.0, Culture=neutral, processorArchitecture=MSIL">
|
<Reference Include="MediaBrowser.Naming, Version=1.0.0.0, Culture=neutral, processorArchitecture=MSIL">
|
||||||
<SpecificVersion>False</SpecificVersion>
|
<SpecificVersion>False</SpecificVersion>
|
||||||
<HintPath>..\packages\MediaBrowser.Naming.1.0.0.1\lib\portable-net45+sl4+wp71+win8+wpa81\MediaBrowser.Naming.dll</HintPath>
|
<HintPath>..\packages\MediaBrowser.Naming.1.0.0.2\lib\portable-net45+sl4+wp71+win8+wpa81\MediaBrowser.Naming.dll</HintPath>
|
||||||
</Reference>
|
</Reference>
|
||||||
<Reference Include="MoreLinq, Version=1.1.17511.0, Culture=neutral, PublicKeyToken=384d532d7e88985d, processorArchitecture=MSIL">
|
<Reference Include="MoreLinq, Version=1.1.17511.0, Culture=neutral, PublicKeyToken=384d532d7e88985d, processorArchitecture=MSIL">
|
||||||
<SpecificVersion>False</SpecificVersion>
|
<SpecificVersion>False</SpecificVersion>
|
||||||
|
@ -1,4 +1,5 @@
|
|||||||
using MediaBrowser.Common.Net;
|
using MediaBrowser.Common.Net;
|
||||||
|
using MediaBrowser.Controller.Library;
|
||||||
using MediaBrowser.Controller.Providers;
|
using MediaBrowser.Controller.Providers;
|
||||||
using MediaBrowser.Model.Entities;
|
using MediaBrowser.Model.Entities;
|
||||||
using MediaBrowser.Model.Logging;
|
using MediaBrowser.Model.Logging;
|
||||||
@ -24,6 +25,7 @@ namespace MediaBrowser.Providers.Movies
|
|||||||
|
|
||||||
private readonly ILogger _logger;
|
private readonly ILogger _logger;
|
||||||
private readonly IJsonSerializer _json;
|
private readonly IJsonSerializer _json;
|
||||||
|
private ILibraryManager _libraryManager;
|
||||||
|
|
||||||
public MovieDbSearch(ILogger logger, IJsonSerializer json)
|
public MovieDbSearch(ILogger logger, IJsonSerializer json)
|
||||||
{
|
{
|
||||||
@ -50,13 +52,14 @@ namespace MediaBrowser.Providers.Movies
|
|||||||
{
|
{
|
||||||
var name = idInfo.Name;
|
var name = idInfo.Name;
|
||||||
var year = idInfo.Year;
|
var year = idInfo.Year;
|
||||||
int? yearInName = null;
|
|
||||||
|
|
||||||
var tmdbSettings = await MovieDbProvider.Current.GetTmdbSettings(cancellationToken).ConfigureAwait(false);
|
var tmdbSettings = await MovieDbProvider.Current.GetTmdbSettings(cancellationToken).ConfigureAwait(false);
|
||||||
|
|
||||||
var tmdbImageUrl = tmdbSettings.images.base_url + "original";
|
var tmdbImageUrl = tmdbSettings.images.base_url + "original";
|
||||||
|
|
||||||
NameParser.ParseName(name, out name, out yearInName);
|
var parsedName = _libraryManager.ParseName(name);
|
||||||
|
var yearInName = parsedName.Year;
|
||||||
|
name = parsedName.Name;
|
||||||
|
|
||||||
year = year ?? yearInName;
|
year = year ?? yearInName;
|
||||||
|
|
||||||
|
@ -37,8 +37,9 @@ namespace MediaBrowser.Providers.TV
|
|||||||
private readonly CultureInfo _usCulture = new CultureInfo("en-US");
|
private readonly CultureInfo _usCulture = new CultureInfo("en-US");
|
||||||
private readonly ILogger _logger;
|
private readonly ILogger _logger;
|
||||||
private readonly ISeriesOrderManager _seriesOrder;
|
private readonly ISeriesOrderManager _seriesOrder;
|
||||||
|
private readonly ILibraryManager _libraryManager;
|
||||||
|
|
||||||
public TvdbSeriesProvider(IZipClient zipClient, IHttpClient httpClient, IFileSystem fileSystem, IServerConfigurationManager config, ILogger logger, ISeriesOrderManager seriesOrder)
|
public TvdbSeriesProvider(IZipClient zipClient, IHttpClient httpClient, IFileSystem fileSystem, IServerConfigurationManager config, ILogger logger, ISeriesOrderManager seriesOrder, ILibraryManager libraryManager)
|
||||||
{
|
{
|
||||||
_zipClient = zipClient;
|
_zipClient = zipClient;
|
||||||
_httpClient = httpClient;
|
_httpClient = httpClient;
|
||||||
@ -46,6 +47,7 @@ namespace MediaBrowser.Providers.TV
|
|||||||
_config = config;
|
_config = config;
|
||||||
_logger = logger;
|
_logger = logger;
|
||||||
_seriesOrder = seriesOrder;
|
_seriesOrder = seriesOrder;
|
||||||
|
_libraryManager = libraryManager;
|
||||||
Current = this;
|
Current = this;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -282,9 +284,8 @@ namespace MediaBrowser.Providers.TV
|
|||||||
|
|
||||||
if (results.Count == 0)
|
if (results.Count == 0)
|
||||||
{
|
{
|
||||||
int? yearInName = null;
|
var parsedName = _libraryManager.ParseName(name);
|
||||||
string nameWithoutYear;
|
var nameWithoutYear = parsedName.Name;
|
||||||
NameParser.ParseName(name, out nameWithoutYear, out yearInName);
|
|
||||||
|
|
||||||
if (!string.IsNullOrEmpty(nameWithoutYear) && !string.Equals(nameWithoutYear, name, StringComparison.OrdinalIgnoreCase))
|
if (!string.IsNullOrEmpty(nameWithoutYear) && !string.Equals(nameWithoutYear, name, StringComparison.OrdinalIgnoreCase))
|
||||||
{
|
{
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<packages>
|
<packages>
|
||||||
<package id="MediaBrowser.BdInfo" version="1.0.0.10" targetFramework="net45" />
|
<package id="MediaBrowser.BdInfo" version="1.0.0.10" targetFramework="net45" />
|
||||||
<package id="MediaBrowser.Naming" version="1.0.0.1" targetFramework="net45" />
|
<package id="MediaBrowser.Naming" version="1.0.0.2" targetFramework="net45" />
|
||||||
<package id="morelinq" version="1.1.0" targetFramework="net45" />
|
<package id="morelinq" version="1.1.0" targetFramework="net45" />
|
||||||
<package id="taglib" version="2.1.0.0" targetFramework="net45" />
|
<package id="taglib" version="2.1.0.0" targetFramework="net45" />
|
||||||
</packages>
|
</packages>
|
@ -321,9 +321,10 @@ namespace MediaBrowser.Server.Implementations.FileOrganization
|
|||||||
|
|
||||||
private Series GetMatchingSeries(string seriesName, FileOrganizationResult result)
|
private Series GetMatchingSeries(string seriesName, FileOrganizationResult result)
|
||||||
{
|
{
|
||||||
int? yearInName;
|
var parsedName = _libraryManager.ParseName(seriesName);
|
||||||
var nameWithoutYear = seriesName;
|
|
||||||
NameParser.ParseName(nameWithoutYear, out nameWithoutYear, out yearInName);
|
var yearInName = parsedName.Year;
|
||||||
|
var nameWithoutYear = parsedName.Name;
|
||||||
|
|
||||||
result.ExtractedName = nameWithoutYear;
|
result.ExtractedName = nameWithoutYear;
|
||||||
result.ExtractedYear = yearInName;
|
result.ExtractedYear = yearInName;
|
||||||
|
@ -21,7 +21,6 @@ using MediaBrowser.Naming.Video;
|
|||||||
using MediaBrowser.Server.Implementations.Library.Resolvers.TV;
|
using MediaBrowser.Server.Implementations.Library.Resolvers.TV;
|
||||||
using MediaBrowser.Server.Implementations.Library.Validators;
|
using MediaBrowser.Server.Implementations.Library.Validators;
|
||||||
using MediaBrowser.Server.Implementations.ScheduledTasks;
|
using MediaBrowser.Server.Implementations.ScheduledTasks;
|
||||||
using MoreLinq;
|
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Concurrent;
|
using System.Collections.Concurrent;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
@ -1635,8 +1634,8 @@ namespace MediaBrowser.Server.Implementations.Library
|
|||||||
|
|
||||||
public bool IsVideoFile(string path)
|
public bool IsVideoFile(string path)
|
||||||
{
|
{
|
||||||
var parser = new VideoFileParser(new ExpandedVideoOptions(), new Naming.Logging.NullLogger());
|
var resolver = new VideoResolver(new ExpandedVideoOptions(), new AudioOptions(), new Naming.Logging.NullLogger());
|
||||||
return parser.IsVideoFile(path);
|
return resolver.IsVideoFile(path);
|
||||||
}
|
}
|
||||||
|
|
||||||
public bool IsAudioFile(string path)
|
public bool IsAudioFile(string path)
|
||||||
@ -1647,13 +1646,13 @@ namespace MediaBrowser.Server.Implementations.Library
|
|||||||
|
|
||||||
public bool IsMultiPartFile(string path)
|
public bool IsMultiPartFile(string path)
|
||||||
{
|
{
|
||||||
var parser = new MultiPartParser(new ExpandedVideoOptions(), new Naming.Logging.NullLogger());
|
var parser = new MultiPartParser(new ExpandedVideoOptions(), new AudioOptions(), new Naming.Logging.NullLogger());
|
||||||
return parser.Parse(path, FileInfoType.File).IsMultiPart;
|
return parser.Parse(path, FileInfoType.File).IsMultiPart;
|
||||||
}
|
}
|
||||||
|
|
||||||
public bool IsMultiPartFolder(string path)
|
public bool IsMultiPartFolder(string path)
|
||||||
{
|
{
|
||||||
var parser = new MultiPartParser(new ExpandedVideoOptions(), new Naming.Logging.NullLogger());
|
var parser = new MultiPartParser(new ExpandedVideoOptions(), new AudioOptions(), new Naming.Logging.NullLogger());
|
||||||
return parser.Parse(path, FileInfoType.Directory).IsMultiPart;
|
return parser.Parse(path, FileInfoType.Directory).IsMultiPart;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1676,5 +1675,18 @@ namespace MediaBrowser.Server.Implementations.Library
|
|||||||
{
|
{
|
||||||
return SeriesResolver.GetEpisodeNumberFromFile(path, considerSeasonless);
|
return SeriesResolver.GetEpisodeNumberFromFile(path, considerSeasonless);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public ItemLookupInfo ParseName(string name)
|
||||||
|
{
|
||||||
|
var resolver = new VideoResolver(new ExpandedVideoOptions(), new AudioOptions(), new Naming.Logging.NullLogger());
|
||||||
|
|
||||||
|
var result = resolver.CleanDateTime(name);
|
||||||
|
|
||||||
|
return new ItemLookupInfo
|
||||||
|
{
|
||||||
|
Name = result.Name,
|
||||||
|
Year = result.Year
|
||||||
|
};
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
using MediaBrowser.Controller.Entities;
|
using MediaBrowser.Controller.Entities;
|
||||||
using MediaBrowser.Controller.Library;
|
using MediaBrowser.Controller.Library;
|
||||||
using MediaBrowser.Model.Entities;
|
using MediaBrowser.Model.Entities;
|
||||||
|
using MediaBrowser.Naming.Audio;
|
||||||
using MediaBrowser.Naming.Video;
|
using MediaBrowser.Naming.Video;
|
||||||
using System;
|
using System;
|
||||||
|
|
||||||
@ -42,8 +43,8 @@ namespace MediaBrowser.Server.Implementations.Library.Resolvers
|
|||||||
// If the path is a file check for a matching extensions
|
// If the path is a file check for a matching extensions
|
||||||
if (!args.IsDirectory)
|
if (!args.IsDirectory)
|
||||||
{
|
{
|
||||||
var parser = new VideoFileParser(new ExpandedVideoOptions(), new Naming.Logging.NullLogger());
|
var parser = new Naming.Video.VideoResolver(new ExpandedVideoOptions(), new AudioOptions(), new Naming.Logging.NullLogger());
|
||||||
var videoInfo = parser.ParseFile(args.Path);
|
var videoInfo = parser.ResolveFile(args.Path);
|
||||||
|
|
||||||
if (videoInfo == null)
|
if (videoInfo == null)
|
||||||
{
|
{
|
||||||
@ -67,7 +68,8 @@ namespace MediaBrowser.Server.Implementations.Library.Resolvers
|
|||||||
IsInMixedFolder = true,
|
IsInMixedFolder = true,
|
||||||
IsPlaceHolder = videoInfo.IsStub,
|
IsPlaceHolder = videoInfo.IsStub,
|
||||||
IsShortcut = isShortcut,
|
IsShortcut = isShortcut,
|
||||||
Name = videoInfo.Name
|
Name = videoInfo.Name,
|
||||||
|
ProductionYear = videoInfo.Year
|
||||||
};
|
};
|
||||||
|
|
||||||
if (videoInfo.IsStub)
|
if (videoInfo.IsStub)
|
||||||
|
@ -70,6 +70,10 @@ namespace MediaBrowser.Server.Implementations.Library.Resolvers.TV
|
|||||||
|
|
||||||
if (episode != null)
|
if (episode != null)
|
||||||
{
|
{
|
||||||
|
// The base video resolver is going to fill these in, so null them out
|
||||||
|
episode.ProductionYear = null;
|
||||||
|
episode.Name = null;
|
||||||
|
|
||||||
if (season != null)
|
if (season != null)
|
||||||
{
|
{
|
||||||
episode.ParentIndexNumber = season.IndexNumber;
|
episode.ParentIndexNumber = season.IndexNumber;
|
||||||
|
@ -51,7 +51,7 @@
|
|||||||
</Reference>
|
</Reference>
|
||||||
<Reference Include="MediaBrowser.Naming, Version=1.0.0.0, Culture=neutral, processorArchitecture=MSIL">
|
<Reference Include="MediaBrowser.Naming, Version=1.0.0.0, Culture=neutral, processorArchitecture=MSIL">
|
||||||
<SpecificVersion>False</SpecificVersion>
|
<SpecificVersion>False</SpecificVersion>
|
||||||
<HintPath>..\packages\MediaBrowser.Naming.1.0.0.1\lib\portable-net45+sl4+wp71+win8+wpa81\MediaBrowser.Naming.dll</HintPath>
|
<HintPath>..\packages\MediaBrowser.Naming.1.0.0.2\lib\portable-net45+sl4+wp71+win8+wpa81\MediaBrowser.Naming.dll</HintPath>
|
||||||
</Reference>
|
</Reference>
|
||||||
<Reference Include="Mono.Nat, Version=1.2.21.0, Culture=neutral, processorArchitecture=MSIL">
|
<Reference Include="Mono.Nat, Version=1.2.21.0, Culture=neutral, processorArchitecture=MSIL">
|
||||||
<SpecificVersion>False</SpecificVersion>
|
<SpecificVersion>False</SpecificVersion>
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<packages>
|
<packages>
|
||||||
<package id="MediaBrowser.Naming" version="1.0.0.1" targetFramework="net45" />
|
<package id="MediaBrowser.Naming" version="1.0.0.2" targetFramework="net45" />
|
||||||
<package id="Mono.Nat" version="1.2.21.0" targetFramework="net45" />
|
<package id="Mono.Nat" version="1.2.21.0" targetFramework="net45" />
|
||||||
<package id="morelinq" version="1.1.0" targetFramework="net45" />
|
<package id="morelinq" version="1.1.0" targetFramework="net45" />
|
||||||
</packages>
|
</packages>
|
@ -3,6 +3,7 @@ using MediaBrowser.Controller.Entities;
|
|||||||
using MediaBrowser.Controller.Entities.TV;
|
using MediaBrowser.Controller.Entities.TV;
|
||||||
using MediaBrowser.Model.Logging;
|
using MediaBrowser.Model.Logging;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
|
using System.Globalization;
|
||||||
using System.Xml;
|
using System.Xml;
|
||||||
|
|
||||||
namespace MediaBrowser.XbmcMetadata.Parsers
|
namespace MediaBrowser.XbmcMetadata.Parsers
|
||||||
@ -31,7 +32,7 @@ namespace MediaBrowser.XbmcMetadata.Parsers
|
|||||||
{
|
{
|
||||||
int num;
|
int num;
|
||||||
|
|
||||||
if (int.TryParse(number, out num))
|
if (int.TryParse(number, NumberStyles.Integer, CultureInfo.InvariantCulture, out num))
|
||||||
{
|
{
|
||||||
item.IndexNumber = num;
|
item.IndexNumber = num;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user