Skip to content

Commit

Permalink
feat: add option to toggle title checking
Browse files Browse the repository at this point in the history
  • Loading branch information
g0ldyy committed Jul 4, 2024
1 parent ffdcabf commit bbb257d
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 4 deletions.
6 changes: 2 additions & 4 deletions comet/api/stream.py
Original file line number Diff line number Diff line change
Expand Up @@ -170,14 +170,12 @@ async def stream(request: Request, b64config: str, type: str, id: str):
object = {
"Title": result["filename"],
"InfoHash": result["infoHash"],
"zilean": True,
}

if indexer_manager_type == "prowlarr":
object = {
"title": result["filename"],
"infoHash": result["infoHash"],
"zilean": True,
}

torrents.append(object)
Expand All @@ -195,9 +193,9 @@ async def stream(request: Request, b64config: str, type: str, id: str):

tasks = []
filtered = 0
filter_title = config["filterTitles"] if "filterTitles" in config else True # not needed when pydantic config validation system implemented
for torrent in torrents:
# Only title match check if from Zilean
if "zilean" in torrent:
if filter_title:
parsed_torrent = parse(
torrent["Title"]
if indexer_manager_type == "jackett"
Expand Down
6 changes: 6 additions & 0 deletions comet/templates/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -510,6 +510,10 @@
<sl-input id="maxResults" type="number" min=0 value=0 label="Max Results" placeholder="Enter max results"></sl-input>
</div>

<div class="form-item">
<sl-checkbox id="filterTitles" checked help-text="Should Comet check for title mismatch?">Filter Titles</sl-checkbox>
</div>

<div class="form-item">
<sl-select id="debridService" value="realdebrid" label="Debrid Service" placeholder="Select debrid service">
<sl-option value="realdebrid">Real-Debrid</sl-option>
Expand Down Expand Up @@ -573,6 +577,7 @@
const languages = Array.from(document.getElementById("languages").selectedOptions).map(option => option.value);
const resolutions = Array.from(document.getElementById("resolutions").selectedOptions).map(option => option.value);
const maxResults = document.getElementById("maxResults").value;
const filterTitles = document.getElementById("filterTitles").checked;

const selectedLanguages = languages.length === defaultLanguages.length && languages.every((val, index) => val === defaultLanguages[index]) ? ["All"] : languages;
const selectedResolutions = resolutions.length === defaultResolutions.length && resolutions.every((val, index) => val === defaultResolutions[index]) ? ["All"] : resolutions;
Expand All @@ -582,6 +587,7 @@
debridApiKey: debridApiKey,
indexers: indexers,
maxResults: parseInt(maxResults),
filterTitles: filterTitles,
resolutions: selectedResolutions,
languages: selectedLanguages
};
Expand Down

0 comments on commit bbb257d

Please sign in to comment.