UI & logs now use proper fork name rather than just youtube-dl

pull/657/head
Isaac Abadi 3 years ago
parent 19a3ffc118
commit 86cbfea08f

@ -2527,6 +2527,8 @@ components:
properties: properties:
key: key:
type: string type: string
title:
type: string
last_ran: last_ran:
type: number type: number
last_confirmed: last_confirmed:

@ -376,6 +376,8 @@ async function downloadQueuedFile(download_uid) {
// helper functions // helper functions
exports.generateArgs = async (url, type, options, user_uid = null, simulated = false) => { exports.generateArgs = async (url, type, options, user_uid = null, simulated = false) => {
const default_downloader = utils.getCurrentDownloader() || config_api.getConfigItem('ytdl_default_downloader');
const audioFolderPath = config_api.getConfigItem('ytdl_audio_folder_path'); const audioFolderPath = config_api.getConfigItem('ytdl_audio_folder_path');
const videoFolderPath = config_api.getConfigItem('ytdl_video_folder_path'); const videoFolderPath = config_api.getConfigItem('ytdl_video_folder_path');
const usersFolderPath = config_api.getConfigItem('ytdl_users_base_path'); const usersFolderPath = config_api.getConfigItem('ytdl_users_base_path');
@ -413,8 +415,6 @@ exports.generateArgs = async (url, type, options, user_uid = null, simulated = f
if (!is_audio && !is_youtube) { if (!is_audio && !is_youtube) {
// tiktok videos fail when using the default format // tiktok videos fail when using the default format
qualityPath = null; qualityPath = null;
} else if (!is_audio && !is_youtube && (url.includes('reddit') || url.includes('pornhub'))) {
qualityPath = ['-f', 'bestvideo+bestaudio']
} }
if (customArgs) { if (customArgs) {
@ -505,7 +505,6 @@ exports.generateArgs = async (url, type, options, user_uid = null, simulated = f
downloadConfig.push('-r', rate_limit); downloadConfig.push('-r', rate_limit);
} }
const default_downloader = utils.getCurrentDownloader() || config_api.getConfigItem('ytdl_default_downloader');
if (default_downloader === 'yt-dlp') { if (default_downloader === 'yt-dlp') {
downloadConfig.push('--no-clean-infojson'); downloadConfig.push('--no-clean-infojson');
} }
@ -515,7 +514,7 @@ exports.generateArgs = async (url, type, options, user_uid = null, simulated = f
// filter out incompatible args // filter out incompatible args
downloadConfig = filterArgs(downloadConfig, is_audio); downloadConfig = filterArgs(downloadConfig, is_audio);
if (!simulated) logger.verbose(`youtube-dl args being used: ${downloadConfig.join(',')}`); if (!simulated) logger.verbose(`${default_downloader} args being used: ${downloadConfig.join(',')}`);
return downloadConfig; return downloadConfig;
} }

@ -4,6 +4,7 @@
export type Task = { export type Task = {
key: string; key: string;
title?: string;
last_ran: number; last_ran: number;
last_confirmed: number; last_confirmed: number;
running: boolean; running: boolean;

@ -7,6 +7,7 @@ import { ConfirmDialogComponent } from 'app/dialogs/confirm-dialog/confirm-dialo
import { RestoreDbDialogComponent } from 'app/dialogs/restore-db-dialog/restore-db-dialog.component'; import { RestoreDbDialogComponent } from 'app/dialogs/restore-db-dialog/restore-db-dialog.component';
import { UpdateTaskScheduleDialogComponent } from 'app/dialogs/update-task-schedule-dialog/update-task-schedule-dialog.component'; import { UpdateTaskScheduleDialogComponent } from 'app/dialogs/update-task-schedule-dialog/update-task-schedule-dialog.component';
import { PostsService } from 'app/posts.services'; import { PostsService } from 'app/posts.services';
import { Task } from 'api-types';
@Component({ @Component({
selector: 'app-tasks', selector: 'app-tasks',
@ -17,7 +18,7 @@ export class TasksComponent implements OnInit {
interval_id = null; interval_id = null;
tasks_check_interval = 1500; tasks_check_interval = 1500;
tasks = null; tasks: Task[] = null;
tasks_retrieved = false; tasks_retrieved = false;
displayedColumns: string[] = ['title', 'last_ran', 'last_confirmed', 'status', 'actions']; displayedColumns: string[] = ['title', 'last_ran', 'last_confirmed', 'status', 'actions'];
@ -55,6 +56,11 @@ export class TasksComponent implements OnInit {
getTasks(): void { getTasks(): void {
this.postsService.getTasks().subscribe(res => { this.postsService.getTasks().subscribe(res => {
for (const task of res['tasks']) {
if (task.title.includes('youtube-dl')) {
task.title = task.title.replace('youtube-dl', this.postsService.config.Advanced.default_downloader);
}
}
if (this.tasks) { if (this.tasks) {
if (JSON.stringify(this.tasks) === JSON.stringify(res['tasks'])) return; if (JSON.stringify(this.tasks) === JSON.stringify(res['tasks'])) return;
for (const task of res['tasks']) { for (const task of res['tasks']) {
@ -94,7 +100,7 @@ export class TasksComponent implements OnInit {
}); });
} }
scheduleTask(task: any): void { scheduleTask(task: Task): void {
// open dialog // open dialog
const dialogRef = this.dialog.open(UpdateTaskScheduleDialogComponent, { const dialogRef = this.dialog.open(UpdateTaskScheduleDialogComponent, {
data: { data: {
@ -152,13 +158,3 @@ export class TasksComponent implements OnInit {
} }
} }
export interface Task {
key: string;
title: string;
last_ran: number;
last_confirmed: number;
running: boolean;
confirming: boolean;
data: unknown;
}

@ -591,7 +591,8 @@ export class MainComponent implements OnInit {
if (passwordIndex !== -1 && passwordIndex !== simulated_args.length - 1) { if (passwordIndex !== -1 && passwordIndex !== simulated_args.length - 1) {
simulated_args[passwordIndex + 1] = simulated_args[passwordIndex + 1].replace(/./g, '*'); simulated_args[passwordIndex + 1] = simulated_args[passwordIndex + 1].replace(/./g, '*');
} }
this.simulatedOutput = `youtube-dl ${this.url} ${simulated_args.join(' ')}`; const downloader = this.postsService.config.Advanced.default_downloader;
this.simulatedOutput = `${downloader} ${this.url} ${simulated_args.join(' ')}`;
} }
}); });
} }

@ -100,7 +100,8 @@ import {
UpdateFileRequest, UpdateFileRequest,
Sort, Sort,
FileTypeFilter, FileTypeFilter,
GetAllFilesRequest GetAllFilesRequest,
GetAllTasksResponse
} from '../api-types'; } from '../api-types';
import { isoLangs } from './settings/locales_list'; import { isoLangs } from './settings/locales_list';
import { Title } from '@angular/platform-browser'; import { Title } from '@angular/platform-browser';
@ -596,7 +597,7 @@ export class PostsService implements CanActivate {
} }
getTasks() { getTasks() {
return this.http.post<SuccessObject>(this.path + 'getTasks', {}, this.httpOptions); return this.http.post<GetAllTasksResponse>(this.path + 'getTasks', {}, this.httpOptions);
} }
resetTasks() { resetTasks() {

Loading…
Cancel
Save