Fix file downloading

This commit is contained in:
Chocobozzz 2018-02-07 11:05:59 +01:00
parent 196b7790d6
commit 00336945ce
No known key found for this signature in database
GPG Key ID: 583A612D890159BE
1 changed files with 4 additions and 1 deletions

View File

@ -13,7 +13,7 @@ export class VideoDownloadComponent implements OnInit {
@ViewChild('modal') modal: ModalDirective @ViewChild('modal') modal: ModalDirective
downloadType: 'direct' | 'torrent' = 'torrent' downloadType: 'direct' | 'torrent' = 'torrent'
resolution = -1 resolution: number | string = -1
constructor () { constructor () {
// empty // empty
@ -32,6 +32,9 @@ export class VideoDownloadComponent implements OnInit {
} }
download () { download () {
// HTML select send us a string, so convert it to a number
this.resolution = parseInt(this.resolution.toString(), 10)
const file = this.video.files.find(f => f.resolution === this.resolution) const file = this.video.files.find(f => f.resolution === this.resolution)
if (!file) { if (!file) {
console.error('Could not find file with resolution %d.', this.resolution) console.error('Could not find file with resolution %d.', this.resolution)