mirror of
https://github.com/Tzahi12345/YoutubeDL-Material.git
synced 2026-04-17 15:51:29 +03:00
Fixed bug that caused downloads to fail when archiving was enabled
Removed error message on URL input on the home page Fixed bug that prevented file deletion in multi user mode with archiving enabled
This commit is contained in:
@@ -1246,6 +1246,7 @@ async function downloadFileByURL_exec(url, type, options, sessionID = null) {
|
|||||||
} else if (output) {
|
} else if (output) {
|
||||||
if (output.length === 0 || output[0].length === 0) {
|
if (output.length === 0 || output[0].length === 0) {
|
||||||
download['error'] = 'No output. Check if video already exists in your archive.';
|
download['error'] = 'No output. Check if video already exists in your archive.';
|
||||||
|
logger.warn(`No output received for video download, check if it exists in your archive.`)
|
||||||
updateDownloads();
|
updateDownloads();
|
||||||
|
|
||||||
resolve(false);
|
resolve(false);
|
||||||
@@ -1296,10 +1297,10 @@ async function downloadFileByURL_exec(url, type, options, sessionID = null) {
|
|||||||
|
|
||||||
let is_playlist = file_names.length > 1;
|
let is_playlist = file_names.length > 1;
|
||||||
|
|
||||||
if (options.merged_string) {
|
if (options.merged_string !== null && options.merged_string !== undefined) {
|
||||||
let current_merged_archive = fs.readFileSync(fileFolderPath + 'merged.txt', 'utf8');
|
let current_merged_archive = fs.readFileSync(path.join(fileFolderPath, `merged_${type}.txt`), 'utf8');
|
||||||
let diff = current_merged_archive.replace(options.merged_string, '');
|
let diff = current_merged_archive.replace(options.merged_string, '');
|
||||||
const archive_path = path.join(archivePath, `archive_${type}.txt`);
|
const archive_path = options.user ? path.join(fileFolderPath, 'archives', `archive_${type}.txt`) : path.join(archivePath, `archive_${type}.txt`);
|
||||||
fs.appendFileSync(archive_path, diff);
|
fs.appendFileSync(archive_path, diff);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1430,10 +1431,10 @@ async function downloadFileByURL_normal(url, type, options, sessionID = null) {
|
|||||||
const base_file_name = video_info._filename.substring(fileFolderPath.length, video_info._filename.length);
|
const base_file_name = video_info._filename.substring(fileFolderPath.length, video_info._filename.length);
|
||||||
file_uid = registerFileDB(base_file_name, type, multiUserMode);
|
file_uid = registerFileDB(base_file_name, type, multiUserMode);
|
||||||
|
|
||||||
if (options.merged_string) {
|
if (options.merged_string !== null && options.merged_string !== undefined) {
|
||||||
let current_merged_archive = fs.readFileSync(fileFolderPath + 'merged.txt', 'utf8');
|
let current_merged_archive = fs.readFileSync(path.join(fileFolderPath, `merged_${type}.txt`), 'utf8');
|
||||||
let diff = current_merged_archive.replace(options.merged_string, '');
|
let diff = current_merged_archive.replace(options.merged_string, '');
|
||||||
const archive_path = req.isAuthenticated() ? path.join(fileFolderPath, 'archives', `archive_${type}.txt`) : path.join(archivePath, `archive_${type}.txt`);
|
const archive_path = options.user ? path.join(fileFolderPath, 'archives', `archive_${type}.txt`) : path.join(archivePath, `archive_${type}.txt`);
|
||||||
fs.appendFileSync(archive_path, diff);
|
fs.appendFileSync(archive_path, diff);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1534,7 +1535,11 @@ async function generateArgs(url, type, options) {
|
|||||||
|
|
||||||
let useYoutubeDLArchive = config_api.getConfigItem('ytdl_use_youtubedl_archive');
|
let useYoutubeDLArchive = config_api.getConfigItem('ytdl_use_youtubedl_archive');
|
||||||
if (useYoutubeDLArchive) {
|
if (useYoutubeDLArchive) {
|
||||||
const archive_path = options.user ? path.join(fileFolderPath, 'archives', `archive_${type}.txt`) : path.join(archivePath, `archive_${type}.txt`);
|
const archive_folder = options.user ? path.join(fileFolderPath, 'archives') : archivePath;
|
||||||
|
const archive_path = path.join(archive_folder, `archive_${type}.txt`);
|
||||||
|
|
||||||
|
fs.ensureDirSync(archive_folder);
|
||||||
|
|
||||||
// create archive file if it doesn't exist
|
// create archive file if it doesn't exist
|
||||||
if (!fs.existsSync(archive_path)) {
|
if (!fs.existsSync(archive_path)) {
|
||||||
fs.closeSync(fs.openSync(archive_path, 'w'));
|
fs.closeSync(fs.openSync(archive_path, 'w'));
|
||||||
@@ -1546,7 +1551,7 @@ async function generateArgs(url, type, options) {
|
|||||||
fs.closeSync(fs.openSync(blacklist_path, 'w'));
|
fs.closeSync(fs.openSync(blacklist_path, 'w'));
|
||||||
}
|
}
|
||||||
|
|
||||||
let merged_path = fileFolderPath + 'merged.txt';
|
let merged_path = path.join(fileFolderPath, `merged_${type}.txt`);
|
||||||
fs.ensureFileSync(merged_path);
|
fs.ensureFileSync(merged_path);
|
||||||
// merges blacklist and regular archive
|
// merges blacklist and regular archive
|
||||||
let inputPathList = [archive_path, blacklist_path];
|
let inputPathList = [archive_path, blacklist_path];
|
||||||
@@ -1568,6 +1573,7 @@ async function generateArgs(url, type, options) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
logger.verbose(`youtube-dl args being used: ${downloadConfig.join(',')}`);
|
||||||
// downloadConfig.map((arg) => `"${arg}"`);
|
// downloadConfig.map((arg) => `"${arg}"`);
|
||||||
resolve(downloadConfig);
|
resolve(downloadConfig);
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -430,8 +430,8 @@ exports.deleteUserFile = function(user_uid, file_uid, type, blacklistMode = fals
|
|||||||
fs.appendFileSync(blacklistPath, line);
|
fs.appendFileSync(blacklistPath, line);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
logger.info('Could not find archive file for audio files. Creating...');
|
logger.info(`Could not find archive file for ${type} files. Creating...`);
|
||||||
fs.closeSync(fs.openSync(archive_path, 'w'));
|
fs.ensureFileSync(archive_path);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -11,10 +11,7 @@
|
|||||||
<div class="row">
|
<div class="row">
|
||||||
<div [ngClass]="allowQualitySelect ? 'col-sm-9' : null" class="col-12">
|
<div [ngClass]="allowQualitySelect ? 'col-sm-9' : null" class="col-12">
|
||||||
<mat-form-field color="accent" class="example-full-width">
|
<mat-form-field color="accent" class="example-full-width">
|
||||||
<input style="padding-right: 25px;" matInput (keyup.enter)="downloadClicked()" (ngModelChange)="inputChanged($event)" [(ngModel)]="url" [placeholder]="'URL' + (youtubeSearchEnabled ? ' or search' : '')" type="url" name="url" [formControl]="urlForm" #urlinput>
|
<input style="padding-right: 25px;" matInput (keyup.enter)="downloadClicked()" (ngModelChange)="inputChanged($event)" [(ngModel)]="url" [placeholder]="'URL' + (youtubeSearchEnabled ? ' or search' : '')" type="url" name="url" #urlinput>
|
||||||
<mat-error *ngIf="urlError || urlForm.invalid">
|
|
||||||
<ng-container i18n="Enter valid URL error">Please enter a valid URL!</ng-container>
|
|
||||||
</mat-error>
|
|
||||||
</mat-form-field>
|
</mat-form-field>
|
||||||
<button type="button" class="input-clear-button" mat-icon-button (click)="clearInput()"><mat-icon>clear</mat-icon></button>
|
<button type="button" class="input-clear-button" mat-icon-button (click)="clearInput()"><mat-icon>clear</mat-icon></button>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
Reference in New Issue
Block a user