Added more info to link analyzer
This commit is contained in:
parent
9c80d4b28c
commit
78d9b2decd
@ -27,6 +27,13 @@ import { isValidURL } from '@/utils/utils'
|
||||
import { sendAddToQueue } from '@/utils/downloads'
|
||||
import { SPOTIFY_STATUS } from '@/constants'
|
||||
|
||||
/* ===== Random utils ===== */
|
||||
|
||||
/* eslint-disable no-extend-native */
|
||||
String.prototype.capitalize = function () {
|
||||
return this.charAt(0).toUpperCase() + this.slice(1)
|
||||
}
|
||||
|
||||
/* ===== App initialization ===== */
|
||||
async function startApp() {
|
||||
new Vue({
|
||||
|
@ -118,12 +118,24 @@
|
||||
<td>{{ $t('linkAnalyzer.table.genres') }}</td>
|
||||
<td>{{ data.genres.data.map(x => x.name).join('; ') }}</td>
|
||||
</tr>
|
||||
<tr v-if="data.readable !== undefined">
|
||||
<td>{{ $t('linkAnalyzer.table.readable') }}</td>
|
||||
<td>{{ $t( data.readable ? 'globals.yes' : 'globals.no').capitalize() }}</td>
|
||||
</tr>
|
||||
<tr v-if="countries.length">
|
||||
<td>{{ $t('linkAnalyzer.table.countries') }}</td>
|
||||
<td v-for="(country, i) in countries" :key="i">{{ country[0] }} - {{ country[1] }}</td>
|
||||
<td>{{ $t('linkAnalyzer.table.available') }}</td>
|
||||
<td>{{ $t( available_countries.includes(user.country.toLowerCase()) ? 'globals.yes' : 'globals.no').capitalize() }}</td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
<template v-if="countries.length">
|
||||
<h3>{{ $t('linkAnalyzer.countries') }}</h3>
|
||||
<p v-for="(country, i) in countries" :key="i">{{ country[0] }} - {{ country[1] }}</p>
|
||||
</template>
|
||||
<template v-else>
|
||||
<h3>{{ $t('linkAnalyzer.noCountries') }}</h3>
|
||||
</template>
|
||||
|
||||
<div v-if="type === 'album'">
|
||||
<router-link tag="button" class="btn btn-primary" name="button" :to="{ name: 'Album', params: { id } }">
|
||||
{{ $t('linkAnalyzer.table.tracklist') }}
|
||||
@ -135,6 +147,7 @@
|
||||
|
||||
<script>
|
||||
/* eslint-disable camelcase */
|
||||
import { mapGetters } from 'vuex'
|
||||
import { socket } from '@/utils/socket'
|
||||
import { convertDuration } from '@/utils/utils'
|
||||
import { COUNTRIES } from '@/utils/countries'
|
||||
@ -151,9 +164,15 @@ export default {
|
||||
data: {},
|
||||
type: '',
|
||||
id: '0',
|
||||
countries: []
|
||||
countries: [],
|
||||
available_countries: []
|
||||
}
|
||||
},
|
||||
computed: {
|
||||
...mapGetters({
|
||||
user: 'getUser'
|
||||
})
|
||||
},
|
||||
mounted() {
|
||||
EventBus.$on('analyze_track', this.showTrack)
|
||||
EventBus.$on('analyze_album', this.showAlbum)
|
||||
@ -169,6 +188,7 @@ export default {
|
||||
this.type = ''
|
||||
this.link = ''
|
||||
this.countries = []
|
||||
this.available_countries = []
|
||||
},
|
||||
showTrack(data) {
|
||||
this.reset()
|
||||
@ -193,6 +213,7 @@ export default {
|
||||
temp.push(String.fromCodePoint(...chars))
|
||||
temp.push(COUNTRIES[cc])
|
||||
this.countries.push(temp)
|
||||
this.available_countries.push(cc.toLowerCase())
|
||||
})
|
||||
|
||||
this.data = data
|
||||
|
@ -41,7 +41,9 @@ const en = {
|
||||
albumN: '0 albums | {n} album | {n} albums',
|
||||
artistN: '0 artists | {n} artist | {n} artists',
|
||||
playlistN: '0 playlists | {n} playlist | {n} playlists'
|
||||
}
|
||||
},
|
||||
yes: 'yes',
|
||||
no: 'no'
|
||||
},
|
||||
about: {
|
||||
appStatus: {
|
||||
@ -166,8 +168,12 @@ const en = {
|
||||
label: 'Label',
|
||||
recordType: 'Record Type',
|
||||
genres: 'Genres',
|
||||
tracklist: 'Tracklist'
|
||||
}
|
||||
tracklist: 'Tracklist',
|
||||
readable: 'Readable',
|
||||
available: 'Available'
|
||||
},
|
||||
countries: 'Countries',
|
||||
noCountries: 'This track is not available in any country.'
|
||||
},
|
||||
search: {
|
||||
startSearching: 'Start searching!',
|
||||
|
@ -41,7 +41,9 @@ const it = {
|
||||
albumN: '{n} album',
|
||||
artistN: '0 artisti | {n} artista | {n} artisti',
|
||||
playlistN: '{n} playlist'
|
||||
}
|
||||
},
|
||||
yes: 'sì',
|
||||
no: 'no'
|
||||
},
|
||||
about: {
|
||||
appStatus: {
|
||||
@ -166,8 +168,12 @@ const it = {
|
||||
label: 'Etichetta',
|
||||
recordType: 'Tipologia di registrazione',
|
||||
genres: 'Generi',
|
||||
tracklist: 'Lista tracce'
|
||||
}
|
||||
tracklist: 'Lista tracce',
|
||||
readable: 'Leggibile',
|
||||
available: 'Disponibile'
|
||||
},
|
||||
countries: 'Paesi',
|
||||
noCountries: 'Questo brano non è disponibile in nessun paese.'
|
||||
},
|
||||
search: {
|
||||
startSearching: 'Inizia a cercare!',
|
||||
|
Loading…
Reference in New Issue
Block a user