Spaces:
Running
Running
Download index.html from MarcRyan/podwave-pro: direct link, hf CLI and curl.
- Browser
- Download file 36.8 kB
-
https://huggingface.co/spaces/MarcRyan/podwave-pro/resolve/main/index.html
- Command line
-
hf download hf://spaces/MarcRyan/podwave-pro/index.html
-
curl -L -o index.html https://huggingface.co/spaces/MarcRyan/podwave-pro/resolve/main/index.html
36.8 kB
| <html lang="en"> | |
| <head> | |
| <meta charset="UTF-8"> | |
| <meta name="viewport" content="width=device-width, initial-scale=1.0"> | |
| <title>Music Player Dashboard</title> | |
| <script src="https://cdn.tailwindcss.com"></script> | |
| <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.0/css/all.min.css"> | |
| <style> | |
| /* Custom scrollbar */ | |
| .custom-scrollbar::-webkit-scrollbar { | |
| width: 6px; | |
| } | |
| .custom-scrollbar::-webkit-scrollbar-track { | |
| background: #f1f1f1; | |
| border-radius: 10px; | |
| } | |
| .custom-scrollbar::-webkit-scrollbar-thumb { | |
| background: #888; | |
| border-radius: 10px; | |
| } | |
| .custom-scrollbar::-webkit-scrollbar-thumb:hover { | |
| background: #555; | |
| } | |
| /* Waveform animation */ | |
| @keyframes wave { | |
| 0% { height: 5px; } | |
| 50% { height: 20px; } | |
| 100% { height: 5px; } | |
| } | |
| .wave-bar { | |
| animation: wave 1.5s ease infinite; | |
| } | |
| .wave-bar:nth-child(2) { animation-delay: 0.2s; } | |
| .wave-bar:nth-child(3) { animation-delay: 0.4s; } | |
| .wave-bar:nth-child(4) { animation-delay: 0.6s; } | |
| .wave-bar:nth-child(5) { animation-delay: 0.8s; } | |
| /* Card container */ | |
| .card-container { | |
| scroll-snap-type: y mandatory; | |
| height: 100vh; | |
| overflow-y: scroll; | |
| } | |
| .player-card { | |
| scroll-snap-align: start; | |
| margin-bottom: 1rem; | |
| } | |
| /* Playlist item hover effect */ | |
| .playlist-item:hover { | |
| background-color: rgba(124, 58, 237, 0.1); | |
| } | |
| /* Loading spinner */ | |
| .spinner { | |
| animation: spin 1s linear infinite; | |
| } | |
| @keyframes spin { | |
| 0% { transform: rotate(0deg); } | |
| 100% { transform: rotate(360deg); } | |
| } | |
| /* Transition effects */ | |
| .fade-in { | |
| animation: fadeIn 0.3s ease-in; | |
| } | |
| @keyframes fadeIn { | |
| from { opacity: 0; } | |
| to { opacity: 1; } | |
| } | |
| </style> | |
| </head> | |
| <body class="bg-gray-100"> | |
| <div class="card-container"> | |
| <!-- Card 1 --> | |
| <div class="player-card w-full max-w-md mx-auto bg-white rounded-3xl shadow-2xl overflow-hidden my-4"> | |
| <!-- Header --> | |
| <div class="bg-gradient-to-r from-purple-600 to-blue-500 p-6 text-white"> | |
| <div class="flex justify-between items-center"> | |
| <h1 class="text-2xl font-bold">PodWave Pro</h1> | |
| <button class="text-white hover:text-gray-200"> | |
| <i class="fas fa-cog"></i> | |
| </button> | |
| </div> | |
| <p class="text-sm opacity-90 mt-1">Your premium audio experience</p> | |
| </div> | |
| <!-- RSS Input --> | |
| <div class="p-4 border-b"> | |
| <div class="flex items-center"> | |
| <input | |
| type="text" | |
| id="rssInput1" | |
| placeholder="Enter RSS feed URL..." | |
| class="flex-1 px-4 py-2 rounded-l-full border border-gray-300 focus:outline-none focus:ring-2 focus:ring-purple-500" | |
| > | |
| <button | |
| id="fetchBtn1" | |
| class="bg-purple-600 text-white px-4 py-2 rounded-r-full hover:bg-purple-700 transition flex items-center justify-center" | |
| > | |
| <i class="fas fa-rss"></i> | |
| </button> | |
| </div> | |
| <p class="text-xs text-gray-500 mt-1">Example: https://example.com/podcast.rss</p> | |
| </div> | |
| <!-- Player Section --> | |
| <div class="p-6"> | |
| <!-- Now Playing --> | |
| <div class="flex items-center mb-6"> | |
| <div class="w-16 h-16 bg-gradient-to-br from-purple-400 to-blue-400 rounded-lg flex items-center justify-center text-white"> | |
| <i class="fas fa-music text-2xl"></i> | |
| </div> | |
| <div class="ml-4 flex-1"> | |
| <h3 id="nowPlayingTitle1" class="font-semibold text-lg">No track selected</h3> | |
| <p id="nowPlayingAuthor1" class="text-sm text-gray-500">Select from playlist</p> | |
| </div> | |
| </div> | |
| <!-- Progress Bar --> | |
| <div class="mb-4"> | |
| <div class="flex justify-between text-xs text-gray-500 mb-1"> | |
| <span id="currentTime1">0:00</span> | |
| <span id="duration1">0:00</span> | |
| </div> | |
| <div class="h-2 bg-gray-200 rounded-full overflow-hidden"> | |
| <div id="progressBar1" class="h-full bg-purple-600 rounded-full" style="width: 0%"></div> | |
| </div> | |
| </div> | |
| <!-- Controls --> | |
| <div class="flex justify-center items-center space-x-8 mb-6"> | |
| <button class="text-gray-600 hover:text-purple-600"> | |
| <i class="fas fa-step-backward text-2xl"></i> | |
| </button> | |
| <button id="playBtn1" class="bg-purple-600 text-white rounded-full w-12 h-12 flex items-center justify-center hover:bg-purple-700"> | |
| <i class="fas fa-play text-xl"></i> | |
| </button> | |
| <button class="text-gray-600 hover:text-purple-600"> | |
| <i class="fas fa-step-forward text-2xl"></i> | |
| </button> | |
| </div> | |
| <!-- Visualizer (shows when playing) --> | |
| <div id="visualizer1" class="hidden flex justify-center space-x-1 h-8 items-end mb-6"> | |
| <div class="wave-bar w-2 bg-purple-400 rounded-t-sm" style="height: 5px;"></div> | |
| <div class="wave-bar w-2 bg-purple-500 rounded-t-sm" style="height: 10px;"></div> | |
| <div class="wave-bar w-2 bg-purple-600 rounded-t-sm" style="height: 15px;"></div> | |
| <div class="wave-bar w-2 bg-purple-500 rounded-t-sm" style="height: 10px;"></div> | |
| <div class="wave-bar w-2 bg-purple-400 rounded-t-sm" style="height: 5px;"></div> | |
| </div> | |
| <!-- Volume --> | |
| <div class="flex items-center"> | |
| <i class="fas fa-volume-down text-gray-500 mr-2"></i> | |
| <input | |
| type="range" | |
| id="volumeControl1" | |
| min="0" | |
| max="1" | |
| step="0.01" | |
| value="0.7" | |
| class="w-full h-2 bg-gray-200 rounded-lg appearance-none cursor-pointer" | |
| > | |
| <i class="fas fa-volume-up text-gray-500 ml-2"></i> | |
| </div> | |
| </div> | |
| <!-- Playlist Section --> | |
| <div class="border-t"> | |
| <div class="flex justify-between items-center p-4"> | |
| <h2 class="font-semibold text-lg">Your Playlist</h2> | |
| <button id="clearBtn1" class="text-sm text-purple-600 hover:text-purple-800">Clear All</button> | |
| </div> | |
| <div id="playlistContainer1" class="max-h-64 overflow-y-auto custom-scrollbar"> | |
| <div class="text-center py-8 text-gray-500"> | |
| <i class="fas fa-music text-4xl mb-2 opacity-30"></i> | |
| <p>Your saved tracks will appear here</p> | |
| </div> | |
| </div> | |
| <!-- RSS Feed Playlist Section --> | |
| <div id="rssFeedSection1" class="hidden border-t"> | |
| <div class="flex justify-between items-center p-4"> | |
| <h2 class="font-semibold text-lg">RSS Feed Content</h2> | |
| <button id="closeRssBtn1" class="text-sm text-purple-600 hover:text-purple-800">Close</button> | |
| </div> | |
| <div id="rssFeedContainer1" class="max-h-64 overflow-y-auto custom-scrollbar"> | |
| <!-- RSS feed content will be loaded here --> | |
| </div> | |
| <div class="p-4 border-t"> | |
| <button | |
| id="addAllBtn1" | |
| class="w-full bg-gradient-to-r from-purple-600 to-blue-500 text-white py-3 rounded-full font-medium hover:opacity-90 transition" | |
| > | |
| Add All to Playlist | |
| </button> | |
| </div> | |
| </div> | |
| <!-- Save Playlist --> | |
| <div class="p-4 border-t"> | |
| <button | |
| id="saveBtn1" | |
| class="w-full bg-gradient-to-r from-purple-600 to-blue-500 text-white py-3 rounded-full font-medium hover:opacity-90 transition disabled:opacity-50" | |
| disabled | |
| > | |
| Save Playlist | |
| </button> | |
| </div> | |
| </div> | |
| </div> | |
| <!-- Card 2 (Duplicate) --> | |
| <div class="player-card w-full max-w-md mx-auto bg-white rounded-3xl shadow-2xl overflow-hidden my-4"> | |
| <!-- Header --> | |
| <div class="bg-gradient-to-r from-purple-600 to-blue-500 p-6 text-white"> | |
| <div class="flex justify-between items-center"> | |
| <h1 class="text-2xl font-bold">PodWave Pro</h1> | |
| <button class="text-white hover:text-gray-200"> | |
| <i class="fas fa-cog"></i> | |
| </button> | |
| </div> | |
| <p class="text-sm opacity-90 mt-1">Your premium audio experience</p> | |
| </div> | |
| <!-- RSS Input --> | |
| <div class="p-4 border-b"> | |
| <div class="flex items-center"> | |
| <input | |
| type="text" | |
| id="rssInput2" | |
| placeholder="Enter RSS feed URL..." | |
| class="flex-1 px-4 py-2 rounded-l-full border border-gray-300 focus:outline-none focus:ring-2 focus:ring-purple-500" | |
| > | |
| <button | |
| id="fetchBtn2" | |
| class="bg-purple-600 text-white px-4 py-2 rounded-r-full hover:bg-purple-700 transition flex items-center justify-center" | |
| > | |
| <i class="fas fa-rss"></i> | |
| </button> | |
| </div> | |
| <p class="text-xs text-gray-500 mt-1">Example: https://example.com/podcast.rss</p> | |
| </div> | |
| <!-- Player Section --> | |
| <div class="p-6"> | |
| <!-- Now Playing --> | |
| <div class="flex items-center mb-6"> | |
| <div class="w-16 h-16 bg-gradient-to-br from-purple-400 to-blue-400 rounded-lg flex items-center justify-center text-white"> | |
| <i class="fas fa-music text-2xl"></i> | |
| </div> | |
| <div class="ml-4 flex-1"> | |
| <h3 id="nowPlayingTitle2" class="font-semibold text-lg">No track selected</h3> | |
| <p id="nowPlayingAuthor2" class="text-sm text-gray-500">Select from playlist</p> | |
| </div> | |
| </div> | |
| <!-- Progress Bar --> | |
| <div class="mb-4"> | |
| <div class="flex justify-between text-xs text-gray-500 mb-1"> | |
| <span id="currentTime2">0:00</span> | |
| <span id="duration2">0:00</span> | |
| </div> | |
| <div class="h-2 bg-gray-200 rounded-full overflow-hidden"> | |
| <div id="progressBar2" class="h-full bg-purple-600 rounded-full" style="width: 0%"></div> | |
| </div> | |
| </div> | |
| <!-- Controls --> | |
| <div class="flex justify-center items-center space-x-8 mb-6"> | |
| <button class="text-gray-600 hover:text-purple-600"> | |
| <i class="fas fa-step-backward text-2xl"></i> | |
| </button> | |
| <button id="playBtn2" class="bg-purple-600 text-white rounded-full w-12 h-12 flex items-center justify-center hover:bg-purple-700"> | |
| <i class="fas fa-play text-xl"></i> | |
| </button> | |
| <button class="text-gray-600 hover:text-purple-600"> | |
| <i class="fas fa-step-forward text-2xl"></i> | |
| </button> | |
| </div> | |
| <!-- Visualizer (shows when playing) --> | |
| <div id="visualizer2" class="hidden flex justify-center space-x-1 h-8 items-end mb-6"> | |
| <div class="wave-bar w-2 bg-purple-400 rounded-t-sm" style="height: 5px;"></div> | |
| <div class="wave-bar w-2 bg-purple-500 rounded-t-sm" style="height: 10px;"></div> | |
| <div class="wave-bar w-2 bg-purple-600 rounded-t-sm" style="height: 15px;"></div> | |
| <div class="wave-bar w-2 bg-purple-500 rounded-t-sm" style="height: 10px;"></div> | |
| <div class="wave-bar w-2 bg-purple-400 rounded-t-sm" style="height: 5px;"></div> | |
| </div> | |
| <!-- Volume --> | |
| <div class="flex items-center"> | |
| <i class="fas fa-volume-down text-gray-500 mr-2"></i> | |
| <input | |
| type="range" | |
| id="volumeControl2" | |
| min="0" | |
| max="1" | |
| step="0.01" | |
| value="0.7" | |
| class="w-full h-2 bg-gray-200 rounded-lg appearance-none cursor-pointer" | |
| > | |
| <i class="fas fa-volume-up text-gray-500 ml-2"></i> | |
| </div> | |
| </div> | |
| <!-- Playlist Section --> | |
| <div class="border-t"> | |
| <div class="flex justify-between items-center p-4"> | |
| <h2 class="font-semibold text-lg">Your Playlist</h2> | |
| <button id="clearBtn2" class="text-sm text-purple-600 hover:text-purple-800">Clear All</button> | |
| </div> | |
| <div id="playlistContainer2" class="max-h-64 overflow-y-auto custom-scrollbar"> | |
| <div class="text-center py-8 text-gray-500"> | |
| <i class="fas fa-music text-4xl mb-2 opacity-30"></i> | |
| <p>Your saved tracks will appear here</p> | |
| </div> | |
| </div> | |
| <!-- RSS Feed Playlist Section --> | |
| <div id="rssFeedSection2" class="hidden border-t"> | |
| <div class="flex justify-between items-center p-4"> | |
| <h2 class="font-semibold text-lg">RSS Feed Content</h2> | |
| <button id="closeRssBtn2" class="text-sm text-purple-600 hover:text-purple-800">Close</button> | |
| </div> | |
| <div id="rssFeedContainer2" class="max-h-64 overflow-y-auto custom-scrollbar"> | |
| <!-- RSS feed content will be loaded here --> | |
| </div> | |
| <div class="p-4 border-t"> | |
| <button | |
| id="addAllBtn2" | |
| class="w-full bg-gradient-to-r from-purple-600 to-blue-500 text-white py-3 rounded-full font-medium hover:opacity-90 transition" | |
| > | |
| Add All to Playlist | |
| </button> | |
| </div> | |
| </div> | |
| <!-- Save Playlist --> | |
| <div class="p-4 border-t"> | |
| <button | |
| id="saveBtn2" | |
| class="w-full bg-gradient-to-r from-purple-600 to-blue-500 text-white py-3 rounded-full font-medium hover:opacity-90 transition disabled:opacity-50" | |
| disabled | |
| > | |
| Save Playlist | |
| </button> | |
| </div> | |
| </div> | |
| </div> | |
| </div> | |
| <script> | |
| document.addEventListener('DOMContentLoaded', function() { | |
| // Initialize both players | |
| initializePlayer(1); | |
| initializePlayer(2); | |
| function initializePlayer(playerNumber) { | |
| // Audio elements | |
| const audio = new Audio(); | |
| // Player elements | |
| const playBtn = document.getElementById(`playBtn${playerNumber}`); | |
| const progressBar = document.getElementById(`progressBar${playerNumber}`); | |
| const currentTime = document.getElementById(`currentTime${playerNumber}`); | |
| const duration = document.getElementById(`duration${playerNumber}`); | |
| const volumeControl = document.getElementById(`volumeControl${playerNumber}`); | |
| const visualizer = document.getElementById(`visualizer${playerNumber}`); | |
| const playlistContainer = document.getElementById(`playlistContainer${playerNumber}`); | |
| const nowPlayingTitle = document.getElementById(`nowPlayingTitle${playerNumber}`); | |
| const nowPlayingAuthor = document.getElementById(`nowPlayingAuthor${playerNumber}`); | |
| const fetchBtn = document.getElementById(`fetchBtn${playerNumber}`); | |
| const rssInput = document.getElementById(`rssInput${playerNumber}`); | |
| const clearBtn = document.getElementById(`clearBtn${playerNumber}`); | |
| const saveBtn = document.getElementById(`saveBtn${playerNumber}`); | |
| const rssFeedSection = document.getElementById(`rssFeedSection${playerNumber}`); | |
| const rssFeedContainer = document.getElementById(`rssFeedContainer${playerNumber}`); | |
| const closeRssBtn = document.getElementById(`closeRssBtn${playerNumber}`); | |
| const addAllBtn = document.getElementById(`addAllBtn${playerNumber}`); | |
| // Player state | |
| let isPlaying = false; | |
| let currentTrackIndex = -1; | |
| let userPlaylist = []; | |
| let rssPlaylist = []; | |
| // Format time (seconds to MM:SS) | |
| function formatTime(seconds) { | |
| const mins = Math.floor(seconds / 60); | |
| const secs = Math.floor(seconds % 60); | |
| return `${mins}:${secs < 10 ? '0' : ''}${secs}`; | |
| } | |
| // Update progress bar | |
| function updateProgressBar() { | |
| if (audio.duration) { | |
| const progress = (audio.currentTime / audio.duration) * 100; | |
| progressBar.style.width = `${progress}%`; | |
| currentTime.textContent = formatTime(audio.currentTime); | |
| duration.textContent = formatTime(audio.duration); | |
| } | |
| } | |
| // Play/pause toggle | |
| function togglePlayPause() { | |
| if (isPlaying) { | |
| audio.pause(); | |
| playBtn.innerHTML = '<i class="fas fa-play text-xl"></i>'; | |
| visualizer.classList.add('hidden'); | |
| } else { | |
| audio.play() | |
| .then(() => { | |
| playBtn.innerHTML = '<i class="fas fa-pause text-xl"></i>'; | |
| visualizer.classList.remove('hidden'); | |
| }) | |
| .catch(error => { | |
| console.error('Playback failed:', error); | |
| }); | |
| } | |
| isPlaying = !isPlaying; | |
| } | |
| // Update player info | |
| function updatePlayerInfo(track) { | |
| nowPlayingTitle.textContent = track.title || 'Unknown Track'; | |
| nowPlayingAuthor.textContent = track.author || 'Unknown Author'; | |
| } | |
| // Play track | |
| function playTrack(track, index) { | |
| currentTrackIndex = index; | |
| audio.src = track.enclosure.url; | |
| audio.load(); | |
| updatePlayerInfo(track); | |
| audio.onloadedmetadata = function() { | |
| audio.play() | |
| .then(() => { | |
| isPlaying = true; | |
| playBtn.innerHTML = '<i class="fas fa-pause text-xl"></i>'; | |
| visualizer.classList.remove('hidden'); | |
| }) | |
| .catch(error => { | |
| console.error('Playback failed:', error); | |
| }); | |
| }; | |
| } | |
| // Create playlist item | |
| function createPlaylistItem(track, index, container, isRssItem = false) { | |
| const item = document.createElement('div'); | |
| item.className = `playlist-item flex items-center p-3 border-b cursor-pointer transition ${isRssItem ? 'bg-gray-50' : ''}`; | |
| item.dataset.index = index; | |
| const icon = document.createElement('div'); | |
| icon.className = 'w-10 h-10 bg-gradient-to-br from-purple-100 to-blue-100 rounded-lg flex items-center justify-center text-purple-600 mr-3'; | |
| icon.innerHTML = '<i class="fas fa-music"></i>'; | |
| const info = document.createElement('div'); | |
| info.className = 'flex-1 min-w-0'; | |
| const title = document.createElement('h4'); | |
| title.className = 'font-medium truncate'; | |
| title.textContent = track.title || 'Unknown Track'; | |
| const author = document.createElement('p'); | |
| author.className = 'text-xs text-gray-500 truncate'; | |
| author.textContent = track.author || 'Unknown Author'; | |
| info.appendChild(title); | |
| info.appendChild(author); | |
| const duration = document.createElement('span'); | |
| duration.className = 'text-xs text-gray-500 ml-2'; | |
| duration.textContent = track.duration ? formatTime(track.duration) : '--:--'; | |
| const addBtn = document.createElement('button'); | |
| addBtn.className = 'ml-2 text-purple-600 hover:text-purple-800'; | |
| addBtn.innerHTML = isRssItem ? '<i class="fas fa-plus"></i>' : '<i class="fas fa-trash-alt"></i>'; | |
| addBtn.onclick = function(e) { | |
| e.stopPropagation(); | |
| if (isRssItem) { | |
| addToPlaylist(track); | |
| } else { | |
| removeFromPlaylist(index); | |
| } | |
| }; | |
| item.appendChild(icon); | |
| item.appendChild(info); | |
| item.appendChild(duration); | |
| item.appendChild(addBtn); | |
| item.onclick = function() { | |
| if (isRssItem) { | |
| playTrack(track, index); | |
| } else { | |
| playTrack(track, index); | |
| } | |
| }; | |
| container.appendChild(item); | |
| } | |
| // Add to playlist | |
| function addToPlaylist(track) { | |
| userPlaylist.push(track); | |
| renderUserPlaylist(); | |
| saveBtn.disabled = false; | |
| // Show success feedback | |
| const feedback = document.createElement('div'); | |
| feedback.className = 'fixed bottom-4 right-4 bg-green-500 text-white px-4 py-2 rounded-lg shadow-lg fade-in'; | |
| feedback.textContent = 'Added to playlist!'; | |
| document.body.appendChild(feedback); | |
| setTimeout(() => { | |
| feedback.classList.add('opacity-0'); | |
| setTimeout(() => feedback.remove(), 300); | |
| }, 2000); | |
| } | |
| // Remove from playlist | |
| function removeFromPlaylist(index) { | |
| userPlaylist.splice(index, 1); | |
| renderUserPlaylist(); | |
| if (userPlaylist.length === 0) { | |
| saveBtn.disabled = true; | |
| } | |
| } | |
| // Render user playlist | |
| function renderUserPlaylist() { | |
| playlistContainer.innerHTML = ''; | |
| if (userPlaylist.length === 0) { | |
| const emptyState = document.createElement('div'); | |
| emptyState.className = 'text-center py-8 text-gray-500'; | |
| emptyState.innerHTML = ` | |
| <i class="fas fa-music text-4xl mb-2 opacity-30"></i> | |
| <p>Your saved tracks will appear here</p> | |
| `; | |
| playlistContainer.appendChild(emptyState); | |
| } else { | |
| userPlaylist.forEach((track, index) => { | |
| createPlaylistItem(track, index, playlistContainer); | |
| }); | |
| } | |
| } | |
| // Render RSS feed playlist | |
| function renderRssPlaylist() { | |
| rssFeedContainer.innerHTML = ''; | |
| if (rssPlaylist.length === 0) { | |
| const emptyState = document.createElement('div'); | |
| emptyState.className = 'text-center py-8 text-gray-500'; | |
| emptyState.innerHTML = ` | |
| <i class="fas fa-rss text-4xl mb-2 opacity-30"></i> | |
| <p>No episodes found in this feed</p> | |
| `; | |
| rssFeedContainer.appendChild(emptyState); | |
| } else { | |
| rssPlaylist.forEach((track, index) => { | |
| createPlaylistItem(track, index, rssFeedContainer, true); | |
| }); | |
| } | |
| } | |
| // Fetch RSS feed | |
| async function fetchRssFeed(url) { | |
| try { | |
| // Show loading state | |
| fetchBtn.innerHTML = '<i class="fas fa-spinner spinner"></i>'; | |
| fetchBtn.disabled = true; | |
| // Use a CORS proxy to avoid issues | |
| const proxyUrl = 'https://api.allorigins.win/get?url='; | |
| const response = await fetch(proxyUrl + encodeURIComponent(url)); | |
| const data = await response.json(); | |
| if (data.contents) { | |
| const parser = new DOMParser(); | |
| const xmlDoc = parser.parseFromString(data.contents, "text/xml"); | |
| // Parse RSS feed | |
| const items = xmlDoc.querySelectorAll('item'); | |
| rssPlaylist = []; | |
| items.forEach(item => { | |
| const title = item.querySelector('title')?.textContent || 'Untitled Episode'; | |
| const author = item.querySelector('author')?.textContent || | |
| item.querySelector('itunes\\:author, author')?.textContent || | |
| 'Unknown Author'; | |
| const enclosure = item.querySelector('enclosure'); | |
| const durationText = item.querySelector('itunes\\:duration')?.textContent || ''; | |
| // Parse duration (HH:MM:SS or MM:SS or SS) | |
| let duration = 0; | |
| if (durationText) { | |
| const parts = durationText.split(':').reverse(); | |
| if (parts.length >= 1) duration += parseInt(parts[0]) || 0; // seconds | |
| if (parts.length >= 2) duration += (parseInt(parts[1]) || 0) * 60; // minutes | |
| if (parts.length >= 3) duration += (parseInt(parts[2]) || 0) * 3600; // hours | |
| } | |
| if (enclosure) { | |
| rssPlaylist.push({ | |
| title, | |
| author, | |
| enclosure: { | |
| url: enclosure.getAttribute('url'), | |
| type: enclosure.getAttribute('type') | |
| }, | |
| duration | |
| }); | |
| } | |
| }); | |
| // Show RSS feed section | |
| rssFeedSection.classList.remove('hidden'); | |
| renderRssPlaylist(); | |
| // Scroll to RSS section | |
| setTimeout(() => { | |
| rssFeedSection.scrollIntoView({ behavior: 'smooth' }); | |
| }, 100); | |
| } else { | |
| throw new Error('Invalid RSS feed'); | |
| } | |
| } catch (error) { | |
| console.error('Error fetching RSS feed:', error); | |
| // Show error feedback | |
| const feedback = document.createElement('div'); | |
| feedback.className = 'fixed bottom-4 right-4 bg-red-500 text-white px-4 py-2 rounded-lg shadow-lg fade-in'; | |
| feedback.textContent = 'Failed to load RSS feed'; | |
| document.body.appendChild(feedback); | |
| setTimeout(() => { | |
| feedback.classList.add('opacity-0'); | |
| setTimeout(() => feedback.remove(), 300); | |
| }, 2000); | |
| } finally { | |
| // Reset button state | |
| fetchBtn.innerHTML = '<i class="fas fa-rss"></i>'; | |
| fetchBtn.disabled = false; | |
| } | |
| } | |
| // Event listeners | |
| playBtn.addEventListener('click', togglePlayPause); | |
| volumeControl.addEventListener('input', function() { | |
| audio.volume = this.value; | |
| }); | |
| audio.addEventListener('timeupdate', updateProgressBar); | |
| audio.addEventListener('ended', function() { | |
| isPlaying = false; | |
| playBtn.innerHTML = '<i class="fas fa-play text-xl"></i>'; | |
| visualizer.classList.add('hidden'); | |
| }); | |
| progressBar.parentElement.addEventListener('click', function(e) { | |
| const rect = this.getBoundingClientRect(); | |
| const pos = (e.clientX - rect.left) / rect.width; | |
| audio.currentTime = pos * audio.duration; | |
| }); | |
| fetchBtn.addEventListener('click', function() { | |
| const url = rssInput.value.trim(); | |
| if (url) { | |
| fetchRssFeed(url); | |
| } | |
| }); | |
| rssInput.addEventListener('keypress', function(e) { | |
| if (e.key === 'Enter') { | |
| fetchBtn.click(); | |
| } | |
| }); | |
| clearBtn.addEventListener('click', function() { | |
| userPlaylist = []; | |
| renderUserPlaylist(); | |
| saveBtn.disabled = true; | |
| }); | |
| closeRssBtn.addEventListener('click', function() { | |
| rssFeedSection.classList.add('hidden'); | |
| }); | |
| addAllBtn.addEventListener('click', function() { | |
| rssPlaylist.forEach(track => { | |
| userPlaylist.push(track); | |
| }); | |
| renderUserPlaylist(); | |
| saveBtn.disabled = false; | |
| // Show success feedback | |
| const feedback = document.createElement('div'); | |
| feedback.className = 'fixed bottom-4 right-4 bg-green-500 text-white px-4 py-2 rounded-lg shadow-lg fade-in'; | |
| feedback.textContent = `Added ${rssPlaylist.length} tracks to playlist!`; | |
| document.body.appendChild(feedback); | |
| setTimeout(() => { | |
| feedback.classList.add('opacity-0'); | |
| setTimeout(() => feedback.remove(), 300); | |
| }, 2000); | |
| }); | |
| saveBtn.addEventListener('click', function() { | |
| // In a real app, you would save to a database or localStorage | |
| // For now, we'll just show a success message | |
| const feedback = document.createElement('div'); | |
| feedback.className = 'fixed bottom-4 right-4 bg-green-500 text-white px-4 py-2 rounded-lg shadow-lg fade-in'; | |
| feedback.textContent = 'Playlist saved successfully!'; | |
| document.body.appendChild(feedback); | |
| setTimeout(() => { | |
| feedback.classList.add('opacity-0'); | |
| setTimeout(() => feedback.remove(), 300); | |
| }, 2000); | |
| }); | |
| // Initialize | |
| renderUserPlaylist(); | |
| } | |
| }); | |
| </script> | |
| <p style="border-radius: 8px; text-align: center; font-size: 12px; color: #fff; margin-top: 16px;position: fixed; left: 8px; bottom: 8px; z-index: 10; background: rgba(0, 0, 0, 0.8); padding: 4px 8px;">Made with <img src="https://enzostvs-deepsite.hf.space/logo.svg" alt="DeepSite Logo" style="width: 16px; height: 16px; vertical-align: middle;display:inline-block;margin-right:3px;filter:brightness(0) invert(1);"><a href="https://enzostvs-deepsite.hf.space" style="color: #fff;text-decoration: underline;" target="_blank" >DeepSite</a> - 🧬 <a href="https://enzostvs-deepsite.hf.space?remix=MarcRyan/podwave-pro" style="color: #fff;text-decoration: underline;" target="_blank" >Remix</a></p></body> | |
| </html> |