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")]
|
[Route("/Items/{Id}/ExternalIdInfos", "GET")]
|
||||||
[Api(Description = "Gets external id infos for an item")]
|
[Api(Description = "Gets external id infos for an item")]
|
||||||
|
[Authenticated]
|
||||||
public class GetExternalIdInfos : IReturn<List<ExternalIdInfo>>
|
public class GetExternalIdInfos : IReturn<List<ExternalIdInfo>>
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
@ -34,54 +35,63 @@ namespace MediaBrowser.Api
|
||||||
|
|
||||||
[Route("/Items/RemoteSearch/Movie", "POST")]
|
[Route("/Items/RemoteSearch/Movie", "POST")]
|
||||||
[Api(Description = "Gets external id infos for an item")]
|
[Api(Description = "Gets external id infos for an item")]
|
||||||
|
[Authenticated]
|
||||||
public class GetMovieRemoteSearchResults : RemoteSearchQuery<MovieInfo>, IReturn<List<RemoteSearchResult>>
|
public class GetMovieRemoteSearchResults : RemoteSearchQuery<MovieInfo>, IReturn<List<RemoteSearchResult>>
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
[Route("/Items/RemoteSearch/Trailer", "POST")]
|
[Route("/Items/RemoteSearch/Trailer", "POST")]
|
||||||
[Api(Description = "Gets external id infos for an item")]
|
[Api(Description = "Gets external id infos for an item")]
|
||||||
|
[Authenticated]
|
||||||
public class GetTrailerRemoteSearchResults : RemoteSearchQuery<TrailerInfo>, IReturn<List<RemoteSearchResult>>
|
public class GetTrailerRemoteSearchResults : RemoteSearchQuery<TrailerInfo>, IReturn<List<RemoteSearchResult>>
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
[Route("/Items/RemoteSearch/AdultVideo", "POST")]
|
[Route("/Items/RemoteSearch/AdultVideo", "POST")]
|
||||||
[Api(Description = "Gets external id infos for an item")]
|
[Api(Description = "Gets external id infos for an item")]
|
||||||
|
[Authenticated]
|
||||||
public class GetAdultVideoRemoteSearchResults : RemoteSearchQuery<ItemLookupInfo>, IReturn<List<RemoteSearchResult>>
|
public class GetAdultVideoRemoteSearchResults : RemoteSearchQuery<ItemLookupInfo>, IReturn<List<RemoteSearchResult>>
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
[Route("/Items/RemoteSearch/Series", "POST")]
|
[Route("/Items/RemoteSearch/Series", "POST")]
|
||||||
[Api(Description = "Gets external id infos for an item")]
|
[Api(Description = "Gets external id infos for an item")]
|
||||||
|
[Authenticated]
|
||||||
public class GetSeriesRemoteSearchResults : RemoteSearchQuery<SeriesInfo>, IReturn<List<RemoteSearchResult>>
|
public class GetSeriesRemoteSearchResults : RemoteSearchQuery<SeriesInfo>, IReturn<List<RemoteSearchResult>>
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
[Route("/Items/RemoteSearch/Game", "POST")]
|
[Route("/Items/RemoteSearch/Game", "POST")]
|
||||||
[Api(Description = "Gets external id infos for an item")]
|
[Api(Description = "Gets external id infos for an item")]
|
||||||
|
[Authenticated]
|
||||||
public class GetGameRemoteSearchResults : RemoteSearchQuery<GameInfo>, IReturn<List<RemoteSearchResult>>
|
public class GetGameRemoteSearchResults : RemoteSearchQuery<GameInfo>, IReturn<List<RemoteSearchResult>>
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
[Route("/Items/RemoteSearch/BoxSet", "POST")]
|
[Route("/Items/RemoteSearch/BoxSet", "POST")]
|
||||||
[Api(Description = "Gets external id infos for an item")]
|
[Api(Description = "Gets external id infos for an item")]
|
||||||
|
[Authenticated]
|
||||||
public class GetBoxSetRemoteSearchResults : RemoteSearchQuery<BoxSetInfo>, IReturn<List<RemoteSearchResult>>
|
public class GetBoxSetRemoteSearchResults : RemoteSearchQuery<BoxSetInfo>, IReturn<List<RemoteSearchResult>>
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
[Route("/Items/RemoteSearch/MusicArtist", "POST")]
|
[Route("/Items/RemoteSearch/MusicArtist", "POST")]
|
||||||
[Api(Description = "Gets external id infos for an item")]
|
[Api(Description = "Gets external id infos for an item")]
|
||||||
|
[Authenticated]
|
||||||
public class GetMusicArtistRemoteSearchResults : RemoteSearchQuery<ArtistInfo>, IReturn<List<RemoteSearchResult>>
|
public class GetMusicArtistRemoteSearchResults : RemoteSearchQuery<ArtistInfo>, IReturn<List<RemoteSearchResult>>
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
[Route("/Items/RemoteSearch/MusicAlbum", "POST")]
|
[Route("/Items/RemoteSearch/MusicAlbum", "POST")]
|
||||||
[Api(Description = "Gets external id infos for an item")]
|
[Api(Description = "Gets external id infos for an item")]
|
||||||
|
[Authenticated]
|
||||||
public class GetMusicAlbumRemoteSearchResults : RemoteSearchQuery<AlbumInfo>, IReturn<List<RemoteSearchResult>>
|
public class GetMusicAlbumRemoteSearchResults : RemoteSearchQuery<AlbumInfo>, IReturn<List<RemoteSearchResult>>
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
[Route("/Items/RemoteSearch/Person", "POST")]
|
[Route("/Items/RemoteSearch/Person", "POST")]
|
||||||
[Api(Description = "Gets external id infos for an item")]
|
[Api(Description = "Gets external id infos for an item")]
|
||||||
|
[Authenticated]
|
||||||
public class GetPersonRemoteSearchResults : RemoteSearchQuery<PersonLookupInfo>, IReturn<List<RemoteSearchResult>>
|
public class GetPersonRemoteSearchResults : RemoteSearchQuery<PersonLookupInfo>, IReturn<List<RemoteSearchResult>>
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
@ -99,13 +109,13 @@ namespace MediaBrowser.Api
|
||||||
|
|
||||||
[Route("/Items/RemoteSearch/Apply/{Id}", "POST")]
|
[Route("/Items/RemoteSearch/Apply/{Id}", "POST")]
|
||||||
[Api(Description = "Applies search criteria to an item and refreshes metadata")]
|
[Api(Description = "Applies search criteria to an item and refreshes metadata")]
|
||||||
|
[Authenticated]
|
||||||
public class ApplySearchCriteria : RemoteSearchResult, IReturnVoid
|
public class ApplySearchCriteria : RemoteSearchResult, IReturnVoid
|
||||||
{
|
{
|
||||||
[ApiMember(Name = "Id", Description = "The item id", IsRequired = true, DataType = "string", ParameterType = "query", Verb = "GET")]
|
[ApiMember(Name = "Id", Description = "The item id", IsRequired = true, DataType = "string", ParameterType = "query", Verb = "GET")]
|
||||||
public string Id { get; set; }
|
public string Id { get; set; }
|
||||||
}
|
}
|
||||||
|
|
||||||
[Authenticated]
|
|
||||||
public class ItemLookupService : BaseApiService
|
public class ItemLookupService : BaseApiService
|
||||||
{
|
{
|
||||||
private readonly IProviderManager _providerManager;
|
private readonly IProviderManager _providerManager;
|
||||||
|
|
|
@ -57,6 +57,16 @@ namespace MediaBrowser.Api.Playback.Hls
|
||||||
{
|
{
|
||||||
var result = GetAsync(request).Result;
|
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;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -91,7 +91,7 @@ namespace MediaBrowser.Model.Dlna
|
||||||
|
|
||||||
if (StringHelper.EqualsIgnoreCase(Protocol, "hls"))
|
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);
|
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)
|
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;
|
return true;
|
||||||
|
@ -177,11 +178,19 @@ namespace MediaBrowser.Providers.Movies
|
||||||
// These dates are always in this exact format
|
// These dates are always in this exact format
|
||||||
if (DateTime.TryParseExact(result.release_date, "yyyy-MM-dd", EnUs, DateTimeStyles.None, out r))
|
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>
|
/// <summary>
|
||||||
|
|
|
@ -95,7 +95,7 @@ namespace MediaBrowser.Providers.TV
|
||||||
{
|
{
|
||||||
var offset = TvdbSeriesProvider.GetSeriesOffset(series.ProviderIds);
|
var offset = TvdbSeriesProvider.GetSeriesOffset(series.ProviderIds);
|
||||||
if (offset != null)
|
if (offset != null)
|
||||||
return (int) (seasonNumber + offset);
|
return (seasonNumber + offset.Value);
|
||||||
|
|
||||||
return seasonNumber;
|
return seasonNumber;
|
||||||
}
|
}
|
||||||
|
|
|
@ -18,7 +18,12 @@ namespace MediaBrowser.Server.Implementations.Library
|
||||||
|
|
||||||
public IEnumerable<Audio> GetInstantMixFromSong(Audio item, User user)
|
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)
|
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)
|
public IEnumerable<Audio> GetInstantMixFromAlbum(MusicAlbum item, User user)
|
||||||
{
|
{
|
||||||
var genres = item
|
var genres = item
|
||||||
.RecursiveChildren
|
.GetRecursiveChildren(user, true)
|
||||||
.OfType<Audio>()
|
.OfType<Audio>()
|
||||||
.SelectMany(i => i.Genres)
|
.SelectMany(i => i.Genres)
|
||||||
.Concat(item.Genres)
|
.Concat(item.Genres)
|
||||||
|
@ -57,6 +62,7 @@ namespace MediaBrowser.Server.Implementations.Library
|
||||||
return inputItems
|
return inputItems
|
||||||
.OfType<Audio>()
|
.OfType<Audio>()
|
||||||
.Select(i => new Tuple<Audio, int>(i, i.Genres.Count(genresDictionary.ContainsKey)))
|
.Select(i => new Tuple<Audio, int>(i, i.Genres.Count(genresDictionary.ContainsKey)))
|
||||||
|
.Where(i => i.Item2 > 0)
|
||||||
.OrderByDescending(i => i.Item2)
|
.OrderByDescending(i => i.Item2)
|
||||||
.ThenBy(i => Guid.NewGuid())
|
.ThenBy(i => Guid.NewGuid())
|
||||||
.Select(i => i.Item1)
|
.Select(i => i.Item1)
|
||||||
|
|
|
@ -858,5 +858,7 @@
|
||||||
"TabBranding": "Branding",
|
"TabBranding": "Branding",
|
||||||
"HeaderBrandingHelp": "Customize the appearance of Media Browser to fit the needs of your group or organization.",
|
"HeaderBrandingHelp": "Customize the appearance of Media Browser to fit the needs of your group or organization.",
|
||||||
"LabelLoginDisclaimer": "Login disclaimer:",
|
"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