added library results in search
This commit is contained in:
parent
a57c1d61fb
commit
4a6e99c922
3 changed files with 106 additions and 59 deletions
|
@ -117,6 +117,13 @@
|
||||||
|
|
||||||
// Search Page
|
// Search Page
|
||||||
&.search-page {
|
&.search-page {
|
||||||
|
|
||||||
|
.searchToggle {
|
||||||
|
float:right;
|
||||||
|
>button {
|
||||||
|
min-width: 120px;
|
||||||
|
}
|
||||||
|
}
|
||||||
.cd-mediaitem-square.mediaitem-brick {
|
.cd-mediaitem-square.mediaitem-brick {
|
||||||
width: 530px !important;
|
width: 530px !important;
|
||||||
|
|
||||||
|
|
|
@ -26,6 +26,7 @@ const app = new Vue({
|
||||||
showHints: false,
|
showHints: false,
|
||||||
results: {},
|
results: {},
|
||||||
resultsSocial: {},
|
resultsSocial: {},
|
||||||
|
resultsLibrary: {},
|
||||||
limit: 10
|
limit: 10
|
||||||
},
|
},
|
||||||
fullscreenLyrics: false,
|
fullscreenLyrics: false,
|
||||||
|
@ -3533,6 +3534,18 @@ const app = new Vue({
|
||||||
friendlyTypes(type) {
|
friendlyTypes(type) {
|
||||||
// use switch statement to return friendly name for media types "songs,artists,albums,playlists,music-videos,stations,apple-curators,curators"
|
// use switch statement to return friendly name for media types "songs,artists,albums,playlists,music-videos,stations,apple-curators,curators"
|
||||||
switch (type) {
|
switch (type) {
|
||||||
|
case "library-songs":
|
||||||
|
return app.getLz('term.songs')
|
||||||
|
break;
|
||||||
|
case "library-artists":
|
||||||
|
return app.getLz('term.artists')
|
||||||
|
break;
|
||||||
|
case "library-albums":
|
||||||
|
return app.getLz('term.albums')
|
||||||
|
break;
|
||||||
|
case "library-playlists":
|
||||||
|
return app.getLz('term.playlists')
|
||||||
|
break;
|
||||||
case "song":
|
case "song":
|
||||||
return app.getLz('term.songs')
|
return app.getLz('term.songs')
|
||||||
break;
|
break;
|
||||||
|
@ -3615,6 +3628,9 @@ const app = new Vue({
|
||||||
results.data.results["meta"] = results.data.meta
|
results.data.results["meta"] = results.data.meta
|
||||||
self.search.resultsSocial = results.data.results
|
self.search.resultsSocial = results.data.results
|
||||||
})
|
})
|
||||||
|
|
||||||
|
this.search.resultsLibrary = await app.mk.api.library.search(app.search.term, { types: 'library-songs,library-albums,library-playlists,library-artists', limit: 25, offset: 0 })
|
||||||
|
|
||||||
},
|
},
|
||||||
async inLibrary(items = []) {
|
async inLibrary(items = []) {
|
||||||
let types = []
|
let types = []
|
||||||
|
|
|
@ -1,6 +1,15 @@
|
||||||
<script type="text/x-template" id="cider-search">
|
<script type="text/x-template" id="cider-search">
|
||||||
<div class="content-inner search-page">
|
<div class="content-inner search-page">
|
||||||
|
<div class="btn-group searchToggle">
|
||||||
|
<button
|
||||||
|
@click="searchType = 'catalog'"
|
||||||
|
class="md-btn md-btn-small" :class="{'md-btn-primary': searchType == 'catalog'}">{{ $root.getLz("term.appleMusic") }}</button>
|
||||||
|
<button
|
||||||
|
@click="searchType = 'library';"
|
||||||
|
class="md-btn md-btn-small" :class="{'md-btn-primary': searchType == 'library'}">{{ $root.getLz("term.library") }}</button>
|
||||||
|
</div>
|
||||||
<div v-if="search != null && search != [] && search.term != ''">
|
<div v-if="search != null && search != [] && search.term != ''">
|
||||||
|
<template v-if="searchType == 'catalog'">
|
||||||
<h3>{{app.getLz('term.topResult')}}</h3>
|
<h3>{{app.getLz('term.topResult')}}</h3>
|
||||||
<mediaitem-scroller-horizontal
|
<mediaitem-scroller-horizontal
|
||||||
:items="search.results[search.results.meta.results.order[0]]['data']"></mediaitem-scroller-horizontal>
|
:items="search.results[search.results.meta.results.order[0]]['data']"></mediaitem-scroller-horizontal>
|
||||||
|
@ -78,6 +87,20 @@
|
||||||
<mediaitem-scroller-horizontal-large
|
<mediaitem-scroller-horizontal-large
|
||||||
:items="search.resultsSocial.profile.data.limit(10)"></mediaitem-scroller-horizontal-large>
|
:items="search.resultsSocial.profile.data.limit(10)"></mediaitem-scroller-horizontal-large>
|
||||||
</template>
|
</template>
|
||||||
|
</template>
|
||||||
|
<template v-else>
|
||||||
|
<h1>{{ $root.getLz("term.library") }}</h1>
|
||||||
|
<div v-for="(section, key) in $root.search.resultsLibrary">
|
||||||
|
<h3>{{app.friendlyTypes(key)}}</h3>
|
||||||
|
<div class="mediaitem-list-item__grid" v-if="key.includes('songs')">
|
||||||
|
<listitem-horizontal :items="section.data"></listitem-horizontal>
|
||||||
|
</div>
|
||||||
|
<div class="well" v-else>
|
||||||
|
<mediaitem-scroller-horizontal-large
|
||||||
|
:items="section.data"></mediaitem-scroller-horizontal-large>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
</div>
|
</div>
|
||||||
<div v-else>
|
<div v-else>
|
||||||
<div v-if="categoriesReady || getCategories()">
|
<div v-if="categoriesReady || getCategories()">
|
||||||
|
@ -111,6 +134,7 @@
|
||||||
recentlyPlayed: [],
|
recentlyPlayed: [],
|
||||||
categoriesView: [],
|
categoriesView: [],
|
||||||
categoriesReady: false,
|
categoriesReady: false,
|
||||||
|
searchType: "catalog",
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue