mirror of
https://github.com/Dvorinka/swingmusic-extended.git
synced 2026-06-04 20:43:04 +00:00
maintain playing track on shuffle (when audio is playing)
This commit is contained in:
@@ -4,9 +4,6 @@
|
|||||||
<NavButtons />
|
<NavButtons />
|
||||||
|
|
||||||
<div
|
<div
|
||||||
:style="{
|
|
||||||
overflowY: hideOverflow() ? 'visible' : 'hidden',
|
|
||||||
}"
|
|
||||||
class="info"
|
class="info"
|
||||||
>
|
>
|
||||||
<APTitle
|
<APTitle
|
||||||
@@ -20,10 +17,6 @@
|
|||||||
<QueueTitle v-if="$route.name == Routes.queue" />
|
<QueueTitle v-if="$route.name == Routes.queue" />
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<!--
|
|
||||||
<div class="center rounded">
|
|
||||||
<Loader />
|
|
||||||
</div> -->
|
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
@@ -39,7 +32,6 @@ import { Routes } from "@/composables/enums";
|
|||||||
import NavButtons from "./NavButtons.vue";
|
import NavButtons from "./NavButtons.vue";
|
||||||
|
|
||||||
import FolderTitle from "./Titles/Folder.vue";
|
import FolderTitle from "./Titles/Folder.vue";
|
||||||
import SimpleTitle from "./Titles/SimpleTitle.vue";
|
|
||||||
import APTitle from "./Titles/APTitle.vue";
|
import APTitle from "./Titles/APTitle.vue";
|
||||||
import SearchTitle from "./Titles/SearchTitle.vue";
|
import SearchTitle from "./Titles/SearchTitle.vue";
|
||||||
import PlaylistsTitle from "./Titles/PlaylistsTitle.vue";
|
import PlaylistsTitle from "./Titles/PlaylistsTitle.vue";
|
||||||
@@ -51,12 +43,6 @@ const nav = useNavStore();
|
|||||||
|
|
||||||
const subPaths = ref<subPath[]>([]);
|
const subPaths = ref<subPath[]>([]);
|
||||||
|
|
||||||
function hideOverflow() {
|
|
||||||
const { name } = route;
|
|
||||||
const { album, playlist, search, folder } = Routes;
|
|
||||||
|
|
||||||
return (album + playlist + search + folder).includes(name as string);
|
|
||||||
}
|
|
||||||
|
|
||||||
watch(
|
watch(
|
||||||
() => route.name,
|
() => route.name,
|
||||||
|
|||||||
@@ -6,7 +6,7 @@
|
|||||||
</router-link>
|
</router-link>
|
||||||
<div class="playing-from">
|
<div class="playing-from">
|
||||||
<div class="border rounded-sm pad-sm">
|
<div class="border rounded-sm pad-sm">
|
||||||
<source-icon />
|
<SourceIcon v-if="SourceIcon" />
|
||||||
<b class="ellip">{{ name }}</b>
|
<b class="ellip">{{ name }}</b>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
+17
-5
@@ -204,15 +204,27 @@ export default defineStore("Queue", {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
const shuffled = shuffle(this.tracklist);
|
const current = this.currenttrack;
|
||||||
this.tracklist = shuffled;
|
const current_hash = current.hash;
|
||||||
|
|
||||||
this.currentindex = 0;
|
this.tracklist = shuffle(this.tracklist);
|
||||||
this.currentid = shuffled[0].trackid;
|
// find current track after shuffle
|
||||||
|
|
||||||
if (this.playing) {
|
if (this.playing) {
|
||||||
this.play(this.currentindex);
|
const newindex = this.tracklist.findIndex(
|
||||||
|
(track) => track.hash === current_hash
|
||||||
|
);
|
||||||
|
|
||||||
|
// remove current track from queue
|
||||||
|
this.tracklist.splice(newindex, 1);
|
||||||
|
// insert current track at beginning of queue
|
||||||
|
this.tracklist.unshift(current);
|
||||||
|
this.currentindex = 0;
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
this.currentindex = 0;
|
||||||
|
this.play(this.currentindex);
|
||||||
},
|
},
|
||||||
removeFromQueue(index: number = 0) {
|
removeFromQueue(index: number = 0) {
|
||||||
this.tracklist.splice(index, 1);
|
this.tracklist.splice(index, 1);
|
||||||
|
|||||||
Reference in New Issue
Block a user