Improve audio length display

This commit is contained in:
Geomitron
2020-05-18 14:39:53 -04:00
parent 502360bec4
commit 819c0ebff8
2 changed files with 4 additions and 3 deletions

View File

@@ -112,11 +112,10 @@ export class ChartSidebarComponent implements OnInit {
songLength: string songLength: string
/** /**
* Converts <this.selectedVersion.song_length> into a readable duration. * Converts `this.selectedVersion.chartMetadata.length` into a readable duration.
*/ */
updateSongLength() { updateSongLength() {
if (this.selectedVersion.song_length == 0) { this.songLength = 'Unknown' } let seconds = this.selectedVersion.chartMetadata.length
let seconds = Math.round(this.selectedVersion.song_length / 1000)
if (seconds < 60) { this.songLength = `${seconds} second${seconds == 1 ? '' : 's'}` } if (seconds < 60) { this.songLength = `${seconds} second${seconds == 1 ? '' : 's'}` }
let minutes = Math.floor(seconds / 60) let minutes = Math.floor(seconds / 60)
let hours = 0 let hours = 0

View File

@@ -78,6 +78,8 @@ export interface ChartMetadata {
[difficulty: string]: number [difficulty: string]: number
} }
} }
/** number of seconds */
length: number length: number
/** number of seconds */
effectiveLength: number effectiveLength: number
} }