mirror of
https://github.com/ThaUnknown/miru.git
synced 2026-04-22 04:51:57 +00:00
minor fixes, WAIT lookup progress
This commit is contained in:
parent
d072f8d590
commit
ba81e5a26e
3 changed files with 390 additions and 287 deletions
|
|
@ -85,6 +85,9 @@ async function alRequest(searchName, method) {
|
|||
media (type: $type, search: $search, sort: $sort, status: $status) {
|
||||
id
|
||||
title {
|
||||
romaji
|
||||
english
|
||||
native
|
||||
userPreferred
|
||||
}
|
||||
description(
|
||||
|
|
@ -96,12 +99,23 @@ async function alRequest(searchName, method) {
|
|||
status
|
||||
episodes
|
||||
duration
|
||||
averageScore
|
||||
genres
|
||||
coverImage {
|
||||
extraLarge
|
||||
medium
|
||||
color
|
||||
}
|
||||
bannerImage
|
||||
synonyms
|
||||
nextAiringEpisode {
|
||||
timeUntilAiring
|
||||
episode
|
||||
}
|
||||
trailer {
|
||||
id
|
||||
site
|
||||
}
|
||||
streamingEpisodes {
|
||||
title
|
||||
thumbnail
|
||||
|
|
@ -166,6 +180,9 @@ async function alRequest(searchName, method) {
|
|||
media (type: $type, search: $search, sort: $sort) {
|
||||
id
|
||||
title {
|
||||
romaji
|
||||
english
|
||||
native
|
||||
userPreferred
|
||||
}
|
||||
description(
|
||||
|
|
@ -177,12 +194,23 @@ async function alRequest(searchName, method) {
|
|||
status
|
||||
episodes
|
||||
duration
|
||||
averageScore
|
||||
genres
|
||||
coverImage {
|
||||
extraLarge
|
||||
medium
|
||||
color
|
||||
}
|
||||
bannerImage
|
||||
synonyms
|
||||
nextAiringEpisode {
|
||||
timeUntilAiring
|
||||
episode
|
||||
}
|
||||
trailer {
|
||||
id
|
||||
site
|
||||
}
|
||||
streamingEpisodes {
|
||||
title
|
||||
thumbnail
|
||||
|
|
@ -190,6 +218,50 @@ async function alRequest(searchName, method) {
|
|||
}
|
||||
}
|
||||
}`
|
||||
} else if (method == "SearchIDSingle") {
|
||||
variables.id = searchName
|
||||
query = `
|
||||
query ($id: Int, $type: MediaType) {
|
||||
Media (id: $id, type: $type){
|
||||
id
|
||||
title {
|
||||
romaji
|
||||
english
|
||||
native
|
||||
userPreferred
|
||||
}
|
||||
description(
|
||||
asHtml: true
|
||||
)
|
||||
season
|
||||
seasonYear
|
||||
format
|
||||
status
|
||||
episodes
|
||||
duration
|
||||
averageScore
|
||||
genres
|
||||
coverImage {
|
||||
extraLarge
|
||||
medium
|
||||
color
|
||||
}
|
||||
bannerImage
|
||||
synonyms
|
||||
nextAiringEpisode {
|
||||
timeUntilAiring
|
||||
episode
|
||||
}
|
||||
trailer {
|
||||
id
|
||||
site
|
||||
}
|
||||
streamingEpisodes {
|
||||
title
|
||||
thumbnail
|
||||
}
|
||||
}
|
||||
}`
|
||||
}
|
||||
options.body = JSON.stringify({
|
||||
query: query,
|
||||
|
|
|
|||
|
|
@ -122,14 +122,14 @@ async function buildVideo(file, nowPlaying) {
|
|||
setTimeout(onProgress, 100)
|
||||
}
|
||||
setTimeout(onProgress, 100)
|
||||
if (nowPlaying) {
|
||||
if (nowPlaying && nowPlaying[0]) {
|
||||
playerData.nowPlaying = nowPlaying
|
||||
} else if (settings.torrent7) {
|
||||
let regexParse = nameParseRegex.simple.exec(file.name)
|
||||
playerData.nowPlaying = [await resolveName(regexParse[2], "SearchAnySingle"), regexParse[4]]
|
||||
console.log(regexParse)
|
||||
}
|
||||
if (playerData.nowPlaying && playerData.nowPlaying[0] && parseInt(playerData.nowPlaying[1]) >= playerData.nowPlaying[0].episodes) {
|
||||
if (playerData.nowPlaying && playerData.nowPlaying[0] && playerData.nowPlaying[0].episodes && parseInt(playerData.nowPlaying[1]) >= playerData.nowPlaying[0].episodes) {
|
||||
bnext.setAttribute("disabled", "")
|
||||
} else {
|
||||
bnext.removeAttribute("disabled")
|
||||
|
|
|
|||
|
|
@ -56,14 +56,46 @@ const announceList = [
|
|||
}
|
||||
})
|
||||
const torrentRx = /(magnet:)?([A-F\d]{8,40})?(.*\.torrent)?/i;
|
||||
window.addEventListener("paste", async (e) => {
|
||||
let content = await navigator.clipboard.readText(),
|
||||
regexParse = torrentRx.exec(content)
|
||||
window.addEventListener("paste", async e => {
|
||||
let item = e.clipboardData.items[0];
|
||||
console.log(item)
|
||||
|
||||
if (item && item.type.indexOf("image") === 0) {
|
||||
e.preventDefault();
|
||||
let blob = item.getAsFile();
|
||||
|
||||
let reader = new FileReader();
|
||||
reader.onload = e => {
|
||||
console.log(e.target.result);
|
||||
fetch("https://trace.moe/api/search", {
|
||||
method: "POST",
|
||||
body: JSON.stringify({ image: e.target.result }),
|
||||
headers: { "Content-Type": "application/json" },
|
||||
})
|
||||
.then((res) => res.json())
|
||||
.then(async (result) => {
|
||||
if (result.docs[0].similarity >= 0.85) {
|
||||
console.log(result.docs[0].anilist_id)
|
||||
let res = await alRequest(result.docs[0].anilist_id, "SearchIDSingle")
|
||||
viewAnime(res.data.Media)
|
||||
} else{
|
||||
console.log("no." + result.docs[0].similarity)
|
||||
}
|
||||
});
|
||||
};
|
||||
reader.readAsDataURL(blob);
|
||||
} else if (item && item.type.indexOf("text") === 0) {
|
||||
item.getAsString(text => {
|
||||
console.log(text)
|
||||
let regexParse = torrentRx.exec(text)
|
||||
if (regexParse[1] || regexParse[2] || regexParse[3]) {
|
||||
e.preventDefault();
|
||||
addTorrent(content);
|
||||
addTorrent(text);
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
})
|
||||
//for debugging
|
||||
function t(a) {
|
||||
switch (a) {
|
||||
|
|
@ -128,12 +160,11 @@ async function addTorrent(magnet, media, episode) {
|
|||
bpl.setAttribute("disabled", "")
|
||||
videofile = videoFiles[0]
|
||||
}
|
||||
console.log(videoFile)
|
||||
if (media && episode) {
|
||||
buildVideo(videoFile[0]||videoFiles[0], [media, episode])
|
||||
videoFile ? buildVideo(videoFile[0], [media, episode]) : buildVideo(videoFiles[0], [media, episode])
|
||||
}
|
||||
else {
|
||||
buildVideo(videoFile[0])
|
||||
videoFile ? buildVideo(videoFile[0], [media, episode]) : buildVideo(videoFiles[0], [media, episode])
|
||||
}
|
||||
} else {
|
||||
halfmoon.initStickyAlert({
|
||||
|
|
|
|||
Loading…
Reference in a new issue