mirror of
https://github.com/anidl/multi-downloader-nx.git
synced 2026-01-11 20:10:20 +00:00
Subtitle fixes for hidive
This commit is contained in:
parent
ea85958191
commit
e75aa80c3a
4 changed files with 36 additions and 6 deletions
3
.gitignore
vendored
3
.gitignore
vendored
|
|
@ -35,4 +35,5 @@ crunchyendpoints
|
|||
.vscode
|
||||
/logs
|
||||
/tmp/*/
|
||||
/videos/*/
|
||||
/videos/*/
|
||||
/tmp/*.*
|
||||
20
@types/hidiveTypes.d.ts
vendored
20
@types/hidiveTypes.d.ts
vendored
|
|
@ -1,3 +1,5 @@
|
|||
import { LanguageItem } from '../modules/module.langsData';
|
||||
|
||||
export interface HidiveVideoList {
|
||||
Code: number;
|
||||
Status: string;
|
||||
|
|
@ -50,12 +52,26 @@ export interface HidiveSubtitleInfo {
|
|||
url: string;
|
||||
}
|
||||
|
||||
export type sxItem = {
|
||||
language: LanguageItem,
|
||||
path: string,
|
||||
file: string
|
||||
title: string,
|
||||
fonts: Font[]
|
||||
}
|
||||
|
||||
export type DownloadedMedia = {
|
||||
type: 'Video',
|
||||
lang: LanguageItem,
|
||||
path: string,
|
||||
uncut: boolean
|
||||
uncut?: boolean
|
||||
} | ({
|
||||
type: 'Subtitle',
|
||||
cc: boolean
|
||||
cc: boolean,
|
||||
belongsToFile: {
|
||||
hasFile: false,
|
||||
} | {
|
||||
hasFile: true,
|
||||
file: string
|
||||
}
|
||||
} & sxItem )
|
||||
16
hidive.ts
16
hidive.ts
|
|
@ -750,10 +750,21 @@ export default class Hidive implements ServiceClass {
|
|||
sxData.fonts = fontsData.assFonts(sBody) as Font[];
|
||||
fs.writeFileSync(sxData.path, sBody);
|
||||
console.info(`Subtitle downloaded: ${sxData.file}`);
|
||||
let tsFile;
|
||||
for (const file of files) {
|
||||
if (file.type == 'Video') {
|
||||
if (sub.cc && file.lang.code == 'eng') {
|
||||
tsFile = `${file.path}.ts`;
|
||||
} else if (!sub.cc && file.lang.code == 'jpn') {
|
||||
tsFile = `${file.path}.ts`;
|
||||
}
|
||||
}
|
||||
}
|
||||
files.push({
|
||||
type: 'Subtitle',
|
||||
...sxData as sxItem,
|
||||
cc: sub.cc
|
||||
cc: sub.cc,
|
||||
belongsToFile: typeof tsFile === 'undefined' ? { hasFile: false } : { hasFile: true, file: `${tsFile}.ts`}
|
||||
});
|
||||
} else{
|
||||
console.warn(`Failed to download subtitle: ${sxData.file}`);
|
||||
|
|
@ -792,7 +803,8 @@ export default class Hidive implements ServiceClass {
|
|||
return {
|
||||
file: a.path,
|
||||
language: a.language,
|
||||
closedCaption: a.cc
|
||||
closedCaption: a.cc,
|
||||
belongsToFile: a.belongsToFile
|
||||
};
|
||||
}),
|
||||
simul: data.filter(a => a.type === 'Video').map((a) : boolean => {
|
||||
|
|
|
|||
|
|
@ -113,7 +113,8 @@ class Merger {
|
|||
const filesToRemove: string[] = [];
|
||||
itemLoop: for (const vna of vnas.slice(1)) {
|
||||
console.info(`Trying to find delay for ${vna.lang.code}...`);
|
||||
outer: for (let i = 1; i <= (items.length-offset); i++) {
|
||||
outer: for (let i = 1; i < (items.length); i++) {
|
||||
console.info(`Trying to match likeness with frame ${i+offset}`);
|
||||
const closeness = [];
|
||||
exec('ffmpeg', 'ffmpeg', `-hide_banner -loglevel error -i tmp/main-frames/${items[i]} -i "${vna.path}" -t ${MAX_OFFSET_SEC} -lavfi "ssim=f=tmp/stats-${i}.log;[0:v][1:v]psnr" -f null -`, false, true);
|
||||
filesToRemove.push(`tmp/stats-${i}.log`);
|
||||
|
|
|
|||
Loading…
Reference in a new issue