Started implementing Link Analyzer's tab
This commit is contained in:
parent
c4e45462bd
commit
22476f50b5
@ -257,7 +257,24 @@ <h1>Favorites</h1>
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div id="analyzer_tab" class="main_tabcontent">
|
<div id="analyzer_tab" class="main_tabcontent">
|
||||||
<h1>Link Analyzer</h1>
|
<h1>Link Analyzer</h1>
|
||||||
|
<h1>{{ title }}</h1>
|
||||||
|
<h2>{{ subtitle }}</h2>
|
||||||
|
<table>
|
||||||
|
<tr v-if="data.isrc"><td>ISRC</td><td>{{ data.isrc }}</td></tr>
|
||||||
|
<tr v-if="data.upc"><td>UPC</td><td>{{ data.upc }}</td></tr>
|
||||||
|
<tr v-if="data.duration"><td>Duration</td><td>{{ convertDuration(data.duration) }}</td></tr>
|
||||||
|
<tr v-if="data.disk_number"><td>Disk Number</td><td>{{ data.disk_number }}</td></tr>
|
||||||
|
<tr v-if="data.track_position"><td>Track Number</td><td>{{ data.track_position }}</td></tr>
|
||||||
|
<tr v-if="data.release_date"><td>Release Date</td><td>{{ data.release_date }}</td></tr>
|
||||||
|
<tr v-if="data.bpm"><td>BPM</td><td>{{ data.bpm }}</td></tr>
|
||||||
|
<tr v-if="data.label"><td>Label</td><td>{{ data.label }}</td></tr>
|
||||||
|
<tr v-if="data.record_type"><td>Record Type</td><td>{{ data.record_type }}</td></tr>
|
||||||
|
<tr v-if="data.genres && data.genres.data.length"><td>Genres</td><td>{{ data.genres.data.map(x => x.name).join("; ") }}</td></tr>
|
||||||
|
</table>
|
||||||
|
<div v-if="countries.length">
|
||||||
|
<p v-for="country in countries">{{ country[0] }} - {{ country[1] }}</p>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div id="settings_tab" class="main_tabcontent fixed_footer">
|
<div id="settings_tab" class="main_tabcontent fixed_footer">
|
||||||
|
62
public/js/modules/link-analyzer-tab.js
Normal file
62
public/js/modules/link-analyzer-tab.js
Normal file
File diff suppressed because one or more lines are too long
@ -3,6 +3,7 @@ import { artistView, albumView, playlistView } from './tabs.js'
|
|||||||
import Downloads from './downloads.js'
|
import Downloads from './downloads.js'
|
||||||
import QualityModal from './quality-modal.js'
|
import QualityModal from './quality-modal.js'
|
||||||
import { playPausePreview, previewMouseEnter, previewMouseLeave } from './track-preview.js'
|
import { playPausePreview, previewMouseEnter, previewMouseLeave } from './track-preview.js'
|
||||||
|
import Utils from './utils.js'
|
||||||
|
|
||||||
const MainSearch = new Vue({
|
const MainSearch = new Vue({
|
||||||
data: {
|
data: {
|
||||||
@ -87,20 +88,8 @@ const MainSearch = new Vue({
|
|||||||
e.preventDefault()
|
e.preventDefault()
|
||||||
QualityModal.open(e.currentTarget.dataset.link)
|
QualityModal.open(e.currentTarget.dataset.link)
|
||||||
},
|
},
|
||||||
numberWithDots(x) {
|
numberWithDots: Utils.numberWithDots,
|
||||||
return x.toString().replace(/\B(?=(\d{3})+(?!\d))/g, '.')
|
convertDuration: Utils.convertDuration,
|
||||||
},
|
|
||||||
convertDuration(duration) {
|
|
||||||
//convert from seconds only to mm:ss format
|
|
||||||
let mm, ss
|
|
||||||
mm = Math.floor(duration / 60)
|
|
||||||
ss = duration - mm * 60
|
|
||||||
//add leading zero if ss < 0
|
|
||||||
if (ss < 10) {
|
|
||||||
ss = '0' + ss
|
|
||||||
}
|
|
||||||
return mm + ':' + ss
|
|
||||||
},
|
|
||||||
search(type) {
|
search(type) {
|
||||||
socket.emit('search', {
|
socket.emit('search', {
|
||||||
term: this.results.query,
|
term: this.results.query,
|
||||||
|
@ -3,6 +3,7 @@ import Utils from './utils.js'
|
|||||||
import QualityModal from './quality-modal.js'
|
import QualityModal from './quality-modal.js'
|
||||||
import Downloads from './downloads.js'
|
import Downloads from './downloads.js'
|
||||||
import { socket } from './socket.js'
|
import { socket } from './socket.js'
|
||||||
|
import { analyzeLink } from './tabs.js'
|
||||||
|
|
||||||
export default class Search {
|
export default class Search {
|
||||||
static linkListeners() {
|
static linkListeners() {
|
||||||
@ -31,7 +32,11 @@ export default class Search {
|
|||||||
if (e.ctrlKey) {
|
if (e.ctrlKey) {
|
||||||
QualityModal.open(term)
|
QualityModal.open(term)
|
||||||
} else {
|
} else {
|
||||||
Downloads.sendAddToQueue(term)
|
if (window.main_selected == 'analyzer_tab'){
|
||||||
|
analyzeLink(term)
|
||||||
|
}else{
|
||||||
|
Downloads.sendAddToQueue(term)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if (term != MainSearch.query || main_selected == 'search_tab') {
|
if (term != MainSearch.query || main_selected == 'search_tab') {
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
import ArtistTab from './artist-tab.js'
|
import ArtistTab from './artist-tab.js'
|
||||||
import TracklistTab from './tracklist-tab.js'
|
import TracklistTab from './tracklist-tab.js'
|
||||||
|
import LinkAnalyzerTab from './link-analyzer-tab.js'
|
||||||
import { socket } from './socket.js'
|
import { socket } from './socket.js'
|
||||||
import SettingsTab from './settings-tab.js'
|
import SettingsTab from './settings-tab.js'
|
||||||
import MainSearch from './main-search.js'
|
import MainSearch from './main-search.js'
|
||||||
@ -34,6 +35,12 @@ export function playlistView(ev) {
|
|||||||
showTab('playlist', id)
|
showTab('playlist', id)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export function analyzeLink(link) {
|
||||||
|
console.log("Analyzing: "+link)
|
||||||
|
LinkAnalyzerTab.reset()
|
||||||
|
socket.emit('analyzeLink', link)
|
||||||
|
}
|
||||||
|
|
||||||
export class Tabs {
|
export class Tabs {
|
||||||
static linkListeners() {
|
static linkListeners() {
|
||||||
document.getElementById('search_tab').addEventListener('click', handleTabClick)
|
document.getElementById('search_tab').addEventListener('click', handleTabClick)
|
||||||
|
@ -27,6 +27,10 @@ function convertDurationSeparated(duration) {
|
|||||||
return [hh, mm, ss]
|
return [hh, mm, ss]
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function numberWithDots(x) {
|
||||||
|
return x.toString().replace(/\B(?=(\d{3})+(?!\d))/g, '.')
|
||||||
|
}
|
||||||
|
|
||||||
// On scroll event, returns currentTarget = null
|
// On scroll event, returns currentTarget = null
|
||||||
// Probably on other events too
|
// Probably on other events too
|
||||||
function debounce(func, wait, immediate) {
|
function debounce(func, wait, immediate) {
|
||||||
@ -49,5 +53,6 @@ export default {
|
|||||||
isValidURL,
|
isValidURL,
|
||||||
convertDuration,
|
convertDuration,
|
||||||
convertDurationSeparated,
|
convertDurationSeparated,
|
||||||
|
numberWithDots,
|
||||||
debounce
|
debounce
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user