mirror of
https://github.com/jellyfin/jellyfin.git
synced 2024-11-15 09:59:06 -07:00
add one year tolerance to movie lookups
This commit is contained in:
parent
385e52c9eb
commit
e2b3320f80
@ -22,6 +22,7 @@ namespace MediaBrowser.Api
|
||||
{
|
||||
[Route("/Items/{Id}/ExternalIdInfos", "GET")]
|
||||
[Api(Description = "Gets external id infos for an item")]
|
||||
[Authenticated]
|
||||
public class GetExternalIdInfos : IReturn<List<ExternalIdInfo>>
|
||||
{
|
||||
/// <summary>
|
||||
@ -34,54 +35,63 @@ namespace MediaBrowser.Api
|
||||
|
||||
[Route("/Items/RemoteSearch/Movie", "POST")]
|
||||
[Api(Description = "Gets external id infos for an item")]
|
||||
[Authenticated]
|
||||
public class GetMovieRemoteSearchResults : RemoteSearchQuery<MovieInfo>, IReturn<List<RemoteSearchResult>>
|
||||
{
|
||||
}
|
||||
|
||||
[Route("/Items/RemoteSearch/Trailer", "POST")]
|
||||
[Api(Description = "Gets external id infos for an item")]
|
||||
[Authenticated]
|
||||
public class GetTrailerRemoteSearchResults : RemoteSearchQuery<TrailerInfo>, IReturn<List<RemoteSearchResult>>
|
||||
{
|
||||
}
|
||||
|
||||
[Route("/Items/RemoteSearch/AdultVideo", "POST")]
|
||||
[Api(Description = "Gets external id infos for an item")]
|
||||
[Authenticated]
|
||||
public class GetAdultVideoRemoteSearchResults : RemoteSearchQuery<ItemLookupInfo>, IReturn<List<RemoteSearchResult>>
|
||||
{
|
||||
}
|
||||
|
||||
[Route("/Items/RemoteSearch/Series", "POST")]
|
||||
[Api(Description = "Gets external id infos for an item")]
|
||||
[Authenticated]
|
||||
public class GetSeriesRemoteSearchResults : RemoteSearchQuery<SeriesInfo>, IReturn<List<RemoteSearchResult>>
|
||||
{
|
||||
}
|
||||
|
||||
[Route("/Items/RemoteSearch/Game", "POST")]
|
||||
[Api(Description = "Gets external id infos for an item")]
|
||||
[Authenticated]
|
||||
public class GetGameRemoteSearchResults : RemoteSearchQuery<GameInfo>, IReturn<List<RemoteSearchResult>>
|
||||
{
|
||||
}
|
||||
|
||||
[Route("/Items/RemoteSearch/BoxSet", "POST")]
|
||||
[Api(Description = "Gets external id infos for an item")]
|
||||
[Authenticated]
|
||||
public class GetBoxSetRemoteSearchResults : RemoteSearchQuery<BoxSetInfo>, IReturn<List<RemoteSearchResult>>
|
||||
{
|
||||
}
|
||||
|
||||
[Route("/Items/RemoteSearch/MusicArtist", "POST")]
|
||||
[Api(Description = "Gets external id infos for an item")]
|
||||
[Authenticated]
|
||||
public class GetMusicArtistRemoteSearchResults : RemoteSearchQuery<ArtistInfo>, IReturn<List<RemoteSearchResult>>
|
||||
{
|
||||
}
|
||||
|
||||
[Route("/Items/RemoteSearch/MusicAlbum", "POST")]
|
||||
[Api(Description = "Gets external id infos for an item")]
|
||||
[Authenticated]
|
||||
public class GetMusicAlbumRemoteSearchResults : RemoteSearchQuery<AlbumInfo>, IReturn<List<RemoteSearchResult>>
|
||||
{
|
||||
}
|
||||
|
||||
[Route("/Items/RemoteSearch/Person", "POST")]
|
||||
[Api(Description = "Gets external id infos for an item")]
|
||||
[Authenticated]
|
||||
public class GetPersonRemoteSearchResults : RemoteSearchQuery<PersonLookupInfo>, IReturn<List<RemoteSearchResult>>
|
||||
{
|
||||
}
|
||||
@ -99,13 +109,13 @@ namespace MediaBrowser.Api
|
||||
|
||||
[Route("/Items/RemoteSearch/Apply/{Id}", "POST")]
|
||||
[Api(Description = "Applies search criteria to an item and refreshes metadata")]
|
||||
[Authenticated]
|
||||
public class ApplySearchCriteria : RemoteSearchResult, IReturnVoid
|
||||
{
|
||||
[ApiMember(Name = "Id", Description = "The item id", IsRequired = true, DataType = "string", ParameterType = "query", Verb = "GET")]
|
||||
public string Id { get; set; }
|
||||
}
|
||||
|
||||
[Authenticated]
|
||||
public class ItemLookupService : BaseApiService
|
||||
{
|
||||
private readonly IProviderManager _providerManager;
|
||||
|
@ -57,6 +57,16 @@ namespace MediaBrowser.Api.Playback.Hls
|
||||
{
|
||||
var result = GetAsync(request).Result;
|
||||
|
||||
if (string.Equals(request.AudioCodec, "copy", StringComparison.OrdinalIgnoreCase))
|
||||
{
|
||||
throw new ArgumentException("Audio codec copy is not allowed here.");
|
||||
}
|
||||
|
||||
if (string.Equals(request.VideoCodec, "copy", StringComparison.OrdinalIgnoreCase))
|
||||
{
|
||||
throw new ArgumentException("Video codec copy is not allowed here.");
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
|
@ -91,7 +91,7 @@ namespace MediaBrowser.Model.Dlna
|
||||
|
||||
if (StringHelper.EqualsIgnoreCase(Protocol, "hls"))
|
||||
{
|
||||
return string.Format("{0}/videos/{1}/stream.m3u8?{2}", baseUrl, ItemId, dlnaCommand);
|
||||
return string.Format("{0}/videos/{1}/master.m3u8?{2}", baseUrl, ItemId, dlnaCommand);
|
||||
}
|
||||
|
||||
return string.Format("{0}/videos/{1}/stream{2}?{3}", baseUrl, ItemId, extension, dlnaCommand);
|
||||
|
@ -109,7 +109,8 @@ namespace MediaBrowser.Providers.Movies
|
||||
{
|
||||
if (year.HasValue && i.ProductionYear.HasValue)
|
||||
{
|
||||
return year.Value == i.ProductionYear.Value;
|
||||
// Allow one year tolerance
|
||||
return Math.Abs(year.Value - i.ProductionYear.Value) <= 1;
|
||||
}
|
||||
|
||||
return true;
|
||||
@ -177,11 +178,19 @@ namespace MediaBrowser.Providers.Movies
|
||||
// These dates are always in this exact format
|
||||
if (DateTime.TryParseExact(result.release_date, "yyyy-MM-dd", EnUs, DateTimeStyles.None, out r))
|
||||
{
|
||||
return Math.Abs(r.Year - year.Value);
|
||||
// Allow one year tolernace, preserve order from Tmdb
|
||||
var variance = Math.Abs(r.Year - year.Value);
|
||||
|
||||
if (variance <= 1)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
return variance;
|
||||
}
|
||||
}
|
||||
|
||||
return 0;
|
||||
return int.MaxValue;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
@ -95,7 +95,7 @@ namespace MediaBrowser.Providers.TV
|
||||
{
|
||||
var offset = TvdbSeriesProvider.GetSeriesOffset(series.ProviderIds);
|
||||
if (offset != null)
|
||||
return (int) (seasonNumber + offset);
|
||||
return (seasonNumber + offset.Value);
|
||||
|
||||
return seasonNumber;
|
||||
}
|
||||
|
@ -18,7 +18,12 @@ namespace MediaBrowser.Server.Implementations.Library
|
||||
|
||||
public IEnumerable<Audio> GetInstantMixFromSong(Audio item, User user)
|
||||
{
|
||||
return GetInstantMixFromGenres(item.Genres, user);
|
||||
var list = new List<Audio>
|
||||
{
|
||||
item
|
||||
};
|
||||
|
||||
return list.Concat(GetInstantMixFromGenres(item.Genres, user));
|
||||
}
|
||||
|
||||
public IEnumerable<Audio> GetInstantMixFromArtist(string name, User user)
|
||||
@ -39,7 +44,7 @@ namespace MediaBrowser.Server.Implementations.Library
|
||||
public IEnumerable<Audio> GetInstantMixFromAlbum(MusicAlbum item, User user)
|
||||
{
|
||||
var genres = item
|
||||
.RecursiveChildren
|
||||
.GetRecursiveChildren(user, true)
|
||||
.OfType<Audio>()
|
||||
.SelectMany(i => i.Genres)
|
||||
.Concat(item.Genres)
|
||||
@ -57,6 +62,7 @@ namespace MediaBrowser.Server.Implementations.Library
|
||||
return inputItems
|
||||
.OfType<Audio>()
|
||||
.Select(i => new Tuple<Audio, int>(i, i.Genres.Count(genresDictionary.ContainsKey)))
|
||||
.Where(i => i.Item2 > 0)
|
||||
.OrderByDescending(i => i.Item2)
|
||||
.ThenBy(i => Guid.NewGuid())
|
||||
.Select(i => i.Item1)
|
||||
|
@ -858,5 +858,7 @@
|
||||
"TabBranding": "Branding",
|
||||
"HeaderBrandingHelp": "Customize the appearance of Media Browser to fit the needs of your group or organization.",
|
||||
"LabelLoginDisclaimer": "Login disclaimer:",
|
||||
"LabelLoginDisclaimerHelp": "This will be displayed at the bottom of the login page."
|
||||
"LabelLoginDisclaimerHelp": "This will be displayed at the bottom of the login page.",
|
||||
"LabelAutomaticallyDonate": "Automatically donate this amount each month",
|
||||
"LabelAutomaticallyDonateHelp": "You can cancel at any time via your PayPal account."
|
||||
}
|
Loading…
Reference in New Issue
Block a user