Fixed issues with spotify playlists and added localization compatibility

This commit is contained in:
RemixDev 2020-07-20 22:31:54 +02:00
parent 6fecc5fde0
commit 57691329b3
11 changed files with 65 additions and 63 deletions

File diff suppressed because one or more lines are too long

View File

@ -167,8 +167,8 @@ export default {
this.sortKey = 'release_date' this.sortKey = 'release_date'
this.sortOrder = 'desc' this.sortOrder = 'desc'
this.head = [ this.head = [
{ title: 'Title', sortKey: 'title' }, { title: this.$tc('globals.listTabs.title',1), sortKey: 'title' },
{ title: 'Release Date', sortKey: 'release_date' }, { title: this.$t('globals.listTabs.releaseDate'), sortKey: 'release_date' },
{ title: '', width: '32px' } { title: '', width: '32px' }
] ]
if (isEmpty(releases)) { if (isEmpty(releases)) {

View File

@ -49,7 +49,7 @@
<p class="primary-text">{{ release.title }}</p> <p class="primary-text">{{ release.title }}</p>
<p class="secondary-text"> <p class="secondary-text">
{{ {{
`${$t('globals.by')} ${release.creator.name} - ${release.nb_tracks} ${$tc('globals.listTabs.track', 2)}` `${$t('globals.by', [release.creator.name])} - ${$tc('globals.listTabs.trackN', release.nb_tracks)}`
}} }}
</p> </p>
</div> </div>
@ -75,9 +75,9 @@
<p class="primary-text">{{ release.title }}</p> <p class="primary-text">{{ release.title }}</p>
<p class="secondary-text"> <p class="secondary-text">
{{ {{
`${$t('globals.by')} ${release.creator.name} - ${release.nb_tracks.name} ${$tc( `${$t('globals.by', [release.creator.name])} - ${$tc(
'globals.listTabs.track', 'globals.listTabs.trackN',
2 release.nb_tracks
)}` )}`
}} }}
</p> </p>
@ -104,7 +104,7 @@
</div> </div>
</div> </div>
<p class="primary-text">{{ release.title }}</p> <p class="primary-text">{{ release.title }}</p>
<p class="secondary-text">{{ `${$t('globals.by')} ${release.artist.name}` }}</p> <p class="secondary-text">{{ `${$t('globals.by', [release.artist.name])}` }}</p>
</div> </div>
</div> </div>
</div> </div>

View File

@ -30,7 +30,7 @@
</div> </div>
<p class="primary-text">{{ release.title }}</p> <p class="primary-text">{{ release.title }}</p>
<p class="secondary-text"> <p class="secondary-text">
{{ `${$t('globals.by')} ${release.user.name} - ${release.nb_tracks} ${$tc('globals.listTabs.track', 2)}` }} {{ `${$t('globals.by', [release.user.name])} - ${$tc('globals.listTabs.trackN', release.nb_tracks)}` }}
</p> </p>
</div> </div>
</div> </div>
@ -59,7 +59,7 @@
</div> </div>
</div> </div>
<p class="primary-text">{{ release.title }}</p> <p class="primary-text">{{ release.title }}</p>
<p class="secondary-text">{{ `${$t('globals.by')} ${release.artist.name}` }}</p> <p class="secondary-text">{{ `${$t('globals.by', [release.artist.name])}` }}</p>
</div> </div>
</div> </div>
</section> </section>

View File

@ -24,15 +24,19 @@
<div> <div>
<h1>{{ title }}</h1> <h1>{{ title }}</h1>
<h2 v-if="type == 'track'"> <h2 v-if="type == 'track'">
{{ $t('globals.by') }} <i18n path="globals.by" tag="span">
<span class="clickable" @click="artistView" :data-id="data.artist.id">{{ data.artist.name }}</span> <span place="0" class="clickable" @click="artistView" :data-id="data.artist.id">{{ data.artist.name }}</span>
{{ `${$t('globals.in')}` }} </i18n>
<span class="clickable" @click="albumView" :data-id="data.album.id">{{ data.album.title }}</span>
<i18n path="globals.in" tag="span">
<span place="0" class="clickable" @click="albumView" :data-id="data.album.id">{{ data.album.title }}</span>
</i18n>
</h2> </h2>
<h2 v-else-if="type == 'album'"> <h2 v-else-if="type == 'album'">
{{ $t('globals.by') }} <i18n path="globals.by" tag="span">
<span class="clickable" @click="artistView" :data-id="data.artist.id">{{ data.artist.name }}</span> <span place="0" class="clickable" @click="artistView" :data-id="data.artist.id">{{ data.artist.name }}</span>
{{ `${data.nb_tracks} ${$tc('globals.listTabs.track', 2)}` }} </i18n>
{{ `${$tc('globals.listTabs.trackN', data.nb_tracks)}` }}
</h2> </h2>
</div> </div>
<div <div

View File

@ -429,7 +429,7 @@
<p class="primary-text">{{ release.title }}</p> <p class="primary-text">{{ release.title }}</p>
<p class="secondary-text"> <p class="secondary-text">
{{ {{
`${$t('globals.by')} ${release.user.name} - ${release.nb_tracks} ${$tc('globals.listTabs.track', 2)}` `${$t('globals.by', [release.user.name])} - ${$tc('globals.listTabs.trackN', release.nb_tracks)}`
}} }}
</p> </p>
</div> </div>

View File

@ -1,17 +1,17 @@
<template> <template>
<div id="modal_quality" class="smallmodal" v-show="open" @click="tryToDownloadTrack($event)" ref="modal"> <div id="modal_quality" class="smallmodal" v-show="open" @click="tryToDownloadTrack($event)" ref="modal">
<div class="smallmodal-content"> <div class="smallmodal-content">
<button class="quality-button" data-quality-value="9">{{ $t('globals.download') }} FLAC</button> <button class="quality-button" data-quality-value="9">{{ $t('globals.download', ['FLAC']) }}</button>
<button class="quality-button" data-quality-value="3">{{ $t('globals.download') }} MP3 320kbps</button> <button class="quality-button" data-quality-value="3">{{ $t('globals.download', ['MP3 320kbps']) }}</button>
<button class="quality-button" data-quality-value="1">{{ $t('globals.download') }} MP3 128kbps</button> <button class="quality-button" data-quality-value="1">{{ $t('globals.download', ['MP3 128kbps']) }}</button>
<button class="quality-button" data-quality-value="15"> <button class="quality-button" data-quality-value="15">
{{ $t('globals.download') }} 360 Reality Audio [HQ] {{ $t('globals.download', ['360 Reality Audio [HQ]']) }}
</button> </button>
<button class="quality-button" data-quality-value="14"> <button class="quality-button" data-quality-value="14">
{{ $t('globals.download') }} 360 Reality Audio [MQ] {{ $t('globals.download', ['360 Reality Audio [MQ]']) }}
</button> </button>
<button class="quality-button" data-quality-value="13"> <button class="quality-button" data-quality-value="13">
{{ $t('globals.download') }} 360 Reality Audio [LQ] {{ $t('globals.download', ['360 Reality Audio [LQ]']) }}
</button> </button>
</div> </div>
</div> </div>

View File

@ -4,7 +4,9 @@
<div id="logged_in_info" ref="loggedInInfo"> <div id="logged_in_info" ref="loggedInInfo">
<img id="settings_picture" src="" alt="Profile Picture" ref="userpicture" class="circle" /> <img id="settings_picture" src="" alt="Profile Picture" ref="userpicture" class="circle" />
<p>{{ $t('settings.login.loggedIn') }} <strong id="settings_username" ref="username"></strong></p> <i18n path="settings.login.loggedIn" tag="p">
<strong place="username" id="settings_username" ref="username"></strong>
</i18n>
<button id="settings_btn_logout" @click="logout">{{ $t('settings.login.logout') }}</button> <button id="settings_btn_logout" @click="logout">{{ $t('settings.login.logout') }}</button>
<select v-if="accounts.length" id="family_account" v-model="accountNum" @change="changeAccount"> <select v-if="accounts.length" id="family_account" v-model="accountNum" @change="changeAccount">
<option v-for="(account, i) in accounts" :value="i.toString()">{{ account.BLOG_NAME }}</option> <option v-for="(account, i) in accounts" :value="i.toString()">{{ account.BLOG_NAME }}</option>

View File

@ -24,7 +24,7 @@
<th>#</th> <th>#</th>
<th>{{ $tc('globals.listTabs.track', 1) }}</th> <th>{{ $tc('globals.listTabs.track', 1) }}</th>
<th>{{ $tc('globals.listTabs.artist', 1) }}</th> <th>{{ $tc('globals.listTabs.artist', 1) }}</th>
<th v-if="type === 'Playlist'">{{ $tc('globals.listTabs.album', 1) }}</th> <th v-if="type === 'playlist'">{{ $tc('globals.listTabs.album', 1) }}</th>
<th> <th>
<i class="material-icons">timer</i> <i class="material-icons">timer</i>
</th> </th>
@ -34,7 +34,7 @@
</tr> </tr>
</thead> </thead>
<tbody> <tbody>
<template v-if="type !== 'Spotify Playlist'"> <template v-if="type !== 'spotifyPlaylist'">
<template v-for="track in body"> <template v-for="track in body">
<tr v-if="track.type == 'track'"> <tr v-if="track.type == 'track'">
<td class="table__cell--x-small table__cell--center"> <td class="table__cell--x-small table__cell--center">
@ -50,7 +50,7 @@
</div> </div>
</td> </td>
<td class="table__cell--small table__cell--center track_position"> <td class="table__cell--small table__cell--center track_position">
{{ type === 'Album' ? track.track_position : body.indexOf(track) + 1 }} {{ type === 'album' ? track.track_position : body.indexOf(track) + 1 }}
</td> </td>
<td class="table__cell--large table__cell--with-icon"> <td class="table__cell--large table__cell--with-icon">
<div class="table__cell-content table__cell-content--vertical-center"> <div class="table__cell-content table__cell-content--vertical-center">
@ -73,7 +73,7 @@
{{ track.artist.name }} {{ track.artist.name }}
</td> </td>
<td <td
v-if="type == 'Playlist'" v-if="type == 'playlist'"
class="table__cell--medium table__cell--center clickable" class="table__cell--medium table__cell--center clickable"
@click="albumView" @click="albumView"
:data-id="track.album.id" :data-id="track.album.id"
@ -82,7 +82,7 @@
</td> </td>
<td <td
class="table__cell--center" class="table__cell--center"
:class="{ 'table__cell--small': type === 'Album', 'table__cell--x-small': type === 'Playlist' }" :class="{ 'table__cell--small': type === 'album', 'table__cell--x-small': type === 'playlist' }"
> >
{{ convertDuration(track.duration) }} {{ convertDuration(track.duration) }}
</td> </td>
@ -132,7 +132,7 @@
<span v-if="label" style="opacity: 0.40;margin-top: 8px;display: inline-block;font-size: 13px;">{{ label }}</span> <span v-if="label" style="opacity: 0.40;margin-top: 8px;display: inline-block;font-size: 13px;">{{ label }}</span>
<footer> <footer>
<button @contextmenu.prevent="openQualityModal" @click.stop="addToQueue" :data-link="link"> <button @contextmenu.prevent="openQualityModal" @click.stop="addToQueue" :data-link="link">
{{ `${$t('globals.download')} ${$tc(`globals.listTabs.${type}`, 1)}` }} {{ `${$t('globals.download', [$tc(`globals.listTabs.${type}`, 1)])}` }}
</button> </button>
<button <button
class="with_icon" class="with_icon"
@ -202,7 +202,7 @@ export default {
if (this.body) { if (this.body) {
this.body.forEach(item => { this.body.forEach(item => {
if (item.type == 'track' && item.selected) if (item.type == 'track' && item.selected)
selected.push(this.type == 'Spotify Playlist' ? item.uri : item.link) selected.push(this.type == 'spotifyPlaylist' ? item.uri : item.link)
}) })
} }
return selected.join(';') return selected.join(';')
@ -221,12 +221,12 @@ export default {
cover_xl cover_xl
} = data } = data
this.type = `${this.$tc('globals.listTabs.album', 1)}` this.type = 'album'
this.link = `https://www.deezer.com/album/${albumID}` this.link = `https://www.deezer.com/album/${albumID}`
this.title = albumTitle this.title = albumTitle
this.explicit = explicit_lyrics this.explicit = explicit_lyrics
this.label = albumLabel this.label = albumLabel
this.metadata = `${artistName}${numberOfTracks} ${this.$tc('globals.listTabs.track', 2)}` this.metadata = `${artistName}${this.$tc('globals.listTabs.trackN', numberOfTracks)}`
this.release_date = release_date.substring(0, 10) this.release_date = release_date.substring(0, 10)
this.image = cover_xl this.image = cover_xl
@ -247,15 +247,12 @@ export default {
tracks: { length: numberOfTracks } tracks: { length: numberOfTracks }
} = data } = data
this.type = `${this.$tc('globals.listTabs.playlist', 1)}` this.type = 'playlist'
this.link = `https://www.deezer.com/playlist/${playlistID}` this.link = `https://www.deezer.com/playlist/${playlistID}`
this.title = playlistTitle this.title = playlistTitle
this.image = playlistCover this.image = playlistCover
this.release_date = creation_date.substring(0, 10) this.release_date = creation_date.substring(0, 10)
this.metadata = `${this.$t('globals.by')} ${creatorName}${numberOfTracks} ${this.$tc( this.metadata = `${this.$t('globals.by', [creatorName])}${this.$tc('globals.listTabs.trackN', numberOfTracks)}`
'globals.listTabs.track',
2
)}`
if (isEmpty(playlistTracks)) { if (isEmpty(playlistTracks)) {
this.body = null this.body = null
@ -274,17 +271,14 @@ export default {
tracks: { length: numberOfTracks } tracks: { length: numberOfTracks }
} = data } = data
this.type = `${this.$tc('globals.listTabs.spotifyPlaylist', 1)}` this.type = 'spotifyPlaylist'
this.link = playlistURI this.link = playlistURI
this.title = playlistName this.title = playlistName
this.image = numberOfImages this.image = numberOfImages
? images[0].url ? images[0].url
: 'https://e-cdns-images.dzcdn.net/images/cover/d41d8cd98f00b204e9800998ecf8427e/1000x1000-000000-80-0-0.jpg' : 'https://e-cdns-images.dzcdn.net/images/cover/d41d8cd98f00b204e9800998ecf8427e/1000x1000-000000-80-0-0.jpg'
this.release_date = '' this.release_date = ''
this.metadata = `${this.$t('globals.by')} ${ownerName}${numberOfTracks} ${this.$tc( this.metadata = `${this.$t('globals.by', [ownerName])}${this.$tc('globals.listTabs.trackN', numberOfTracks)}`
'globals.listTabs.track',
2
)}`
if (isEmpty(playlistTracks)) { if (isEmpty(playlistTracks)) {
this.body = null this.body = null

View File

@ -3,9 +3,9 @@ const en = {
welcome: 'Welcome to deemix', welcome: 'Welcome to deemix',
back: 'back', back: 'back',
loading: 'loading', loading: 'loading',
download: 'Download', download: 'Download {0}',
by: 'by', by: 'by {0}',
in: 'in', in: 'in {0}',
listTabs: { listTabs: {
empty: '', empty: '',
all: 'all', all: 'all',
@ -14,9 +14,10 @@ const en = {
single: 'single | singles', single: 'single | singles',
title: 'title | titles', title: 'title | titles',
track: 'track | tracks', track: 'track | tracks',
trackN: '0 tracks | {n} track | {n} tracks',
playlist: 'playlist | playlists', playlist: 'playlist | playlists',
compile: 'compilations', compile: 'compilation | compilations',
ep: 'eps', ep: 'ep | eps',
spotifyPlaylist: 'spotify playlist | spotify playlists', spotifyPlaylist: 'spotify playlist | spotify playlists',
releaseDate: 'release date', releaseDate: 'release date',
error: 'error' error: 'error'
@ -77,7 +78,7 @@ const en = {
languages: 'Languages', languages: 'Languages',
login: { login: {
title: 'Login', title: 'Login',
loggedIn: 'You are logged in as', loggedIn: 'You are logged in as {username}',
arl: { arl: {
question: 'How do I get my own ARL?', question: 'How do I get my own ARL?',
update: 'Update ARL' update: 'Update ARL'

View File

@ -3,9 +3,9 @@ const it = {
welcome: 'Benvenuto su deemix', welcome: 'Benvenuto su deemix',
back: 'indietro', back: 'indietro',
loading: 'caricamento', loading: 'caricamento',
download: 'Scarica', download: 'Scarica {0}',
by: 'di', by: 'di {0}',
in: 'in', in: 'in {0}',
listTabs: { listTabs: {
all: 'tutto', all: 'tutto',
album: 'album', album: 'album',
@ -13,6 +13,7 @@ const it = {
single: 'singolo | singoli', single: 'singolo | singoli',
title: 'titolo | titoli', title: 'titolo | titoli',
track: 'traccia | tracce', track: 'traccia | tracce',
trackN: '0 tracce | {n} traccia | {n} tracce',
playlist: 'playlist', playlist: 'playlist',
compile: 'compilation', compile: 'compilation',
ep: 'ep', ep: 'ep',
@ -73,7 +74,7 @@ const it = {
languages: 'Lingue', languages: 'Lingue',
login: { login: {
title: 'Login', title: 'Login',
loggedIn: 'Sei loggato come', loggedIn: 'Sei loggato come {username}',
arl: { arl: {
question: 'Come ottengo il mio ARL?', question: 'Come ottengo il mio ARL?',
update: 'Aggiorna ARL' update: 'Aggiorna ARL'