mirror of
https://github.com/jellyfin/jellyfin.git
synced 2025-07-09 03:04:24 -04:00
commit
65c99a16de
@ -58,7 +58,7 @@ namespace MediaBrowser.Api.Movies
|
|||||||
|
|
||||||
getItems.IncludeItemTypes = "Trailer";
|
getItems.IncludeItemTypes = "Trailer";
|
||||||
|
|
||||||
return new ItemsService(_userManager, _libraryManager, _userDataRepository, _localizationManager, _dtoService, _collectionManager)
|
return new ItemsService(_userManager, _libraryManager, _localizationManager, _dtoService)
|
||||||
{
|
{
|
||||||
AuthorizationContext = AuthorizationContext,
|
AuthorizationContext = AuthorizationContext,
|
||||||
Logger = Logger,
|
Logger = Logger,
|
||||||
|
@ -48,11 +48,9 @@ namespace MediaBrowser.Api.UserLibrary
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="userManager">The user manager.</param>
|
/// <param name="userManager">The user manager.</param>
|
||||||
/// <param name="libraryManager">The library manager.</param>
|
/// <param name="libraryManager">The library manager.</param>
|
||||||
/// <param name="userDataRepository">The user data repository.</param>
|
|
||||||
/// <param name="localization">The localization.</param>
|
/// <param name="localization">The localization.</param>
|
||||||
/// <param name="dtoService">The dto service.</param>
|
/// <param name="dtoService">The dto service.</param>
|
||||||
/// <param name="collectionManager">The collection manager.</param>
|
public ItemsService(IUserManager userManager, ILibraryManager libraryManager, ILocalizationManager localization, IDtoService dtoService)
|
||||||
public ItemsService(IUserManager userManager, ILibraryManager libraryManager, IUserDataManager userDataRepository, ILocalizationManager localization, IDtoService dtoService, ICollectionManager collectionManager)
|
|
||||||
{
|
{
|
||||||
_userManager = userManager;
|
_userManager = userManager;
|
||||||
_libraryManager = libraryManager;
|
_libraryManager = libraryManager;
|
||||||
@ -302,7 +300,7 @@ namespace MediaBrowser.Api.UserLibrary
|
|||||||
{
|
{
|
||||||
query.LocationTypes = request.LocationTypes.Split(',').Select(d => (LocationType)Enum.Parse(typeof(LocationType), d, true)).ToArray();
|
query.LocationTypes = request.LocationTypes.Split(',').Select(d => (LocationType)Enum.Parse(typeof(LocationType), d, true)).ToArray();
|
||||||
}
|
}
|
||||||
|
|
||||||
// Min official rating
|
// Min official rating
|
||||||
if (!string.IsNullOrWhiteSpace(request.MinOfficialRating))
|
if (!string.IsNullOrWhiteSpace(request.MinOfficialRating))
|
||||||
{
|
{
|
||||||
|
@ -842,17 +842,17 @@ namespace MediaBrowser.Model.Dlna
|
|||||||
{
|
{
|
||||||
bool requiresConversion = !StringHelper.EqualsIgnoreCase(subtitleStream.Codec, profile.Format);
|
bool requiresConversion = !StringHelper.EqualsIgnoreCase(subtitleStream.Codec, profile.Format);
|
||||||
|
|
||||||
if (requiresConversion && !allowConversion)
|
|
||||||
{
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!requiresConversion)
|
if (!requiresConversion)
|
||||||
{
|
{
|
||||||
return profile;
|
return profile;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (subtitleStream.IsTextSubtitleStream && subtitleStream.SupportsExternalStream)
|
if (!allowConversion)
|
||||||
|
{
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (subtitleStream.IsTextSubtitleStream && subtitleStream.SupportsExternalStream && subtitleStream.SupportsSubtitleConversionTo(profile.Format))
|
||||||
{
|
{
|
||||||
return profile;
|
return profile;
|
||||||
}
|
}
|
||||||
|
@ -282,6 +282,36 @@ namespace MediaBrowser.Model.Entities
|
|||||||
!StringHelper.EqualsIgnoreCase(codec, "sub");
|
!StringHelper.EqualsIgnoreCase(codec, "sub");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public bool SupportsSubtitleConversionTo(string codec)
|
||||||
|
{
|
||||||
|
if (!IsTextSubtitleStream)
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Can't convert from this
|
||||||
|
if (StringHelper.EqualsIgnoreCase(Codec, "ass"))
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
if (StringHelper.EqualsIgnoreCase(Codec, "ssa"))
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Can't convert to this
|
||||||
|
if (StringHelper.EqualsIgnoreCase(codec, "ass"))
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
if (StringHelper.EqualsIgnoreCase(codec, "ssa"))
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets or sets a value indicating whether [supports external stream].
|
/// Gets or sets a value indicating whether [supports external stream].
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
@ -83,7 +83,7 @@ namespace MediaBrowser.Providers.BoxSets
|
|||||||
VoteCount = i.vote_count,
|
VoteCount = i.vote_count,
|
||||||
Width = i.width,
|
Width = i.width,
|
||||||
Height = i.height,
|
Height = i.height,
|
||||||
Language = i.iso_639_1,
|
Language = MovieDbProvider.AdjustImageLanguage(i.iso_639_1, language),
|
||||||
ProviderName = Name,
|
ProviderName = Name,
|
||||||
Type = ImageType.Primary,
|
Type = ImageType.Primary,
|
||||||
RatingType = RatingType.Score
|
RatingType = RatingType.Score
|
||||||
|
@ -63,6 +63,8 @@ namespace MediaBrowser.Providers.Movies
|
|||||||
{
|
{
|
||||||
var list = new List<RemoteImageInfo>();
|
var list = new List<RemoteImageInfo>();
|
||||||
|
|
||||||
|
var language = item.GetPreferredMetadataLanguage();
|
||||||
|
|
||||||
var results = await FetchImages((BaseItem)item, null, _jsonSerializer, cancellationToken).ConfigureAwait(false);
|
var results = await FetchImages((BaseItem)item, null, _jsonSerializer, cancellationToken).ConfigureAwait(false);
|
||||||
|
|
||||||
if (results == null)
|
if (results == null)
|
||||||
@ -85,7 +87,7 @@ namespace MediaBrowser.Providers.Movies
|
|||||||
VoteCount = i.vote_count,
|
VoteCount = i.vote_count,
|
||||||
Width = i.width,
|
Width = i.width,
|
||||||
Height = i.height,
|
Height = i.height,
|
||||||
Language = i.iso_639_1,
|
Language = MovieDbProvider.AdjustImageLanguage(i.iso_639_1, language),
|
||||||
ProviderName = Name,
|
ProviderName = Name,
|
||||||
Type = ImageType.Primary,
|
Type = ImageType.Primary,
|
||||||
RatingType = RatingType.Score
|
RatingType = RatingType.Score
|
||||||
@ -107,8 +109,6 @@ namespace MediaBrowser.Providers.Movies
|
|||||||
}));
|
}));
|
||||||
}
|
}
|
||||||
|
|
||||||
var language = item.GetPreferredMetadataLanguage();
|
|
||||||
|
|
||||||
var isLanguageEn = string.Equals(language, "en", StringComparison.OrdinalIgnoreCase);
|
var isLanguageEn = string.Equals(language, "en", StringComparison.OrdinalIgnoreCase);
|
||||||
|
|
||||||
return list.OrderByDescending(i =>
|
return list.OrderByDescending(i =>
|
||||||
|
@ -267,9 +267,21 @@ namespace MediaBrowser.Providers.Movies
|
|||||||
|
|
||||||
if (!string.IsNullOrEmpty(preferredLanguage))
|
if (!string.IsNullOrEmpty(preferredLanguage))
|
||||||
{
|
{
|
||||||
|
preferredLanguage = NormalizeLanguage(preferredLanguage);
|
||||||
|
|
||||||
languages.Add(preferredLanguage);
|
languages.Add(preferredLanguage);
|
||||||
|
|
||||||
|
if (preferredLanguage.Length == 5) // like en-US
|
||||||
|
{
|
||||||
|
// Currenty, TMDB supports 2-letter language codes only
|
||||||
|
// They are planning to change this in the future, thus we're
|
||||||
|
// supplying both codes if we're having a 5-letter code.
|
||||||
|
languages.Add(preferredLanguage.Substring(0, 2));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
languages.Add("null");
|
languages.Add("null");
|
||||||
|
|
||||||
if (!string.Equals(preferredLanguage, "en", StringComparison.OrdinalIgnoreCase))
|
if (!string.Equals(preferredLanguage, "en", StringComparison.OrdinalIgnoreCase))
|
||||||
{
|
{
|
||||||
languages.Add("en");
|
languages.Add("en");
|
||||||
@ -280,18 +292,35 @@ namespace MediaBrowser.Providers.Movies
|
|||||||
|
|
||||||
public static string NormalizeLanguage(string language)
|
public static string NormalizeLanguage(string language)
|
||||||
{
|
{
|
||||||
// They require this to be uppercase
|
if (!string.IsNullOrEmpty(language))
|
||||||
// https://emby.media/community/index.php?/topic/32454-fr-follow-tmdbs-new-language-api-update/?p=311148
|
|
||||||
var parts = language.Split('-');
|
|
||||||
|
|
||||||
if (parts.Length == 2)
|
|
||||||
{
|
{
|
||||||
language = parts[0] + "-" + parts[1].ToUpper();
|
// They require this to be uppercase
|
||||||
|
// https://emby.media/community/index.php?/topic/32454-fr-follow-tmdbs-new-language-api-update/?p=311148
|
||||||
|
var parts = language.Split('-');
|
||||||
|
|
||||||
|
if (parts.Length == 2)
|
||||||
|
{
|
||||||
|
language = parts[0] + "-" + parts[1].ToUpper();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return language;
|
return language;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static string AdjustImageLanguage(string imageLanguage, string requestLanguage)
|
||||||
|
{
|
||||||
|
if (!string.IsNullOrEmpty(imageLanguage)
|
||||||
|
&& !string.IsNullOrEmpty(requestLanguage)
|
||||||
|
&& requestLanguage.Length > 2
|
||||||
|
&& imageLanguage.Length == 2
|
||||||
|
&& requestLanguage.StartsWith(imageLanguage, StringComparison.OrdinalIgnoreCase))
|
||||||
|
{
|
||||||
|
return requestLanguage;
|
||||||
|
}
|
||||||
|
|
||||||
|
return imageLanguage;
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Fetches the main result.
|
/// Fetches the main result.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
@ -57,8 +57,10 @@ namespace MediaBrowser.Providers.TV
|
|||||||
return list;
|
return list;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
var language = item.GetPreferredMetadataLanguage();
|
||||||
|
|
||||||
var response = await GetEpisodeInfo(seriesId, seasonNumber.Value, episodeNumber.Value,
|
var response = await GetEpisodeInfo(seriesId, seasonNumber.Value, episodeNumber.Value,
|
||||||
item.GetPreferredMetadataLanguage(), cancellationToken).ConfigureAwait(false);
|
language, cancellationToken).ConfigureAwait(false);
|
||||||
|
|
||||||
var tmdbSettings = await MovieDbProvider.Current.GetTmdbSettings(cancellationToken).ConfigureAwait(false);
|
var tmdbSettings = await MovieDbProvider.Current.GetTmdbSettings(cancellationToken).ConfigureAwait(false);
|
||||||
|
|
||||||
@ -71,12 +73,12 @@ namespace MediaBrowser.Providers.TV
|
|||||||
VoteCount = i.vote_count,
|
VoteCount = i.vote_count,
|
||||||
Width = i.width,
|
Width = i.width,
|
||||||
Height = i.height,
|
Height = i.height,
|
||||||
|
Language = MovieDbProvider.AdjustImageLanguage(i.iso_639_1, language),
|
||||||
ProviderName = Name,
|
ProviderName = Name,
|
||||||
Type = ImageType.Primary,
|
Type = ImageType.Primary,
|
||||||
RatingType = RatingType.Score
|
RatingType = RatingType.Score
|
||||||
}));
|
}));
|
||||||
|
|
||||||
var language = item.GetPreferredMetadataLanguage();
|
|
||||||
|
|
||||||
var isLanguageEn = string.Equals(language, "en", StringComparison.OrdinalIgnoreCase);
|
var isLanguageEn = string.Equals(language, "en", StringComparison.OrdinalIgnoreCase);
|
||||||
|
|
||||||
|
@ -151,7 +151,7 @@ namespace MediaBrowser.Providers.TV
|
|||||||
public string file_path { get; set; }
|
public string file_path { get; set; }
|
||||||
public int height { get; set; }
|
public int height { get; set; }
|
||||||
public string id { get; set; }
|
public string id { get; set; }
|
||||||
public object iso_639_1 { get; set; }
|
public string iso_639_1 { get; set; }
|
||||||
public double vote_average { get; set; }
|
public double vote_average { get; set; }
|
||||||
public int vote_count { get; set; }
|
public int vote_count { get; set; }
|
||||||
public int width { get; set; }
|
public int width { get; set; }
|
||||||
|
@ -66,6 +66,8 @@ namespace MediaBrowser.Providers.TV
|
|||||||
|
|
||||||
var tmdbImageUrl = tmdbSettings.images.secure_base_url + "original";
|
var tmdbImageUrl = tmdbSettings.images.secure_base_url + "original";
|
||||||
|
|
||||||
|
var language = item.GetPreferredMetadataLanguage();
|
||||||
|
|
||||||
list.AddRange(GetPosters(results).Select(i => new RemoteImageInfo
|
list.AddRange(GetPosters(results).Select(i => new RemoteImageInfo
|
||||||
{
|
{
|
||||||
Url = tmdbImageUrl + i.file_path,
|
Url = tmdbImageUrl + i.file_path,
|
||||||
@ -73,7 +75,7 @@ namespace MediaBrowser.Providers.TV
|
|||||||
VoteCount = i.vote_count,
|
VoteCount = i.vote_count,
|
||||||
Width = i.width,
|
Width = i.width,
|
||||||
Height = i.height,
|
Height = i.height,
|
||||||
Language = i.iso_639_1,
|
Language = MovieDbProvider.AdjustImageLanguage(i.iso_639_1, language),
|
||||||
ProviderName = Name,
|
ProviderName = Name,
|
||||||
Type = ImageType.Primary,
|
Type = ImageType.Primary,
|
||||||
RatingType = RatingType.Score
|
RatingType = RatingType.Score
|
||||||
@ -91,8 +93,6 @@ namespace MediaBrowser.Providers.TV
|
|||||||
RatingType = RatingType.Score
|
RatingType = RatingType.Score
|
||||||
}));
|
}));
|
||||||
|
|
||||||
var language = item.GetPreferredMetadataLanguage();
|
|
||||||
|
|
||||||
var isLanguageEn = string.Equals(language, "en", StringComparison.OrdinalIgnoreCase);
|
var isLanguageEn = string.Equals(language, "en", StringComparison.OrdinalIgnoreCase);
|
||||||
|
|
||||||
return list.OrderByDescending(i =>
|
return list.OrderByDescending(i =>
|
||||||
|
@ -1320,20 +1320,14 @@ namespace MediaBrowser.Server.Implementations.Channels
|
|||||||
item.Tags = info.Tags;
|
item.Tags = info.Tags;
|
||||||
item.HomePageUrl = info.HomePageUrl;
|
item.HomePageUrl = info.HomePageUrl;
|
||||||
}
|
}
|
||||||
else
|
else if (info.Type == ChannelItemType.Folder && info.FolderType == ChannelFolderType.Container)
|
||||||
{
|
{
|
||||||
// Can't do this right now due to channels that utilize the server's metadata services
|
// At least update names of container folders
|
||||||
//if (item.Name != info.Name)
|
if (item.Name != info.Name)
|
||||||
//{
|
{
|
||||||
// item.Name = info.Name;
|
item.Name = info.Name;
|
||||||
// forceUpdate = true;
|
forceUpdate = true;
|
||||||
//}
|
}
|
||||||
|
|
||||||
//if (item.CommunityRating != info.CommunityRating)
|
|
||||||
//{
|
|
||||||
// item.CommunityRating = info.CommunityRating;
|
|
||||||
// forceUpdate = true;
|
|
||||||
//}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
var hasArtists = item as IHasArtist;
|
var hasArtists = item as IHasArtist;
|
||||||
|
@ -69,14 +69,6 @@ namespace MediaBrowser.Server.Implementations.Library
|
|||||||
|
|
||||||
if (stream.IsTextSubtitleStream)
|
if (stream.IsTextSubtitleStream)
|
||||||
{
|
{
|
||||||
if (string.Equals(stream.Codec, "ass", StringComparison.OrdinalIgnoreCase))
|
|
||||||
{
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
if (string.Equals(stream.Codec, "ssa", StringComparison.OrdinalIgnoreCase))
|
|
||||||
{
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -8,7 +8,7 @@ namespace MediaBrowser.Server.Implementations.Persistence
|
|||||||
{
|
{
|
||||||
public abstract class BaseSqliteRepository : IDisposable
|
public abstract class BaseSqliteRepository : IDisposable
|
||||||
{
|
{
|
||||||
protected readonly SemaphoreSlim WriteLock = new SemaphoreSlim(1, 1);
|
protected SemaphoreSlim WriteLock = new SemaphoreSlim(1, 1);
|
||||||
protected readonly IDbConnector DbConnector;
|
protected readonly IDbConnector DbConnector;
|
||||||
protected ILogger Logger;
|
protected ILogger Logger;
|
||||||
|
|
||||||
|
@ -328,7 +328,7 @@ namespace MediaBrowser.Server.Implementations.Persistence
|
|||||||
new MediaStreamColumns(_connection, Logger).AddColumns();
|
new MediaStreamColumns(_connection, Logger).AddColumns();
|
||||||
|
|
||||||
DataExtensions.Attach(_connection, Path.Combine(_config.ApplicationPaths.DataPath, "userdata_v2.db"), "UserDataDb");
|
DataExtensions.Attach(_connection, Path.Combine(_config.ApplicationPaths.DataPath, "userdata_v2.db"), "UserDataDb");
|
||||||
await userDataRepo.Initialize(_connection).ConfigureAwait(false);
|
await userDataRepo.Initialize(_connection, WriteLock).ConfigureAwait(false);
|
||||||
//await Vacuum(_connection).ConfigureAwait(false);
|
//await Vacuum(_connection).ConfigureAwait(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -56,8 +56,10 @@ namespace MediaBrowser.Server.Implementations.Persistence
|
|||||||
/// Opens the connection to the database
|
/// Opens the connection to the database
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <returns>Task.</returns>
|
/// <returns>Task.</returns>
|
||||||
public async Task Initialize(IDbConnection connection)
|
public async Task Initialize(IDbConnection connection, SemaphoreSlim writeLock)
|
||||||
{
|
{
|
||||||
|
WriteLock.Dispose();
|
||||||
|
WriteLock = writeLock;
|
||||||
_connection = connection;
|
_connection = connection;
|
||||||
|
|
||||||
string[] queries = {
|
string[] queries = {
|
||||||
@ -438,18 +440,14 @@ namespace MediaBrowser.Server.Implementations.Persistence
|
|||||||
return userData;
|
return userData;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected override void Dispose(bool dispose)
|
||||||
|
{
|
||||||
|
// handled by library database
|
||||||
|
}
|
||||||
|
|
||||||
protected override void CloseConnection()
|
protected override void CloseConnection()
|
||||||
{
|
{
|
||||||
if (_connection != null)
|
// handled by library database
|
||||||
{
|
|
||||||
if (_connection.IsOpen())
|
|
||||||
{
|
|
||||||
_connection.Close();
|
|
||||||
}
|
|
||||||
|
|
||||||
_connection.Dispose();
|
|
||||||
_connection = null;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
Loading…
x
Reference in New Issue
Block a user