Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <!DOCTYPE html>
- <html lang="en">
- <head>
- <meta charset="UTF-8">
- <meta http-equiv="X-UA-Compatible" content="IE=edge">
- <meta name="viewport" content="width=device-width, initial-scale=1.0">
- <title>Currently Playing</title>
- <style>
- body {
- margin: 0;
- padding: 0;
- background-color: transparent;
- font-family: Arial, sans-serif;
- }
- .overlay {
- display: flex;
- align-items: center;
- position: fixed;
- bottom: 15px;
- left: 15px;
- padding: 15px;
- background: linear-gradient(90deg, rgba(0, 0, 0, 0.9), rgba(30, 30, 30, 0.9)); /* Gradient background */
- color: white;
- border-radius: 10px;
- opacity: 0; /* Start hidden for fade-in effect */
- transition: opacity 1s ease-in; /* Fade-in transition */
- }
- .album-art {
- height: 100%; /* Make album artwork match the height of the container */
- max-height: 150px;
- margin-right: 20px;
- border-radius: 5px 0 0 5px; /* Rounded corners on the left side only */
- }
- .song-info {
- display: flex;
- flex-direction: column;
- }
- .song-title {
- font-size: 33px; /* Increased size */
- font-weight: bold;
- margin-bottom: 10px;
- }
- .artist-name {
- font-size: 25px; /* Increased size */
- color: #ddd;
- }
- </style>
- </head>
- <body>
- <div class="overlay" id="overlay">
- <img src="" alt="Album Art" class="album-art" id="albumArt">
- <div class="song-info">
- <div class="song-title" id="songTitle">Loading...</div>
- <div class="artist-name" id="artistName">Loading...</div>
- </div>
- </div>
- <script>
- // Fetch and display currently playing song information
- async function fetchCurrentlyPlayingInfo() {
- try {
- const [artResponse, songResponse, artistResponse] = await Promise.all([
- fetch('http://10.0.10.114:8000/api/custom-variable/currently_playing_art/value'),
- fetch('http://10.0.10.114:8000/api/custom-variable/currently_playing_song/value'),
- fetch('http://10.0.10.114:8000/api/custom-variable/currently_playing_artist/value')
- ]);
- if (!artResponse.ok || !songResponse.ok || !artistResponse.ok) {
- console.error('Error fetching currently playing information');
- return;
- }
- const albumArtUrl = await artResponse.text();
- const songTitle = await songResponse.text();
- const artistName = await artistResponse.text();
- document.getElementById('albumArt').src = albumArtUrl;
- document.getElementById('songTitle').textContent = songTitle;
- document.getElementById('artistName').textContent = artistName;
- // Fade in the overlay after the data is loaded
- document.getElementById('overlay').style.opacity = 1;
- } catch (error) {
- console.error('Error fetching data:', error);
- }
- }
- // Fetch the information every 5 seconds to keep it up to date
- fetchCurrentlyPlayingInfo();
- setInterval(fetchCurrentlyPlayingInfo, 5000);
- </script>
- </body>
- </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement