fix: dont exclude torrents if user is using external player

This commit is contained in:
ThaUnknown 2024-08-20 17:16:29 +02:00
parent 32d1d03d11
commit 3eb349c31e
3 changed files with 21 additions and 19 deletions

View file

@ -1,5 +1,4 @@
import { settings } from '@/modules/settings.js'
import { exclusions } from '../rss.js'
import { sleep } from '../util.js'
import { anilistClient } from '../anilist.js'
import { anitomyscript } from '../anime.js'
@ -10,6 +9,22 @@ import Debug from 'debug'
const debug = Debug('ui:extensions')
const exclusions = ['DTS', 'TrueHD', '[EMBER]']
const isDev = location.hostname === 'localhost'
const video = document.createElement('video')
if (!isDev && !video.canPlayType('video/mp4; codecs="hev1.1.6.L93.B0"')) {
exclusions.push('HEVC', 'x265', 'H.265')
}
if (!isDev && !video.canPlayType('audio/mp4; codecs="ac-3"')) {
exclusions.push('AC3', 'AC-3')
}
if (!('audioTracks' in HTMLVideoElement.prototype)) {
exclusions.push('DUAL')
}
video.remove()
/** @typedef {import('@thaunknown/ani-resourced/sources/types.d.ts').Options} Options */
/** @typedef {import('@thaunknown/ani-resourced/sources/types.d.ts').Result} Result */
@ -40,7 +55,7 @@ export default async function getResultsFromExtensions ({ media, episode, batch,
anidbEid,
titles: createTitles(media),
resolution,
exclusions
exclusions: settings.value.enableExternal ? [] : exclusions
}
const { results, errors } = await worker.query(options, { movie, batch }, settings.value.sources)

View file

@ -10,22 +10,6 @@ import Debug from 'debug'
const debug = Debug('ui:rss')
export const exclusions = ['DTS', 'TrueHD', '[EMBER]']
const isDev = location.hostname === 'localhost'
const video = document.createElement('video')
if (!isDev && !video.canPlayType('video/mp4; codecs="hev1.1.6.L93.B0"')) {
exclusions.push('HEVC', 'x265', 'H.265')
}
if (!isDev && !video.canPlayType('audio/mp4; codecs="ac-3"')) {
exclusions.push('AC3', 'AC-3')
}
if (!('audioTracks' in HTMLVideoElement.prototype)) {
exclusions.push('DUAL')
}
video.remove()
export function parseRSSNodes (nodes) {
return nodes.map(item => {
const pubDate = item.querySelector('pubDate')?.textContent

View file

@ -1,4 +1,5 @@
import { SUPPORTS } from '@/modules/support.js'
import { enable } from './debug.js'
export function countdown (s) {
const d = Math.floor(s / (3600 * 24))
@ -153,7 +154,9 @@ export const defaults = {
angle: 'default',
toshoURL: SUPPORTS.extensions ? decodeURIComponent(atob('aHR0cHM6Ly9mZWVkLmFuaW1ldG9zaG8ub3JnLw==')) : '',
extensions: SUPPORTS.extensions ? ['@thaunknown/ani-resourced'] : [],
sources: {}
sources: {},
enableExternal: false,
playerPath: ''
}
export const subtitleExtensions = ['srt', 'vtt', 'ass', 'ssa', 'sub', 'txt']