diff --git a/src/app/app.component.html b/src/app/app.component.html index 30afddf..31a405a 100644 --- a/src/app/app.component.html +++ b/src/app/app.component.html @@ -82,10 +82,10 @@
- + + [length]="file.duration" [isAudio]="true">
@@ -101,7 +101,7 @@
- + diff --git a/src/app/app.component.ts b/src/app/app.component.ts index 13c9b9e..5b1a843 100644 --- a/src/app/app.component.ts +++ b/src/app/app.component.ts @@ -48,6 +48,7 @@ export class AppComponent implements OnInit { mp3s: any[] = []; mp4s: any[] = []; + files_cols = (window.innerWidth <= 450) ? 2 : 4; urlForm = new FormControl('', [Validators.required]); @@ -143,90 +144,55 @@ export class AppComponent implements OnInit { // download helpers downloadHelperMp3(name, is_playlist = false, forceView = false) { - /* - this.postsService.getFileStatusMp3(name).subscribe(fileExists => { - const exists = fileExists; - this.exists = exists[0]; - if (exists[0] === 'failed') { - const percent = exists[2]; - // console.log(percent); - if (percent > 0.30) { - this.determinateProgress = true; - this.percentDownloaded = percent * 100; - } - setTimeout(() => this.downloadHelperMp3(name, is_playlist, forceView), 500); - } else { - */ - this.downloadingfile = false; - - // if download only mode, just download the file. no redirect - if (forceView === false && this.downloadOnlyMode && !this.iOS) { - if (is_playlist) { - for (let i = 0; i < name.length; i++) { - this.downloadAudioFile(name[i]); - } - } else { - this.downloadAudioFile(name); - } - } else { - if (is_playlist) { - window.location.href = this.baseStreamPath + this.audioFolderPath + name[0]; - } else { - window.location.href = this.baseStreamPath + this.audioFolderPath + name; - } - } + this.downloadingfile = false; - // reloads mp3s - if (this.fileManagerEnabled) { - this.getMp3s(); + // if download only mode, just download the file. no redirect + if (forceView === false && this.downloadOnlyMode && !this.iOS) { + if (is_playlist) { + for (let i = 0; i < name.length; i++) { + this.downloadAudioFile(name[i]); } - /* } - });*/ + } else { + this.downloadAudioFile(name); + } + } else { + if (is_playlist) { + window.location.href = this.baseStreamPath + this.audioFolderPath + name[0] + '.mp3'; + } else { + window.location.href = this.baseStreamPath + this.audioFolderPath + name + '.mp3'; + } + } + // reloads mp3s + if (this.fileManagerEnabled) { + this.getMp3s(); + } } downloadHelperMp4(name, is_playlist = false, forceView = false) { - /* - this.postsService.getFileStatusMp4(name).subscribe(fileExists => { - const exists = fileExists; - this.exists = exists[0]; - if (exists[0] === 'failed') { - const percent = exists[2]; - if (percent > 0.30) { - this.determinateProgress = true; - this.percentDownloaded = percent * 100; - } - setTimeout(() => this.downloadHelperMp4(name, is_playlist, forceView), 500); - } else { - */ - this.downloadingfile = false; - - // if download only mode, just download the file. no redirect - if (forceView === false && this.downloadOnlyMode) { - if (is_playlist) { - for (let i = 0; i < name.length; i++) { - this.downloadVideoFile(name[i]); - } - } else { - this.downloadVideoFile(name); - } - } else { - if (is_playlist) { - window.location.href = this.baseStreamPath + this.videoFolderPath + name[0]; - } else { - window.location.href = this.baseStreamPath + this.videoFolderPath + name; - } - } + this.downloadingfile = false; - // reloads mp4s - if (this.fileManagerEnabled) { - this.getMp4s(); + // if download only mode, just download the file. no redirect + if (forceView === false && this.downloadOnlyMode) { + if (is_playlist) { + for (let i = 0; i < name.length; i++) { + this.downloadVideoFile(name[i]); } - /* + } else { + this.downloadVideoFile(name); } - }); - */ + } else { + if (is_playlist) { + window.location.href = this.baseStreamPath + this.videoFolderPath + name[0] + '.mp4'; + } else { + window.location.href = this.baseStreamPath + this.videoFolderPath + name + '.mp4'; + } + } + // reloads mp4s + if (this.fileManagerEnabled) { + this.getMp4s(); + } } // download click handler @@ -361,5 +327,9 @@ export class AppComponent implements OnInit { } ); } + + onResize(event) { + this.files_cols = (event.target.innerWidth <= 450) ? 2 : 4; + } }