diff --git a/app.py b/app.py index 6b0abb9..9714b69 100644 --- a/app.py +++ b/app.py @@ -160,7 +160,7 @@ def make_preview(song_id, song_type, preview): prev_path = 'public/songs/%s/preview.mp3' % song_id if os.path.isfile(song_path) and not os.path.isfile(prev_path): - if not preview or preview <= 0.1: + if not preview or preview <= 0: print('Skipping #%s due to no preview' % song_id) return False diff --git a/public/src/js/importsongs.js b/public/src/js/importsongs.js index cb907f5..374908f 100644 --- a/public/src/js/importsongs.js +++ b/public/src/js/importsongs.js @@ -197,7 +197,7 @@ subtitle = subtitle.slice(2) } songObj.subtitle = songObj.subtitle_en = subtitle - songObj.preview = meta.demostart ? Math.floor(meta.demostart * 1000) : 0 + songObj.preview = meta.demostart || 0 if(meta.level){ songObj.stars[this.courseTypes[diff]] = meta.level + (meta.branch ? " B" : "") } @@ -238,7 +238,7 @@ chart: data, subtitle: osu.metadata.ArtistUnicode || osu.metadata.Artist, subtitle_en: osu.metadata.Artist || osu.metadata.ArtistUnicode, - preview: osu.generalInfo.PreviewTime, + preview: osu.generalInfo.PreviewTime / 1000, stars: [null, null, null, parseInt(osu.difficulty.overallDifficulty) || 1], music: this.otherFiles[dir + osu.generalInfo.AudioFilename.toLowerCase()] } diff --git a/public/src/js/songselect.js b/public/src/js/songselect.js index c6271f4..1f9bedf 100644 --- a/public/src/js/songselect.js +++ b/public/src/js/songselect.js @@ -1746,7 +1746,7 @@ class SongSelect{ }else{ songObj = {id: id} - var previewFilename = prvTime > 0.1 ? "/preview.mp3" : "/main.mp3" + var previewFilename = prvTime > 0 ? "/preview.mp3" : "/main.mp3" var loadPreview = previewFilename => { return snd.previewGain.load(gameConfig.songs_baseurl + id + previewFilename) @@ -1786,7 +1786,7 @@ class SongSelect{ var difference = endLoad - startLoad var minDelay = 300 var delay = minDelay - Math.min(minDelay, difference) - this.preview.playLoop(delay / 1000, false, prvTime / 1000) + this.preview.playLoop(delay / 1000, false, prvTime) } endPreview(){ this.previewId++