Skip to content

Commit

Permalink
Advanced Listening Parties Testing
Browse files Browse the repository at this point in the history
  • Loading branch information
Ascensionist committed Aug 1, 2024
1 parent 289ca67 commit d1081aa
Show file tree
Hide file tree
Showing 25 changed files with 962 additions and 22 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
https://fund.saturn.kim/

# Featuring:
- [Listening Parties (Clubs)](https://clubs.saturn.kim)
- FLAC & MP3 320 support
- BYO Last.fm Integration (Safer solution!)
- Discord Listen Together & RPC
Expand Down
2 changes: 1 addition & 1 deletion app/client/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "client",
"version": "1.0.6",
"version": "1.1.0",
"private": true,
"scripts": {
"serve": "vue-cli-service serve",
Expand Down
21 changes: 21 additions & 0 deletions app/client/src/App.vue
Original file line number Diff line number Diff line change
Expand Up @@ -144,6 +144,14 @@
<v-list-item-title>{{$t('About')}}</v-list-item-title>
</v-list-item>

<!-- Rooms -->
<v-list-item link to='/rooms' v-if='isUp()'>
<v-list-item-icon>
<v-icon>mdi-earth</v-icon>
</v-list-item-icon>
<v-list-item-title>Clubs</v-list-item-title>
</v-list-item>

</v-list>
</v-navigation-drawer>

Expand Down Expand Up @@ -227,6 +235,7 @@

<!-- Controls -->
<v-col class='text-center' cols='12' sm='auto'>
<div v-if='$rooms.allowControls()'>
<v-btn icon large @click.stop='$root.skip(-1)'>
<v-icon>mdi-skip-previous</v-icon>
</v-btn>
Expand All @@ -237,6 +246,7 @@
<v-btn icon large @click.stop='$root.skipNext'>
<v-icon>mdi-skip-next</v-icon>
</v-btn>
</div>
</v-col>


Expand Down Expand Up @@ -346,6 +356,7 @@

<script>
import FullscreenPlayer from '@/views/FullscreenPlayer.vue';
import axios from 'axios';
export default {
name: 'App',
Expand Down Expand Up @@ -375,6 +386,15 @@ export default {
if (this.showPlayer) this.showPlayer = false;
this.volume = this.$root.volume;
},
async isUp() { // do not show button if site is down because consistency
await axios.get('https://clubs.saturn.kim/a')
.catch(function (error) {
if (error.response) {
if (error.response.status == 404) { return true; } // index doesnt exist so this actually makes sense
else { return false; }
}
});
},
//Navigation
previous() {
if (window.history.length == 3) return;
Expand Down Expand Up @@ -440,6 +460,7 @@ export default {
}
},
seek(val) {
if (!this.$rooms.allowControls()) return;
this.$root.seek(Math.round((val / 100) * this.$root.duration()));
},
async exitApp() {
Expand Down
4 changes: 2 additions & 2 deletions app/client/src/components/AlbumContext.vue
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<template>
<v-list dense>
<!-- Play album -->
<v-list-item dense @click='$emit("play")'>
<v-list-item dense @click='$emit("play")' v-if='!$rooms.room'>
<v-list-item-icon>
<v-icon>mdi-play</v-icon>
</v-list-item-icon>
Expand All @@ -10,7 +10,7 @@
</v-list-item-content>
</v-list-item>
<!-- Add to queue -->
<v-list-item dense @click='$emit("addQueue")'>
<v-list-item dense @click='$emit("addQueue")' v-if='!$rooms.room'>
<v-list-item-icon>
<v-icon>mdi-playlist-plus</v-icon>
</v-list-item-icon>
Expand Down
6 changes: 6 additions & 0 deletions app/client/src/components/AlbumTile.vue
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,9 @@ export default {
});
},
async play() {
//Rooms
if (!this.$rooms.allowControls()) return;
let album = this.album;
//Load album from API if tracks are missing
if (album.tracks.length == 0) {
Expand All @@ -139,6 +142,9 @@ export default {
},
//Add to queue
async addQueue() {
//Rooms
if (!this.$rooms.allowControls()) return;
let album = this.album;
//Load album from API if tracks are missing
if (album.tracks.length == 0) {
Expand Down
3 changes: 3 additions & 0 deletions app/client/src/components/LibraryHistory.vue
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,9 @@ export default {
},
//Load as queue and play
play(index) {
//Rooms
if (this.$rooms.room) return;
this.$root.queue.source = {
text: this.$t('History'),
source: 'history',
Expand Down
3 changes: 3 additions & 0 deletions app/client/src/components/LibraryTracks.vue
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,9 @@ export default {
},
//Play track
async play(id) {
//Rooms
if (this.$rooms.room) return;
this.$root.queue.source = {
text: 'Loved tracks',
source: 'playlist',
Expand Down
3 changes: 3 additions & 0 deletions app/client/src/components/Lyrics.vue
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,9 @@ export default {
},
//Seek to lyric in song
seekTo(i) {
//Rooms
if (!this.$rooms.allowControls()) return;
this.$root.seek(this.lyrics.lyrics[i].offset);
}
},
Expand Down
4 changes: 3 additions & 1 deletion app/client/src/components/PlaylistTile.vue
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
</template>
<v-list dense>
<!-- Play -->
<v-list-item dense @click='play'>
<v-list-item dense @click='play' v-if='!$rooms.room'>
<v-list-item-icon>
<v-icon>mdi-play</v-icon>
</v-list-item-icon>
Expand Down Expand Up @@ -134,6 +134,8 @@ export default {
},
methods: {
async play() {
if (this.$rooms.room) return;
let playlist = this.playlist;
//Load if no tracks
if (!playlist || playlist.tracks.length == 0)
Expand Down
4 changes: 4 additions & 0 deletions app/client/src/components/SmartTrackList.vue
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,10 @@ export default {
methods: {
//Load stt as source
async play() {
//Rooms
if (this.$rooms.room) return;
this.loading = true;
//Load data
Expand Down
25 changes: 22 additions & 3 deletions app/client/src/components/TrackTile.vue
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@
</template>
<v-list dense>
<!-- Play Next -->
<v-list-item dense @click='playNext'>
<v-list-item dense @click='playNext' v-if='$rooms.allowControls()'>
<v-list-item-icon>
<v-icon>mdi-playlist-plus</v-icon>
</v-list-item-icon>
Expand All @@ -53,14 +53,23 @@
</v-list-item-content>
</v-list-item>
<!-- Add to end of queue -->
<v-list-item dense @click='addQueue'>
<v-list-item dense @click='addQueue' v-if='$rooms.allowControls()'>
<v-list-item-icon>
<v-icon>mdi-playlist-plus</v-icon>
</v-list-item-icon>
<v-list-item-content>
<v-list-item-title>{{$t("Add to queue")}}</v-list-item-title>
</v-list-item-content>
</v-list-item>
<!-- Request song (Rooms) -->
<v-list-item dense @click='$rooms.request(track)' v-if='$rooms.room && !$rooms.allowControls()'>
<v-list-item-icon>
<v-icon>mdi-playlist-plus</v-icon>
</v-list-item-icon>
<v-list-item-content>
<v-list-item-title>Request song in room</v-list-item-title>
</v-list-item-content>
</v-list-item>
<!-- Add to library -->
<v-list-item dense @click='addLibrary' v-if='!isLibrary'>
<v-list-item-icon>
Expand Down Expand Up @@ -107,7 +116,7 @@
</v-list-item-content>
</v-list-item>
<!-- Play track mix -->
<v-list-item dense @click='trackMix'>
<v-list-item dense @click='trackMix' v-if='!$rooms.room'>
<v-list-item-icon>
<v-icon>mdi-playlist-music</v-icon>
</v-list-item-icon>
Expand Down Expand Up @@ -199,9 +208,19 @@ export default {
methods: {
//Add track next to queue
playNext() {
//Rooms
if (this.$rooms.allowControls()) {
this.$rooms.addQueue(this.track, true);
return;
}
this.$root.addTrackIndex(this.track, this.$root.queue.index+1);
},
addQueue() {
//Rooms
if (this.$rooms.allowControls()) {
this.$rooms.addQueue(this.track);
return;
}
this.$root.queue.data.push(this.track);
},
addLibrary() {
Expand Down
Loading

0 comments on commit d1081aa

Please sign in to comment.