Beispiel #1
0
// This file is required by the index.html file and will
// be executed in the renderer process for that window.
// All of the Node.js APIs are available in this process.

"use strict";

var SpotifyWebHelper = require('@jonny/spotify-web-helper')
var helper = SpotifyWebHelper()

var currentArtist = 'Artist'
var currentSong = 'Song'

var request = require('request')
var cheerio = require('cheerio')

var urlBase = 'http://www.azlyrics.com/'
var urlLyric = 'http://www.azlyrics.com/lyrics/'
var notFound = 'Error: Not found.'

function cleanArtist(artist) {
    return artist.toLowerCase().replace(/^(the )/g, '').replace(/[^\w\d]/g, '')
}

function cleanSong(song) {
    var titleA = /([a-z0-9&\s',.]+[a-z0-9&',.]).*/i.exec(song)
    return titleA[1].toLowerCase().replace(/\s/g, '').replace(/[^a-z0-9]/g, '')
}

function changeTrackInfo(artist, song) {
    document.getElementById('artist').innerHTML = artist
    document.getElementById('song').innerHTML = song
Beispiel #2
0
app.on('refresh_spotify', function(ev) {
    helper = SpotifyWebHelper();
    spotify_ready = false;
    initSpotify();
})