mirror of
https://github.com/anidl/multi-downloader-nx.git
synced 2026-05-10 20:10:38 +00:00
file write on different disk bug solved
This commit is contained in:
parent
9a592bb337
commit
4519a80a4b
4 changed files with 48 additions and 22 deletions
16
adn.ts
16
adn.ts
|
|
@ -833,13 +833,15 @@ export default class AnimationDigitalNetwork implements ServiceClass {
|
|||
|
||||
const sxData: Partial<sxItem> = {};
|
||||
sxData.file = langsData.subsFile(fileName as string, subIndex+'', subLang, false, options.ccTag);
|
||||
sxData.path = path.join(this.cfg.dir.content, sxData.file);
|
||||
const split = sxData.path.split(path.sep).slice(0, -1);
|
||||
split.forEach((val, ind, arr) => {
|
||||
const isAbsolut = path.isAbsolute(sxData.path as string);
|
||||
if (!fs.existsSync(path.join(isAbsolut ? '' : this.cfg.dir.content, ...arr.slice(0, ind), val)))
|
||||
fs.mkdirSync(path.join(isAbsolut ? '' : this.cfg.dir.content, ...arr.slice(0, ind), val));
|
||||
});
|
||||
if (path.isAbsolute(sxData.file)) {
|
||||
sxData.path = sxData.file;
|
||||
} else {
|
||||
sxData.path = path.join(this.cfg.dir.content, sxData.file);
|
||||
}
|
||||
const dirName = path.dirname(sxData.path);
|
||||
if (!fs.existsSync(dirName)) {
|
||||
fs.mkdirSync(dirName, { recursive: true });
|
||||
}
|
||||
sxData.language = subLang;
|
||||
if(options.dlsubs.includes('all') || options.dlsubs.includes(subLang.locale)) {
|
||||
let subBody = '[Script Info]'
|
||||
|
|
|
|||
16
ao.ts
16
ao.ts
|
|
@ -727,7 +727,8 @@ export default class AnimeOnegai implements ServiceClass {
|
|||
if (!options.nocleanup) {
|
||||
fs.removeSync(`${tempTsFile}.video.enc.mp4`);
|
||||
}
|
||||
fs.renameSync(`${tempTsFile}.video.mp4`, `${tsFile}.video.mp4`);
|
||||
fs.copyFileSync(`${tempTsFile}.video.m4s`, `${tsFile}.video.m4s`);
|
||||
fs.unlinkSync(`${tempTsFile}.video.m4s`);
|
||||
files.push({
|
||||
type: 'Video',
|
||||
path: `${tsFile}.video.mp4`,
|
||||
|
|
@ -748,7 +749,8 @@ export default class AnimeOnegai implements ServiceClass {
|
|||
if (!options.nocleanup) {
|
||||
fs.removeSync(`${tempTsFile}.audio.enc.mp4`);
|
||||
}
|
||||
fs.renameSync(`${tempTsFile}.audio.mp4`, `${tsFile}.audio.mp4`);
|
||||
fs.copyFileSync(`${tempTsFile}.audio.m4s`, `${tsFile}.audio.m4s`);
|
||||
fs.unlinkSync(`${tempTsFile}.audio.m4s`);
|
||||
files.push({
|
||||
type: 'Audio',
|
||||
path: `${tsFile}.audio.mp4`,
|
||||
|
|
@ -800,7 +802,15 @@ export default class AnimeOnegai implements ServiceClass {
|
|||
}
|
||||
const sxData: Partial<sxItem> = {};
|
||||
sxData.file = langsData.subsFile(fileName as string, subIndex+'', subLang, false, options.ccTag);
|
||||
sxData.path = path.join(this.cfg.dir.content, sxData.file);
|
||||
if (path.isAbsolute(sxData.file)) {
|
||||
sxData.path = sxData.file;
|
||||
} else {
|
||||
sxData.path = path.join(this.cfg.dir.content, sxData.file);
|
||||
}
|
||||
const dirName = path.dirname(sxData.path);
|
||||
if (!fs.existsSync(dirName)) {
|
||||
fs.mkdirSync(dirName, { recursive: true });
|
||||
}
|
||||
sxData.language = subLang;
|
||||
if((options.dlsubs.includes('all') || options.dlsubs.includes(subLang.locale)) && sub.url.includes('.ass')) {
|
||||
const getSubtitle = await this.req.getData(sub.url, AuthHeaders);
|
||||
|
|
|
|||
22
crunchy.ts
22
crunchy.ts
|
|
@ -1831,7 +1831,8 @@ export default class Crunchy implements ServiceClass {
|
|||
if (!options.nocleanup) {
|
||||
fs.removeSync(`${tempTsFile}.video.enc.m4s`);
|
||||
}
|
||||
fs.renameSync(`${tempTsFile}.video.m4s`, `${tsFile}.video.m4s`);
|
||||
fs.copyFileSync(`${tempTsFile}.video.m4s`, `${tsFile}.video.m4s`)
|
||||
fs.unlinkSync(`${tempTsFile}.video.m4s`)
|
||||
files.push({
|
||||
type: 'Video',
|
||||
path: `${tsFile}.video.m4s`,
|
||||
|
|
@ -1853,7 +1854,8 @@ export default class Crunchy implements ServiceClass {
|
|||
if (!options.nocleanup) {
|
||||
fs.removeSync(`${tempTsFile}.audio.enc.m4s`);
|
||||
}
|
||||
fs.renameSync(`${tempTsFile}.audio.m4s`, `${tsFile}.audio.m4s`);
|
||||
fs.copyFileSync(`${tempTsFile}.audio.m4s`, `${tsFile}.audio.m4s`);
|
||||
fs.unlinkSync(`${tempTsFile}.audio.m4s`);
|
||||
files.push({
|
||||
type: 'Audio',
|
||||
path: `${tsFile}.audio.m4s`,
|
||||
|
|
@ -2131,13 +2133,15 @@ export default class Crunchy implements ServiceClass {
|
|||
const isSigns = langItem.code === audDub && !subsItem.isCC;
|
||||
const isCC = subsItem.isCC;
|
||||
sxData.file = langsData.subsFile(fileName as string, subsIndex, langItem, isCC, options.ccTag, isSigns, subsItem.format);
|
||||
sxData.path = path.join(this.cfg.dir.content, sxData.file);
|
||||
const split = sxData.path.split(path.sep).slice(0, -1);
|
||||
split.forEach((val, ind, arr) => {
|
||||
const isAbsolut = path.isAbsolute(sxData.path as string);
|
||||
if (!fs.existsSync(path.join(isAbsolut ? '' : this.cfg.dir.content, ...arr.slice(0, ind), val)))
|
||||
fs.mkdirSync(path.join(isAbsolut ? '' : this.cfg.dir.content, ...arr.slice(0, ind), val));
|
||||
});
|
||||
if (path.isAbsolute(sxData.file)) {
|
||||
sxData.path = sxData.file;
|
||||
} else {
|
||||
sxData.path = path.join(this.cfg.dir.content, sxData.file);
|
||||
}
|
||||
const dirName = path.dirname(sxData.path);
|
||||
if (!fs.existsSync(dirName)) {
|
||||
fs.mkdirSync(dirName, { recursive: true });
|
||||
}
|
||||
if (files.some(a => a.type === 'Subtitle' && (a.language.cr_locale == langItem.cr_locale || a.language.locale == langItem.locale) && a.cc === isCC && a.signs === isSigns))
|
||||
continue;
|
||||
if(options.dlsubs.includes('all') || options.dlsubs.includes(langItem.locale)){
|
||||
|
|
|
|||
16
hidive.ts
16
hidive.ts
|
|
@ -852,7 +852,8 @@ export default class Hidive implements ServiceClass {
|
|||
if (!options.nocleanup) {
|
||||
fs.removeSync(`${tempTsFile}.video.enc.m4s`);
|
||||
}
|
||||
fs.renameSync(`${tempTsFile}.video.m4s`, `${tsFile}.video.m4s`);
|
||||
fs.copyFileSync(`${tempTsFile}.video.m4s`, `${tsFile}.video.m4s`);
|
||||
fs.unlinkSync(`${tempTsFile}.video.m4s`);
|
||||
files.push({
|
||||
type: 'Video',
|
||||
path: `${tsFile}.video.m4s`,
|
||||
|
|
@ -938,7 +939,8 @@ export default class Hidive implements ServiceClass {
|
|||
if (!options.nocleanup) {
|
||||
fs.removeSync(`${tempTsFile}.audio.enc.m4s`);
|
||||
}
|
||||
fs.renameSync(`${tempTsFile}.audio.m4s`, `${tsFile}.audio.m4s`);
|
||||
fs.copyFileSync(`${tempTsFile}.audio.m4s`, `${tsFile}.audio.m4s`);
|
||||
fs.unlinkSync(`${tempTsFile}.audio.m4s`);
|
||||
files.push({
|
||||
type: 'Audio',
|
||||
path: `${tsFile}.audio.m4s`,
|
||||
|
|
@ -976,7 +978,15 @@ export default class Hidive implements ServiceClass {
|
|||
}
|
||||
const sxData: Partial<sxItem> = {};
|
||||
sxData.file = langsData.subsFile(fileName as string, subIndex+'', subLang, false, options.ccTag);
|
||||
sxData.path = path.join(this.cfg.dir.content, sxData.file);
|
||||
if (path.isAbsolute(sxData.file)) {
|
||||
sxData.path = sxData.file;
|
||||
} else {
|
||||
sxData.path = path.join(this.cfg.dir.content, sxData.file);
|
||||
}
|
||||
const dirName = path.dirname(sxData.path);
|
||||
if (!fs.existsSync(dirName)) {
|
||||
fs.mkdirSync(dirName, { recursive: true });
|
||||
}
|
||||
sxData.language = subLang;
|
||||
if(options.dlsubs.includes('all') || options.dlsubs.includes(subLang.locale)) {
|
||||
const getVttContent = await this.req.getData(sub.url);
|
||||
|
|
|
|||
Loading…
Reference in a new issue