From c688313239eea30e641764aa37db339683883a96 Mon Sep 17 00:00:00 2001 From: Alberto Miranda Date: Thu, 19 Apr 2018 14:49:17 -0300 Subject: [PATCH] Displaying filename while music metadata is being downloaded. --- src/renderer/pages/player-page.js | 3 ++- src/renderer/webtorrent.js | 4 ++++ 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/src/renderer/pages/player-page.js b/src/renderer/pages/player-page.js index c6a2b72a..ccc73f1b 100644 --- a/src/renderer/pages/player-page.js +++ b/src/renderer/pages/player-page.js @@ -207,7 +207,7 @@ function renderOverlay (state) { function renderAudioMetadata (state) { const fileSummary = state.getPlayingFileSummary() if (!fileSummary.audioInfo) return - const common = fileSummary.audioInfo.common + const common = fileSummary.audioInfo.common || {} // Get audio track info const title = common.title ? common.title : fileSummary.name @@ -273,6 +273,7 @@ function renderAudioMetadata (state) { // Audio metadata: format const format = [] + fileSummary.audioInfo.format = fileSummary.audioInfo.format || '' if (fileSummary.audioInfo.format.dataformat) { format.push(fileSummary.audioInfo.format.dataformat) } diff --git a/src/renderer/webtorrent.js b/src/renderer/webtorrent.js index 44b67377..a8679fef 100644 --- a/src/renderer/webtorrent.js +++ b/src/renderer/webtorrent.js @@ -340,6 +340,10 @@ function getAudioMetadata (infoHash, index) { const torrent = client.get(infoHash) const file = torrent.files[index] + // Set initial matadata to display the filename first. + const metadata = { title: file.name } + ipc.send('wt-audio-metadata', infoHash, index, metadata) + const options = {native: false, skipCovers: true, fileSize: file.length} const onMetaData = file.done // If completed; use direct file access