mirror of
https://github.com/anidl/multi-downloader-nx.git
synced 2026-03-11 17:45:30 +00:00
added noASSConv var
This commit is contained in:
parent
b4062da455
commit
7cb3e4ffbd
5 changed files with 38 additions and 11 deletions
1
@types/crunchyTypes.d.ts
vendored
1
@types/crunchyTypes.d.ts
vendored
|
|
@ -44,6 +44,7 @@ export type CrunchyDownloadOptions = {
|
|||
fontSize: number;
|
||||
dubLang: string[];
|
||||
// Subtitle Fix Options
|
||||
noASSConv: boolean;
|
||||
noSubFix: boolean;
|
||||
srtAssFix: boolean;
|
||||
layoutResFix: boolean;
|
||||
|
|
|
|||
15
crunchy.ts
15
crunchy.ts
|
|
@ -2650,11 +2650,16 @@ export default class Crunchy implements ServiceClass {
|
|||
if (subsAssReq.ok && subsAssReq.res) {
|
||||
let sBody = await subsAssReq.res.text();
|
||||
if (subsItem.format == 'vtt') {
|
||||
const chosenFontSize = options.originalFontSize ? undefined : options.fontSize;
|
||||
if (!options.originalFontSize) sBody = sBody.replace(/( font-size:.+?;)/g, '').replace(/(font-size:.+?;)/g, '');
|
||||
sBody = vtt2ass(undefined, chosenFontSize, sBody, '', undefined, options.fontName);
|
||||
sxData.fonts = fontsData.assFonts(sBody) as Font[];
|
||||
sxData.file = sxData.file.replace('.vtt', '.ass');
|
||||
if (!options.noASSConv) {
|
||||
const chosenFontSize = options.originalFontSize ? undefined : options.fontSize;
|
||||
if (!options.originalFontSize) sBody = sBody.replace(/( font-size:.+?;)/g, '').replace(/(font-size:.+?;)/g, '');
|
||||
sBody = vtt2ass(undefined, chosenFontSize, sBody, '', undefined, options.fontName);
|
||||
sxData.fonts = fontsData.assFonts(sBody) as Font[];
|
||||
sxData.file = sxData.file.replace('.vtt', '.ass');
|
||||
} else {
|
||||
// Yeah, whatever
|
||||
sxData.fonts = [];
|
||||
}
|
||||
} else {
|
||||
// Extract PlayRes
|
||||
const mX = sBody.match(/^PlayResX:\s*(\d+)/m);
|
||||
|
|
|
|||
20
hidive.ts
20
hidive.ts
|
|
@ -1075,15 +1075,23 @@ export default class Hidive implements ServiceClass {
|
|||
}
|
||||
sxData.language = subLang;
|
||||
if (options.dlsubs.includes('all') || options.dlsubs.includes(subLang.locale)) {
|
||||
const getVttContent = await this.req.getData(sub.url);
|
||||
let getVttContent = await this.req.getData(sub.url);
|
||||
if (getVttContent.ok && getVttContent.res) {
|
||||
let sBody = await getVttContent.res.text();
|
||||
|
||||
console.info(`Subtitle Downloaded: ${sub.url}`);
|
||||
//vttConvert(getVttContent.res.body, false, subLang.name, fontSize);
|
||||
const sBody = vtt2ass(undefined, chosenFontSize, await getVttContent.res.text(), '', subsMargin, options.fontName, options.combineLines);
|
||||
sxData.title = `${subLang.language} / ${sxData.title}`;
|
||||
sxData.fonts = fontsData.assFonts(sBody) as Font[];
|
||||
|
||||
if (!options.noASSConv) {
|
||||
sBody = vtt2ass(undefined, chosenFontSize, await getVttContent.res.text(), '', subsMargin, options.fontName, options.combineLines);
|
||||
sxData.title = `${subLang.language} / ${sxData.title}`;
|
||||
sxData.fonts = fontsData.assFonts(sBody) as Font[];
|
||||
console.info(`Subtitle converted: ${sxData.file}`);
|
||||
} else {
|
||||
// Yeah, whatever
|
||||
sxData.fonts = [];
|
||||
}
|
||||
|
||||
fs.writeFileSync(sxData.path, sBody);
|
||||
console.info(`Subtitle converted: ${sxData.file}`);
|
||||
files.push({
|
||||
type: 'Subtitle',
|
||||
...(sxData as sxItem),
|
||||
|
|
|
|||
|
|
@ -89,6 +89,7 @@ let argvC: {
|
|||
syncTiming: boolean;
|
||||
callbackMaker?: (data: DownloadInfo) => HLSCallback;
|
||||
// Subtitle Fix Options
|
||||
noASSConv: boolean;
|
||||
noSubFix: boolean;
|
||||
srtAssFix: boolean;
|
||||
layoutResFix: boolean;
|
||||
|
|
|
|||
|
|
@ -372,6 +372,18 @@ const args: TAppArg<boolean | number | string | unknown[]>[] = [
|
|||
},
|
||||
usage: '${sub1} ${sub2}'
|
||||
},
|
||||
{
|
||||
name: 'noASSConv',
|
||||
group: 'dl',
|
||||
describe: 'Disables VTT conversion to ASS.',
|
||||
docDescribe: true,
|
||||
service: ['crunchy', 'hidive'],
|
||||
type: 'boolean',
|
||||
usage: '',
|
||||
default: {
|
||||
default: false
|
||||
}
|
||||
},
|
||||
{
|
||||
name: 'noSubFix',
|
||||
group: 'dl',
|
||||
|
|
|
|||
Loading…
Reference in a new issue