mirror of
https://github.com/Tzahi12345/YoutubeDL-Material.git
synced 2026-04-03 23:11:28 +03:00
Updated API
Removed unused component
This commit is contained in:
@@ -47,7 +47,6 @@ import { InputDialogComponent } from './input-dialog/input-dialog.component';
|
||||
import { LazyLoadImageModule, IsVisibleProps } from 'ng-lazyload-image';
|
||||
import { audioFilesMouseHovering, videoFilesMouseHovering, audioFilesOpened, videoFilesOpened } from './main/main.component';
|
||||
import { CreatePlaylistComponent } from './create-playlist/create-playlist.component';
|
||||
import { DownloadItemComponent } from './download-item/download-item.component';
|
||||
import { SubscriptionsComponent } from './subscriptions/subscriptions.component';
|
||||
import { SubscribeDialogComponent } from './dialogs/subscribe-dialog/subscribe-dialog.component';
|
||||
import { SubscriptionComponent } from './subscription//subscription/subscription.component';
|
||||
@@ -102,7 +101,6 @@ export function isVisible({ event, element, scrollContainer, offset }: IsVisible
|
||||
PlayerComponent,
|
||||
InputDialogComponent,
|
||||
CreatePlaylistComponent,
|
||||
DownloadItemComponent,
|
||||
SubscriptionsComponent,
|
||||
SubscribeDialogComponent,
|
||||
SubscriptionComponent,
|
||||
|
||||
@@ -90,7 +90,7 @@ export class SubscribeDialogComponent implements OnInit {
|
||||
if (!this.download_all) {
|
||||
timerange = 'now-' + this.timerange_amount.toString() + this.timerange_unit;
|
||||
}
|
||||
this.postsService.createSubscription(this.url, this.name, timerange, this.streamingOnlyMode, this.maxQuality,
|
||||
this.postsService.createSubscription(this.url, this.name, timerange, this.maxQuality,
|
||||
this.audioOnlyMode, this.customArgs, this.customFileOutput).subscribe(res => {
|
||||
this.subscribing = false;
|
||||
if (res['new_sub']) {
|
||||
|
||||
@@ -1,41 +0,0 @@
|
||||
<div>
|
||||
<mat-grid-list [rowHeight]="50" [cols]="24">
|
||||
<mat-grid-tile [colspan]="7">
|
||||
<div style="display: inline-block; text-align: center; width: 100%;"><span class="shorten"><ng-container i18n="Download ID">ID:</ng-container> {{url_id ? url_id : download.uid}}</span></div>
|
||||
</mat-grid-tile>
|
||||
<mat-grid-tile [colspan]="13">
|
||||
<mat-progress-bar [value]="(download.complete || download.error) ? 100 : download.percent_complete" [mode]="(!download.complete && download.percent_complete === 0 && !download.error) ? 'indeterminate' : 'determinate'"></mat-progress-bar>
|
||||
<mat-icon *ngIf="download.complete" style="margin-left: 25px; cursor: default" matTooltip="The download was successful" i18n-matTooltip="download successful tooltip">done</mat-icon>
|
||||
<mat-icon *ngIf="download.error" style="margin-left: 25px; cursor: default" matTooltip="An error has occurred" i18n-matTooltip="download error tooltip">error</mat-icon>
|
||||
</mat-grid-tile>
|
||||
<mat-grid-tile [colspan]="4">
|
||||
<button style="margin-bottom: 2px;" (click)="cancelTheDownload()" mat-icon-button color="warn"><mat-icon fontSet="material-icons-outlined">cancel</mat-icon></button>
|
||||
</mat-grid-tile>
|
||||
</mat-grid-list>
|
||||
<mat-expansion-panel *ngIf="download.timestamp_start" class="ignore-margin">
|
||||
<mat-expansion-panel-header>
|
||||
<div>
|
||||
<ng-container i18n="Details">Details</ng-container>
|
||||
</div>
|
||||
<div style="width: 100%">
|
||||
<div style="float: right">
|
||||
<mat-panel-description>{{download.timestamp_start | date:'medium'}}</mat-panel-description>
|
||||
</div>
|
||||
</div>
|
||||
</mat-expansion-panel-header>
|
||||
<div *ngIf="download.error">
|
||||
<strong><ng-container i18n="Error label">An error has occurred:</ng-container></strong>
|
||||
<br/>
|
||||
{{download.error}}
|
||||
</div>
|
||||
<div *ngIf="download.timestamp_start">
|
||||
<strong><ng-container i18n="Download start label">Download start:</ng-container></strong> {{download.timestamp_start | date:'medium'}}
|
||||
</div>
|
||||
<div *ngIf="download.timestamp_end">
|
||||
<strong><ng-container i18n="Download end label">Download end:</ng-container></strong> {{download.timestamp_end | date:'medium'}}
|
||||
</div>
|
||||
<div *ngIf="download.fileNames">
|
||||
<strong><ng-container i18n="File path(s) label">File path(s):</ng-container></strong> {{download.fileNames.join(', ')}}
|
||||
</div>
|
||||
</mat-expansion-panel>
|
||||
</div>
|
||||
@@ -1,16 +0,0 @@
|
||||
.shorten {
|
||||
white-space: nowrap;
|
||||
text-overflow: ellipsis;
|
||||
overflow: hidden;
|
||||
display: block;
|
||||
}
|
||||
|
||||
.mat-expansion-panel:not([class*='mat-elevation-z']) {
|
||||
box-shadow: none;
|
||||
}
|
||||
|
||||
.ignore-margin {
|
||||
margin-left: -15px;
|
||||
margin-right: -15px;
|
||||
margin-bottom: -15px;
|
||||
}
|
||||
@@ -1,25 +0,0 @@
|
||||
import { ComponentFixture, TestBed, waitForAsync } from '@angular/core/testing';
|
||||
|
||||
import { DownloadItemComponent } from './download-item.component';
|
||||
|
||||
describe('DownloadItemComponent', () => {
|
||||
let component: DownloadItemComponent;
|
||||
let fixture: ComponentFixture<DownloadItemComponent>;
|
||||
|
||||
beforeEach(waitForAsync(() => {
|
||||
TestBed.configureTestingModule({
|
||||
declarations: [ DownloadItemComponent ]
|
||||
})
|
||||
.compileComponents();
|
||||
}));
|
||||
|
||||
beforeEach(() => {
|
||||
fixture = TestBed.createComponent(DownloadItemComponent);
|
||||
component = fixture.componentInstance;
|
||||
fixture.detectChanges();
|
||||
});
|
||||
|
||||
it('should create', () => {
|
||||
expect(component).toBeTruthy();
|
||||
});
|
||||
});
|
||||
@@ -1,45 +0,0 @@
|
||||
import { Component, OnInit, Output, EventEmitter, Input } from '@angular/core';
|
||||
import { Download } from 'app/main/main.component';
|
||||
|
||||
|
||||
@Component({
|
||||
selector: 'app-download-item',
|
||||
templateUrl: './download-item.component.html',
|
||||
styleUrls: ['./download-item.component.scss']
|
||||
})
|
||||
export class DownloadItemComponent implements OnInit {
|
||||
|
||||
@Input() download: Download = {
|
||||
uid: null,
|
||||
type: 'audio',
|
||||
percent_complete: 0,
|
||||
complete: false,
|
||||
url: 'http://youtube.com/watch?v=17848rufj',
|
||||
downloading: true,
|
||||
timestamp_start: null,
|
||||
timestamp_end: null,
|
||||
is_playlist: false,
|
||||
error: false
|
||||
};
|
||||
@Output() cancelDownload = new EventEmitter<Download>();
|
||||
|
||||
@Input() queueNumber = null;
|
||||
|
||||
url_id = null;
|
||||
|
||||
constructor() { }
|
||||
|
||||
ngOnInit() {
|
||||
if (this.download && this.download.url && this.download.url.includes('youtu')) {
|
||||
const string_id = (this.download.is_playlist ? '?list=' : '?v=')
|
||||
const index_offset = (this.download.is_playlist ? 6 : 3);
|
||||
const end_index = this.download.url.indexOf(string_id) + index_offset;
|
||||
this.url_id = this.download.url.substring(end_index, this.download.url.length);
|
||||
}
|
||||
}
|
||||
|
||||
cancelTheDownload() {
|
||||
this.cancelDownload.emit(this.download);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -10,26 +10,13 @@ import { Router, ActivatedRoute } from '@angular/router';
|
||||
import { Platform } from '@angular/cdk/platform';
|
||||
import { ArgModifierDialogComponent } from 'app/dialogs/arg-modifier-dialog/arg-modifier-dialog.component';
|
||||
import { RecentVideosComponent } from 'app/components/recent-videos/recent-videos.component';
|
||||
import { Download, FileType } from 'api-types';
|
||||
|
||||
export let audioFilesMouseHovering = false;
|
||||
export let videoFilesMouseHovering = false;
|
||||
export let audioFilesOpened = false;
|
||||
export let videoFilesOpened = false;
|
||||
|
||||
export interface Download {
|
||||
uid: string;
|
||||
type: string;
|
||||
url: string;
|
||||
percent_complete: number;
|
||||
downloading: boolean;
|
||||
is_playlist: boolean;
|
||||
error?: boolean | string;
|
||||
fileNames?: string[];
|
||||
complete?: boolean;
|
||||
timestamp_start?: number;
|
||||
timestamp_end?: number;
|
||||
}
|
||||
|
||||
@Component({
|
||||
selector: 'app-root',
|
||||
templateUrl: './main.component.html',
|
||||
@@ -198,16 +185,6 @@ export class MainComponent implements OnInit {
|
||||
last_valid_url = '';
|
||||
last_url_check = 0;
|
||||
|
||||
test_download: Download = {
|
||||
uid: null,
|
||||
type: 'audio',
|
||||
percent_complete: 0,
|
||||
url: 'http://youtube.com/watch?v=17848rufj',
|
||||
downloading: true,
|
||||
is_playlist: false,
|
||||
error: false
|
||||
};
|
||||
|
||||
argsChangedSubject: Subject<boolean> = new Subject<boolean>();
|
||||
simulatedOutput = '';
|
||||
|
||||
@@ -411,7 +388,7 @@ export class MainComponent implements OnInit {
|
||||
const urls = this.getURLArray(this.url);
|
||||
for (let i = 0; i < urls.length; i++) {
|
||||
const url = urls[i];
|
||||
this.postsService.downloadFile(url, type, (selected_quality === '' ? null : selected_quality),
|
||||
this.postsService.downloadFile(url, type as FileType, (selected_quality === '' ? null : selected_quality),
|
||||
customQualityConfiguration, customArgs, additionalArgs, customOutput, youtubeUsername, youtubePassword, cropFileSettings).subscribe(res => {
|
||||
this.current_download = res['download'];
|
||||
this.downloads.push(res['download']);
|
||||
@@ -439,7 +416,6 @@ export class MainComponent implements OnInit {
|
||||
return;
|
||||
}
|
||||
this.downloadingfile = false;
|
||||
this.current_download.downloading = false;
|
||||
this.current_download = null;
|
||||
}
|
||||
|
||||
|
||||
@@ -157,7 +157,7 @@ export class PlayerComponent implements OnInit, AfterViewInit, OnDestroy {
|
||||
});
|
||||
// regular video/audio file (not playlist)
|
||||
this.uids = [this.db_file['uid']];
|
||||
this.type = this.db_file['isAudio'] ? 'audio' : 'video' as FileType;
|
||||
this.type = this.db_file['isAudio'] ? 'audio' as FileType : 'video' as FileType;
|
||||
this.parseFileNames();
|
||||
});
|
||||
}
|
||||
|
||||
@@ -16,6 +16,7 @@ import {
|
||||
ConfigResponse,
|
||||
CreatePlaylistRequest,
|
||||
CreatePlaylistResponse,
|
||||
CropFileSettings,
|
||||
DeleteMp3Mp4Request,
|
||||
DeletePlaylistRequest,
|
||||
DeleteSubscriptionFileRequest,
|
||||
@@ -41,10 +42,8 @@ import {
|
||||
GetUsersResponse,
|
||||
LoginRequest,
|
||||
LoginResponse,
|
||||
Mp3DownloadRequest,
|
||||
Mp3DownloadResponse,
|
||||
Mp4DownloadRequest,
|
||||
Mp4DownloadResponse,
|
||||
DownloadRequest,
|
||||
DownloadResponse,
|
||||
Playlist,
|
||||
RegisterRequest,
|
||||
RegisterResponse,
|
||||
@@ -57,7 +56,6 @@ import {
|
||||
UpdaterStatus,
|
||||
UnsubscribeRequest,
|
||||
UnsubscribeResponse,
|
||||
UpdatePlaylistFilesRequest,
|
||||
UpdatePlaylistRequest,
|
||||
UpdateServerRequest,
|
||||
UpdateUserRequest,
|
||||
@@ -231,7 +229,7 @@ export class PostsService implements CanActivate {
|
||||
|
||||
// tslint:disable-next-line: max-line-length
|
||||
// tslint:disable-next-line: max-line-length
|
||||
downloadFile(url: string, type: string, selectedQuality: string, customQualityConfiguration: string, customArgs: string = null, additionalArgs: string = null, customOutput: string = null, youtubeUsername: string = null, youtubePassword: string = null, cropFileSettings: CropFileSettings = null) {
|
||||
downloadFile(url: string, type: FileType, selectedQuality: string, customQualityConfiguration: string, customArgs: string = null, additionalArgs: string = null, customOutput: string = null, youtubeUsername: string = null, youtubePassword: string = null, cropFileSettings: CropFileSettings = null) {
|
||||
const body: DownloadRequest = {url: url,
|
||||
selectedHeight: selectedQuality,
|
||||
customQualityConfiguration: customQualityConfiguration,
|
||||
@@ -299,7 +297,7 @@ export class PostsService implements CanActivate {
|
||||
return this.http.post<SuccessObject>(this.path + 'setConfig', body, this.httpOptions);
|
||||
}
|
||||
|
||||
deleteFile(uid: string, isAudio: boolean, blacklistMode = false) {
|
||||
deleteFile(uid: string, blacklistMode = false) {
|
||||
const body: DeleteMp3Mp4Request = {uid: uid, blacklistMode: blacklistMode}
|
||||
return this.http.post(this.path + 'deleteFile', body, this.httpOptions);
|
||||
}
|
||||
@@ -392,12 +390,12 @@ export class PostsService implements CanActivate {
|
||||
return this.http.post<GenerateNewApiKeyResponse>(this.path + 'generateNewAPIKey', {}, this.httpOptions);
|
||||
}
|
||||
|
||||
enableSharing(uid: string, type: FileType, is_playlist: boolean) {
|
||||
enableSharing(uid: string, is_playlist: boolean) {
|
||||
const body: SharingToggle = {uid: uid, is_playlist: is_playlist};
|
||||
return this.http.post<SuccessObject>(this.path + 'enableSharing', body, this.httpOptions);
|
||||
}
|
||||
|
||||
disableSharing(uid: string, type: FileType, is_playlist: boolean) {
|
||||
disableSharing(uid: string, is_playlist: boolean) {
|
||||
const body: SharingToggle = {uid: uid, is_playlist: is_playlist};
|
||||
return this.http.post<SuccessObject>(this.path + 'disableSharing', body, this.httpOptions);
|
||||
}
|
||||
@@ -434,10 +432,9 @@ export class PostsService implements CanActivate {
|
||||
return this.http.post<SuccessObject>(this.path + 'deletePlaylist', body, this.httpOptions);
|
||||
}
|
||||
|
||||
createSubscription(url, name, timerange = null, streamingOnly = false, maxQuality = 'best', audioOnly = false, customArgs: string = null, customFileOutput: string = null) {
|
||||
createSubscription(url, name, timerange = null, maxQuality = 'best', audioOnly = false, customArgs: string = null, customFileOutput: string = null) {
|
||||
const body: SubscribeRequest = {url: url, name: name, timerange: timerange, maxQuality: maxQuality,
|
||||
streamingOnly: streamingOnly, audioOnly: audioOnly, customArgs: customArgs,
|
||||
customFileOutput: customFileOutput};
|
||||
audioOnly: audioOnly, customArgs: customArgs, customFileOutput: customFileOutput};
|
||||
return this.http.post<SubscribeResponse>(this.path + 'subscribe', body, this.httpOptions);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user