owntone-server/htdocs/assets/PageSearchSpotify.js

2 lines
13 KiB
JavaScript
Raw Normal View History

2023-12-14 15:00:28 -05:00
import{_ as S,o as a,c as u,a as o,t as h,z as P,a3 as B,e as W,r as c,h as d,j as F,Z as G,d as m,F as f,f as k,g as n,w as r,k as _,b as v,m as H}from"./index.js";import{C as R,T as Z}from"./TabsSearch.js";import{C as j}from"./ContentWithHeading.js";import{C as U}from"./CoverArtwork.js";import{L as J}from"./ListItemAlbumSpotify.js";import{L as K}from"./ListItemPlaylistSpotify.js";import{L as O,M as Q}from"./ModalDialogTrackSpotify.js";import{M as X}from"./ModalDialogAlbumSpotify.js";import{M as Y}from"./ModalDialogArtistSpotify.js";import{M as $}from"./ModalDialogPlaylistSpotify.js";import{S as tt}from"./spotify-web-api.js";import{G as st}from"./vue-eternal-loading.js";const et={name:"ListItemArtistSpotify",props:["artist"],methods:{open_artist(){this.$router.push({name:"music-spotify-artist",params:{id:this.artist.id}})}}},it={class:"media is-align-items-center"},lt=["textContent"],ot={class:"media-right"};function at(t,s,w,x,e,l){return a(),u("div",it,[o("div",{class:"media-content is-clickable is-clipped",onClick:s[0]||(s[0]=(...p)=>l.open_artist&&l.open_artist(...p))},[o("h1",{class:"title is-6",textContent:h(w.artist.name)},null,8,lt)]),o("div",ot,[P(t.$slots,"actions")])])}const rt=S(et,[["render",at]]),b=50,nt={name:"PageSearchSpotify",components:{ContentText:R,ContentWithHeading:j,CoverArtwork:U,ListItemAlbumSpotify:J,ListItemArtistSpotify:rt,ListItemPlaylistSpotify:K,ListItemTrackSpotify:O,ModalDialogAlbumSpotify:X,ModalDialogArtistSpotify:Y,ModalDialogPlaylistSpotify:$,ModalDialogTrackSpotify:Q,TabsSearch:Z,VueEternalLoading:st},data(){return{albums:{items:[],total:0},artists:{items:[],total:0},playlists:{items:[],total:0},query:{},search_param:{},search_query:"",selected_album:{},selected_artist:{},selected_playlist:{},selected_track:{},show_album_details_modal:!1,show_artist_details_modal:!1,show_playlist_details_modal:!1,show_track_details_modal:!1,tracks:{items:[],total:0},validSearchTypes:["track","artist","album","playlist"]}},computed:{is_visible_artwork(){return this.$store.getters.settings_option("webinterface","show_cover_artwork_in_album_lists").value},recent_searches(){return this.$store.state.recent_searches.filter(t=>!t.startsWith("query:"))},show_albums(){return this.$route.query.type&&this.$route.query.type.includes("album")},show_all_albums_button(){return this.albums.total>this.albums.items.length},show_all_artists_button(){return this.artists.total>this.artists.items.length},show_all_playlists_button(){return this.playlists.total>this.playlists.items.length},show_all_tracks_button(){return this.tracks.total>this.tracks.items.length},show_artists(){return this.$route.query.type&&this.$route.query.type.includes("artist")},show_playlists(){return this.$route.query.type&&this.$route.query.type.includes("playlist")},show_tracks(){return this.$route.query.type&&this.$route.query.type.includes("track")}},watch:{$route(t,s){this.query=t.query,this.search()}},mounted(){this.query=this.$route.query,this.search()},methods:{artwork_url(t){return t.images&&t.images.length>0?t.images[0].url:""},new_search(){this.search_query&&(this.$router.push({name:"search-spotify",query:{limit:3,offset:0,query:this.search_query,type:"track,artist,album,playlist,audiobook,podcast"}}),this.$refs.search_field.blur())},open_album(t){this.$router.push({name:"music-spotify-album",params:{id:t.id}})},open_album_dialog(t){this.selected_album=t,this.show_album_details_modal=!0},open_artist_dialog(t){this.selected_artist=t,this.show_artist_details_modal=!0},open_playlist_dialog(t){this.selected_playlist=t,this.show_playlist_details_modal=!0},open_recent_search(t){this.search_query=t,this.new_search()},open_search_albums(){this.$router.push({name:"search-spotify",query:{query:this.$route.query.query,type:"album"}})},open_search_artists(){this.$router.push({name:"search-spotify",query:{query:this.$route.query.query,type:"artist"}})},open_search_playlists(){this.$router.push({name:"search-spotify",query:{query:this.$route.query.query,type:"playlist"}})},open_search_tracks(){this.$router.push({name:"search-spotify",query:{query:th