Handle bad tracks, tracks with weird names
This commit is contained in:
parent
3205af0be6
commit
270d80ee0e
|
@ -86,6 +86,10 @@ class window.Player
|
|||
$('.playlist li').removeClass 'now'
|
||||
$obj.addClass 'now'
|
||||
_vk_music.search track.artist, track.name, track.duration, (audio) ->
|
||||
if audio is null
|
||||
console.log audio
|
||||
_player.setTrack _player.nextTrack(true)
|
||||
else
|
||||
_player.playSource audio.url
|
||||
if track.length == 0
|
||||
len = parseInt(audio.duration, 10)
|
||||
|
@ -96,8 +100,8 @@ class window.Player
|
|||
if r.result is 'success'
|
||||
$('.playlist li[data-id="'+track.id+'"] .song-duration').text(duration)
|
||||
$($('.album div[data-id="'+track.id+'"]').siblings()[0]).text(duration)
|
||||
|
||||
this.updateNowListening track
|
||||
_player.updateNowListening track
|
||||
false
|
||||
false
|
||||
|
||||
getTrackInfo: (id) ->
|
||||
|
|
|
@ -59,7 +59,7 @@ class window.VkontakteMusic
|
|||
data
|
||||
|
||||
prepareQuery: (artist, track) ->
|
||||
artist+" "+track.replace(/\(.*\)/i, '').split('/')[0]
|
||||
artist+" "+this.trim(/[\w\d\s]+/.exec(track)[0]).replace(/\(.*\)/i, '').split('/')[0]
|
||||
|
||||
trim: (str) ->
|
||||
while str.indexOf(' ') isnt -1
|
||||
|
|
Loading…
Reference in New Issue