Revert "revert 49cd2b87355a0031b1376f1842d894c19f0f0d67"
This reverts commit d3a4e97180.
redoing previous revert
This commit is contained in:
@@ -1 +1,5 @@
|
|||||||
|
<<<<<<< HEAD
|
||||||
{"token": "240508682dd31a29b369cb3e363b37522b3f583074e0a18384854b", "expiration_time": 1715204997}
|
{"token": "240508682dd31a29b369cb3e363b37522b3f583074e0a18384854b", "expiration_time": 1715204997}
|
||||||
|
=======
|
||||||
|
{"token": "240507dc1c1d721b422f329d191594415da1e4aec72fa0405c547e", "expiration_time": 1715112558}
|
||||||
|
>>>>>>> parent of d3a4e97 (revert 49cd2b87355a0031b1376f1842d894c19f0f0d67)
|
||||||
|
|||||||
@@ -105,6 +105,7 @@ def appdata():
|
|||||||
|
|
||||||
# needs to add an if statement that says if song is not playing then, becuase when nothing is playing the json response is different.
|
# needs to add an if statement that says if song is not playing then, becuase when nothing is playing the json response is different.
|
||||||
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 +122,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,
|
||||||
'fetchlyrics': 'fetch'
|
'gofetch': '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" style="cursor: none;">
|
<html lang="en">
|
||||||
<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,19 +7,17 @@
|
|||||||
<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>
|
||||||
:root {
|
.animated-background {
|
||||||
--start-color: #d734e9;
|
transition: background-color 1s ease-in-out; /* add a transition effect */
|
||||||
--end-color: #FFFFFF;
|
background-color: #fff; /* initial background color */
|
||||||
}
|
}
|
||||||
@keyframes bg-fade {
|
.animated-background.update-color {
|
||||||
from { background-color: var(--start-color); }
|
background-color: var(--color); /* change the background color to black */
|
||||||
to { background-color: var(--end-color); }
|
|
||||||
}
|
}
|
||||||
body {
|
@keyframes fade-in {
|
||||||
background-color: #d734e9
|
to {
|
||||||
|
background-color: var(--color); /* change the background color to black */
|
||||||
}
|
}
|
||||||
.animateBackground {
|
|
||||||
animation: bg-fade 4s;
|
|
||||||
}
|
}
|
||||||
.progress-container {
|
.progress-container {
|
||||||
position: fixed;
|
position: fixed;
|
||||||
@@ -95,7 +93,7 @@
|
|||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body class="animated-background">
|
||||||
<!-- <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">
|
||||||
@@ -188,8 +186,10 @@
|
|||||||
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 +214,8 @@
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
function getLyrics(name, artist, progress_ms, fetchlyrics) {
|
function getLyrics(name, artist, progress_ms, gofetch) {
|
||||||
if (lyrics == undefined || fetchlyrics !== undefined && name !== undefined) {
|
if (lyrics == undefined || gofetch !== undefined && name !== undefined) {
|
||||||
$('#lyric').text('');
|
$('#lyric').text('');
|
||||||
$.ajax({
|
$.ajax({
|
||||||
url: '/lyrics',
|
url: '/lyrics',
|
||||||
@@ -243,7 +243,7 @@
|
|||||||
const colorThief = new ColorThief();
|
const colorThief = new ColorThief();
|
||||||
const img = document.getElementById('image');
|
const img = document.getElementById('image');
|
||||||
img.crossOrigin = 'Anonymous';
|
img.crossOrigin = 'Anonymous';
|
||||||
//set property:
|
animatedBackground = document.querySelector('.animated-background');
|
||||||
|
|
||||||
document.documentElement.style
|
document.documentElement.style
|
||||||
.setProperty('--my-variable-name', '100px');
|
.setProperty('--my-variable-name', '100px');
|
||||||
@@ -254,26 +254,17 @@ getComputedStyle(document.documentElement)
|
|||||||
.getPropertyValue('--my-variable-name'); // returns value
|
.getPropertyValue('--my-variable-name'); // returns value
|
||||||
if (img.complete) {
|
if (img.complete) {
|
||||||
const color = colorThief.getColor(img);
|
const color = colorThief.getColor(img);
|
||||||
oldColor = getComputedStyle(document.documentElement)
|
|
||||||
.getPropertyValue('--end-color');
|
|
||||||
document.documentElement.style
|
|
||||||
.setProperty('--start-color', oldColor);
|
|
||||||
document.documentElement.style
|
|
||||||
.setProperty('--end-color', color);
|
|
||||||
document.body.classList.add('animateBackground');
|
|
||||||
// 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);
|
||||||
oldColor = getComputedStyle(document.documentElement)
|
|
||||||
.getPropertyValue('--end-color');
|
|
||||||
document.documentElement.style
|
|
||||||
.setProperty('--start-color', oldColor);
|
|
||||||
document.documentElement.style
|
|
||||||
.setProperty('--end-color', color);
|
|
||||||
document.body.classList.add('animateBackground');
|
|
||||||
// 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