Skip to content

Commit

Permalink
feat: remove_unknown_languages in webui
Browse files Browse the repository at this point in the history
  • Loading branch information
g0ldyy committed Feb 25, 2025
1 parent 886ec29 commit 96c2fd3
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 3 deletions.
9 changes: 7 additions & 2 deletions comet/templates/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -570,9 +570,10 @@

<sl-details summary="Advanced Settings">
<div class="form-item">
<sl-input id="rankThreshold" type="number" value="-10000000000" label="Minimum Rank Threshold" placeholder="Enter minimum rank threshold" help-text="Results with rank below this value will be filtered out"></sl-input>
<sl-input id="rankThreshold" type="number" value="-10000000000" label="Minimum Rank Threshold" placeholder="Enter minimum rank threshold" help-text="Torrents ranked below this value will be excluded from results."></sl-input>
<sl-checkbox id="cachedOnly" help-text="Show only content that has already been cached.">Show Cached Only</sl-checkbox>
<sl-checkbox id="allowEnglishInLanguages" help-text="Allows English language torrents to be included even if you excluded English from your language preferences.">Allow English in Languages</sl-checkbox>
<sl-checkbox id="removeUnknownLanguages" help-text="Exclude torrents that don't have a language in the title.">Remove Unknown Languages</sl-checkbox>
<sl-checkbox checked id="removeTrash" help-text="Remove all trash from results (if disabled, your filters will not be applied - Adult Content, CAM, Clean Audio, PDTV, R5, Screener, Size, Telecine and Telesync)">Remove Trash</sl-checkbox>
<sl-select id="resultFormat" multiple label="Result Format" placeholder="Select what to show in result title" hoist max-options-visible=10>
</sl-select>
Expand Down Expand Up @@ -834,6 +835,7 @@
const cachedOnly = document.getElementById("cachedOnly").checked;
const removeTrash = document.getElementById("removeTrash").checked;
const allowEnglishInLanguages = document.getElementById("allowEnglishInLanguages").checked;
const removeUnknownLanguages = document.getElementById("removeUnknownLanguages").checked;
const resultFormat = Array.from(document.getElementById("resultFormat").selectedOptions).map(option => option.value);
const debridService = document.getElementById("debridService").value;
const debridApiKey = document.getElementById("debridApiKey").value;
Expand All @@ -858,7 +860,8 @@
resolutions: resolutions,
options: {
remove_ranks_under: parseFloat(rankThreshold),
allow_english_in_languages: allowEnglishInLanguages
allow_english_in_languages: allowEnglishInLanguages,
remove_unknown_languages: removeUnknownLanguages
}
};
}
Expand Down Expand Up @@ -937,6 +940,8 @@
document.getElementById("rankThreshold").value = settings.options.remove_ranks_under;
if (settings.options?.allow_english_in_languages !== undefined)
document.getElementById("allowEnglishInLanguages").checked = settings.options.allow_english_in_languages;
if (settings.options?.remove_unknown_languages !== undefined)
document.getElementById("removeUnknownLanguages").checked = settings.options.remove_unknown_languages;
}
</script>
</div>
Expand Down
6 changes: 5 additions & 1 deletion comet/utils/general.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,11 @@ def config_check(b64config: str):
validated_config = validated_config.model_dump()

for key in list(validated_config["options"].keys()):
if key not in ["remove_ranks_under", "allow_english_in_languages"]:
if key not in [
"remove_ranks_under",
"allow_english_in_languages",
"remove_unknown_languages",
]:
validated_config["options"].pop(key)

validated_config["options"]["remove_all_trash"] = validated_config[
Expand Down

0 comments on commit 96c2fd3

Please sign in to comment.