diff --git a/copyparty/web/browser.js b/copyparty/web/browser.js index 5fd44540..51c19d2f 100644 --- a/copyparty/web/browser.js +++ b/copyparty/web/browser.js @@ -278,6 +278,7 @@ var Ls = { "ml_drc": "dynamic range compressor", "mt_loop": "loop/repeat one song\">🔁", + "mt_one": "stop after one song\">1️⃣", "mt_shuf": "shuffle the songs in each folder\">🔀", "mt_aplay": "autoplay if there is a song-ID in the link you clicked to access the server$N$Ndisabling this will also stop the page URL from being updated with song-IDs when playing music, to prevent autoplay if these settings are lost but the URL remains\">a▶", "mt_preload": "start loading the next song near the end for gapless playback\">preload", @@ -295,6 +296,7 @@ var Ls = { "mt_uncache": "clear cache  (try this if your browser cached$Na broken copy of a song so it refuses to play)\">uncache", "mt_mloop": "loop the open folder\">🔁 loop", "mt_mnext": "load the next folder and continue\">📂 next", + "mt_mstop": "stop playback\">⏸ stop", "mt_cflac": "convert flac / wav to opus\">flac", "mt_caac": "convert aac / m4a to opus\">aac", "mt_coth": "convert all others (not mp3) to opus\">oth", @@ -903,6 +905,7 @@ var Ls = { "ml_drc": "compressor (volum-utjevning)", "mt_loop": "spill den samme sangen om og om igjen\">🔁", + "mt_one": "spill kun én sang\">1️⃣", "mt_shuf": "sangene i hver mappe$Nspilles i tilfeldig rekkefølge\">🔀", "mt_aplay": "forsøk å starte avspilling hvis linken du klikket på for å åpne nettsiden inneholder en sang-ID$N$Nhvis denne deaktiveres så vil heller ikke nettside-URLen bli oppdatert med sang-ID'er når musikk spilles, i tilfelle innstillingene skulle gå tapt og nettsiden lastes på ny\">a▶", "mt_preload": "hent ned litt av neste sang i forkant,$Nslik at pausen i overgangen blir mindre\">forles", @@ -920,6 +923,7 @@ var Ls = { "mt_uncache": "prøv denne hvis en sang ikke spiller riktig\">oppfrisk", "mt_mloop": "repeter hele mappen\">🔁 gjenta", "mt_mnext": "hopp til neste mappe og fortsett\">📂 neste", + "mt_mstop": "stopp avspilling\">⏸ stopp", "mt_cflac": "konverter flac / wav-filer til opus\">flac", "mt_caac": "konverter aac / m4a-filer til to opus\">aac", "mt_coth": "konverter alt annet (men ikke mp3) til opus\">andre", @@ -1528,6 +1532,7 @@ var Ls = { "ml_drc": "动态范围压缩器", "mt_loop": "循环播放当前的歌曲\">🔁", //m + "mt_one": "只播放一首歌后停止\">1️⃣", //m "mt_shuf": "在每个文件夹中随机播放歌曲\">🔀", "mt_aplay": "如果链接中有歌曲 ID,则自动播放,禁用此选项将停止在播放音乐时更新页面 URL 中的歌曲 ID,以防止在设置丢失但 URL 保留时自动播放\">自动播放▶", "mt_preload": "在歌曲快结束时开始加载下一首歌,以实现无缝播放\">预加载", @@ -1545,6 +1550,7 @@ var Ls = { "mt_uncache": "清除缓存 $N(如果你的浏览器缓存了一个损坏的歌曲副本而拒绝播放,请尝试此操作)\">uncache", "mt_mloop": "循环打开的文件夹\">🔁 循环", "mt_mnext": "加载下一个文件夹并继续\">📂 下一首", + "mt_mstop": "停止播放\">⏸ 停止", //m "mt_cflac": "将 flac / wav 转换为 opus\">flac", "mt_caac": "将 aac / m4a 转换为 opus\">aac", "mt_coth": "将所有其他(不是 mp3)转换为 opus\">oth", @@ -2366,6 +2372,7 @@ var mpl = (function () { ebi('op_player').innerHTML = ( '

' + L.cl_opts + '

' + '' + ' 1 ? len - pos : 999, full = null; @@ -3687,7 +3699,12 @@ var mpui = (function () { var oi = mp.order.indexOf(mp.au.tid) + 1, evp = get_evpath(); - if (mpl.pb_mode == 'loop' || mp.au.evp != evp || ebi('unsearch')) + if (oi >= mp.order.length && ( + mpl.one || + mpl.pb_mode != 'next' || + mp.au.evp != evp || + ebi('unsearch')) + ) oi = 0; if (oi >= mp.order.length) { @@ -4173,6 +4190,9 @@ function play(tid, is_ev, seek) { } if (tn >= mp.order.length) { + if (mpl.pb_mode == 'stop') + return; + if (mpl.pb_mode == 'loop' || ebi('unsearch')) { tn = 0; } @@ -4257,7 +4277,7 @@ function play(tid, is_ev, seek) { try { mp.nopause(); - mp.au.loop = mpl.loop; + mp.au.loop = mpl.loop && !mpl.one; if (mpl.aplay || is_ev !== -1) mp.au.play(); @@ -4303,6 +4323,8 @@ function scroll2playing() { function evau_end(e) { + if (mpl.one) + return; if (!mpl.loop) return next_song(e); ev(e); diff --git a/scripts/tl.js b/scripts/tl.js index c2e13faf..40ffe8a4 100644 --- a/scripts/tl.js +++ b/scripts/tl.js @@ -364,6 +364,7 @@ var tl_browser = { "ml_drc": "dynamic range compressor", "mt_loop": "loop/repeat one song\">🔁", + "mt_one": "stop after one song\">1️⃣", "mt_shuf": "shuffle the songs in each folder\">🔀", "mt_aplay": "autoplay if there is a song-ID in the link you clicked to access the server$N$Ndisabling this will also stop the page URL from being updated with song-IDs when playing music, to prevent autoplay if these settings are lost but the URL remains\">a▶", "mt_preload": "start loading the next song near the end for gapless playback\">preload", @@ -381,6 +382,7 @@ var tl_browser = { "mt_uncache": "clear cache  (try this if your browser cached$Na broken copy of a song so it refuses to play)\">uncache", "mt_mloop": "loop the open folder\">🔁 loop", "mt_mnext": "load the next folder and continue\">📂 next", + "mt_mstop": "stop playback\">⏸ stop", "mt_cflac": "convert flac / wav to opus\">flac", "mt_caac": "convert aac / m4a to opus\">aac", "mt_coth": "convert all others (not mp3) to opus\">oth",