Updated API

Removed unused component
This commit is contained in:
Isaac Abadi
2021-09-30 19:37:21 -06:00
parent 3937700eff
commit 94006ef794
80 changed files with 300 additions and 588 deletions

View File

@@ -6,34 +6,7 @@ info:
servers:
- url: 'http://localhost:17442'
paths:
/api/tomp3:
post:
tags:
- downloader
summary: Download audio file
description: |-
Downloads an audio file with the given URL. Will include global args if they exist.
HTTP requests will return once the audio file download completes. In the future, it will (by default) return once the download starts, and a separate API call will be used for checking the download status.
operationId: post-tomp3
requestBody:
content:
application/json:
schema:
$ref: '#/components/schemas/Mp3DownloadRequest'
responses:
'200':
description: OK
content:
application/json:
schema:
$ref: '#/components/schemas/Mp3DownloadResponse'
'500':
description: Server download error
security:
- Auth query parameter: []
/api/tomp4:
/api/downloadFile:
post:
tags:
- downloader
@@ -48,14 +21,14 @@ paths:
content:
application/json:
schema:
$ref: '#/components/schemas/Mp4DownloadRequest'
$ref: '#/components/schemas/DownloadRequest'
responses:
'200':
description: OK
content:
application/json:
schema:
$ref: '#/components/schemas/Mp4DownloadResponse'
$ref: '#/components/schemas/DownloadResponse'
'500':
description: Server download error
security:
@@ -365,27 +338,6 @@ paths:
$ref: '#/components/schemas/SuccessObject'
security:
- Auth query parameter: []
/api/updatePlaylistFiles:
post:
tags:
- playlists
summary: Update playlist files
description: Updates the list of filenames in the playlist object
operationId: post-api-updatePlaylistFiles
requestBody:
content:
application/json:
schema:
$ref: '#/components/schemas/UpdatePlaylistFilesRequest'
responses:
'200':
description: OK
content:
application/json:
schema:
$ref: '#/components/schemas/SuccessObject'
security:
- Auth query parameter: []
/api/deletePlaylist:
post:
tags:
@@ -429,7 +381,7 @@ paths:
description: Whether the operation succeeded
security:
- Auth query parameter: []
/api/downloadFile:
/api/downloadFileFromServer:
post:
tags:
- files
@@ -451,13 +403,13 @@ paths:
post:
tags:
- files
summary: Delete downloaded file (unused)
summary: Delete downloaded file
operationId: post-api-deleteFile
requestBody:
content:
application/json:
schema:
$ref: '#/components/schemas/DeleteFileRequest'
$ref: '#/components/schemas/DeleteMp3Mp4Request'
responses:
'200':
description: OK
@@ -861,6 +813,16 @@ components:
enum:
- audio
- video
CropFileSettings:
type: object
required:
- cropFileStart
- cropFileEnd
properties:
cropFileStart:
type: number
cropFileEnd:
type: number
Config:
required:
- YoutubeDLMaterial
@@ -868,7 +830,7 @@ components:
properties:
YoutubeDLMaterial:
type: object
BaseDownloadRequest:
DownloadRequest:
required:
- url
type: object
@@ -881,7 +843,10 @@ components:
example: '251'
customArgs:
type: string
description: Custom command-line arguments for youtubedl. Overrides all other options, except url.
description: Custom command-line arguments for youtube-dl. Overrides all other options, except url.
additionalArgs:
type: string
description: Additional command-line arguments for youtube-dl. Added to whatever args would normally be used.
customOutput:
type: string
description: Custom output filename template.
@@ -891,67 +856,31 @@ components:
youtubePassword:
type: string
description: Account password
ui_uid:
type: string
nullable: true
Mp3DownloadRequest:
allOf:
- $ref: '#/components/schemas/BaseDownloadRequest'
- type: object
properties:
maxBitrate:
type: string
description: Specify ffmpeg/avconv audio quality
example: '160'
Mp4DownloadRequest:
allOf:
- $ref: '#/components/schemas/BaseDownloadRequest'
- type: object
properties:
selectedHeight:
type: string
description: Height of the video, if known
example: '1080'
BaseDownloadResponse:
required:
- uid
maxBitrate:
type: string
description: Specify ffmpeg/avconv audio quality
example: '160'
type:
$ref: '#/components/schemas/FileType'
cropFileSettings:
$ref: '#/components/schemas/CropFileSettings'
DownloadResponse:
type: object
properties:
uid:
type: string
file_names:
download:
$ref: '#/components/schemas/Download'
nullable: true
type: array
items:
type: string
Mp3DownloadResponse:
allOf:
- $ref: '#/components/schemas/BaseDownloadResponse'
- type: object
required:
- audiopathEncoded
properties:
audiopathEncoded:
type: string
Mp4DownloadResponse:
allOf:
- $ref: '#/components/schemas/BaseDownloadResponse'
- type: object
required:
- videopathEncoded
properties:
videopathEncoded:
type: string
GetDownloadRequest:
type: object
properties:
session_id:
type: string
download_id:
download_uid:
type: string
required:
- session_id
- download_id
- download_uid
GetDownloadResponse:
type: object
properties:
@@ -962,12 +891,8 @@ components:
type: object
properties:
downloads:
type: object
description: Map of Session ID to inner map
additionalProperties:
type: object
description: Map of Download UID to downoad
additionalProperties:
type: array
items:
$ref: '#/components/schemas/Download'
GetMp3sResponse:
required:
@@ -1038,14 +963,11 @@ components:
$ref: '#/components/schemas/DatabaseFile'
SharingToggle:
required:
- type
- uid
type: object
properties:
uid:
type: string
type:
$ref: '#/components/schemas/FileType'
is_playlist:
type: boolean
SubscribeRequest:
@@ -1061,14 +983,14 @@ components:
type: string
timerange:
type: string
streamingOnly:
type: boolean
audioOnly:
type: boolean
customArgs:
type: string
customFileOutput:
type: string
maxQuality:
type: string
SubscribeResponse:
required:
- new_sub
@@ -1120,6 +1042,9 @@ components:
id:
type: string
description: Subscription ID
name:
type: string
description: Subscription name
GetSubscriptionResponse:
required:
- files
@@ -1150,16 +1075,15 @@ components:
$ref: '#/components/schemas/Subscription'
CreatePlaylistRequest:
required:
- fileNames
- uids
- playlistName
- thumbnailURL
- type
- duration
type: object
properties:
playlistName:
type: string
fileNames:
uids:
type: array
items:
type: string
@@ -1167,8 +1091,6 @@ components:
$ref: '#/components/schemas/FileType'
thumbnailURL:
type: string
duration:
type: number
CreatePlaylistResponse:
required:
- new_playlist
@@ -1181,15 +1103,17 @@ components:
type: boolean
GetPlaylistRequest:
required:
- playlistID
- playlist_id
type: object
properties:
playlistID:
playlist_id:
type: string
type:
$ref: '#/components/schemas/FileType'
uuid:
type: string
include_file_metadata:
type: boolean
GetPlaylistResponse:
required:
- playlist
@@ -1203,6 +1127,20 @@ components:
$ref: '#/components/schemas/FileType'
success:
type: boolean
GetPlaylistsRequest:
type: object
properties:
include_categories:
type: boolean
GetPlaylistsResponse:
required:
- playlists
type: object
properties:
playlists:
type: array
items:
$ref: '#/components/schemas/Playlist'
UpdatePlaylistRequest:
required:
- playlist
@@ -1210,74 +1148,30 @@ components:
properties:
playlist:
$ref: '#/components/schemas/Playlist'
UpdatePlaylistFilesRequest:
required:
- fileNames
- playlistID
- type
type: object
properties:
playlistID:
type: string
fileNames:
type: array
items:
type: string
type:
$ref: '#/components/schemas/FileType'
DeletePlaylistRequest:
required:
- playlistID
- playlist_id
- type
type: object
properties:
playlistID:
playlist_id:
type: string
type:
$ref: '#/components/schemas/FileType'
DownloadFileRequest:
required:
- fileNames
- type
- uid
type: object
properties:
fileNames:
oneOf:
- type: string
- type: array
description: Array of 1 or more files to download
items:
type: string
zip_mode:
type: boolean
type:
$ref: '#/components/schemas/FileType'
outputName:
type: string
fullPathProvided:
type: boolean
uuid:
type: string
uid:
type: string
id:
uuid:
type: string
subscriptionName:
sub_id:
type: string
description: Only used for subscriptions
subPlaylist:
is_playlist:
type: boolean
description: Only used for subscriptions
DeleteFileRequest:
required:
- fileName
- type
type: object
properties:
fileName:
type: string
type:
$ref: '#/components/schemas/FileType'
DownloadArchiveRequest:
required:
- sub
@@ -1406,7 +1300,7 @@ components:
type: boolean
Playlist:
required:
- fileNames
- uids
- id
- name
- thumbnailURL
@@ -1417,7 +1311,7 @@ components:
properties:
name:
type: string
fileNames:
uids:
type: array
items:
type: string
@@ -1431,16 +1325,22 @@ components:
type: number
duration:
type: number
user_uid:
type: string
Download:
required:
- uid
- ui_uid
- downloading
- complete
- url
- type
- title
- type
- options
- uid
- step_index
- paused
- running
- finished_step
- percent_complete
- is_playlist
- finished
- timestamp_start
type: object
properties:
@@ -1448,31 +1348,35 @@ components:
type: string
ui_uid:
type: string
downloading:
running:
type: boolean
complete:
finished:
type: boolean
paused:
type: boolean
finished_step:
type: boolean
url:
type: string
type:
type: string
title:
type: string
step_index:
type: number
percent_complete:
type: number
is_playlist:
type: boolean
timestamp_start:
type: number
timestamp_end:
type: number
filesize:
type: number
nullable: true
error:
type: string
description: Error text, set if download fails.
fileNames:
type: array
items:
nullable: true
user_uid:
type: string
sub_id:
type: string
sub_name:
type: string
SubscriptionRequestData:
required:

View File

@@ -1348,7 +1348,6 @@ app.post('/api/subscribe', optionalJwt, async (req, res) => {
let url = req.body.url;
let maxQuality = req.body.maxQuality;
let timerange = req.body.timerange;
let streamingOnly = req.body.streamingOnly;
let audioOnly = req.body.audioOnly;
let customArgs = req.body.customArgs;
let customOutput = req.body.customFileOutput;
@@ -1358,7 +1357,6 @@ app.post('/api/subscribe', optionalJwt, async (req, res) => {
url: url,
maxQuality: maxQuality,
id: uuid(),
streamingOnly: streamingOnly,
user_uid: user_uid,
type: audioOnly ? 'audio' : 'video'
};
@@ -1554,7 +1552,7 @@ app.post('/api/getPlaylists', optionalJwt, async (req, res) => {
const uuid = req.isAuthenticated() ? req.user.uid : null;
const include_categories = req.body.include_categories;
const playlists = await db_api.getRecords('playlists', {user_uid: uuid});
let playlists = await db_api.getRecords('playlists', {user_uid: uuid});
if (include_categories) {
const categories = await categories_api.getCategoriesAsPlaylists(files);
if (categories) {

View File

@@ -3,8 +3,6 @@
/* eslint-disable */
export type { BaseChangePermissionsRequest } from './models/BaseChangePermissionsRequest';
export type { BaseDownloadRequest } from './models/BaseDownloadRequest';
export type { BaseDownloadResponse } from './models/BaseDownloadResponse';
export type { body_19 } from './models/body_19';
export type { body_20 } from './models/body_20';
export type { ChangeRolePermissionsRequest } from './models/ChangeRolePermissionsRequest';
@@ -13,8 +11,8 @@ export type { Config } from './models/Config';
export type { ConfigResponse } from './models/ConfigResponse';
export type { CreatePlaylistRequest } from './models/CreatePlaylistRequest';
export type { CreatePlaylistResponse } from './models/CreatePlaylistResponse';
export type { CropFileSettings } from './models/CropFileSettings';
export type { DatabaseFile } from './models/DatabaseFile';
export type { DeleteFileRequest } from './models/DeleteFileRequest';
export type { DeleteMp3Mp4Request } from './models/DeleteMp3Mp4Request';
export type { DeletePlaylistRequest } from './models/DeletePlaylistRequest';
export type { DeleteSubscriptionFileRequest } from './models/DeleteSubscriptionFileRequest';
@@ -22,6 +20,8 @@ export type { DeleteUserRequest } from './models/DeleteUserRequest';
export type { Download } from './models/Download';
export type { DownloadArchiveRequest } from './models/DownloadArchiveRequest';
export type { DownloadFileRequest } from './models/DownloadFileRequest';
export type { DownloadRequest } from './models/DownloadRequest';
export type { DownloadResponse } from './models/DownloadResponse';
export type { DownloadVideosForSubscriptionRequest } from './models/DownloadVideosForSubscriptionRequest';
export type { File } from './models/File';
export { FileType } from './models/FileType';
@@ -37,6 +37,8 @@ export type { GetMp3sResponse } from './models/GetMp3sResponse';
export type { GetMp4sResponse } from './models/GetMp4sResponse';
export type { GetPlaylistRequest } from './models/GetPlaylistRequest';
export type { GetPlaylistResponse } from './models/GetPlaylistResponse';
export type { GetPlaylistsRequest } from './models/GetPlaylistsRequest';
export type { GetPlaylistsResponse } from './models/GetPlaylistsResponse';
export type { GetRolesResponse } from './models/GetRolesResponse';
export type { GetSubscriptionRequest } from './models/GetSubscriptionRequest';
export type { GetSubscriptionResponse } from './models/GetSubscriptionResponse';
@@ -44,10 +46,6 @@ export type { GetUsersResponse } from './models/GetUsersResponse';
export type { inline_response_200_15 } from './models/inline_response_200_15';
export type { LoginRequest } from './models/LoginRequest';
export type { LoginResponse } from './models/LoginResponse';
export type { Mp3DownloadRequest } from './models/Mp3DownloadRequest';
export type { Mp3DownloadResponse } from './models/Mp3DownloadResponse';
export type { Mp4DownloadRequest } from './models/Mp4DownloadRequest';
export type { Mp4DownloadResponse } from './models/Mp4DownloadResponse';
export type { Playlist } from './models/Playlist';
export type { RegisterRequest } from './models/RegisterRequest';
export type { RegisterResponse } from './models/RegisterResponse';
@@ -60,7 +58,6 @@ export type { SubscriptionRequestData } from './models/SubscriptionRequestData';
export type { SuccessObject } from './models/SuccessObject';
export type { UnsubscribeRequest } from './models/UnsubscribeRequest';
export type { UnsubscribeResponse } from './models/UnsubscribeResponse';
export type { UpdatePlaylistFilesRequest } from './models/UpdatePlaylistFilesRequest';
export type { UpdatePlaylistRequest } from './models/UpdatePlaylistRequest';
export type { UpdaterStatus } from './models/UpdaterStatus';
export type { UpdateServerRequest } from './models/UpdateServerRequest';

View File

@@ -1,29 +0,0 @@
/* istanbul ignore file */
/* tslint:disable */
/* eslint-disable */
export interface BaseDownloadRequest {
url: string;
/**
* Video format code. Overrides other quality options.
*/
customQualityConfiguration?: string;
/**
* Custom command-line arguments for youtubedl. Overrides all other options, except url.
*/
customArgs?: string;
/**
* Custom output filename template.
*/
customOutput?: string;
/**
* Login with this account ID
*/
youtubeUsername?: string;
/**
* Account password
*/
youtubePassword?: string;
ui_uid?: string | null;
}

View File

@@ -1,9 +0,0 @@
/* istanbul ignore file */
/* tslint:disable */
/* eslint-disable */
export interface BaseDownloadResponse {
uid: string;
file_names?: Array<string> | null;
}

View File

@@ -6,8 +6,7 @@ import { FileType } from './FileType';
export interface CreatePlaylistRequest {
playlistName: string;
fileNames: Array<string>;
uids: Array<string>;
type: FileType;
thumbnailURL: string;
duration: number;
}

View File

@@ -0,0 +1,9 @@
/* istanbul ignore file */
/* tslint:disable */
/* eslint-disable */
export interface CropFileSettings {
cropFileStart: number;
cropFileEnd: number;
}

View File

@@ -1,10 +0,0 @@
/* istanbul ignore file */
/* tslint:disable */
/* eslint-disable */
import { FileType } from './FileType';
export interface DeleteFileRequest {
fileName: string;
type: FileType;
}

View File

@@ -5,6 +5,6 @@
import { FileType } from './FileType';
export interface DeletePlaylistRequest {
playlistID: string;
playlist_id: string;
type: FileType;
}

View File

@@ -5,19 +5,22 @@
export interface Download {
uid: string;
ui_uid: string;
downloading: boolean;
complete: boolean;
ui_uid?: string;
running: boolean;
finished: boolean;
paused: boolean;
finished_step: boolean;
url: string;
type: string;
title: string;
step_index: number;
percent_complete: number;
is_playlist: boolean;
timestamp_start: number;
timestamp_end?: number;
filesize?: number | null;
/**
* Error text, set if download fails.
*/
error?: string;
fileNames?: Array<string>;
error?: string | null;
user_uid?: string;
sub_id?: string;
sub_name?: string;
}

View File

@@ -5,6 +5,6 @@
export interface DownloadArchiveRequest {
sub: {
archive_dir: string,
};
archive_dir: string,
};
}

View File

@@ -2,23 +2,13 @@
/* tslint:disable */
/* eslint-disable */
import { FileType } from './FileType';
export interface DownloadFileRequest {
fileNames: ;
zip_mode?: boolean;
type: FileType;
outputName?: string;
fullPathProvided?: boolean;
uid: string;
uuid?: string;
uid?: string;
id?: string;
sub_id?: string;
/**
* Only used for subscriptions
*/
subscriptionName?: string;
/**
* Only used for subscriptions
*/
subPlaylist?: boolean;
is_playlist?: boolean;
}

View File

@@ -0,0 +1,44 @@
/* istanbul ignore file */
/* tslint:disable */
/* eslint-disable */
import { CropFileSettings } from './CropFileSettings';
import { FileType } from './FileType';
export interface DownloadRequest {
url: string;
/**
* Video format code. Overrides other quality options.
*/
customQualityConfiguration?: string;
/**
* Custom command-line arguments for youtube-dl. Overrides all other options, except url.
*/
customArgs?: string;
/**
* Additional command-line arguments for youtube-dl. Added to whatever args would normally be used.
*/
additionalArgs?: string;
/**
* Custom output filename template.
*/
customOutput?: string;
/**
* Login with this account ID
*/
youtubeUsername?: string;
/**
* Account password
*/
youtubePassword?: string;
/**
* Height of the video, if known
*/
selectedHeight?: string;
/**
* Specify ffmpeg/avconv audio quality
*/
maxBitrate?: string;
type?: FileType;
cropFileSettings?: CropFileSettings;
}

View File

@@ -0,0 +1,9 @@
/* istanbul ignore file */
/* tslint:disable */
/* eslint-disable */
import { Download } from './Download';
export interface DownloadResponse {
download?: Download | null;
}

View File

@@ -2,12 +2,8 @@
/* tslint:disable */
/* eslint-disable */
import { Dictionary } from './Dictionary';
import { Download } from './Download';
export interface GetAllDownloadsResponse {
/**
* Map of Session ID to inner map
*/
downloads?: Dictionary<Dictionary<Download>>;
downloads?: Array<Download>;
}

View File

@@ -4,6 +4,5 @@
export interface GetDownloadRequest {
session_id: string;
download_id: string;
download_uid: string;
}

View File

@@ -5,7 +5,8 @@
import { FileType } from './FileType';
export interface GetPlaylistRequest {
playlistID: string;
playlist_id: string;
type?: FileType;
uuid?: string;
include_file_metadata?: boolean;
}

View File

@@ -0,0 +1,8 @@
/* istanbul ignore file */
/* tslint:disable */
/* eslint-disable */
export interface GetPlaylistsRequest {
include_categories?: boolean;
}

View File

@@ -0,0 +1,9 @@
/* istanbul ignore file */
/* tslint:disable */
/* eslint-disable */
import { Playlist } from './Playlist';
export interface GetPlaylistsResponse {
playlists: Array<Playlist>;
}

View File

@@ -6,11 +6,11 @@ import { UserPermission } from './UserPermission';
export interface GetRolesResponse {
roles: {
admin?: {
permissions?: Array<UserPermission>,
},
user?: {
permissions?: Array<UserPermission>,
},
};
admin?: {
permissions?: Array<UserPermission>,
},
user?: {
permissions?: Array<UserPermission>,
},
};
}

View File

@@ -8,4 +8,8 @@ export interface GetSubscriptionRequest {
* Subscription ID
*/
id: string;
/**
* Subscription name
*/
name?: string;
}

View File

@@ -1,12 +0,0 @@
/* istanbul ignore file */
/* tslint:disable */
/* eslint-disable */
import { BaseDownloadRequest } from './BaseDownloadRequest';
export interface Mp3DownloadRequest extends BaseDownloadRequest {
/**
* Specify ffmpeg/avconv audio quality
*/
maxBitrate?: string;
}

View File

@@ -1,9 +0,0 @@
/* istanbul ignore file */
/* tslint:disable */
/* eslint-disable */
import { BaseDownloadResponse } from './BaseDownloadResponse';
export interface Mp3DownloadResponse extends BaseDownloadResponse {
audiopathEncoded: string;
}

View File

@@ -1,12 +0,0 @@
/* istanbul ignore file */
/* tslint:disable */
/* eslint-disable */
import { BaseDownloadRequest } from './BaseDownloadRequest';
export interface Mp4DownloadRequest extends BaseDownloadRequest {
/**
* Height of the video, if known
*/
selectedHeight?: string;
}

View File

@@ -1,9 +0,0 @@
/* istanbul ignore file */
/* tslint:disable */
/* eslint-disable */
import { BaseDownloadResponse } from './BaseDownloadResponse';
export interface Mp4DownloadResponse extends BaseDownloadResponse {
videopathEncoded: string;
}

View File

@@ -6,10 +6,11 @@ import { FileType } from './FileType';
export interface Playlist {
name: string;
fileNames: Array<string>;
uids: Array<string>;
id: string;
thumbnailURL: string;
type: FileType;
registered: number;
duration: number;
user_uid?: string;
}

View File

@@ -2,10 +2,8 @@
/* tslint:disable */
/* eslint-disable */
import { FileType } from './FileType';
export interface SharingToggle {
uid: string;
type: FileType;
is_playlist?: boolean;
}

View File

@@ -7,8 +7,8 @@ export interface SubscribeRequest {
name: string;
url: string;
timerange?: string;
streamingOnly: boolean;
audioOnly?: boolean;
customArgs?: string;
customFileOutput?: string;
maxQuality?: string;
}

View File

@@ -1,11 +0,0 @@
/* istanbul ignore file */
/* tslint:disable */
/* eslint-disable */
import { FileType } from './FileType';
export interface UpdatePlaylistFilesRequest {
playlistID: string;
fileNames: Array<string>;
type: FileType;
}

View File

@@ -5,8 +5,8 @@
export interface UpdateUserRequest {
change_object: {
uid: string,
name?: string,
role?: string,
};
uid: string,
name?: string,
role?: string,
};
}

View File

@@ -10,13 +10,13 @@ export interface User {
name?: string;
passhash?: string;
files?: {
audio?: Array<File>,
video?: Array<File>,
};
audio?: Array<File>,
video?: Array<File>,
};
playlists?: {
audio?: Array<File>,
video?: Array<File>,
};
audio?: Array<File>,
video?: Array<File>,
};
subscriptions?: Array<Subscription>;
created?: number;
role?: string;

View File

@@ -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,

View File

@@ -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']) {

View File

@@ -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>&nbsp;{{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>&nbsp;{{download.timestamp_start | date:'medium'}}
</div>
<div *ngIf="download.timestamp_end">
<strong><ng-container i18n="Download end label">Download end:</ng-container></strong>&nbsp;{{download.timestamp_end | date:'medium'}}
</div>
<div *ngIf="download.fileNames">
<strong><ng-container i18n="File path(s) label">File path(s):</ng-container></strong>&nbsp;{{download.fileNames.join(', ')}}
</div>
</mat-expansion-panel>
</div>

View File

@@ -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;
}

View File

@@ -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();
});
});

View File

@@ -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);
}
}

View File

@@ -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;
}

View File

@@ -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();
});
}

View File

@@ -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);
}