Skip to content

Commit

Permalink
tweak: split tmdb logo configuration.
Browse files Browse the repository at this point in the history
  • Loading branch information
cxfksword committed Feb 7, 2024
1 parent 10c3414 commit 3c054cf
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,12 @@ public class PluginConfiguration : BasePluginConfiguration
/// 启用tmdb获取背景图
/// </summary>
public bool EnableTmdbBackdrop { get; set; } = true;

/// <summary>
/// 启用tmdb获取商标
/// </summary>
public bool EnableTmdbLogo { get; set; } = true;

/// <summary>
/// 是否获取电影系列信息
/// </summary>
Expand Down
14 changes: 12 additions & 2 deletions Jellyfin.Plugin.MetaShark/Configuration/configPage.html
Original file line number Diff line number Diff line change
Expand Up @@ -94,9 +94,17 @@ <h3>TheMovieDb</h3>
<label class="emby-checkbox-label" for="EnableTmdbBackdrop">
<input id="EnableTmdbBackdrop" name="EnableTmdbBackdrop" type="checkbox"
is="emby-checkbox" />
<span>使用TheMovieDb补全背景图和商标</span>
<span>使用TheMovieDb补全背景图</span>
</label>
<div class="fieldDescription">勾选后,当影片在豆瓣找不到背景图或商标时,改使用TheMovieDb的补全</div>
<div class="fieldDescription">勾选后,当影片在豆瓣找不到背景图时,改使用TheMovieDb的补全</div>
</div>
<div class="checkboxContainer checkboxContainer-withDescription">
<label class="emby-checkbox-label" for="EnableTmdbLogo">
<input id="EnableTmdbLogo" name="EnableTmdbLogo" type="checkbox"
is="emby-checkbox" />
<span>从TheMovieDb获取商标</span>
</label>
<div class="fieldDescription">勾选后,使用TheMovieDb的商标图片补全</div>
</div>
<div class="checkboxContainer checkboxContainer-withDescription">
<label class="emby-checkbox-label" for="EnableTmdbCollection">
Expand Down Expand Up @@ -178,6 +186,7 @@ <h3>TheMovieDb</h3>
document.querySelector('#EnableTmdb').checked = config.EnableTmdb;
document.querySelector('#EnableTmdbSearch').checked = config.EnableTmdbSearch;
document.querySelector('#EnableTmdbBackdrop').checked = config.EnableTmdbBackdrop;
document.querySelector('#EnableTmdbLogo').checked = config.EnableTmdbLogo;
document.querySelector('#EnableTmdbCollection').checked = config.EnableTmdbCollection;
document.querySelector('#EnableTmdbOfficialRating').checked = config.EnableTmdbOfficialRating;
document.querySelector('#TmdbApiKey').value = config.TmdbApiKey;
Expand Down Expand Up @@ -207,6 +216,7 @@ <h3>TheMovieDb</h3>
config.EnableTmdb = document.querySelector('#EnableTmdb').checked;
config.EnableTmdbSearch = document.querySelector('#EnableTmdbSearch').checked;
config.EnableTmdbBackdrop = document.querySelector('#EnableTmdbBackdrop').checked;
config.EnableTmdbLogo = document.querySelector('#EnableTmdbLogo').checked;
config.EnableTmdbCollection = document.querySelector('#EnableTmdbCollection').checked;
config.EnableTmdbOfficialRating = document.querySelector('#EnableTmdbOfficialRating').checked;
config.TmdbApiKey = document.querySelector('#TmdbApiKey').value;
Expand Down
3 changes: 2 additions & 1 deletion Jellyfin.Plugin.MetaShark/Providers/MovieImageProvider.cs
Original file line number Diff line number Diff line change
Expand Up @@ -200,8 +200,9 @@ private async Task<IEnumerable<RemoteImageInfo>> GetLogos(BaseItem item, Cancell
var tmdbId = item.GetProviderId(MetadataProvider.Tmdb);
var list = new List<RemoteImageInfo>();
var language = item.GetPreferredMetadataLanguage();
if (this.config.EnableTmdbBackdrop && !string.IsNullOrEmpty(tmdbId))
if (this.config.EnableTmdbLogo && !string.IsNullOrEmpty(tmdbId))
{
this.Log("GetLogos from tmdb id: {0} lang: {1}", tmdbId, language);
var movie = await this._tmdbApi
.GetMovieAsync(tmdbId.ToInt(), language, language, cancellationToken)
.ConfigureAwait(false);
Expand Down
3 changes: 2 additions & 1 deletion Jellyfin.Plugin.MetaShark/Providers/SeriesImageProvider.cs
Original file line number Diff line number Diff line change
Expand Up @@ -200,8 +200,9 @@ private async Task<IEnumerable<RemoteImageInfo>> GetLogos(BaseItem item, Cancell
var tmdbId = item.GetProviderId(MetadataProvider.Tmdb);
var language = item.GetPreferredMetadataLanguage();
var list = new List<RemoteImageInfo>();
if (this.config.EnableTmdbBackdrop && !string.IsNullOrEmpty(tmdbId))
if (this.config.EnableTmdbLogo && !string.IsNullOrEmpty(tmdbId))
{
this.Log("GetLogos from tmdb id: {0} lang: {1}", tmdbId, language);
var movie = await this._tmdbApi
.GetSeriesAsync(tmdbId.ToInt(), language, language, cancellationToken)
.ConfigureAwait(false);
Expand Down

0 comments on commit 3c054cf

Please sign in to comment.