Skip to content

Commit

Permalink
minor fixes, batch search improvements, custom RSS option
Browse files Browse the repository at this point in the history
  • Loading branch information
ThaUnknown committed Nov 15, 2020
1 parent 60b9454 commit 189a21f
Show file tree
Hide file tree
Showing 5 changed files with 40 additions and 20 deletions.
26 changes: 16 additions & 10 deletions app/index.html
Expand Up @@ -353,16 +353,17 @@ <h1 class="content-title font-size-22">
</select>
</div>
<div class="input-group mb-10 w-200" data-toggle="tooltip" data-placement="top"
data-title="What Feed To Fetch Torrents From">
data-title="What RSS Feed To Fetch Torrents From, Allows For Custom CORS Enabled Feeds, URL Is Automatically Followed By Resolution">
<div class="input-group-prepend">
<span class="input-group-text">Feed</span>
</div>
<select class="form-control" id="torrent4">
<option value="https://subsplease.org/rss/?r=" selected>SubsPlease</option>
<option
value="https://miru.kirdow.com/request/?url=https://www.erai-raws.info/rss-">
Erai-raws</option>
</select>
<input id="torrent4" type="text" list="torrent4list" class="form-control"
autocomplete="off">
<datalist id="torrent4list">
<option value="SubsPlease">https://subsplease.org/rss/?r=</option>
<option value="Erai-raws">
https://miru.kirdow.com/request/?url=https://www.erai-raws.info/rss-</option>
</datalist>
</div>
<div class="input-group w-200 mb-10" data-toggle="tooltip" data-placement="top"
data-title="How Many Max Peers To Connect To, Higher Numbers Mean Higher Speeds And More CPU Usage">
Expand Down Expand Up @@ -392,11 +393,16 @@ <h1 class="content-title font-size-22">
<input type="checkbox" id="torrent8">
<label for="torrent8">Persistent Storing</label>
</div>
<div class="custom-switch mb-20" data-toggle="tooltip" data-placement="top"
<div class="custom-switch mb-10" data-toggle="tooltip" data-placement="top"
data-title="Tries To Resolve Anime Names From Manually Added Torrent Names, Might Lead To Wrong Anime Being Detected">
<input type="checkbox" id="torrent7" checked>
<label for="torrent7">Resolve Names</label>
</div>
<div class="custom-switch mb-20" data-toggle="tooltip" data-placement="top"
data-title="Tries To Find Batches For Finished Shows Instead Of Downloading 1 Episode At A Time">
<input type="checkbox" id="torrent9" checked>
<label for="torrent9">Batch Lookup</label>
</div>
</div>
<div class="p-5">
<h1 class="content-title font-size-22">
Expand All @@ -414,9 +420,9 @@ <h1 class="content-title font-size-22">
</div>
</div>
<div class="custom-switch mb-20" data-toggle="tooltip" data-placement="top"
data-title="Automatically Marks Episodes As Complete On AniList When You Complete Watching Them, Requires AniList Login">
data-title="Automatically Marks Episodes As Complete On AniList When You Finish Watching Them, Requires AniList Login">
<input type="checkbox" id="other2">
<label for="other2">AniList Sync [Requires <a
<label for="other2">Autocomplete Episodes [Requires <a
href="https://anilist.co/api/v2/oauth/authorize?client_id=4254&response_type=token"
target="_top">OAuth2 Login</a>]</label>
</div>
Expand Down
20 changes: 15 additions & 5 deletions app/js/animeHandler.js
Expand Up @@ -294,7 +294,7 @@ function viewAnime(media) {
} else {
viewTrailer.setAttribute("disabled", "")
}
if (media.status == "NOT_YET_RELEASED"){
if (media.status == "NOT_YET_RELEASED") {
viewPlay.setAttribute("disabled", "")
} else {
viewPlay.removeAttribute("disabled", "")
Expand All @@ -304,6 +304,7 @@ function viewAnime(media) {
}
episodes.innerHTML = ""
if (media.streamingEpisodes.length) {
viewEpisodesWrapper.classList.add("hidden")
viewEpisodes.removeAttribute("disabled", "")
let frag = document.createDocumentFragment()
media.streamingEpisodes.forEach(episode => {
Expand All @@ -324,7 +325,7 @@ function viewAnime(media) {
function trailerPopup(trailer) {
trailerVideo.src = ""
halfmoon.toggleModal("trailer")
switch (trailer.site) {
switch (trailer.site) { // should support the other possible sites too, but i cant find any examples
case "youtube":
trailerVideo.src = "https://www.youtube.com/embed/" + trailer.id
break;
Expand Down Expand Up @@ -405,6 +406,9 @@ async function nyaaSearch(media, episode) {
if (parseInt(episode) < 10) {
episode = `0${episode}`
}
if (media.status == "FINISHED") {

}

let table = document.querySelector("tbody.results")
let results = await nyaaRss(media, episode)
Expand All @@ -425,7 +429,8 @@ async function nyaaSearch(media, episode) {

async function nyaaRss(media, episode) {
let frag = document.createDocumentFragment(),
url = new URL(`https://miru.kirdow.com/request/?url=https://nyaa.si/?page=rss$c=1_2$f=${settings.torrent3 == true ? 2 : 0}$s=seeders$o=desc$q="${Object.values(media.title).concat(media.synonyms).filter(name => name != null).join("\"|\"")}""+${episode}+"${settings.torrent1}`)
ep = (media.status == "FINISHED" && settings.torrent9) ? `"01-${media.episodes}"|"01~${media.episodes}"|"batch"|"Batch"|"complete"|"Complete"` : `"+${episode}+"`,
url = new URL(`https://miru.kirdow.com/request/?url=https://nyaa.si/?page=rss$c=1_2$f=${settings.torrent3 == true ? 2 : 0}$s=seeders$o=desc$q="${Object.values(media.title).concat(media.synonyms).filter(name => name != null).join("\"|\"")}"${ep}"${settings.torrent1}"`)
res = await fetch(url)
await res.text().then((xmlTxt) => {
try {
Expand Down Expand Up @@ -479,8 +484,13 @@ let store = JSON.parse(localStorage.getItem("store")) || {},
async function releasesRss() {
let frag = document.createDocumentFragment(),
releases = document.querySelector(".releases"),
url = torrent4.options[torrent4.selectedIndex].text == "Erai-raws" ? new URL(settings.torrent4 + settings.torrent1 + "-magnet") : new URL(settings.torrent4 + settings.torrent1)
res = await fetch(url)
url
if (Object.values(torrent4list.options).filter(item => item.value == settings.torrent4)[0]){
url = settings.torrent4 == "Erai-raws" ? new URL(Object.values(torrent4list.options).filter(item => item.value == settings.torrent4)[0].innerText + settings.torrent1 + "-magnet") : new URL(Object.values(torrent4list.options).filter(item => item.value == settings.torrent4)[0].innerText + settings.torrent1)
} else {
url = settings.torrent4 + settings.torrent1
}
let res = await fetch(url)
await res.text().then(async (xmlTxt) => {
try {
let doc = DOMPARSER(xmlTxt, "text/xml")
Expand Down
2 changes: 1 addition & 1 deletion app/js/playerHandler.js
Expand Up @@ -674,7 +674,7 @@ function checkCompletion() {
} else{
halfmoon.initStickyAlert({
content: `Do You Want To Mark <br><b>${playerData.nowPlaying[0].title.userPreferred}</b><br>Episode ${playerData.nowPlaying[1]} As Completed?<br>
<button class="btn btn-sm btn-square btn-success mt-5" onclick="alEntry()">✓</button>
<button class="btn btn-sm btn-square btn-success mt-5" onclick="alEntry()" data-dismiss="alert" type="button" aria-label="Close">✓</button>
<button class="btn btn-sm btn-square mt-5" data-dismiss="alert" type="button" aria-label="Close"><span aria-hidden="true">X</span></button>`,
title: "Episode Complete",
timeShown: 180000
Expand Down
2 changes: 1 addition & 1 deletion app/js/settingsHandler.js
@@ -1,5 +1,5 @@
const settingsElements = [
player1, player2, player3, player4, player5, player6, player7, player8, subtitle1, subtitle2, subtitle3, torrent1, torrent2, torrent3, torrent4, torrent5, torrent6, torrent7, torrent8, other1, other2
player1, player2, player3, player4, player5, player6, player7, player8, subtitle1, subtitle2, subtitle3, torrent1, torrent2, torrent3, torrent4, torrent5, torrent6, torrent7, torrent8, torrent9, other1, other2
]
let settings = {}
function restoreDefaults() {
Expand Down
10 changes: 7 additions & 3 deletions app/js/torrentHandler.js
Expand Up @@ -118,18 +118,22 @@ async function addTorrent(magnet, media, episode) {
videoFiles = torrent.files.filter(file => videoExtensions.some(ext => file.name.endsWith(ext)))
if (videoFiles.length) {
videoFiles.sort((a, b) => {
return parseInt(nameParseRegex.fallback.exec(a.name)[3]) - parseInt(nameParseRegex.fallback.exec(b.name)[3])
return parseInt(nameParseRegex.simple.exec(a.name)[4]) - parseInt(nameParseRegex.simple.exec(b.name)[4])
})
let videoFile
if (videoFiles.length > 1) {
bpl.removeAttribute("disabled")
videoFile = videoFiles.filter(file => { parseInt(nameParseRegex.simple.exec(file.name)[4]) == parseInt(episode) })
} else {
bpl.setAttribute("disabled", "")
videofile = videoFiles[0]
}
console.log(videoFile)
if (media && episode) {
buildVideo(videoFiles[0], [media, episode])
buildVideo(videoFile[0]||videoFiles[0], [media, episode])
}
else {
buildVideo(videoFiles[0])
buildVideo(videoFile[0])
}
} else {
halfmoon.initStickyAlert({
Expand Down

0 comments on commit 189a21f

Please sign in to comment.