CHONKY BOY

This commit is contained in:
Core 2022-08-04 05:27:29 +01:00
parent 31ed921a1a
commit c15f55d0ee
No known key found for this signature in database
GPG key ID: FE9BF1B547F8F3C6
213 changed files with 64188 additions and 55736 deletions

View file

@ -15,18 +15,22 @@
</div>
<div class="col-auto cider-flex-center">
<div class="row">
<button class="col md-btn md-btn-primary md-btn-icon" style="min-width: 100px;margin-right: 3px;"
@click="app.mk.shuffleMode = 0; play()"> <img class="md-ico-play">
<button class="col md-btn md-btn-primary md-btn-icon"
style="min-width: 100px;margin-right: 3px;"
@click="app.mk.shuffleMode = 0; play()"><img class="md-ico-play">
{{app.getLz('term.play')}}
</button>
<button class="col md-btn md-btn-primary md-btn-icon" style="min-width: 100px;margin-right: 3px;"
@click="app.mk.shuffleMode = 1;play()"> <img class="md-ico-shuffle">
<button class="col md-btn md-btn-primary md-btn-icon"
style="min-width: 100px;margin-right: 3px;"
@click="app.mk.shuffleMode = 1;play()"><img class="md-ico-shuffle">
{{app.getLz('term.shuffle')}}
</button>
</button>
<div class="col">
<select class="md-select" v-model="prefs.sort" @change="$root.searchLibrarySongs()">
<optgroup :label="app.getLz('term.sortBy')">
<option v-for="(sort, index) in library.songs.sortingOptions" :value="index">{{ sort }}</option>
<option v-for="(sort, index) in library.songs.sortingOptions" :value="index">{{ sort
}}
</option>
</optgroup>
</select>
</div>
@ -50,7 +54,9 @@
<select class="md-select" v-model="prefs.scroll">
<optgroup :label="app.getLz('term.scroll')">
<option value="infinite">{{app.getLz('term.scroll.infinite')}}</option>
<option value="paged">{{app.getLz('term.scroll.paged').replace("${songsPerPage}", pageSize)}}</option>
<option value="paged">{{app.getLz('term.scroll.paged').replace("${songsPerPage}",
pageSize)}}
</option>
</optgroup>
</select>
</div>
@ -58,81 +64,87 @@
</div>
<div class="col-auto cider-flex-center">
<button v-if="library.songs.downloadState == 2" @click="$root.getLibrarySongsFull(true)"
class="reload-btn" :aria-label="app.getLz('menubar.options.reload')"><%- include('../svg/redo.svg') %></button>
<button v-else class="reload-btn" style="opacity: 0.8;pointer-events: none" :aria-label="app.getLz('menubar.options.reload')">
class="reload-btn"
:aria-label="app.getLz('menubar.options.reload')"><%- include('../svg/redo.svg') %></button>
<button v-else class="reload-btn" style="opacity: 0.8;pointer-events: none"
:aria-label="app.getLz('menubar.options.reload')">
<div class="spinner"></div>
</button>
</div>
</div>
<pagination
:length="library.songs.displayListing.length"
:pageSize="pageSize"
:scroll="prefs.scroll"
scrollSelector="#app-content"
@onRangeChange="onRangeChange"
:length="library.songs.displayListing.length"
:pageSize="pageSize"
:scroll="prefs.scroll"
scrollSelector="#app-content"
@onRangeChange="onRangeChange"
/>
</div>
<div v-if="library.songs.downloadState == 3">Library contains no songs.</div>
<div class="well" :key="1" v-if="prefs.size == 'compact'">
<mediaitem-list-item class-list="compact" :item="item" :parent="'librarysongs'" :index="index" :show-meta-data="true" :show-library-status="false" v-for="(item, index) in currentSlice"></mediaitem-list-item>
<mediaitem-list-item class-list="compact" :item="item" :parent="'librarysongs'" :index="index"
:show-meta-data="true" :show-library-status="false"
v-for="(item, index) in currentSlice"></mediaitem-list-item>
</div>
<div class="well" :key="2" v-else>
<mediaitem-list-item :item="item" :parent="'librarysongs'" :index="index" :show-meta-data="true" :show-library-status="false" v-for="(item, index) in currentSlice"></mediaitem-list-item>
<mediaitem-list-item :item="item" :parent="'librarysongs'" :index="index" :show-meta-data="true"
:show-library-status="false"
v-for="(item, index) in currentSlice"></mediaitem-list-item>
</div>
</div>
</script>
<script>
Vue.component('cider-library-songs', {
template: '#cider-library-songs',
data: function () {
const pageSize = this.$root.cfg.libraryPrefs.pageSize;
return {
// currentPage is oneIndexed
library: this.$root.library,
mediaItemSize: "compact",
prefs: this.$root.cfg.libraryPrefs.songs,
app: this.$root,
pageSize: pageSize,
start: 0,
end: pageSize
}
},
mounted() {
this.$root.getLibrarySongsFull()
},
computed: {
currentSlice: function () {
return this.library.songs.displayListing.slice(this.start, this.end);
}
},
methods: {
onRangeChange: function (newRange) {
this.start = newRange[0];
this.end = newRange[1];
},
play: function () {
function shuffleArray(array) {
for (var i = array.length - 1; i > 0; i--) {
var j = Math.floor(Math.random() * (i + 1));
var temp = array[i];
array[i] = array[j];
array[j] = temp;
}
}
let query = this.app.library.songs.displayListing.map(item => new MusicKit.MediaItem(item));
if (!app.mk.queue.isEmpty)
app.mk.queue.splice(0, app.mk.queue._itemIDs.length);
app.mk.stop().then(() => {
if (app.mk.shuffleMode == 1) {
shuffleArray(query)
}
app.mk.queue.append(query)
app.mk.changeToMediaAtIndex(0)
});
}
Vue.component('cider-library-songs', {
template: '#cider-library-songs',
data: function() {
const pageSize = this.$root.cfg.libraryPrefs.pageSize;
return {
// currentPage is oneIndexed
library: this.$root.library,
mediaItemSize: "compact",
prefs: this.$root.cfg.libraryPrefs.songs,
app: this.$root,
pageSize: pageSize,
start: 0,
end: pageSize
}
},
mounted() {
this.$root.getLibrarySongsFull()
},
computed: {
currentSlice: function() {
return this.library.songs.displayListing.slice(this.start, this.end);
}
},
methods: {
onRangeChange: function(newRange) {
this.start = newRange[0];
this.end = newRange[1];
},
play: function() {
function shuffleArray(array) {
for (var i = array.length - 1; i > 0; i--) {
var j = Math.floor(Math.random() * (i + 1));
var temp = array[i];
array[i] = array[j];
array[j] = temp;
}
}
});
</script>
let query = this.app.library.songs.displayListing.map(item => new MusicKit.MediaItem(item));
if (!app.mk.queue.isEmpty)
app.mk.queue.splice(0, app.mk.queue._itemIDs.length);
app.mk.stop().then(() => {
if (app.mk.shuffleMode == 1) {
shuffleArray(query)
}
app.mk.queue.append(query)
app.mk.changeToMediaAtIndex(0)
});
}
}
});
</script>