1.1.20 - self describing code (jk read telegram changelog)
This commit is contained in:
@ -527,6 +527,11 @@ class DownloadThread {
|
||||
}
|
||||
}
|
||||
|
||||
//Cut path to fit into windows limits
|
||||
if (fn.length >= 249) {
|
||||
fn = fn.substring(0, 249);
|
||||
}
|
||||
|
||||
//Extension
|
||||
if (quality.toString() == '9') {
|
||||
fn += '.flac';
|
||||
|
@ -54,11 +54,12 @@ class Integrations extends EventEmitter {
|
||||
}
|
||||
|
||||
//LastFM Scrobble
|
||||
async scrobbleLastFM(title, artist) {
|
||||
async scrobbleLastFM(title, album, artist) {
|
||||
if (this.settings.lastFM)
|
||||
this.lastfm.track.scrobble({
|
||||
artist: artist,
|
||||
artist,
|
||||
track: title,
|
||||
album,
|
||||
timestamp: Math.floor((new Date()).getTime() / 1000)
|
||||
});
|
||||
}
|
||||
@ -103,35 +104,39 @@ class Integrations extends EventEmitter {
|
||||
//Called when playback state changed
|
||||
async updateState(data) {
|
||||
if (this.discordReady) {
|
||||
let richPresence = {
|
||||
state: data.track.artistString,
|
||||
details: data.track.title,
|
||||
largeImageKey: 'icon',
|
||||
instance: true,
|
||||
if (data.state == 2){
|
||||
let richPresence = {
|
||||
state: data.track.artistString,
|
||||
details: data.track.title,
|
||||
largeImageKey: 'icon',
|
||||
instance: true,
|
||||
}
|
||||
//Show timestamp only if playing
|
||||
if (data.state == 2) {
|
||||
Object.assign(richPresence, {
|
||||
startTimestamp: Date.now() - data.position,
|
||||
endTimestamp: (Date.now() - data.position) + data.duration,
|
||||
});
|
||||
}
|
||||
//Enabled discord join
|
||||
if (this.settings.discordJoin) {
|
||||
Object.assign(richPresence, {
|
||||
partySize: 1,
|
||||
partyMax: 10,
|
||||
matchSecret: 'match_secret_' + data.track.id,
|
||||
joinSecret: JSON.stringify({
|
||||
pos: Math.floor(data.position),
|
||||
ts: Date.now(),
|
||||
id: data.track.id
|
||||
}),
|
||||
partyId: 'party_id_' + data.track.id
|
||||
});
|
||||
}
|
||||
//Set
|
||||
this.discordRPC.setActivity(richPresence);
|
||||
} else {
|
||||
this.discordRPC.clearActivity();
|
||||
}
|
||||
//Show timestamp only if playing
|
||||
if (data.state == 2) {
|
||||
Object.assign(richPresence, {
|
||||
startTimestamp: Date.now() - data.position,
|
||||
endTimestamp: (Date.now() - data.position) + data.duration,
|
||||
});
|
||||
}
|
||||
//Enabled discord join
|
||||
if (this.settings.discordJoin) {
|
||||
Object.assign(richPresence, {
|
||||
partySize: 1,
|
||||
partyMax: 10,
|
||||
matchSecret: 'match_secret_' + data.track.id,
|
||||
joinSecret: JSON.stringify({
|
||||
pos: Math.floor(data.position),
|
||||
ts: Date.now(),
|
||||
id: data.track.id
|
||||
}),
|
||||
partyId: 'party_id_' + data.track.id
|
||||
});
|
||||
}
|
||||
//Set
|
||||
this.discordRPC.setActivity(richPresence);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -27,8 +27,14 @@ app.use(express.static(path.join(__dirname, '../client', 'dist')));
|
||||
app.use(cors({origin: 'http://localhost:8080'}));
|
||||
//Server
|
||||
const server = require('http').createServer(app);
|
||||
const io = require('socket.io').listen(server, {
|
||||
const { Server } = require('socket.io');
|
||||
const io = new Server(server, {
|
||||
path: '/socket',
|
||||
//CORS for webpack debug
|
||||
cors: {
|
||||
origin: 'http://localhost:8080',
|
||||
methods: ["GET", "POST"],
|
||||
}
|
||||
});
|
||||
|
||||
//Get playback info
|
||||
@ -463,7 +469,7 @@ app.delete('/downloads/:index', async (req, res) => {
|
||||
//Log listen to deezer & lastfm
|
||||
app.post('/log', async (req, res) => {
|
||||
//LastFM
|
||||
integrations.scrobbleLastFM(req.body.title, req.body.artists[0].name);
|
||||
integrations.scrobbleLastFM(req.body.title, req.body.album.title, req.body.artists[0].name);
|
||||
|
||||
//Deezer
|
||||
if (settings.logListen)
|
||||
|
@ -44,6 +44,8 @@ class Settings {
|
||||
this.contentLanguage = 'en';
|
||||
this.contentCountry = 'US';
|
||||
this.sidebarOpen = false;
|
||||
this.lgbtMode = false;
|
||||
this.nativeTopBar = false;
|
||||
|
||||
//Has to be local path
|
||||
this.backgroundImage = null;
|
||||
|
Reference in New Issue
Block a user