This commit is contained in:
An Phan 2017-01-17 22:09:27 +08:00
parent d27f7aa7c3
commit 84d523d240
No known key found for this signature in database
GPG key ID: 05536BB4BCDC02A2
7 changed files with 7 additions and 15 deletions

View file

@ -160,7 +160,7 @@ export default {
}
this.sortKey = key
this.order = 0 - this.order
this.order *= -1
this.sortingByAlbum = Array.isArray(this.sortKey) && this.sortKey[0] === 'song.album.name'
this.sortingByArtist = Array.isArray(this.sortKey) && this.sortKey[0] === 'song.album.artist.name'
this.songRows = orderBy(this.songRows, this.sortKey, this.order)

View file

@ -2,9 +2,7 @@ import localStore from 'local-storage'
export const ls = {
get (key, defaultVal = null) {
const val = localStore(key)
return val || defaultVal
return localStore(key) || defaultVal
},
set (key, val) {

View file

@ -369,6 +369,7 @@ export const playback = {
playAllByArtist (artist, shuffled = true) {
if (!shuffled) {
this.queueAndPlay(orderBy(artist.songs, 'album_id', 'track'))
return
}
this.queueAndPlay(artist.songs, true)

View file

@ -24,7 +24,6 @@ export const albumStore = {
// While we're doing so, for each album, we get its length
// and keep a back reference to the artist too.
each(artist.albums, album => this.setupAlbum(album, artist))
return albums.concat(artist.albums)
}, [])
@ -103,7 +102,7 @@ export const albumStore = {
addSongsIntoAlbum (album, songs) {
songs = [].concat(songs)
album.songs = union(album.songs ? album.songs : [], songs)
album.songs = union(album.songs || [], songs)
each(songs, song => {
song.album_id = album.id

View file

@ -26,7 +26,6 @@ export const artistStore = {
// Traverse through artists array to get the cover and number of songs for each.
each(this.all, artist => this.setupArtist(artist))
albumStore.init(this.all)
},
@ -121,7 +120,7 @@ export const artistStore = {
addAlbumsIntoArtist (artist, albums) {
albums = [].concat(albums)
artist.albums = union(artist.albums ? artist.albums : [], albums)
artist.albums = union(artist.albums || [], albums)
each(albums, album => {
album.artist_id = artist.id

View file

@ -37,10 +37,7 @@ export const songStore = {
// Iterate through the albums. With each, add its songs into our master song list.
// While doing so, we populate some other information into the songs as well.
this.all = albums.reduce((songs, album) => {
each(album.songs, song => {
this.setupSong(song, album)
})
each(album.songs, song => this.setupSong(song, album))
return songs.concat(album.songs)
}, [])

View file

@ -66,9 +66,7 @@ const event = {
if (arguments.length === 2) {
this.bus.$on(arguments[0], arguments[1])
} else {
each(Object.keys(arguments[0]), key => {
this.bus.$on(key, arguments[0][key])
})
each(Object.keys(arguments[0]), key => this.bus.$on(key, arguments[0][key]))
}
return this