2020-06-24 20:54:36 +00:00
|
|
|
<template>
|
2020-07-28 20:09:13 +00:00
|
|
|
<div id="analyzer_tab" class="main_tabcontent image_header" ref="root">
|
2020-07-20 16:27:41 +00:00
|
|
|
<h2 class="page_heading page_heading--capitalize">{{ $t('sidebar.linkAnalyzer') }}</h2>
|
2020-09-19 12:20:15 +00:00
|
|
|
|
|
|
|
<div v-if="link === ''">
|
2020-06-24 20:54:36 +00:00
|
|
|
<p>
|
2020-07-20 16:27:41 +00:00
|
|
|
{{ $t('linkAnalyzer.info') }}
|
|
|
|
</p>
|
|
|
|
<p>
|
|
|
|
{{ $t('linkAnalyzer.useful') }}
|
2020-06-24 20:54:36 +00:00
|
|
|
</p>
|
|
|
|
</div>
|
2020-09-19 12:20:15 +00:00
|
|
|
<div v-else-if="link === 'error'">
|
2020-07-20 16:27:41 +00:00
|
|
|
<h2>{{ $t('linkAnalyzer.linkNotSupported') }}</h2>
|
|
|
|
<p>{{ $t('linkAnalyzer.linkNotSupportedYet') }}</p>
|
2020-06-24 20:54:36 +00:00
|
|
|
</div>
|
2020-09-19 12:20:15 +00:00
|
|
|
|
2020-06-24 20:54:36 +00:00
|
|
|
<div v-else>
|
|
|
|
<header
|
|
|
|
class="inline-flex"
|
|
|
|
:style="{
|
|
|
|
'background-image':
|
|
|
|
'linear-gradient(to bottom, transparent 0%, var(--main-background) 100%), url(\'' + image + '\')'
|
|
|
|
}"
|
|
|
|
>
|
|
|
|
<div>
|
|
|
|
<h1>{{ title }}</h1>
|
2020-09-26 17:48:30 +00:00
|
|
|
<h2 v-if="type === 'track'">
|
2020-07-20 20:31:54 +00:00
|
|
|
<i18n path="globals.by" tag="span">
|
2020-09-26 17:48:30 +00:00
|
|
|
<router-link
|
|
|
|
tag="span"
|
|
|
|
place="artist"
|
|
|
|
class="clickable"
|
|
|
|
:to="{ name: 'Artist', params: { id: data.artist.id } }"
|
|
|
|
>
|
|
|
|
{{ data.artist.name }}
|
|
|
|
</router-link>
|
2020-07-20 20:31:54 +00:00
|
|
|
</i18n>
|
2020-07-28 20:09:13 +00:00
|
|
|
•
|
2020-07-20 20:31:54 +00:00
|
|
|
<i18n path="globals.in" tag="span">
|
2020-09-26 17:48:30 +00:00
|
|
|
<router-link
|
|
|
|
tag="span"
|
|
|
|
place="album"
|
|
|
|
class="clickable"
|
|
|
|
:to="{ name: 'Tracklist', params: { type: 'album', id: data.album.id } }"
|
|
|
|
>
|
|
|
|
{{ data.album.title }}
|
|
|
|
</router-link>
|
2020-07-20 20:31:54 +00:00
|
|
|
</i18n>
|
2020-06-24 20:54:36 +00:00
|
|
|
</h2>
|
2020-09-26 17:48:30 +00:00
|
|
|
<h2 v-else-if="type === 'album'">
|
2020-07-20 20:31:54 +00:00
|
|
|
<i18n path="globals.by" tag="span">
|
2020-09-26 17:48:30 +00:00
|
|
|
<router-link
|
|
|
|
tag="span"
|
|
|
|
place="artist"
|
|
|
|
class="clickable"
|
|
|
|
:to="{ name: 'Artist', params: { id: data.artist.id } }"
|
|
|
|
>
|
|
|
|
{{ data.artist.name }}
|
|
|
|
</router-link>
|
2020-07-20 20:31:54 +00:00
|
|
|
</i18n>
|
|
|
|
{{ ` • ${$tc('globals.listTabs.trackN', data.nb_tracks)}` }}
|
2020-06-24 20:54:36 +00:00
|
|
|
</h2>
|
|
|
|
</div>
|
|
|
|
<div
|
|
|
|
role="button"
|
|
|
|
aria-label="download"
|
|
|
|
@contextmenu.prevent="openQualityModal"
|
|
|
|
@click.stop="addToQueue"
|
|
|
|
:data-link="link"
|
|
|
|
class="fab right"
|
|
|
|
>
|
2020-07-25 13:51:36 +00:00
|
|
|
<i class="material-icons" :title="$t('globals.download_hint')">get_app</i>
|
2020-06-24 20:54:36 +00:00
|
|
|
</div>
|
|
|
|
</header>
|
|
|
|
<table class="table">
|
|
|
|
<tr v-if="data.id">
|
2020-07-20 16:27:41 +00:00
|
|
|
<td>{{ $t('linkAnalyzer.table.id') }}</td>
|
2020-06-24 20:54:36 +00:00
|
|
|
<td>{{ data.id }}</td>
|
|
|
|
</tr>
|
|
|
|
<tr v-if="data.isrc">
|
2020-07-20 16:27:41 +00:00
|
|
|
<td>{{ $t('linkAnalyzer.table.isrc') }}</td>
|
2020-06-24 20:54:36 +00:00
|
|
|
<td>{{ data.isrc }}</td>
|
|
|
|
</tr>
|
|
|
|
<tr v-if="data.upc">
|
2020-07-20 16:27:41 +00:00
|
|
|
<td>{{ $t('linkAnalyzer.table.upc') }}</td>
|
2020-06-24 20:54:36 +00:00
|
|
|
<td>{{ data.upc }}</td>
|
|
|
|
</tr>
|
|
|
|
<tr v-if="data.duration">
|
2020-07-20 16:27:41 +00:00
|
|
|
<td>{{ $t('linkAnalyzer.table.duration') }}</td>
|
2020-06-24 20:54:36 +00:00
|
|
|
<td>{{ convertDuration(data.duration) }}</td>
|
|
|
|
</tr>
|
|
|
|
<tr v-if="data.disk_number">
|
2020-07-20 16:27:41 +00:00
|
|
|
<td>{{ $t('linkAnalyzer.table.diskNumber') }}</td>
|
2020-06-24 20:54:36 +00:00
|
|
|
<td>{{ data.disk_number }}</td>
|
|
|
|
</tr>
|
|
|
|
<tr v-if="data.track_position">
|
2020-07-20 16:27:41 +00:00
|
|
|
<td>{{ $t('linkAnalyzer.table.trackNumber') }}</td>
|
2020-06-24 20:54:36 +00:00
|
|
|
<td>{{ data.track_position }}</td>
|
|
|
|
</tr>
|
|
|
|
<tr v-if="data.release_date">
|
2020-07-20 16:27:41 +00:00
|
|
|
<td>{{ $t('linkAnalyzer.table.releaseDate') }}</td>
|
2020-06-24 20:54:36 +00:00
|
|
|
<td>{{ data.release_date }}</td>
|
|
|
|
</tr>
|
|
|
|
<tr v-if="data.bpm">
|
2020-07-20 16:27:41 +00:00
|
|
|
<td>{{ $t('linkAnalyzer.table.bpm') }}</td>
|
2020-06-24 20:54:36 +00:00
|
|
|
<td>{{ data.bpm }}</td>
|
|
|
|
</tr>
|
|
|
|
<tr v-if="data.label">
|
2020-07-20 16:27:41 +00:00
|
|
|
<td>{{ $t('linkAnalyzer.table.label') }}</td>
|
2020-06-24 20:54:36 +00:00
|
|
|
<td>{{ data.label }}</td>
|
|
|
|
</tr>
|
|
|
|
<tr v-if="data.record_type">
|
2020-07-20 16:27:41 +00:00
|
|
|
<td>{{ $t('linkAnalyzer.table.recordType') }}</td>
|
|
|
|
<td>{{ $tc(`globals.listTabs.${data.record_type}`, 1) }}</td>
|
2020-06-24 20:54:36 +00:00
|
|
|
</tr>
|
|
|
|
<tr v-if="data.genres && data.genres.data.length">
|
2020-07-20 16:27:41 +00:00
|
|
|
<td>{{ $t('linkAnalyzer.table.genres') }}</td>
|
2020-06-24 20:54:36 +00:00
|
|
|
<td>{{ data.genres.data.map(x => x.name).join('; ') }}</td>
|
|
|
|
</tr>
|
|
|
|
</table>
|
|
|
|
|
|
|
|
<div v-if="type == 'album'">
|
2020-09-26 17:48:30 +00:00
|
|
|
<router-link tag="button" :to="{ name: 'Tracklist', params: { type: 'album', id } }">
|
|
|
|
{{ $t('linkAnalyzer.table.tracklist') }}
|
|
|
|
</router-link>
|
2020-06-24 20:54:36 +00:00
|
|
|
</div>
|
|
|
|
<div v-if="countries.length">
|
|
|
|
<p v-for="country in countries">{{ country[0] }} - {{ country[1] }}</p>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</template>
|
|
|
|
|
|
|
|
<script>
|
2020-07-16 22:11:28 +00:00
|
|
|
import { socket } from '@/utils/socket'
|
2020-09-19 12:20:15 +00:00
|
|
|
import { convertDuration } from '@/utils/utils'
|
|
|
|
import { COUNTRIES } from '@/utils/countries'
|
2020-07-16 22:11:28 +00:00
|
|
|
import EventBus from '@/utils/EventBus'
|
2020-09-19 12:20:15 +00:00
|
|
|
import { sendAddToQueue } from '@/utils/downloads'
|
2020-06-24 20:54:36 +00:00
|
|
|
|
|
|
|
export default {
|
|
|
|
data() {
|
|
|
|
return {
|
2020-09-19 12:20:15 +00:00
|
|
|
link: '',
|
2020-06-24 20:54:36 +00:00
|
|
|
title: '',
|
|
|
|
subtitle: '',
|
|
|
|
image: '',
|
|
|
|
data: {},
|
|
|
|
type: '',
|
|
|
|
id: '0',
|
|
|
|
countries: []
|
|
|
|
}
|
|
|
|
},
|
|
|
|
methods: {
|
2020-09-19 12:20:15 +00:00
|
|
|
convertDuration,
|
2020-06-24 20:54:36 +00:00
|
|
|
reset() {
|
|
|
|
this.title = 'Loading...'
|
|
|
|
this.subtitle = ''
|
|
|
|
this.image = ''
|
|
|
|
this.data = {}
|
|
|
|
this.type = ''
|
|
|
|
this.link = ''
|
|
|
|
this.countries = []
|
|
|
|
},
|
|
|
|
showTrack(data) {
|
2020-09-19 12:20:15 +00:00
|
|
|
this.reset()
|
2020-06-24 20:54:36 +00:00
|
|
|
const {
|
|
|
|
title,
|
|
|
|
title_version,
|
|
|
|
album: { cover_xl },
|
|
|
|
link,
|
|
|
|
available_countries,
|
|
|
|
id
|
|
|
|
} = data
|
|
|
|
|
|
|
|
this.title = title + (title_version && title.indexOf(title_version) == -1 ? ' ' + title_version : '')
|
|
|
|
this.image = cover_xl
|
|
|
|
this.type = 'track'
|
|
|
|
this.link = link
|
|
|
|
this.id = id
|
|
|
|
|
|
|
|
available_countries.forEach(cc => {
|
|
|
|
let temp = []
|
|
|
|
let chars = [...cc].map(c => c.charCodeAt() + 127397)
|
|
|
|
temp.push(String.fromCodePoint(...chars))
|
2020-09-19 12:20:15 +00:00
|
|
|
temp.push(COUNTRIES[cc])
|
2020-06-24 20:54:36 +00:00
|
|
|
this.countries.push(temp)
|
|
|
|
})
|
|
|
|
|
|
|
|
this.data = data
|
|
|
|
},
|
|
|
|
showAlbum(data) {
|
2020-09-19 12:20:15 +00:00
|
|
|
this.reset()
|
2020-06-24 20:54:36 +00:00
|
|
|
const { title, cover_xl, link, id } = data
|
|
|
|
|
|
|
|
this.title = title
|
|
|
|
this.image = cover_xl
|
|
|
|
this.type = 'album'
|
|
|
|
this.link = link
|
|
|
|
this.data = data
|
|
|
|
this.id = id
|
|
|
|
},
|
|
|
|
notSupported() {
|
|
|
|
this.link = 'error'
|
2020-08-22 13:21:40 +00:00
|
|
|
},
|
|
|
|
addToQueue(e) {
|
2020-09-19 12:20:15 +00:00
|
|
|
sendAddToQueue(e.currentTarget.dataset.link)
|
2020-06-24 20:54:36 +00:00
|
|
|
}
|
|
|
|
},
|
|
|
|
mounted() {
|
|
|
|
EventBus.$on('linkAnalyzerTab:reset', this.reset)
|
|
|
|
|
|
|
|
socket.on('analyze_track', this.showTrack)
|
|
|
|
socket.on('analyze_album', this.showAlbum)
|
|
|
|
socket.on('analyze_notSupported', this.notSupported)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
</script>
|
|
|
|
|
|
|
|
<style>
|
2020-07-20 20:31:54 +00:00
|
|
|
</style>
|