From 88e7b56c86c7f4a7f9ba8eca01c7389383d27a46 Mon Sep 17 00:00:00 2001 From: ThaUnknown <6506529+ThaUnknown@users.noreply.github.com> Date: Thu, 21 Dec 2023 14:32:44 +0100 Subject: [PATCH] feat: video deband [no worky] --- common/jsconfig.json | 8 ++++++- common/modules/util.js | 1 + common/package.json | 1 + common/tsconfig.json | 15 ------------ common/types.d.ts | 6 +++++ common/views/Player/Player.svelte | 26 +++++++++++++++++++++ common/views/Settings/PlayerSettings.svelte | 6 +++++ electron/package.json | 2 +- pnpm-lock.yaml | 26 ++++++++++++++++----- 9 files changed, 68 insertions(+), 23 deletions(-) delete mode 100644 common/tsconfig.json diff --git a/common/jsconfig.json b/common/jsconfig.json index a097cac7..ca37096a 100644 --- a/common/jsconfig.json +++ b/common/jsconfig.json @@ -6,7 +6,13 @@ }, "checkJs": true, "target": "ESNext", - "moduleResolution": "node", + "moduleResolution": "bundler", + "verbatimModuleSyntax": true, + "isolatedModules": true, + "resolveJsonModule": true, + "sourceMap": true, + "esModuleInterop": true, + "skipLibCheck": true, "module": "ESNext", "types": ["./types.d.ts"], "allowSyntheticDefaultImports": true diff --git a/common/modules/util.js b/common/modules/util.js index ba0f1afa..972e326e 100644 --- a/common/modules/util.js +++ b/common/modules/util.js @@ -147,6 +147,7 @@ export const defaults = { playerAutoplay: true, playerPause: true, playerAutocomplete: true, + playerDeband: false, rssQuality: '1080', rssFeedsNew: [['New Releases', 'SubsPlease']], rssAutoplay: true, diff --git a/common/package.json b/common/package.json index 84d8aaac..7c867690 100644 --- a/common/package.json +++ b/common/package.json @@ -20,6 +20,7 @@ "svelte-loader": "^3.1.9", "svelte-miniplayer": "^1.0.5", "svelte-sonner": "^0.3.6", + "video-deband": "^1.0.5", "webpack-merge": "^5.10.0" } } \ No newline at end of file diff --git a/common/tsconfig.json b/common/tsconfig.json deleted file mode 100644 index a097cac7..00000000 --- a/common/tsconfig.json +++ /dev/null @@ -1,15 +0,0 @@ -{ - "compilerOptions": { - "baseUrl": "./", - "paths": { - "@/*": ["./*"], - }, - "checkJs": true, - "target": "ESNext", - "moduleResolution": "node", - "module": "ESNext", - "types": ["./types.d.ts"], - "allowSyntheticDefaultImports": true - }, - "exclude": ["node_modules", "dist", "build", "git_modules", "**/node_modules", "**/dist", "**/build", "**/git_modules",] -} \ No newline at end of file diff --git a/common/types.d.ts b/common/types.d.ts index a816e67c..64ec1d47 100644 --- a/common/types.d.ts +++ b/common/types.d.ts @@ -1,3 +1,5 @@ +import type { SvelteComponentTyped } from 'svelte' + export {} type Track = { @@ -31,3 +33,7 @@ declare global { audioTracks: Track[] } } + +declare module '*.svelte' { + export default SvelteComponentTyped +} diff --git a/common/views/Player/Player.svelte b/common/views/Player/Player.svelte index 193de9aa..33ad65f6 100644 --- a/common/views/Player/Player.svelte +++ b/common/views/Player/Player.svelte @@ -10,6 +10,7 @@ import { getChaptersAniSkip } from '@/modules/anime.js' import Seekbar from 'perfect-seekbar' import { click } from '@/modules/click.js' + import VideoDeband from 'video-deband' import { w2gEmitter, state } from '../WatchTogether/WatchTogether.svelte' import Keybinds, { loadWithDefaults, condition } from 'svelte-keybinds' @@ -132,6 +133,10 @@ function clearLoadInterval () { clearInterval(loadInterval) } + /** + * @type {VideoDeband} + */ + let deband async function handleCurrent (file) { if (file) { @@ -147,11 +152,20 @@ currentSkippable = null completed = false if (subs) subs.destroy() + if (deband) { + deband.destroy() + deband.canvas.remove() + } current = file emit('current', current) src = file.url client.send('current', file) subs = new Subtitles(video, files, current, handleHeaders) + if ($settings.playerDeband) { + deband = new VideoDeband(video) + deband.canvas.classList.add('deband-canvas') + video.parentNode.append(deband.canvas) + } video.load() } } @@ -1080,6 +1094,18 @@