mirror of
https://github.com/jellyfin/jellyfin-plugin-anilist.git
synced 2024-11-27 00:00:24 +00:00
Merge pull request #65 from mmshivesh/feature-add-language-filter
This commit is contained in:
commit
b04ed7ddb1
@ -25,12 +25,19 @@ namespace Jellyfin.Plugin.AniList.Configuration
|
||||
None, Anime, Animation
|
||||
}
|
||||
|
||||
public enum LanguageFilterType {
|
||||
Localized,
|
||||
Japanese,
|
||||
All
|
||||
}
|
||||
|
||||
public class PluginConfiguration : BasePluginConfiguration
|
||||
{
|
||||
public PluginConfiguration()
|
||||
{
|
||||
TitlePreference = TitlePreferenceType.Localized;
|
||||
OriginalTitlePreference = TitlePreferenceType.JapaneseRomaji;
|
||||
PersonLanguageFilterPreference = LanguageFilterType.All;
|
||||
MaxGenres = 5;
|
||||
AnimeDefaultGenre = AnimeDefaultGenreType.Anime;
|
||||
AniDbRateLimit = 2000;
|
||||
@ -43,6 +50,8 @@ namespace Jellyfin.Plugin.AniList.Configuration
|
||||
|
||||
public TitlePreferenceType OriginalTitlePreference { get; set; }
|
||||
|
||||
public LanguageFilterType PersonLanguageFilterPreference { get; set; }
|
||||
|
||||
public int MaxGenres { get; set; }
|
||||
|
||||
public AnimeDefaultGenreType AnimeDefaultGenre { get; set; }
|
||||
@ -53,8 +62,6 @@ namespace Jellyfin.Plugin.AniList.Configuration
|
||||
|
||||
public bool AniListShowSpoilerTags { get; set; }
|
||||
|
||||
public bool FilterPeopleByTitlePreference { get; set; }
|
||||
|
||||
public bool UseAnitomyLibrary { get; set; }
|
||||
|
||||
}
|
||||
|
@ -26,14 +26,17 @@
|
||||
<option id="optLanguageJapaneseRomaji" value="JapaneseRomaji">Romaji</option>
|
||||
</select>
|
||||
</div>
|
||||
<div class="checkboxContainer checkboxContainer-withDescription">
|
||||
<label class="emby-checkbox-label">
|
||||
<input id="chkFilterPeopleByTitlePreference" name="chkFilterPeopleByTitlePreference" type="checkbox" is="emby-checkbox" />
|
||||
<span>Filter people by title preference</span>
|
||||
</label>
|
||||
<div class="selectContainer">
|
||||
<label class="selectLabel" for="filterPeopleByLanguage">Filter People by Language Preference</label>
|
||||
<select is="emby-select" id="filterPeopleByLanguage" name="filterPeopleByLanguage" class="emby-select-withcolor emby-select">
|
||||
<option id="optLanguageLocalized" value="Localized">Localized</option>
|
||||
<option id="optLanguageJapanese" value="Japanese">Japanese</option>
|
||||
<option id="optLanguageAll" value="All">Do not filter</option>
|
||||
</select>
|
||||
<div class="fieldDescription">This setting will only keep people with chosen language. Choosing Localized will retain everybody except Japanese VAs.</div>
|
||||
</div>
|
||||
<div class="inputContainer">
|
||||
<label class="inputeLabel inputLabelUnfocused" for="chkMaxGenres">Max Genres</label>
|
||||
<label class="inputLabel inputLabelUnfocused" for="chkMaxGenres">Max Genres</label>
|
||||
<input id="chkMaxGenres" name="chkMaxGenres" type="number" is="emby-input" min="0" />
|
||||
<div class="fieldDescription">Set this to zero to remove any limit.</div>
|
||||
</div>
|
||||
@ -46,7 +49,7 @@
|
||||
</select>
|
||||
</div>
|
||||
<div class="inputContainer">
|
||||
<label class="inputeLabel inputLabelUnfocused" for="chkAniDbRateLimit">AniDB Rate Limit</label>
|
||||
<label class="inputLabel inputLabelUnfocused" for="chkAniDbRateLimit">AniDB Rate Limit</label>
|
||||
<input id="chkAniDbRateLimit" name="chkAniDbRateLimit" type="number" is="emby-input" min="0" />
|
||||
<div class="fieldDescription">This will prevent IP bans for requesting data too quickly.</div>
|
||||
</div>
|
||||
@ -87,7 +90,7 @@
|
||||
ApiClient.getPluginConfiguration(AniListConfigurationPage.pluginUniqueId).then(function (config) {
|
||||
document.getElementById('titleLanguage').value = config.TitlePreference;
|
||||
document.getElementById('originalTitleLanguage').value = config.OriginalTitlePreference;
|
||||
document.getElementById('chkFilterPeopleByTitlePreference').checked = config.FilterPeopleByTitlePreference;
|
||||
document.getElementById('filterPeopleByLanguage').value = config.PersonLanguageFilterPreference;
|
||||
document.getElementById('chkMaxGenres').value = config.MaxGenres;
|
||||
document.getElementById('animeDefaultGenre').value = config.AnimeDefaultGenre;
|
||||
document.getElementById('chkAniDbRateLimit').value = config.AniDbRateLimit;
|
||||
@ -105,7 +108,7 @@
|
||||
ApiClient.getPluginConfiguration(AniListConfigurationPage.pluginUniqueId).then(function (config) {
|
||||
config.TitlePreference = document.getElementById('titleLanguage').value;
|
||||
config.OriginalTitlePreference = document.getElementById('originalTitleLanguage').value;
|
||||
config.FilterPeopleByTitlePreference = document.getElementById('chkFilterPeopleByTitlePreference').checked;
|
||||
config.PersonLanguageFilterPreference = document.getElementById('filterPeopleByLanguage').value;
|
||||
config.MaxGenres = document.getElementById('chkMaxGenres').value;
|
||||
config.AnimeDefaultGenre = document.getElementById('animeDefaultGenre').value;
|
||||
config.AniDbRateLimit = document.getElementById('chkAniDbRateLimit').value;
|
||||
|
@ -129,7 +129,7 @@ query($id: Int!, $type: MediaType) {
|
||||
medium
|
||||
large
|
||||
}
|
||||
language
|
||||
language: languageV2
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -199,11 +199,11 @@ namespace Jellyfin.Plugin.AniList.Providers.AniList
|
||||
{
|
||||
foreach (VoiceActor va in edge.voiceActors)
|
||||
{
|
||||
if (config.FilterPeopleByTitlePreference) {
|
||||
if (config.TitlePreference != TitlePreferenceType.Localized && va.language != "JAPANESE") {
|
||||
if (config.PersonLanguageFilterPreference != LanguageFilterType.All) {
|
||||
if (config.PersonLanguageFilterPreference == LanguageFilterType.Japanese && va.language != "Japanese") {
|
||||
continue;
|
||||
}
|
||||
if (config.TitlePreference == TitlePreferenceType.Localized && va.language == "JAPANESE") {
|
||||
if (config.PersonLanguageFilterPreference == LanguageFilterType.Localized && va.language == "Japanese") {
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user