Revamp the pop-up player modal

This commit is contained in:
Lei Nelissen
2022-05-10 23:52:58 +02:00
parent 37ead0ec98
commit b21766a352
21 changed files with 295 additions and 131 deletions

View File

@@ -42,6 +42,7 @@ export function generateTrack(track: AlbumTrack, credentials: Credentials): Trac
title: track.Name,
artist: track.Artists.join(', '),
album: track.Album,
duration: track.RunTimeTicks,
artwork: track.AlbumId
? getImage(track.AlbumId, credentials)
: getImage(track.Id, credentials),

View File

@@ -0,0 +1,9 @@
function ticksToDuration(ticks: number) {
const seconds = Math.round(ticks / 10000000);
const minutes = Math.round(seconds / 60);
const hours = Math.round(minutes / 60);
return `${hours > 0 ? hours + ':' : ''}${minutes}:${(seconds % 60).toString().padStart(2, '0')}`;
}
export default ticksToDuration;

View File

@@ -57,7 +57,7 @@ export default function usePlayTracks() {
// Check if a downloaded version exists, and if so rewrite the URL
const download = downloads[trackId];
if (download?.location) {
generatedTrack.url = download.location;
generatedTrack.url = 'file://' + download.location;
}
return generatedTrack;