Skip to content

Commit

Permalink
prioritize single file over 7z
Browse files Browse the repository at this point in the history
  • Loading branch information
GodPepe7 committed Jul 25, 2024
1 parent 5dc9dd7 commit b646078
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion src/background.ts
Original file line number Diff line number Diff line change
Expand Up @@ -212,7 +212,14 @@ async function getSubs(animeTitle: string, episode: number) {
if (typeof subs === "string") {
return subs;
}
const singleSub = subs.find(sub => !sub.name.endsWith(".zip") && !sub.name.endsWith(".rar"))
const compressedFileEndings = [".zip", ".rar", ".7z"]
const singleSub = subs.find(sub => {
for (let cfe of compressedFileEndings) {
if (sub.name.endsWith(cfe))
return false
}
return true
})
const { url, name } = singleSub ? singleSub : subs[0]
chrome.downloads.download({
url,
Expand Down

0 comments on commit b646078

Please sign in to comment.