2018-08-11 07:47:10 +02:00
|
|
|
<template>
|
|
|
|
<div>
|
|
|
|
<!-- Search field + recent searches -->
|
2023-06-11 08:44:45 +02:00
|
|
|
<section class="section pb-0">
|
2018-08-11 07:47:10 +02:00
|
|
|
<div class="container">
|
|
|
|
<div class="columns is-centered">
|
|
|
|
<div class="column is-four-fifths">
|
2022-02-19 06:39:14 +01:00
|
|
|
<form @submit.prevent="new_search">
|
2018-08-11 07:47:10 +02:00
|
|
|
<div class="field">
|
|
|
|
<p class="control is-expanded has-icons-left">
|
2022-05-29 18:49:00 +02:00
|
|
|
<input
|
|
|
|
ref="search_field"
|
|
|
|
v-model="search_query"
|
|
|
|
class="input is-rounded is-shadowless"
|
|
|
|
type="text"
|
|
|
|
placeholder="Search"
|
|
|
|
autocomplete="off"
|
|
|
|
/>
|
2022-06-15 19:24:51 +02:00
|
|
|
<span class="icon is-left"
|
|
|
|
><mdicon name="magnify" size="16"
|
|
|
|
/></span>
|
2018-08-11 07:47:10 +02:00
|
|
|
</p>
|
2022-02-19 06:39:14 +01:00
|
|
|
<p class="help has-text-centered">
|
2022-05-20 13:44:22 +02:00
|
|
|
<span v-html="$t('page.search.help')" />
|
2020-04-11 20:32:03 +02:00
|
|
|
</p>
|
2018-08-11 07:47:10 +02:00
|
|
|
</div>
|
|
|
|
</form>
|
2022-02-19 06:39:14 +01:00
|
|
|
<div class="tags" style="margin-top: 16px">
|
2022-05-29 18:49:00 +02:00
|
|
|
<a
|
|
|
|
v-for="recent_search in recent_searches"
|
|
|
|
:key="recent_search"
|
|
|
|
class="tag"
|
|
|
|
@click="open_recent_search(recent_search)"
|
|
|
|
v-text="recent_search"
|
|
|
|
/>
|
2018-08-11 07:47:10 +02:00
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</section>
|
2022-02-19 06:39:14 +01:00
|
|
|
<tabs-search :query="search_query" />
|
2018-08-11 07:47:10 +02:00
|
|
|
<!-- Tracks -->
|
2020-10-17 11:42:50 +02:00
|
|
|
<content-with-heading v-if="show_tracks && tracks.total">
|
2022-02-19 06:39:14 +01:00
|
|
|
<template #heading-left>
|
2022-05-20 13:44:22 +02:00
|
|
|
<p class="title is-4" v-text="$t('page.search.tracks')" />
|
2018-08-11 07:47:10 +02:00
|
|
|
</template>
|
2022-02-19 06:39:14 +01:00
|
|
|
<template #content>
|
2023-03-23 23:19:55 +01:00
|
|
|
<list-tracks :tracks="tracks" />
|
2018-08-11 07:47:10 +02:00
|
|
|
</template>
|
2022-02-19 06:39:14 +01:00
|
|
|
<template #footer>
|
2018-08-11 07:47:10 +02:00
|
|
|
<nav v-if="show_all_tracks_button" class="level">
|
|
|
|
<p class="level-item">
|
2022-05-29 18:49:00 +02:00
|
|
|
<a
|
|
|
|
class="button is-light is-small is-rounded"
|
|
|
|
@click="open_search_tracks"
|
|
|
|
v-text="
|
2022-06-05 10:46:00 +02:00
|
|
|
$t('page.search.show-tracks', {
|
2022-06-05 19:19:00 +02:00
|
|
|
count: tracks.total.toLocaleString($i18n.locale)
|
2022-05-29 18:49:00 +02:00
|
|
|
})
|
|
|
|
"
|
|
|
|
/>
|
2018-08-11 07:47:10 +02:00
|
|
|
</p>
|
|
|
|
</nav>
|
|
|
|
</template>
|
|
|
|
</content-with-heading>
|
2020-10-17 11:42:50 +02:00
|
|
|
<content-text v-if="show_tracks && !tracks.total" class="mt-6">
|
2022-02-19 06:39:14 +01:00
|
|
|
<template #content>
|
2022-05-20 13:44:22 +02:00
|
|
|
<p><i v-text="$t('page.search.no-tracks')" /></p>
|
2020-10-17 11:42:50 +02:00
|
|
|
</template>
|
|
|
|
</content-text>
|
2018-08-11 07:47:10 +02:00
|
|
|
<!-- Artists -->
|
2020-10-17 11:42:50 +02:00
|
|
|
<content-with-heading v-if="show_artists && artists.total">
|
2022-02-19 06:39:14 +01:00
|
|
|
<template #heading-left>
|
2022-05-20 13:44:22 +02:00
|
|
|
<p class="title is-4" v-text="$t('page.search.artists')" />
|
2018-08-11 07:47:10 +02:00
|
|
|
</template>
|
2022-02-19 06:39:14 +01:00
|
|
|
<template #content>
|
2022-02-19 07:47:54 +01:00
|
|
|
<list-artists :artists="artists" :hide_group_title="true" />
|
2018-08-11 07:47:10 +02:00
|
|
|
</template>
|
2022-02-19 06:39:14 +01:00
|
|
|
<template #footer>
|
2018-08-11 07:47:10 +02:00
|
|
|
<nav v-if="show_all_artists_button" class="level">
|
|
|
|
<p class="level-item">
|
2022-05-29 18:49:00 +02:00
|
|
|
<a
|
|
|
|
class="button is-light is-small is-rounded"
|
|
|
|
@click="open_search_artists"
|
|
|
|
v-text="
|
2022-06-05 10:46:00 +02:00
|
|
|
$t('page.search.show-artists', {
|
2022-06-16 06:30:49 +02:00
|
|
|
count: artists.total.toLocaleString($i18n.locale)
|
2022-05-29 18:49:00 +02:00
|
|
|
})
|
|
|
|
"
|
|
|
|
/>
|
2018-08-11 07:47:10 +02:00
|
|
|
</p>
|
|
|
|
</nav>
|
|
|
|
</template>
|
|
|
|
</content-with-heading>
|
2020-10-17 11:42:50 +02:00
|
|
|
<content-text v-if="show_artists && !artists.total">
|
2022-02-19 06:39:14 +01:00
|
|
|
<template #content>
|
2022-05-20 13:44:22 +02:00
|
|
|
<p><i v-text="$t('page.search.no-artists')" /></p>
|
2020-10-17 11:42:50 +02:00
|
|
|
</template>
|
|
|
|
</content-text>
|
2018-08-11 07:47:10 +02:00
|
|
|
<!-- Albums -->
|
2020-10-17 11:42:50 +02:00
|
|
|
<content-with-heading v-if="show_albums && albums.total">
|
2022-02-19 06:39:14 +01:00
|
|
|
<template #heading-left>
|
2022-05-20 13:44:22 +02:00
|
|
|
<p class="title is-4" v-text="$t('page.search.albums')" />
|
2018-08-11 07:47:10 +02:00
|
|
|
</template>
|
2022-02-19 06:39:14 +01:00
|
|
|
<template #content>
|
2022-02-19 07:47:54 +01:00
|
|
|
<list-albums :albums="albums" :hide_group_title="true" />
|
2018-08-11 07:47:10 +02:00
|
|
|
</template>
|
2022-02-19 06:39:14 +01:00
|
|
|
<template #footer>
|
2018-08-11 07:47:10 +02:00
|
|
|
<nav v-if="show_all_albums_button" class="level">
|
|
|
|
<p class="level-item">
|
2022-05-29 18:49:00 +02:00
|
|
|
<a
|
|
|
|
class="button is-light is-small is-rounded"
|
|
|
|
@click="open_search_albums"
|
|
|
|
v-text="
|
|
|
|
$t('page.search.show-albums', {
|
2022-06-05 19:19:00 +02:00
|
|
|
count: albums.total.toLocaleString($i18n.locale)
|
2022-05-29 18:49:00 +02:00
|
|
|
})
|
|
|
|
"
|
|
|
|
/>
|
2018-08-11 07:47:10 +02:00
|
|
|
</p>
|
|
|
|
</nav>
|
|
|
|
</template>
|
|
|
|
</content-with-heading>
|
2020-10-17 11:42:50 +02:00
|
|
|
<content-text v-if="show_albums && !albums.total">
|
2022-02-19 06:39:14 +01:00
|
|
|
<template #content>
|
2022-05-20 13:44:22 +02:00
|
|
|
<p><i v-text="$t('page.search.no-albums')" /></p>
|
2020-10-17 11:42:50 +02:00
|
|
|
</template>
|
|
|
|
</content-text>
|
2021-10-23 10:48:11 +01:00
|
|
|
<!-- Composers -->
|
|
|
|
<content-with-heading v-if="show_composers && composers.total">
|
2022-02-19 07:05:59 +01:00
|
|
|
<template #heading-left>
|
2022-05-20 13:44:22 +02:00
|
|
|
<p class="title is-4" v-text="$t('page.search.composers')" />
|
2021-10-23 10:48:11 +01:00
|
|
|
</template>
|
2022-02-19 07:05:59 +01:00
|
|
|
<template #content>
|
2022-04-17 07:48:58 +02:00
|
|
|
<list-composers :composers="composers" />
|
2021-10-23 10:48:11 +01:00
|
|
|
</template>
|
2022-02-19 07:05:59 +01:00
|
|
|
<template #footer>
|
2021-10-23 10:48:11 +01:00
|
|
|
<nav v-if="show_all_composers_button" class="level">
|
|
|
|
<p class="level-item">
|
2022-05-29 18:49:00 +02:00
|
|
|
<a
|
|
|
|
class="button is-light is-small is-rounded"
|
|
|
|
@click="open_search_composers"
|
|
|
|
v-text="
|
2022-06-05 10:46:00 +02:00
|
|
|
$t('page.search.show-composers', {
|
2022-06-05 19:19:00 +02:00
|
|
|
count: composers.total.toLocaleString($i18n.locale)
|
2022-05-29 18:49:00 +02:00
|
|
|
})
|
|
|
|
"
|
|
|
|
/>
|
2021-10-23 10:48:11 +01:00
|
|
|
</p>
|
|
|
|
</nav>
|
|
|
|
</template>
|
|
|
|
</content-with-heading>
|
|
|
|
<content-text v-if="show_composers && !composers.total">
|
2022-02-19 07:05:59 +01:00
|
|
|
<template #content>
|
2022-05-20 13:44:22 +02:00
|
|
|
<p><i v-text="$t('page.search.no-composers')" /></p>
|
2021-10-23 10:48:11 +01:00
|
|
|
</template>
|
|
|
|
</content-text>
|
2018-08-11 07:47:10 +02:00
|
|
|
<!-- Playlists -->
|
2020-10-17 11:42:50 +02:00
|
|
|
<content-with-heading v-if="show_playlists && playlists.total">
|
2022-02-19 06:39:14 +01:00
|
|
|
<template #heading-left>
|
2022-05-20 13:44:22 +02:00
|
|
|
<p class="title is-4" v-text="$t('page.search.playlists')" />
|
2018-08-11 07:47:10 +02:00
|
|
|
</template>
|
2022-02-19 06:39:14 +01:00
|
|
|
<template #content>
|
2022-04-17 07:48:58 +02:00
|
|
|
<list-playlists :playlists="playlists" />
|
2018-08-11 07:47:10 +02:00
|
|
|
</template>
|
2022-02-19 06:39:14 +01:00
|
|
|
<template #footer>
|
2018-08-11 07:47:10 +02:00
|
|
|
<nav v-if="show_all_playlists_button" class="level">
|
|
|
|
<p class="level-item">
|
2022-05-29 18:49:00 +02:00
|
|
|
<a
|
|
|
|
class="button is-light is-small is-rounded"
|
|
|
|
@click="open_search_playlists"
|
|
|
|
v-text="
|
2022-06-05 10:46:00 +02:00
|
|
|
$t('page.search.show-playlists', {
|
2022-06-05 19:19:00 +02:00
|
|
|
count: playlists.total.toLocaleString($i18n.locale)
|
2022-05-29 18:49:00 +02:00
|
|
|
})
|
|
|
|
"
|
|
|
|
/>
|
2018-08-11 07:47:10 +02:00
|
|
|
</p>
|
|
|
|
</nav>
|
|
|
|
</template>
|
|
|
|
</content-with-heading>
|
2020-10-17 11:42:50 +02:00
|
|
|
<content-text v-if="show_playlists && !playlists.total">
|
2022-02-19 06:39:14 +01:00
|
|
|
<template #content>
|
2022-05-20 13:44:22 +02:00
|
|
|
<p><i v-text="$t('page.search.no-playlists')" /></p>
|
2020-10-17 11:42:50 +02:00
|
|
|
</template>
|
|
|
|
</content-text>
|
2020-08-30 15:53:12 +02:00
|
|
|
<!-- Podcasts -->
|
2020-10-17 11:42:50 +02:00
|
|
|
<content-with-heading v-if="show_podcasts && podcasts.total">
|
2022-02-19 06:39:14 +01:00
|
|
|
<template #heading-left>
|
2022-05-20 13:44:22 +02:00
|
|
|
<p class="title is-4" v-text="$t('page.search.podcasts')" />
|
2020-08-30 15:53:12 +02:00
|
|
|
</template>
|
2022-02-19 06:39:14 +01:00
|
|
|
<template #content>
|
2022-02-19 07:47:54 +01:00
|
|
|
<list-albums :albums="podcasts" />
|
2020-08-30 15:53:12 +02:00
|
|
|
</template>
|
2022-02-19 06:39:14 +01:00
|
|
|
<template #footer>
|
2020-08-30 15:53:12 +02:00
|
|
|
<nav v-if="show_all_podcasts_button" class="level">
|
|
|
|
<p class="level-item">
|
2022-05-29 18:49:00 +02:00
|
|
|
<a
|
|
|
|
class="button is-light is-small is-rounded"
|
|
|
|
@click="open_search_podcasts"
|
|
|
|
v-text="
|
2022-06-05 10:46:00 +02:00
|
|
|
$t('page.search.show-podcasts', {
|
2022-06-05 19:19:00 +02:00
|
|
|
count: podcasts.total.toLocaleString($i18n.locale)
|
2022-05-29 18:49:00 +02:00
|
|
|
})
|
|
|
|
"
|
|
|
|
/>
|
2020-08-30 15:53:12 +02:00
|
|
|
</p>
|
|
|
|
</nav>
|
|
|
|
</template>
|
|
|
|
</content-with-heading>
|
2020-10-17 11:42:50 +02:00
|
|
|
<content-text v-if="show_podcasts && !podcasts.total">
|
2022-02-19 06:39:14 +01:00
|
|
|
<template #content>
|
2022-05-20 13:44:22 +02:00
|
|
|
<p><i v-text="$t('page.search.no-podcasts')" /></p>
|
2020-10-17 11:42:50 +02:00
|
|
|
</template>
|
|
|
|
</content-text>
|
2020-08-30 15:53:12 +02:00
|
|
|
|
|
|
|
<!-- Audiobooks -->
|
2020-10-17 11:42:50 +02:00
|
|
|
<content-with-heading v-if="show_audiobooks && audiobooks.total">
|
2022-02-19 06:39:14 +01:00
|
|
|
<template #heading-left>
|
2022-05-20 13:44:22 +02:00
|
|
|
<p class="title is-4" v-text="$t('page.search.audiobooks')" />
|
2020-08-30 15:53:12 +02:00
|
|
|
</template>
|
2022-02-19 06:39:14 +01:00
|
|
|
<template #content>
|
2022-02-19 07:47:54 +01:00
|
|
|
<list-albums :albums="audiobooks" />
|
2020-08-30 15:53:12 +02:00
|
|
|
</template>
|
2022-02-19 06:39:14 +01:00
|
|
|
<template #footer>
|
2020-08-30 15:53:12 +02:00
|
|
|
<nav v-if="show_all_audiobooks_button" class="level">
|
|
|
|
<p class="level-item">
|
2022-05-29 18:49:00 +02:00
|
|
|
<a
|
|
|
|
class="button is-light is-small is-rounded"
|
|
|
|
@click="open_search_audiobooks"
|
|
|
|
v-text="
|
2022-06-05 10:46:00 +02:00
|
|
|
$t('page.search.show-audiobooks', {
|
2022-06-05 19:19:00 +02:00
|
|
|
count: audiobooks.total.toLocaleString($i18n.locale)
|
2022-05-29 18:49:00 +02:00
|
|
|
})
|
|
|
|
"
|
|
|
|
/>
|
2020-08-30 15:53:12 +02:00
|
|
|
</p>
|
|
|
|
</nav>
|
|
|
|
</template>
|
|
|
|
</content-with-heading>
|
2020-10-17 11:42:50 +02:00
|
|
|
<content-text v-if="show_audiobooks && !audiobooks.total">
|
2022-02-19 06:39:14 +01:00
|
|
|
<template #content>
|
2022-05-20 13:44:22 +02:00
|
|
|
<p><i v-text="$t('page.search.no-audiobooks')" /></p>
|
2020-10-17 11:42:50 +02:00
|
|
|
</template>
|
|
|
|
</content-text>
|
2018-08-11 07:47:10 +02:00
|
|
|
</div>
|
|
|
|
</template>
|
|
|
|
|
|
|
|
<script>
|
2022-02-19 06:18:01 +01:00
|
|
|
import ContentWithHeading from '@/templates/ContentWithHeading.vue'
|
|
|
|
import ContentText from '@/templates/ContentText.vue'
|
|
|
|
import TabsSearch from '@/components/TabsSearch.vue'
|
|
|
|
import ListTracks from '@/components/ListTracks.vue'
|
|
|
|
import ListArtists from '@/components/ListArtists.vue'
|
|
|
|
import ListAlbums from '@/components/ListAlbums.vue'
|
|
|
|
import ListComposers from '@/components/ListComposers.vue'
|
|
|
|
import ListPlaylists from '@/components/ListPlaylists.vue'
|
2018-08-11 07:47:10 +02:00
|
|
|
import webapi from '@/webapi'
|
|
|
|
import * as types from '@/store/mutation_types'
|
2022-02-19 07:47:54 +01:00
|
|
|
import { GroupByList } from '@/lib/GroupByList'
|
2018-08-11 07:47:10 +02:00
|
|
|
|
|
|
|
export default {
|
|
|
|
name: 'PageSearch',
|
2022-02-19 06:39:14 +01:00
|
|
|
components: {
|
|
|
|
ContentWithHeading,
|
|
|
|
ContentText,
|
|
|
|
TabsSearch,
|
|
|
|
ListTracks,
|
|
|
|
ListArtists,
|
|
|
|
ListAlbums,
|
|
|
|
ListPlaylists,
|
|
|
|
ListComposers
|
|
|
|
},
|
2018-08-11 07:47:10 +02:00
|
|
|
|
2022-02-19 06:39:14 +01:00
|
|
|
data() {
|
2018-08-11 07:47:10 +02:00
|
|
|
return {
|
|
|
|
search_query: '',
|
2023-03-23 23:19:55 +01:00
|
|
|
tracks: new GroupByList(),
|
2022-02-19 07:47:54 +01:00
|
|
|
artists: new GroupByList(),
|
|
|
|
albums: new GroupByList(),
|
2022-04-17 07:48:58 +02:00
|
|
|
composers: new GroupByList(),
|
|
|
|
playlists: new GroupByList(),
|
2022-02-19 07:47:54 +01:00
|
|
|
audiobooks: new GroupByList(),
|
|
|
|
podcasts: new GroupByList()
|
2018-08-11 07:47:10 +02:00
|
|
|
}
|
|
|
|
},
|
|
|
|
|
|
|
|
computed: {
|
2022-02-19 06:39:14 +01:00
|
|
|
recent_searches() {
|
2018-08-11 07:47:10 +02:00
|
|
|
return this.$store.state.recent_searches
|
|
|
|
},
|
|
|
|
|
2022-02-19 06:39:14 +01:00
|
|
|
show_tracks() {
|
2018-08-11 07:47:10 +02:00
|
|
|
return this.$route.query.type && this.$route.query.type.includes('track')
|
|
|
|
},
|
2022-02-19 06:39:14 +01:00
|
|
|
show_all_tracks_button() {
|
2018-08-11 07:47:10 +02:00
|
|
|
return this.tracks.total > this.tracks.items.length
|
|
|
|
},
|
|
|
|
|
2022-02-19 06:39:14 +01:00
|
|
|
show_artists() {
|
2018-08-11 07:47:10 +02:00
|
|
|
return this.$route.query.type && this.$route.query.type.includes('artist')
|
|
|
|
},
|
2022-02-19 06:39:14 +01:00
|
|
|
show_all_artists_button() {
|
2018-08-11 07:47:10 +02:00
|
|
|
return this.artists.total > this.artists.items.length
|
|
|
|
},
|
|
|
|
|
2022-02-19 06:39:14 +01:00
|
|
|
show_albums() {
|
2018-08-11 07:47:10 +02:00
|
|
|
return this.$route.query.type && this.$route.query.type.includes('album')
|
|
|
|
},
|
2022-02-19 06:39:14 +01:00
|
|
|
show_all_albums_button() {
|
2018-08-11 07:47:10 +02:00
|
|
|
return this.albums.total > this.albums.items.length
|
|
|
|
},
|
|
|
|
|
2022-02-19 06:39:14 +01:00
|
|
|
show_composers() {
|
|
|
|
return (
|
|
|
|
this.$route.query.type && this.$route.query.type.includes('composer')
|
|
|
|
)
|
2021-10-23 10:48:11 +01:00
|
|
|
},
|
2022-02-19 06:39:14 +01:00
|
|
|
show_all_composers_button() {
|
2021-10-23 10:48:11 +01:00
|
|
|
return this.composers.total > this.composers.items.length
|
|
|
|
},
|
|
|
|
|
2022-02-19 06:39:14 +01:00
|
|
|
show_playlists() {
|
|
|
|
return (
|
|
|
|
this.$route.query.type && this.$route.query.type.includes('playlist')
|
|
|
|
)
|
2018-08-11 07:47:10 +02:00
|
|
|
},
|
2022-02-19 06:39:14 +01:00
|
|
|
show_all_playlists_button() {
|
2018-08-11 07:47:10 +02:00
|
|
|
return this.playlists.total > this.playlists.items.length
|
2020-08-23 19:26:54 +02:00
|
|
|
},
|
|
|
|
|
2022-02-19 06:39:14 +01:00
|
|
|
show_audiobooks() {
|
|
|
|
return (
|
|
|
|
this.$route.query.type && this.$route.query.type.includes('audiobook')
|
|
|
|
)
|
2020-08-30 15:53:12 +02:00
|
|
|
},
|
2022-02-19 06:39:14 +01:00
|
|
|
show_all_audiobooks_button() {
|
2020-08-30 15:53:12 +02:00
|
|
|
return this.audiobooks.total > this.audiobooks.items.length
|
|
|
|
},
|
|
|
|
|
2022-02-19 06:39:14 +01:00
|
|
|
show_podcasts() {
|
|
|
|
return (
|
|
|
|
this.$route.query.type && this.$route.query.type.includes('podcast')
|
|
|
|
)
|
2020-08-30 15:53:12 +02:00
|
|
|
},
|
2022-02-19 06:39:14 +01:00
|
|
|
show_all_podcasts_button() {
|
2020-08-30 15:53:12 +02:00
|
|
|
return this.podcasts.total > this.podcasts.items.length
|
2022-02-19 06:39:14 +01:00
|
|
|
}
|
|
|
|
},
|
|
|
|
|
|
|
|
watch: {
|
|
|
|
$route(to, from) {
|
|
|
|
this.search(to)
|
2018-08-11 07:47:10 +02:00
|
|
|
}
|
|
|
|
},
|
|
|
|
|
2023-06-07 21:25:54 +02:00
|
|
|
mounted() {
|
2022-02-19 06:39:14 +01:00
|
|
|
this.search(this.$route)
|
|
|
|
},
|
|
|
|
|
2018-08-11 07:47:10 +02:00
|
|
|
methods: {
|
2023-06-07 21:25:54 +02:00
|
|
|
search(route) {
|
2018-08-11 07:47:10 +02:00
|
|
|
if (!route.query.query || route.query.query === '') {
|
|
|
|
this.search_query = ''
|
|
|
|
this.$refs.search_field.focus()
|
|
|
|
return
|
|
|
|
}
|
|
|
|
|
2020-10-18 07:39:29 +02:00
|
|
|
this.search_query = route.query.query
|
2020-08-30 15:53:12 +02:00
|
|
|
this.searchMusic(route.query)
|
|
|
|
this.searchAudiobooks(route.query)
|
|
|
|
this.searchPodcasts(route.query)
|
|
|
|
this.$store.commit(types.ADD_RECENT_SEARCH, route.query.query)
|
|
|
|
},
|
|
|
|
|
2023-06-07 21:25:54 +02:00
|
|
|
searchMusic(query) {
|
2022-02-19 06:39:14 +01:00
|
|
|
if (
|
|
|
|
query.type.indexOf('track') < 0 &&
|
|
|
|
query.type.indexOf('artist') < 0 &&
|
|
|
|
query.type.indexOf('album') < 0 &&
|
|
|
|
query.type.indexOf('playlist') < 0
|
|
|
|
) {
|
2020-08-30 15:53:12 +02:00
|
|
|
return
|
|
|
|
}
|
|
|
|
|
2021-01-10 07:51:50 +01:00
|
|
|
const searchParams = {
|
2020-08-30 15:53:12 +02:00
|
|
|
type: query.type,
|
2020-04-11 19:43:53 +02:00
|
|
|
media_kind: 'music'
|
2018-08-11 07:47:10 +02:00
|
|
|
}
|
|
|
|
|
2020-08-30 15:53:12 +02:00
|
|
|
if (query.query.startsWith('query:')) {
|
|
|
|
searchParams.expression = query.query.replace(/^query:/, '').trim()
|
2020-04-11 20:32:03 +02:00
|
|
|
} else {
|
2020-08-30 15:53:12 +02:00
|
|
|
searchParams.query = query.query
|
2020-04-11 20:32:03 +02:00
|
|
|
}
|
|
|
|
|
2020-08-30 15:53:12 +02:00
|
|
|
if (query.limit) {
|
|
|
|
searchParams.limit = query.limit
|
|
|
|
searchParams.offset = query.offset
|
2018-08-11 07:47:10 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
webapi.search(searchParams).then(({ data }) => {
|
2023-03-23 23:19:55 +01:00
|
|
|
this.tracks = new GroupByList(data.tracks)
|
2022-02-19 07:47:54 +01:00
|
|
|
this.artists = new GroupByList(data.artists)
|
|
|
|
this.albums = new GroupByList(data.albums)
|
2022-04-17 07:48:58 +02:00
|
|
|
this.composers = new GroupByList(data.composers)
|
|
|
|
this.playlists = new GroupByList(data.playlists)
|
2020-08-30 15:53:12 +02:00
|
|
|
})
|
|
|
|
},
|
|
|
|
|
2023-06-07 21:25:54 +02:00
|
|
|
searchAudiobooks(query) {
|
2020-08-30 15:53:12 +02:00
|
|
|
if (query.type.indexOf('audiobook') < 0) {
|
|
|
|
return
|
|
|
|
}
|
|
|
|
|
2021-01-10 07:51:50 +01:00
|
|
|
const searchParams = {
|
2020-08-30 15:53:12 +02:00
|
|
|
type: 'album',
|
|
|
|
media_kind: 'audiobook'
|
|
|
|
}
|
|
|
|
|
|
|
|
if (query.query.startsWith('query:')) {
|
|
|
|
searchParams.expression = query.query.replace(/^query:/, '').trim()
|
|
|
|
} else {
|
2022-02-19 06:39:14 +01:00
|
|
|
searchParams.expression =
|
|
|
|
'((album includes "' +
|
|
|
|
query.query +
|
|
|
|
'" or artist includes "' +
|
|
|
|
query.query +
|
|
|
|
'") and media_kind is audiobook)'
|
2020-08-30 15:53:12 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
if (query.limit) {
|
|
|
|
searchParams.limit = query.limit
|
|
|
|
searchParams.offset = query.offset
|
|
|
|
}
|
2018-08-11 07:47:10 +02:00
|
|
|
|
2020-08-30 15:53:12 +02:00
|
|
|
webapi.search(searchParams).then(({ data }) => {
|
2022-02-19 07:47:54 +01:00
|
|
|
this.audiobooks = new GroupByList(data.albums)
|
2020-08-30 15:53:12 +02:00
|
|
|
})
|
|
|
|
},
|
|
|
|
|
2023-06-07 21:25:54 +02:00
|
|
|
searchPodcasts(query) {
|
2020-08-30 15:53:12 +02:00
|
|
|
if (query.type.indexOf('podcast') < 0) {
|
|
|
|
return
|
|
|
|
}
|
|
|
|
|
2021-01-10 07:51:50 +01:00
|
|
|
const searchParams = {
|
2020-08-30 15:53:12 +02:00
|
|
|
type: 'album',
|
|
|
|
media_kind: 'podcast'
|
|
|
|
}
|
|
|
|
|
|
|
|
if (query.query.startsWith('query:')) {
|
|
|
|
searchParams.expression = query.query.replace(/^query:/, '').trim()
|
|
|
|
} else {
|
2022-02-19 06:39:14 +01:00
|
|
|
searchParams.expression =
|
|
|
|
'((album includes "' +
|
|
|
|
query.query +
|
|
|
|
'" or artist includes "' +
|
|
|
|
query.query +
|
|
|
|
'") and media_kind is podcast)'
|
2020-08-30 15:53:12 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
if (query.limit) {
|
|
|
|
searchParams.limit = query.limit
|
|
|
|
searchParams.offset = query.offset
|
|
|
|
}
|
|
|
|
|
|
|
|
webapi.search(searchParams).then(({ data }) => {
|
2022-02-19 07:47:54 +01:00
|
|
|
this.podcasts = new GroupByList(data.albums)
|
2018-08-11 07:47:10 +02:00
|
|
|
})
|
|
|
|
},
|
|
|
|
|
2023-06-07 21:25:54 +02:00
|
|
|
new_search() {
|
2018-08-11 07:47:10 +02:00
|
|
|
if (!this.search_query) {
|
|
|
|
return
|
|
|
|
}
|
|
|
|
|
2020-04-11 19:43:53 +02:00
|
|
|
this.$router.push({
|
2022-02-26 20:29:30 +00:00
|
|
|
path: this.$store.state.search_path,
|
2018-08-11 07:47:10 +02:00
|
|
|
query: {
|
2021-10-23 10:48:11 +01:00
|
|
|
type: 'track,artist,album,playlist,audiobook,podcast,composer',
|
2018-08-11 07:47:10 +02:00
|
|
|
query: this.search_query,
|
|
|
|
limit: 3,
|
|
|
|
offset: 0
|
|
|
|
}
|
|
|
|
})
|
|
|
|
this.$refs.search_field.blur()
|
|
|
|
},
|
|
|
|
|
2023-06-07 21:25:54 +02:00
|
|
|
open_search_tracks() {
|
2020-04-11 19:43:53 +02:00
|
|
|
this.$router.push({
|
|
|
|
path: '/search/library',
|
2018-08-11 07:47:10 +02:00
|
|
|
query: {
|
|
|
|
type: 'track',
|
|
|
|
query: this.$route.query.query
|
|
|
|
}
|
|
|
|
})
|
|
|
|
},
|
|
|
|
|
2023-06-07 21:25:54 +02:00
|
|
|
open_search_artists() {
|
2020-04-11 19:43:53 +02:00
|
|
|
this.$router.push({
|
|
|
|
path: '/search/library',
|
2018-08-11 07:47:10 +02:00
|
|
|
query: {
|
|
|
|
type: 'artist',
|
|
|
|
query: this.$route.query.query
|
|
|
|
}
|
|
|
|
})
|
|
|
|
},
|
|
|
|
|
2023-06-07 21:25:54 +02:00
|
|
|
open_search_albums() {
|
2020-04-11 19:43:53 +02:00
|
|
|
this.$router.push({
|
|
|
|
path: '/search/library',
|
2018-08-11 07:47:10 +02:00
|
|
|
query: {
|
|
|
|
type: 'album',
|
|
|
|
query: this.$route.query.query
|
|
|
|
}
|
|
|
|
})
|
|
|
|
},
|
|
|
|
|
2023-06-07 21:25:54 +02:00
|
|
|
open_search_composers() {
|
2021-10-23 10:48:11 +01:00
|
|
|
this.$router.push({
|
|
|
|
path: '/search/library',
|
|
|
|
query: {
|
|
|
|
type: 'tracks',
|
|
|
|
query: this.$route.query.query
|
|
|
|
}
|
|
|
|
})
|
|
|
|
},
|
|
|
|
|
2023-06-07 21:25:54 +02:00
|
|
|
open_search_playlists() {
|
2020-04-11 19:43:53 +02:00
|
|
|
this.$router.push({
|
|
|
|
path: '/search/library',
|
2018-08-11 07:47:10 +02:00
|
|
|
query: {
|
|
|
|
type: 'playlist',
|
|
|
|
query: this.$route.query.query
|
|
|
|
}
|
|
|
|
})
|
|
|
|
},
|
|
|
|
|
2023-06-07 21:25:54 +02:00
|
|
|
open_search_audiobooks() {
|
2020-08-30 15:53:12 +02:00
|
|
|
this.$router.push({
|
|
|
|
path: '/search/library',
|
|
|
|
query: {
|
|
|
|
type: 'audiobook',
|
|
|
|
query: this.$route.query.query
|
|
|
|
}
|
|
|
|
})
|
|
|
|
},
|
|
|
|
|
2023-06-07 21:25:54 +02:00
|
|
|
open_search_podcasts() {
|
2020-08-30 15:53:12 +02:00
|
|
|
this.$router.push({
|
|
|
|
path: '/search/library',
|
|
|
|
query: {
|
|
|
|
type: 'podcast',
|
|
|
|
query: this.$route.query.query
|
|
|
|
}
|
|
|
|
})
|
|
|
|
},
|
|
|
|
|
2023-06-07 21:25:54 +02:00
|
|
|
open_composer(composer) {
|
2022-02-19 06:39:14 +01:00
|
|
|
this.$router.push({
|
|
|
|
name: 'ComposerAlbums',
|
|
|
|
params: { composer: composer.name }
|
|
|
|
})
|
2021-10-23 10:48:11 +01:00
|
|
|
},
|
|
|
|
|
2023-06-07 21:25:54 +02:00
|
|
|
open_playlist(playlist) {
|
2021-10-23 10:48:11 +01:00
|
|
|
this.$router.push({ path: '/playlists/' + playlist.id + '/tracks' })
|
|
|
|
},
|
|
|
|
|
2023-06-07 21:25:54 +02:00
|
|
|
open_recent_search(query) {
|
2018-08-11 07:47:10 +02:00
|
|
|
this.search_query = query
|
|
|
|
this.new_search()
|
2021-10-23 10:48:11 +01:00
|
|
|
},
|
|
|
|
|
2023-06-07 21:25:54 +02:00
|
|
|
open_track_dialog(track) {
|
2021-10-23 10:48:11 +01:00
|
|
|
this.selected_track = track
|
|
|
|
this.show_track_details_modal = true
|
|
|
|
},
|
|
|
|
|
2023-06-07 21:25:54 +02:00
|
|
|
open_album_dialog(album) {
|
2021-10-23 10:48:11 +01:00
|
|
|
this.selected_album = album
|
|
|
|
this.show_album_details_modal = true
|
|
|
|
},
|
|
|
|
|
2023-06-07 21:25:54 +02:00
|
|
|
open_artist_dialog(artist) {
|
2021-10-23 10:48:11 +01:00
|
|
|
this.selected_artist = artist
|
|
|
|
this.show_artist_details_modal = true
|
|
|
|
},
|
|
|
|
|
2023-06-07 21:25:54 +02:00
|
|
|
open_composer_dialog(composer) {
|
2021-10-23 10:48:11 +01:00
|
|
|
this.selected_composer = composer
|
|
|
|
this.show_composer_details_modal = true
|
|
|
|
},
|
|
|
|
|
2023-06-07 21:25:54 +02:00
|
|
|
open_playlist_dialog(playlist) {
|
2021-10-23 10:48:11 +01:00
|
|
|
this.selected_playlist = playlist
|
|
|
|
this.show_playlist_details_modal = true
|
2018-08-11 07:47:10 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
</script>
|
|
|
|
|
2022-02-19 06:39:14 +01:00
|
|
|
<style></style>
|