mirror of
https://github.com/ThaUnknown/miru.git
synced 2026-08-16 15:47:10 +00:00
experimental indexedDB storage
This commit is contained in:
parent
cd6e9a380a
commit
d2758629ef
4 changed files with 2256 additions and 28 deletions
|
|
@ -345,10 +345,14 @@
|
|||
<label for="torrent2">Auto-Play Torrents [This might lead to wrong torrents being
|
||||
played]</label>
|
||||
</div>
|
||||
<div class="custom-switch mb-20">
|
||||
<div class="custom-switch mb-10">
|
||||
<input type="checkbox" id="torrent3">
|
||||
<label for="torrent3">Trusted Only [Less results but higher quality and more seeders]</label>
|
||||
</div>
|
||||
</div>
|
||||
<div class="custom-switch mb-20">
|
||||
<input type="checkbox" id="torrent5">
|
||||
<label for="torrent5">Drive Store [GREATLY reduces RAM usage, increases CPU and Drive usage, bad for SSDs]</label>
|
||||
</div>
|
||||
|
||||
<h1 class="content-title font-size-22">
|
||||
Other
|
||||
|
|
@ -388,6 +392,7 @@
|
|||
<script src="js/playerHandler.js"></script>
|
||||
<script src="https://cdn.jsdelivr.net/npm/webtorrent@latest/webtorrent.min.js"></script>
|
||||
<script src="js/rangeParser.js"></script>
|
||||
<script src="js/idbkv-chunk-store.js"></script>
|
||||
<script src="js/torrentHandler.js"></script>
|
||||
<script src="https://cdn.jsdelivr.net/npm/matroska-subtitles@3.2.0/dist/matroska-subtitles.min.js"></script>
|
||||
<script src="js/subtitles-octopus.js"></script>
|
||||
|
|
|
|||
2219
app/js/idbkv-chunk-store.js
Normal file
2219
app/js/idbkv-chunk-store.js
Normal file
File diff suppressed because it is too large
Load diff
|
|
@ -14,6 +14,7 @@ const settingsElements = {
|
|||
torrent2: torrent2,
|
||||
torrent3: torrent3,
|
||||
torrent4: torrent4,
|
||||
torrent5: torrent5,
|
||||
other1: other1,
|
||||
other2: other2
|
||||
}
|
||||
|
|
@ -36,6 +37,7 @@ function restoreDefaults() {
|
|||
torrent2: false,
|
||||
torrent3: true,
|
||||
torrent4: "https://subsplease.org/rss/?r=",
|
||||
torrent4: false,
|
||||
other1: 100,
|
||||
other2: true
|
||||
}
|
||||
|
|
|
|||
|
|
@ -68,11 +68,13 @@ async function addTorrent(magnet) {
|
|||
}
|
||||
halfmoon.hideModal("tsearch")
|
||||
document.location.href = "#player"
|
||||
let selected = playerData.selected
|
||||
let selected = playerData.selected,
|
||||
store
|
||||
resetVideo()
|
||||
selected ? selPlaying(selected) : ""
|
||||
await sw
|
||||
client.add(magnet, function (torrent) {
|
||||
settings.torrent5 ? store = { store: IdbkvChunkStore } : store = {}
|
||||
client.add(magnet, store, function (torrent) {
|
||||
torrent.on('noPeers', () => {
|
||||
if (client.torrents[0].progress != 1) {
|
||||
halfmoon.initStickyAlert({
|
||||
|
|
@ -86,34 +88,34 @@ async function addTorrent(magnet) {
|
|||
let videoFiles = torrent.files.filter(file => videoExtensions.some(ext => file.name.endsWith(ext)))
|
||||
let selectedFile
|
||||
if (videoFiles.length) {
|
||||
selectedFile = videoFiles.reduce((a, b) => { return a.length > b.length ? a : b; });
|
||||
torrent.on('done', () => {
|
||||
selectedFile = videoFiles.reduce((a, b) => { return a.length > b.length ? a : b; });
|
||||
torrent.on('done', () => {
|
||||
halfmoon.initStickyAlert({
|
||||
content: `<span class="text-break">${torrent.infoHash}</span> has finished downloading. Now seeding.`,
|
||||
title: "Download Complete",
|
||||
alertType: "alert-success",
|
||||
fillType: ""
|
||||
});
|
||||
selectedFile.getBlobURL((err, url) => {
|
||||
finishThumbnails(url);
|
||||
downloadFile(url, selectedFile.name)
|
||||
postDownload(url, selectedFile)
|
||||
})
|
||||
})
|
||||
video.src = `${scope}webtorrent/${torrent.infoHash}/${encodeURI(selectedFile.path)}`
|
||||
video.load()
|
||||
} else {
|
||||
halfmoon.initStickyAlert({
|
||||
content: `<span class="text-break">${torrent.infoHash}</span> has finished downloading. Now seeding.`,
|
||||
title: "Download Complete",
|
||||
alertType: "alert-success",
|
||||
content: `Couldn't find video file for <span class="text-break">${torrent.infoHash}</span>!`,
|
||||
title: "Search Failed",
|
||||
alertType: "alert-danger",
|
||||
fillType: ""
|
||||
});
|
||||
selectedFile.getBlobURL((err, url) => {
|
||||
finishThumbnails(url);
|
||||
downloadFile(url, selectedFile.name)
|
||||
postDownload(url, selectedFile)
|
||||
})
|
||||
})
|
||||
video.src = `${scope}webtorrent/${torrent.infoHash}/${encodeURI(selectedFile.path)}`
|
||||
video.load()
|
||||
} else {
|
||||
halfmoon.initStickyAlert({
|
||||
content: `Couldn't find video file for <span class="text-break">${torrent.infoHash}</span>!`,
|
||||
title: "Search Failed",
|
||||
alertType: "alert-danger",
|
||||
fillType: ""
|
||||
});
|
||||
client.torrents[0].store ? client.torrents[0].store.destroy() : ""
|
||||
client.torrents[0].destroy()
|
||||
}
|
||||
client.torrents[0].store ? client.torrents[0].store.destroy() : ""
|
||||
client.torrents[0].destroy()
|
||||
}
|
||||
|
||||
})
|
||||
})
|
||||
|
||||
}
|
||||
function postDownload(url, file) {
|
||||
|
|
|
|||
Loading…
Reference in a new issue