Skip to content

Commit

Permalink
fix: dont exclude torrents if user is using external player
Browse files Browse the repository at this point in the history
  • Loading branch information
ThaUnknown committed Aug 20, 2024
1 parent 32d1d03 commit 3eb349c
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 19 deletions.
19 changes: 17 additions & 2 deletions common/modules/extensions/index.js
Original file line number Diff line number Diff line change
@@ -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'
Expand All @@ -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 */

Expand Down Expand Up @@ -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)
Expand Down
16 changes: 0 additions & 16 deletions common/modules/rss.js
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
5 changes: 4 additions & 1 deletion common/modules/util.js
Original file line number Diff line number Diff line change
@@ -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))
Expand Down Expand Up @@ -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']
Expand Down

0 comments on commit 3eb349c

Please sign in to comment.