@@ -1 +1 @@
|
|||||||
{"token": "240507dc1c1d721b422f329d191594415da1e4aec72fa0405c547e", "expiration_time": 1715112558}
|
{"token": "240425a54f5df91735a14b241dcfb1e5df28f942d95b9cad8ea6a4", "expiration_time": 1714086845}
|
||||||
@@ -104,7 +104,6 @@ def appdata():
|
|||||||
currently_playing = requests.get("https://api.spotify.com/v1/me/player/currently-playing", headers=user_headers)
|
currently_playing = requests.get("https://api.spotify.com/v1/me/player/currently-playing", headers=user_headers)
|
||||||
|
|
||||||
if currently_playing.content:
|
if currently_playing.content:
|
||||||
if "is_playing" in currently_playing.json():
|
|
||||||
if currently_playing.json()["is_playing"] is True and currently_playing.json()["item"]["id"] == request.args.get('id'):
|
if currently_playing.json()["is_playing"] is True and currently_playing.json()["item"]["id"] == request.args.get('id'):
|
||||||
print("QUICK" + str(time.time() - stime))
|
print("QUICK" + str(time.time() - stime))
|
||||||
return { 'progress_ms': currently_playing.json()["progress_ms"],
|
return { 'progress_ms': currently_playing.json()["progress_ms"],
|
||||||
@@ -121,7 +120,7 @@ def appdata():
|
|||||||
'duration_ms': currently_playing.json()["item"]["duration_ms"],
|
'duration_ms': currently_playing.json()["item"]["duration_ms"],
|
||||||
'is_liked': requests.get("https://api.spotify.com/v1/me/tracks/contains?ids=" + currently_playing.json()["item"]["id"], headers=user_headers).json()[0],
|
'is_liked': requests.get("https://api.spotify.com/v1/me/tracks/contains?ids=" + currently_playing.json()["item"]["id"], headers=user_headers).json()[0],
|
||||||
'canvas': False,
|
'canvas': False,
|
||||||
'gofetch': 'fetch'
|
'fetchlyrics': 'fetch'
|
||||||
}
|
}
|
||||||
elif currently_playing.json()["is_playing"] is False:
|
elif currently_playing.json()["is_playing"] is False:
|
||||||
return { 'is_playing': False
|
return { 'is_playing': False
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
<!DOCTYPE html>
|
<!DOCTYPE html>
|
||||||
<html lang="en">
|
<html lang="en" style="cursor: none;">
|
||||||
<head>
|
<head>
|
||||||
<meta charset="UTF-8">
|
<meta charset="UTF-8">
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||||
@@ -7,18 +7,6 @@
|
|||||||
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.5.1/jquery.min.js"></script>
|
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.5.1/jquery.min.js"></script>
|
||||||
<script src="https://cdnjs.cloudflare.com/ajax/libs/color-thief/2.3.0/color-thief.umd.js"></script>
|
<script src="https://cdnjs.cloudflare.com/ajax/libs/color-thief/2.3.0/color-thief.umd.js"></script>
|
||||||
<style>
|
<style>
|
||||||
.animated-background {
|
|
||||||
transition: background-color 1s ease-in-out; /* add a transition effect */
|
|
||||||
background-color: #fff; /* initial background color */
|
|
||||||
}
|
|
||||||
.animated-background.update-color {
|
|
||||||
background-color: var(--color); /* change the background color to black */
|
|
||||||
}
|
|
||||||
@keyframes fade-in {
|
|
||||||
to {
|
|
||||||
background-color: var(--color); /* change the background color to black */
|
|
||||||
}
|
|
||||||
}
|
|
||||||
.progress-container {
|
.progress-container {
|
||||||
position: fixed;
|
position: fixed;
|
||||||
bottom: 8px;
|
bottom: 8px;
|
||||||
@@ -93,7 +81,7 @@
|
|||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
</head>
|
</head>
|
||||||
<body class="animated-background">
|
<body>
|
||||||
<!-- <link href="http://127.0.0.1:8888/font" rel="stylesheet"> -->
|
<!-- <link href="http://127.0.0.1:8888/font" rel="stylesheet"> -->
|
||||||
<div class="total">
|
<div class="total">
|
||||||
<div class="left">
|
<div class="left">
|
||||||
@@ -186,10 +174,8 @@
|
|||||||
document.getElementById('canvas_url').style.display = "none";
|
document.getElementById('canvas_url').style.display = "none";
|
||||||
document.getElementById('image').style.display = "flex";
|
document.getElementById('image').style.display = "flex";
|
||||||
}
|
}
|
||||||
if (data['gofetch'] !== undefined) {
|
|
||||||
getColors(data['image'])
|
getColors(data['image'])
|
||||||
}
|
getLyrics(data['name'], data['artist'], data['progress_ms'], data['fetchlyrics'])
|
||||||
getLyrics(data['name'], data['artist'], data['progress_ms'], data['gofetch'])
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@@ -214,8 +200,8 @@
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
function getLyrics(name, artist, progress_ms, gofetch) {
|
function getLyrics(name, artist, progress_ms, fetchlyrics) {
|
||||||
if (lyrics == undefined || gofetch !== undefined && name !== undefined) {
|
if (lyrics == undefined || fetchlyrics !== undefined && name !== undefined) {
|
||||||
$('#lyric').text('');
|
$('#lyric').text('');
|
||||||
$.ajax({
|
$.ajax({
|
||||||
url: '/lyrics',
|
url: '/lyrics',
|
||||||
@@ -243,21 +229,15 @@
|
|||||||
const colorThief = new ColorThief();
|
const colorThief = new ColorThief();
|
||||||
const img = document.getElementById('image');
|
const img = document.getElementById('image');
|
||||||
img.crossOrigin = 'Anonymous';
|
img.crossOrigin = 'Anonymous';
|
||||||
animatedBackground = document.querySelector('.animated-background');
|
|
||||||
|
|
||||||
if (img.complete) {
|
if (img.complete) {
|
||||||
const color = colorThief.getColor(img);
|
const color = colorThief.getColor(img);
|
||||||
// document.body.style.backgroundColor = 'rgb(' + color + ')';
|
document.body.style.backgroundColor = 'rgb(' + color + ')';
|
||||||
// document.body.style.backgroundColor = 'rgb(' + color + ')';
|
|
||||||
animatedBackground.style.setProperty('--color', 'rgb(' + color + ')');
|
|
||||||
animatedBackground.classList.add('update-color');
|
|
||||||
getLuminance(color);
|
getLuminance(color);
|
||||||
} else {
|
} else {
|
||||||
img.addEventListener('load', function() {
|
img.addEventListener('load', function() {
|
||||||
const color = colorThief.getColor(img);
|
const color = colorThief.getColor(img);
|
||||||
// document.body.style.backgroundColor = 'rgb(' + color + ')';
|
document.body.style.backgroundColor = 'rgb(' + color + ')';
|
||||||
animatedBackground.style.setProperty('--color', 'rgb(' + color + ')');
|
|
||||||
animatedBackground.classList.add('update-color');
|
|
||||||
getLuminance(color);
|
getLuminance(color);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user