fixed loved tracks download

This commit is contained in:
RemixDev 2021-12-29 18:46:11 +01:00
parent 004e0a99be
commit 352a59c291
3 changed files with 15 additions and 5 deletions

View File

@ -194,6 +194,7 @@ export default defineComponent({
favoriteSpotifyPlaylists,
favoritePlaylists,
favoriteTracks,
lovedTracksPlaylist,
isRefreshingFavorites,
refreshFavorites
} = useFavorites()
@ -217,6 +218,7 @@ export default defineComponent({
artists: favoriteArtists,
playlists: favoritePlaylists,
spotifyPlaylists: favoriteSpotifyPlaylists,
lovedTracks: lovedTracksPlaylist,
refreshFavorites,
isRefreshingFavorites
}
@ -236,9 +238,12 @@ export default defineComponent({
const toDownload = this.getActiveRelease()
if (this.activeTab === 'track') {
if (this.lovedTracks){
sendAddToQueue(this.lovedTracks)
} else {
const lovedTracks = this.getLovedTracksPlaylist()
sendAddToQueue(lovedTracks.link)
}
} else {
sendAddToQueue(aggregateDownloadLinks(toDownload))
}
@ -290,6 +295,7 @@ export default defineComponent({
if (lovedTracks.length !== 0) {
return lovedTracks[0]
} else {
toast(this.$t('toasts.noLovedPlaylist'), 'warning', true)
throw new Error('No loved tracks playlist!')
}
}

View File

@ -215,7 +215,8 @@ const en = {
loginNeededToDownload: 'You need to log in to download tracks!',
deezerNotAvailable: 'Deezer is not available in your country. You should use a VPN.',
startGeneratingItems: 'Processing {n} items...',
finishGeneratingItems: 'Generated {n} items.'
finishGeneratingItems: 'Generated {n} items.',
noLovedPlaylist: 'No loved tracks playlist!'
},
settings: {
title: 'Settings',

View File

@ -9,12 +9,13 @@ const favoriteAlbums = ref([])
const favoriteSpotifyPlaylists = ref([])
const favoritePlaylists = ref([])
const favoriteTracks = ref([])
const lovedTracksPlaylist = ref('')
const isLoggedWithSpotify = computed(() => store.getters.isLoggedWithSpotify)
const isRefreshingFavorites = ref(false)
const setAllFavorites = data => {
const { tracks, albums, artists, playlists } = data
const { tracks, albums, artists, playlists, lovedTracks } = data
isRefreshingFavorites.value = false
@ -22,6 +23,7 @@ const setAllFavorites = data => {
favoriteAlbums.value = albums
favoritePlaylists.value = playlists
favoriteTracks.value = tracks
lovedTracksPlaylist.value = lovedTracks
}
const setSpotifyPlaylists = response => {
@ -59,6 +61,7 @@ export const useFavorites = () => ({
favoriteSpotifyPlaylists,
favoritePlaylists,
favoriteTracks,
lovedTracksPlaylist,
isRefreshingFavorites,
refreshFavorites
})