drive store improvements

This commit is contained in:
ThaUnknown 2020-11-15 01:24:53 +01:00
parent edfd69b001
commit 276c826c0c
2 changed files with 11 additions and 3 deletions

View file

@ -8,6 +8,7 @@ function subStream(stream) {
} else {
playerData.subtitleStream = new SubtitleStream()
playerData.subtitleStream.once('tracks', pTracks => {
console.log(pTracks)
pTracks.forEach(track => {
if (track.type == "ass") {
if (!playerData.headers) {

View file

@ -1,6 +1,13 @@
let client = new WebTorrent({ maxConns: settings.torrent6 })
let client = new WebTorrent({ maxConns: settings.torrent6 }),
mystore = class extends IdbkvChunkStore {
constructor(len, opts) {
super(len, { ...opts, batchInterval: 1000 });
}
}
window.onbeforeunload = () => {
client.torrents[0] ? client.torrents[0].store.destroy() : ""
if (!settings.torrent8) {
client.torrents[0] ? client.torrents[0].store.destroy() : ""
}
client.torrents[0] ? client.torrents[0].destroy() : ""
client.destroy()
resetVideo()
@ -94,7 +101,7 @@ async function addTorrent(magnet, media, episode) {
let store
cleanupVideo()
await sw
settings.torrent5 ? store = { store: IdbkvChunkStore } : store = {}
settings.torrent5 ? store = { store: mystore } : store = {}
client.add(magnet, store, function (torrent) {
torrent.files.forEach(file => file.deselect());
torrent.deselect(0, torrent.pieces.length - 1, false);