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&5&z>iBE^#eZPJm^LQ}HL<|r^ps;{TWW?!a
zqkT3FM{$8}QE#SE+lS|m*+vqDe{Krjxk3IsPDz>vKJppL+B%wKQ_T-ft+m(u@KTvZ
zeBwrL$cK-L(6ioTJ}~9R*#m*tE`KtXMDy^2uzHKX9xC%uF#5mxsNhEu{HEDS+qSx=
z)&_LAyt)9bIu4h5j(qvCajN3?2T=3yE_NIGyBH4To>!$kqvT;@Yu?B&aLf$Ryst|v
z2?NaK(FRo9^iDbEWOHZFR@o6LgQ~w}+rfh-_%CnXu@!ORN&QMH53z@|ZtmNrR)Umm
z>lRh?EPYY$l${iM9qVCevZBzU%j22e4><){=`Q;TTF`vB=2~F2IIJ@PhGKKv6E`0D
zDAhb07uB2+IUwJg{l*Sb!z7uNQc{PI7$`q0p5O2*U}$J^71W~v6PoWc^2#q|
z3~Fu(Lf5qkD4uDX5u{I7C8Y>G(I9kW90&ykfpVs6uAv!rTs*U1oO{A2F8Z;wJa7;l
zq}(&P#iU^J$8*2@F}dJk0`|*4B&tn_#O%mA
zg2W40i`_zd6^ZBN8=GY-GaBT_V4-jn=+2IN&J8~++aK_-)mheX;vG&D$?4Dx2N)o}
zbncfHX!RX=vq#%2`Uh9P=tOO)E+WJlTiQ5_ZQ@&u${ZPxy-2XD;W{eYt-5^Y5_zAI|yz8_>VN)4Eds_rFe|e*tJ^3H`6*Y5fn-UkmX+
s3jO7a|H0mWLhdi;{wL)A^2PtoUIf>7Z%UdpJzn}x)U5yCAM*bH05y2IOaK4?
literal 0
HcmV?d00001
diff --git a/xiaomusic/static/tailwind/index.html b/xiaomusic/static/tailwind/index.html
index 917e310..36e8d26 100644
--- a/xiaomusic/static/tailwind/index.html
+++ b/xiaomusic/static/tailwind/index.html
@@ -254,7 +254,8 @@
-
![]()
+
+
@@ -484,7 +485,7 @@
if (window.did === 'web_device') return;
const data = await API.getPlayingStatus(window.did);
-
+
if (data.ret === 'OK') {
isPlaying.value = data.is_playing;
currentTime.value = data.offset || 0;
@@ -785,11 +786,11 @@
// 创建新的音频播放器
const audio = document.createElement('audio');
audio.id = 'audio-player';
-
+
// 设置音频属性
audio.preload = 'auto'; // 预加载
audio.crossOrigin = 'anonymous'; // 允许跨域
-
+
// 添加到文档
document.body.appendChild(audio);
audioPlayer.value = audio;
@@ -799,7 +800,7 @@
console.error('Audio playback error:', e);
const error = e.target.error;
let errorMessage = '播放出错';
-
+
if (error) {
switch (error.code) {
case error.MEDIA_ERR_ABORTED:
@@ -816,7 +817,7 @@
break;
}
}
-
+
showMessage(errorMessage, 'alert-error');
isPlaying.value = false;
});
diff --git a/xiaomusic/static/tailwind/md.js b/xiaomusic/static/tailwind/md.js
index 341135c..2078818 100644
--- a/xiaomusic/static/tailwind/md.js
+++ b/xiaomusic/static/tailwind/md.js
@@ -38,7 +38,7 @@ function startProgressUpdate() {
if (progressInterval) {
clearInterval(progressInterval);
}
-
+
// 每秒更新一次进度条
progressInterval = setInterval(() => {
if (duration > 0) {
@@ -66,18 +66,18 @@ function stopProgressUpdate() {
window.playMusic = function(songName) {
const currentPlaylist = localStorage.getItem("cur_playlist");
console.log(`播放音乐: ${songName}, 播放列表: ${currentPlaylist}`);
-
+
// 检查是否是当前播放的歌曲
const currentPlayingSong = localStorage.getItem("cur_music");
const isCurrentSong = currentPlayingSong === songName;
-
+
if (window.did === 'web_device') {
// Web播放模式
$.get(`/musicinfo?name=${songName}`, function (data, status) {
if (data.ret == "OK") {
if (validHost(data.url)) {
const audio = $("#audio")[0];
-
+
// 如果是同一首歌,切换播放/暂停状态
if (audio.src && audio.src === data.url) {
if (audio.paused) {
@@ -148,25 +148,25 @@ function do_play_music_list(listname, musicname) {
// 更新播放信息
function updatePlayingInfo(songName, isPlaying) {
if (!songName) return;
-
+
// 更新播放栏信息
const displayText = isPlaying ? `【播放中】 ${songName}` : `【暂停中】 ${songName}`;
$("#playering-music").text(displayText);
$("#playering-music-mobile").text(displayText);
-
+
// 更新播放按钮图标
$(".play").text(isPlaying ? "pause_circle_outline" : "play_circle_outline");
-
+
// 更新收藏状态
updateFavoriteStatus(songName);
-
+
// 高亮当前播放的歌曲
highlightPlayingSong(songName, isPlaying);
-
+
// 保存当前播放的歌曲
localStorage.setItem("cur_music", songName);
localStorage.setItem("is_playing", isPlaying);
-
+
// 根据播放状态控制进度条更新
if (isPlaying) {
startProgressUpdate();
@@ -179,10 +179,10 @@ function updatePlayingInfo(songName, isPlaying) {
function highlightPlayingSong(songName, isPlaying) {
// 移除所有歌曲的高亮状态
$(".song-item").removeClass("bg-blue-50 dark:bg-blue-900/20");
-
+
// 重置所有播放按钮为播放图标(只选择播放按钮中的图标)
$(".play-icon").text("play_arrow");
-
+
// 高亮当前歌曲,无论是播放还是暂停状态
$(".song-item").each(function() {
const itemSongName = $(this).find("h3").text();
@@ -249,33 +249,33 @@ function nextTrack() {
function togglePlayMode(isSend = true) {
console.log('切换播放模式...');
-
+
// 从本地存储获取当前播放模式,如果没有则使用默认值2(随机播放)
if (playModeIndex === undefined || playModeIndex === null) {
playModeIndex = parseInt(localStorage.getItem("playModeIndex")) || 2;
}
-
+
// 计算下一个播放模式索引:2 -> 3 -> 4 -> 2
const nextModeIndex = playModeIndex >= 4 ? 2 : playModeIndex + 1;
-
+
// 获取下一个播放模式
const nextMode = playModes[nextModeIndex];
console.log('切换到播放模式:', nextModeIndex, nextMode.cmd);
-
+
// 更新按钮图标和提示文本
const modeBtn = $("#modeBtn");
const modeBtnIcon = modeBtn.find(".material-icons");
const tooltip = modeBtn.find(".tooltip");
-
+
modeBtnIcon.text(nextMode.icon);
tooltip.text(nextMode.cmd);
-
+
// 如果需要发送命令,则发送到设备
if (isSend && window.did !== 'web_device') {
console.log('发送播放模式命令:', nextMode.cmd);
sendcmd(nextMode.cmd);
}
-
+
// 保存新的播放模式到本地存储和全局变量
localStorage.setItem("playModeIndex", nextModeIndex);
playModeIndex = nextModeIndex;
@@ -287,7 +287,7 @@ function addToFavorites() {
const isLiked = favoritelist.includes(currentSong);
const cmd = isLiked ? "取消收藏" : "加入收藏";
-
+
// 发送收藏命令
$.ajax({
type: "POST",
@@ -299,7 +299,7 @@ function addToFavorites() {
}),
success: () => {
console.log(`${cmd}成功: ${currentSong}`);
-
+
// 更新本地收藏列表
if (isLiked) {
// 取消收藏
@@ -312,7 +312,7 @@ function addToFavorites() {
}
$(".favorite").addClass("favorite-active");
}
-
+
// 如果当前在收藏列表页面,刷新列表
if (localStorage.getItem("cur_playlist") === "收藏") {
refresh_music_list();
@@ -390,23 +390,23 @@ $.get("/getsetting", function (data, status) {
if (data.mi_did != null) {
dids = data.mi_did.split(",");
}
-
+
if (did != "web_device" && dids.length > 0 && (did == null || did == "" || !dids.includes(did))) {
did = dids[0];
localStorage.setItem("cur_did", did);
}
window.did = did;
-
+
// 渲染设备按钮
renderDeviceButtons(data.devices, did);
-
+
// 获取音量
$.get(`/getvolume?did=${did}`, function (data, status) {
console.log(data, status, data["volume"]);
$("#volume").val(data.volume);
});
-
+
// 刷新音乐列表
refresh_music_list();
@@ -459,7 +459,7 @@ function _refresh_music_list(callback) {
console.error("未获取到音乐列表数据");
return;
}
-
+
favoritelist = data["收藏"] || [];
// 设置默认播放列表
@@ -521,7 +521,7 @@ function renderSystemPlaylists(data) {
const songs = data[playlist.name] || [];
const count = songs.length;
const isActive = playlist.name === currentPlaylist;
-
+
const button = $(`
`);
-
+
container.append(button);
});
}
@@ -551,35 +551,35 @@ function renderSystemPlaylists(data) {
// 渲染专辑列表
function renderAlbumList(data) {
const container = $("#album-list");
-
+
if (!data || typeof data !== 'object') {
return;
}
-
+
container.empty();
-
+
// 系统预设的播放列表,这些不在专辑列表中显示
const systemPlaylists = [
'收藏', '最近新增', '所有歌曲', '临时搜索列表',
'所有电台', '全部', '下载', '其他'
];
-
+
const currentPlaylist = localStorage.getItem("cur_playlist");
-
+
// 遍历所有播放列表
for (const [listName, songs] of Object.entries(data)) {
// 跳过系统预设列表
if (systemPlaylists.includes(listName)) {
continue;
}
-
+
// 跳过空列表
if (songs.length === 0) {
continue;
}
-
+
const isActive = listName === currentPlaylist;
-
+
const button = $(`
`);
-
+
container.append(button);
}
}
@@ -625,10 +625,10 @@ window.showPlaylist = function(listName) {
// 渲染歌曲列表
const songs = data[listName] || [];
renderSongList(songs);
-
+
// 保存当前播放列表
localStorage.setItem("cur_playlist", listName);
-
+
// 重新渲染系统播放列表和专辑列表以更新高亮状态
renderSystemPlaylists(data);
renderAlbumList(data);
@@ -641,10 +641,10 @@ function refresh_music_list() {
// 刷新列表时清空并临时禁用搜索框
const searchInput = document.getElementById("search-input");
if (!searchInput) {
- console.error("未找到搜索输入框");
+ // console.error("未找到搜索输入框");
return;
}
-
+
const oriPlaceHolder = searchInput.placeholder;
const oriValue = searchInput.value;
const inputEvent = new Event("input", { bubbles: true });
@@ -802,7 +802,7 @@ function handleSearch() {
console.log("搜索输入框不存在");
return;
}
-
+ console.log("触发搜索::!")
searchInput.addEventListener(
"input",
debounce(function () {
@@ -831,18 +831,18 @@ function get_playing_music() {
console.log(data);
if (data.ret == "OK" && data.cur_music) { // 确保cur_music存在
updatePlayingInfo(data.cur_music, data.is_playing);
-
+
// 更新进度条和时间显示
offset = data.offset || 0;
duration = data.duration || 0;
-
+
if (duration > 0) {
// 更新进度条
$("#progress").val((offset / duration) * 100);
// 更新时间显示
$("#current-time").text(formatTime(offset));
$("#duration").text(formatTime(duration));
-
+
// 如果正在播放,启动进度条更新
if (data.is_playing) {
startProgressUpdate();
@@ -856,7 +856,7 @@ function get_playing_music() {
$("#duration").text("00:00");
stopProgressUpdate();
}
-
+
// 更新收藏状态
if (favoritelist.includes(data.cur_music)) {
$(".favorite").addClass("favorite-active");
@@ -906,7 +906,7 @@ window.stopPlay = function() {
sendcmd("停止");
updatePlayingInfo(currentSong, false);
}
-
+
// 重置进度条和时间显示
$("#progress").val(0);
$("#current-time").text("00:00");
@@ -1051,7 +1051,7 @@ function adjustVolume(value) {
audio.volume = value;
localStorage.setItem('volume', value);
}
-
+
// 更新设备音量
if (window.did && window.did !== 'web_device') {
$.ajax({
@@ -1112,7 +1112,7 @@ document.getElementById('volume-slider')?.addEventListener('input', function() {
function renderDeviceButtons(devices, currentDid) {
const container = $("#device-buttons");
container.empty();
-
+
// 切换设备函数
function switchDevice(did) {
// 只有在切换到不同设备时才刷新页面
@@ -1122,7 +1122,7 @@ function renderDeviceButtons(devices, currentDid) {
location.reload();
}
}
-
+
// 添加设备按钮
Object.values(devices).forEach(device => {
const isActive = device.did === currentDid;
@@ -1148,14 +1148,14 @@ function renderDeviceButtons(devices, currentDid) {
${isActive ? 'check' : ''}
`);
-
+
button.click(function() {
switchDevice(device.did);
});
-
+
container.append(button);
});
-
+
// 添加本机播放按钮
const isWebDevice = currentDid === 'web_device';
const webDeviceButton = $(`
@@ -1180,11 +1180,11 @@ function renderDeviceButtons(devices, currentDid) {
${isWebDevice ? 'check' : ''}
`);
-
+
webDeviceButton.click(function() {
switchDevice('web_device');
});
-
+
container.append(webDeviceButton);
}
@@ -1194,7 +1194,7 @@ function showPlaylist(type) {
$('.playlist-button').removeClass('bg-blue-50 dark:bg-blue-900/20');
// 添加当前按钮的活动状态
$(`[data-playlist="${type}"]`).addClass('bg-blue-50 dark:bg-blue-900/20');
-
+
switch(type) {
case 'all':
// 显示所有歌曲
@@ -1268,12 +1268,12 @@ function renderSongList(songs) {