Add playlist types

pull/218/head
Tiger Oakes 5 years ago
parent 62c79c267e
commit 4d74c375f4

@ -148,7 +148,7 @@ paths:
content: content:
application/json: application/json:
schema: schema:
$ref: '#/components/schemas/inline_response_200_5' $ref: '#/components/schemas/SuccessObject'
security: security:
- Auth query parameter: [] - Auth query parameter: []
/api/disableSharing: /api/disableSharing:
@ -170,7 +170,7 @@ paths:
content: content:
application/json: application/json:
schema: schema:
$ref: '#/components/schemas/inline_response_200_5' $ref: '#/components/schemas/SuccessObject'
security: security:
- Auth query parameter: [] - Auth query parameter: []
/api/subscribe: /api/subscribe:
@ -311,14 +311,14 @@ paths:
content: content:
application/json: application/json:
schema: schema:
$ref: '#/components/schemas/body_10' $ref: '#/components/schemas/CreatePlaylistRequest'
responses: responses:
'200': '200':
description: OK description: OK
content: content:
application/json: application/json:
schema: schema:
$ref: '#/components/schemas/inline_response_200_12' $ref: '#/components/schemas/CreatePlaylistResponse'
security: security:
- Auth query parameter: [] - Auth query parameter: []
/api/getPlaylist: /api/getPlaylist:
@ -332,28 +332,49 @@ paths:
content: content:
application/json: application/json:
schema: schema:
$ref: '#/components/schemas/body_11' $ref: '#/components/schemas/GetPlaylistRequest'
responses: responses:
'200': '200':
description: OK description: OK
content: content:
application/json: application/json:
schema: schema:
$ref: '#/components/schemas/inline_response_200_13' $ref: '#/components/schemas/GetPlaylistResponse'
security: security:
- Auth query parameter: [] - Auth query parameter: []
/api/updatePlaylist: /api/updatePlaylist:
post:
tags:
- playlists
summary: Update playlist
description: Updates the playlist object
operationId: post-api-updatePlaylist
requestBody:
content:
application/json:
schema:
$ref: '#/components/schemas/UpdatePlaylistRequest'
responses:
'200':
description: OK
content:
application/json:
schema:
$ref: '#/components/schemas/SuccessObject'
security:
- Auth query parameter: []
/api/updatePlaylistFiles:
post: post:
tags: tags:
- playlists - playlists
summary: Update playlist files summary: Update playlist files
description: Updates the list of filenames in the playlist object description: Updates the list of filenames in the playlist object
operationId: post-api-updatePlaylist operationId: post-api-updatePlaylistFiles
requestBody: requestBody:
content: content:
application/json: application/json:
schema: schema:
$ref: '#/components/schemas/body_12' $ref: '#/components/schemas/UpdatePlaylistFilesRequest'
responses: responses:
'200': '200':
description: OK description: OK
@ -374,14 +395,14 @@ paths:
content: content:
application/json: application/json:
schema: schema:
$ref: '#/components/schemas/body_13' $ref: '#/components/schemas/DeletePlaylistRequest'
responses: responses:
'200': '200':
description: OK description: OK
content: content:
application/json: application/json:
schema: schema:
$ref: '#/components/schemas/inline_response_200_5' $ref: '#/components/schemas/SuccessObject'
security: security:
- Auth query parameter: [] - Auth query parameter: []
/api/deleteMp4: /api/deleteMp4:
@ -495,7 +516,7 @@ paths:
content: content:
application/json: application/json:
schema: schema:
$ref: '#/components/schemas/inline_response_200_5' $ref: '#/components/schemas/SuccessObject'
security: security:
- Auth query parameter: [] - Auth query parameter: []
/api/isPinSet: /api/isPinSet:
@ -532,7 +553,7 @@ paths:
content: content:
application/json: application/json:
schema: schema:
$ref: '#/components/schemas/inline_response_200_5' $ref: '#/components/schemas/SuccessObject'
security: security:
- Auth query parameter: [] - Auth query parameter: []
/api/setPin: /api/setPin:
@ -552,7 +573,7 @@ paths:
content: content:
application/json: application/json:
schema: schema:
$ref: '#/components/schemas/inline_response_200_5' $ref: '#/components/schemas/SuccessObject'
security: security:
- Auth query parameter: [] - Auth query parameter: []
description: '' description: ''
@ -625,7 +646,7 @@ paths:
content: content:
application/json: application/json:
schema: schema:
$ref: '#/components/schemas/inline_response_200_5' $ref: '#/components/schemas/SuccessObject'
security: security:
- Auth query parameter: [] - Auth query parameter: []
/api/downloads: /api/downloads:
@ -1196,12 +1217,13 @@ components:
type: array type: array
items: items:
$ref: '#/components/schemas/Subscription' $ref: '#/components/schemas/Subscription'
body_10: CreatePlaylistRequest:
required: required:
- fileNames - fileNames
- playlistName - playlistName
- thumbnailURL - thumbnailURL
- type - type
- duration
type: object type: object
properties: properties:
playlistName: playlistName:
@ -1211,30 +1233,33 @@ components:
items: items:
type: string type: string
type: type:
type: string $ref: '#/components/schemas/FileType'
thumbnailURL: thumbnailURL:
type: string type: string
inline_response_200_12: duration:
type: number
CreatePlaylistResponse:
required: required:
- new_playlist - new_playlist
- success - success
type: object type: object
properties: properties:
new_playlist: new_playlist:
$ref: '#/components/schemas/inline_response_200_12_new_playlist' $ref: '#/components/schemas/Playlist'
success: success:
type: boolean type: boolean
body_11: GetPlaylistRequest:
required: required:
- playlistID - playlistID
- type
type: object type: object
properties: properties:
playlistID: playlistID:
type: string type: string
type: type:
$ref: '#/components/schemas/FileType'
uuid:
type: string type: string
inline_response_200_13: GetPlaylistResponse:
required: required:
- playlist - playlist
- success - success
@ -1244,10 +1269,17 @@ components:
playlist: playlist:
$ref: '#/components/schemas/Playlist' $ref: '#/components/schemas/Playlist'
type: type:
type: string $ref: '#/components/schemas/FileType'
success: success:
type: boolean type: boolean
body_12: UpdatePlaylistRequest:
required:
- playlist
type: object
properties:
playlist:
$ref: '#/components/schemas/Playlist'
UpdatePlaylistFilesRequest:
required: required:
- fileNames - fileNames
- playlistID - playlistID
@ -1261,8 +1293,8 @@ components:
items: items:
type: string type: string
type: type:
type: string $ref: '#/components/schemas/FileType'
body_13: DeletePlaylistRequest:
required: required:
- playlistID - playlistID
- type - type
@ -1271,7 +1303,7 @@ components:
playlistID: playlistID:
type: string type: string
type: type:
type: string $ref: '#/components/schemas/FileType'
body_15: body_15:
required: required:
- fileNames - fileNames
@ -1435,6 +1467,9 @@ components:
- id - id
- name - name
- thumbnailURL - thumbnailURL
- type
- registered
- duration
type: object type: object
properties: properties:
name: name:
@ -1447,6 +1482,12 @@ components:
type: string type: string
thumbnailURL: thumbnailURL:
type: string type: string
type:
$ref: '#/components/schemas/FileType'
registered:
type: number
duration:
type: number
Download: Download:
required: required:
- uid - uid
@ -1545,25 +1586,6 @@ components:
type: array type: array
items: items:
type: object type: object
inline_response_200_12_new_playlist:
required:
- fileNames
- id
- name
- thumbnailURL
- type
type: object
properties:
name:
type: string
fileNames:
type: string
id:
type: string
thumbnailURL:
type: string
type:
type: string
User: User:
title: user title: user
type: object type: object

@ -20,6 +20,7 @@ import { CreatePlaylistComponent } from 'app/create-playlist/create-playlist.com
import { Platform } from '@angular/cdk/platform'; import { Platform } from '@angular/cdk/platform';
import { v4 as uuid } from 'uuid'; import { v4 as uuid } from 'uuid';
import { ArgModifierDialogComponent } from 'app/dialogs/arg-modifier-dialog/arg-modifier-dialog.component'; import { ArgModifierDialogComponent } from 'app/dialogs/arg-modifier-dialog/arg-modifier-dialog.component';
import type { FileType } from 'api-types';
export let audioFilesMouseHovering = false; export let audioFilesMouseHovering = false;
export let videoFilesMouseHovering = false; export let videoFilesMouseHovering = false;
@ -453,7 +454,7 @@ export class MainComponent implements OnInit {
} }
public removePlaylistMp3(playlistID, index) { public removePlaylistMp3(playlistID, index) {
this.postsService.removePlaylist(playlistID, 'audio').subscribe(res => { this.postsService.removePlaylist(playlistID, 'audio' as FileType).subscribe(res => {
if (res['success']) { if (res['success']) {
this.playlists.audio.splice(index, 1); this.playlists.audio.splice(index, 1);
this.openSnackBar('Playlist successfully removed.', ''); this.openSnackBar('Playlist successfully removed.', '');
@ -472,7 +473,7 @@ export class MainComponent implements OnInit {
} }
public removePlaylistMp4(playlistID, index) { public removePlaylistMp4(playlistID, index) {
this.postsService.removePlaylist(playlistID, 'video').subscribe(res => { this.postsService.removePlaylist(playlistID, 'video' as FileType).subscribe(res => {
if (res['success']) { if (res['success']) {
this.playlists.video.splice(index, 1); this.playlists.video.splice(index, 1);
this.openSnackBar('Playlist successfully removed.', ''); this.openSnackBar('Playlist successfully removed.', '');

@ -7,6 +7,7 @@ import { MatSnackBar } from '@angular/material/snack-bar';
import { InputDialogComponent } from 'app/input-dialog/input-dialog.component'; import { InputDialogComponent } from 'app/input-dialog/input-dialog.component';
import { CdkDragDrop, moveItemInArray } from '@angular/cdk/drag-drop'; import { CdkDragDrop, moveItemInArray } from '@angular/cdk/drag-drop';
import { ShareMediaDialogComponent } from '../dialogs/share-media-dialog/share-media-dialog.component'; import { ShareMediaDialogComponent } from '../dialogs/share-media-dialog/share-media-dialog.component';
import type { FileType } from 'api-types';
export interface IMedia { export interface IMedia {
title: string; title: string;
@ -360,7 +361,7 @@ export class PlayerComponent implements OnInit, AfterViewInit, OnDestroy {
// Eventually do additional checks on name // Eventually do additional checks on name
if (name) { if (name) {
const fileNames = this.getFileNames(); const fileNames = this.getFileNames();
this.postsService.createPlaylist(name, fileNames, this.type, null).subscribe(res => { this.postsService.createPlaylist(name, fileNames, this.type as FileType, null).subscribe(res => {
if (res['success']) { if (res['success']) {
dialogRef.close(); dialogRef.close();
const new_playlist = res['new_playlist']; const new_playlist = res['new_playlist'];
@ -401,7 +402,7 @@ export class PlayerComponent implements OnInit, AfterViewInit, OnDestroy {
updatePlaylist() { updatePlaylist() {
const fileNames = this.getFileNames(); const fileNames = this.getFileNames();
this.playlist_updating = true; this.playlist_updating = true;
this.postsService.updatePlaylistFiles(this.id, fileNames, this.type).subscribe(res => { this.postsService.updatePlaylistFiles(this.id, fileNames, this.type as FileType).subscribe(res => {
this.playlist_updating = false; this.playlist_updating = false;
if (res['success']) { if (res['success']) {
const fileNamesEncoded = fileNames.join('|nvr|'); const fileNamesEncoded = fileNames.join('|nvr|');

@ -11,7 +11,10 @@ import { BehaviorSubject } from 'rxjs';
import { MatSnackBar } from '@angular/material/snack-bar'; import { MatSnackBar } from '@angular/material/snack-bar';
import * as Fingerprint2 from 'fingerprintjs2'; import * as Fingerprint2 from 'fingerprintjs2';
import { import {
CreatePlaylistRequest,
CreatePlaylistResponse,
DeleteMp3Mp4Request, DeleteMp3Mp4Request,
DeletePlaylistRequest,
DeleteSubscriptionFileRequest, DeleteSubscriptionFileRequest,
FileType, FileType,
GetAllDownloadsResponse, GetAllDownloadsResponse,
@ -23,18 +26,24 @@ import {
GetFileResponse, GetFileResponse,
GetMp3sResponse, GetMp3sResponse,
GetMp4sResponse, GetMp4sResponse,
GetPlaylistRequest,
GetPlaylistResponse,
GetSubscriptionRequest, GetSubscriptionRequest,
GetSubscriptionResponse, GetSubscriptionResponse,
Mp3DownloadRequest, Mp3DownloadRequest,
Mp3DownloadResponse, Mp3DownloadResponse,
Mp4DownloadRequest, Mp4DownloadRequest,
Mp4DownloadResponse, Mp4DownloadResponse,
Playlist,
SharingToggle,
SubscribeRequest, SubscribeRequest,
SubscribeResponse, SubscribeResponse,
SubscriptionRequestData, SubscriptionRequestData,
SuccessObject, SuccessObject,
UnsubscribeRequest, UnsubscribeRequest,
UnsubscribeResponse UnsubscribeResponse,
UpdatePlaylistFilesRequest,
UpdatePlaylistRequest,
} from 'api-types'; } from 'api-types';
@Injectable() @Injectable()
@ -293,39 +302,46 @@ export class PostsService implements CanActivate {
return this.http.post(this.path + 'generateNewAPIKey', {}, this.httpOptions); return this.http.post(this.path + 'generateNewAPIKey', {}, this.httpOptions);
} }
enableSharing(uid, type, is_playlist) { enableSharing(uid: string, type: FileType, is_playlist: boolean) {
return this.http.post(this.path + 'enableSharing', {uid: uid, type: type, is_playlist: is_playlist}, this.httpOptions); const body: SharingToggle = {uid: uid, type: type, is_playlist: is_playlist};
return this.http.post<SuccessObject>(this.path + 'enableSharing', body, this.httpOptions);
} }
disableSharing(uid, type, is_playlist) { disableSharing(uid: string, type: FileType, is_playlist: boolean) {
return this.http.post(this.path + 'disableSharing', {uid: uid, type: type, is_playlist: is_playlist}, this.httpOptions); const body: SharingToggle = {uid: uid, type: type, is_playlist: is_playlist};
return this.http.post<SuccessObject>(this.path + 'disableSharing', body, this.httpOptions);
} }
createPlaylist(playlistName, fileNames, type, thumbnailURL, duration = null) { createPlaylist(playlistName: string, fileNames: string[], type: FileType, thumbnailURL: string, duration: number = null) {
return this.http.post(this.path + 'createPlaylist', {playlistName: playlistName, const body: CreatePlaylistRequest = {playlistName: playlistName,
fileNames: fileNames, fileNames: fileNames,
type: type, type: type,
thumbnailURL: thumbnailURL, thumbnailURL: thumbnailURL,
duration: duration}, this.httpOptions); duration: duration};
return this.http.post<CreatePlaylistResponse>(this.path + 'createPlaylist', body, this.httpOptions);
} }
getPlaylist(playlistID, type, uuid = null) { getPlaylist(playlistID: string, type: FileType, uuid: string = null) {
return this.http.post(this.path + 'getPlaylist', {playlistID: playlistID, const body: GetPlaylistRequest = {playlistID: playlistID,
type: type, uuid: uuid}, this.httpOptions); type: type, uuid: uuid};
return this.http.post<GetPlaylistResponse>(this.path + 'getPlaylist', body, this.httpOptions);
} }
updatePlaylist(playlist) { updatePlaylist(playlist: Playlist) {
return this.http.post(this.path + 'updatePlaylist', {playlist: playlist}, this.httpOptions); const body: UpdatePlaylistRequest = {playlist: playlist};
return this.http.post<SuccessObject>(this.path + 'updatePlaylist', body, this.httpOptions);
} }
updatePlaylistFiles(playlistID, fileNames, type) { updatePlaylistFiles(playlistID: string, fileNames: string[], type: FileType) {
return this.http.post(this.path + 'updatePlaylistFiles', {playlistID: playlistID, const body: UpdatePlaylistFilesRequest = {playlistID: playlistID,
fileNames: fileNames, fileNames: fileNames,
type: type}, this.httpOptions); type: type};
return this.http.post<SuccessObject>(this.path + 'updatePlaylistFiles', body, this.httpOptions);
} }
removePlaylist(playlistID, type) { removePlaylist(playlistID: string, type: FileType) {
return this.http.post(this.path + 'deletePlaylist', {playlistID: playlistID, type: type}, this.httpOptions); const body: DeletePlaylistRequest = {playlistID: playlistID, type: type};
return this.http.post<SuccessObject>(this.path + 'deletePlaylist', body, this.httpOptions);
} }
createSubscription(url: string, name: string, timerange: string = null, streamingOnly = false, audioOnly = false, customArgs: string = null, customFileOutput: string = null) { createSubscription(url: string, name: string, timerange: string = null, streamingOnly = false, audioOnly = false, customArgs: string = null, customFileOutput: string = null) {

Loading…
Cancel
Save