owntone-server/htdocs/assets/ModalDialogQueueItem.js
2023-12-14 20:00:28 +00:00

2 lines
6.0 KiB
JavaScript

import{S as h}from"./spotify-web-api.js";import{_ as r,e as c,r as C,o as a,c as o,d as u,w as k,a as t,t as i,k as l,T as p}from"./index.js";const x={name:"ModalDialogQueueItem",props:["show","item"],emits:["close"],data(){return{spotify_track:{}}},watch:{item(){if(this.item&&this.item.data_kind==="spotify"){const s=new h;s.setAccessToken(this.$store.state.spotify.webapi_token),s.getTrack(this.item.path.slice(this.item.path.lastIndexOf(":")+1)).then(n=>{this.spotify_track=n})}else this.spotify_track={}}},methods:{open_album(){this.item.data_kind==="spotify"?this.$router.push({name:"music-spotify-album",params:{id:this.spotify_track.album.id}}):this.item.media_kind==="podcast"?this.$router.push({name:"podcast",params:{id:this.item.album_id}}):this.item.media_kind==="audiobook"?this.$router.push({name:"audiobooks-album",params:{id:this.item.album_id}}):this.item.media_kind==="music"&&this.$router.push({name:"music-album",params:{id:this.item.album_id}})},open_album_artist(){this.item.data_kind==="spotify"?this.$router.push({name:"music-spotify-artist",params:{id:this.spotify_track.artists[0].id}}):this.item.media_kind==="music"||this.item.media_kind==="podcast"?this.$router.push({name:"music-artist",params:{id:this.item.album_artist_id}}):this.item.media_kind==="audiobook"&&this.$router.push({name:"audiobooks-artist",params:{id:this.item.album_artist_id}})},open_genre(){this.$router.push({name:"genre-albums",params:{name:this.item.genre},query:{media_kind:this.item.media_kind}})},play(){this.$emit("close"),c.player_play({item_id:this.item.id})},remove(){this.$emit("close"),c.queue_remove(this.item.id)}}},g={key:0,class:"modal is-active"},y={class:"modal-content fd-modal-card"},b={class:"card"},f={class:"card-content"},q=["textContent"],v=["textContent"],w={class:"content is-small"},z={key:0},I=["textContent"],T=["textContent"],A={key:1},B=["textContent"],D=["textContent"],M={key:2},N=["textContent"],S=["textContent"],V={key:3},j=["textContent"],Q=["textContent"],E={key:4},H=["textContent"],O=["textContent"],W={key:5},F=["textContent"],G=["textContent"],J={key:6},K=["textContent"],L=["textContent"],P=["textContent"],R=["textContent"],U=["textContent"],X={class:"title is-6"},Y=["textContent"],Z={key:7},$=["textContent"],tt={class:"title is-6"},et=["textContent"],it=["textContent"],st=["textContent"],nt=["textContent"],at={class:"card-footer"},ot=["textContent"],lt=["textContent"];function mt(s,n,e,dt,ut,d){const _=C("mdicon");return a(),o("div",null,[u(p,{name:"fade"},{default:k(()=>[e.show?(a(),o("div",g,[t("div",{class:"modal-background",onClick:n[0]||(n[0]=m=>s.$emit("close"))}),t("div",y,[t("div",b,[t("div",f,[t("p",{class:"title is-4",textContent:i(e.item.title)},null,8,q),t("p",{class:"subtitle",textContent:i(e.item.artist)},null,8,v),t("div",w,[e.item.album?(a(),o("p",z,[t("span",{class:"heading",textContent:i(s.$t("dialog.queue-item.album"))},null,8,I),t("a",{class:"title is-6 has-text-link",onClick:n[1]||(n[1]=(...m)=>d.open_album&&d.open_album(...m)),textContent:i(e.item.album)},null,8,T)])):l("",!0),e.item.album_artist?(a(),o("p",A,[t("span",{class:"heading",textContent:i(s.$t("dialog.queue-item.album-artist"))},null,8,B),t("a",{class:"title is-6 has-text-link",onClick:n[2]||(n[2]=(...m)=>d.open_album_artist&&d.open_album_artist(...m)),textContent:i(e.item.album_artist)},null,8,D)])):l("",!0),e.item.composer?(a(),o("p",M,[t("span",{class:"heading",textContent:i(s.$t("dialog.queue-item.composer"))},null,8,N),t("span",{class:"title is-6",textContent:i(e.item.composer)},null,8,S)])):l("",!0),e.item.year?(a(),o("p",V,[t("span",{class:"heading",textContent:i(s.$t("dialog.queue-item.year"))},null,8,j),t("span",{class:"title is-6",textContent:i(e.item.year)},null,8,Q)])):l("",!0),e.item.genre?(a(),o("p",E,[t("span",{class:"heading",textContent:i(s.$t("dialog.queue-item.genre"))},null,8,H),t("a",{class:"title is-6 has-text-link",onClick:n[3]||(n[3]=(...m)=>d.open_genre&&d.open_genre(...m)),textContent:i(e.item.genre)},null,8,O)])):l("",!0),e.item.disc_number?(a(),o("p",W,[t("span",{class:"heading",textContent:i(s.$t("dialog.queue-item.position"))},null,8,F),t("span",{class:"title is-6",textContent:i([e.item.disc_number,e.item.track_number].join(" / "))},null,8,G)])):l("",!0),e.item.length_ms?(a(),o("p",J,[t("span",{class:"heading",textContent:i(s.$t("dialog.queue-item.duration"))},null,8,K),t("span",{class:"title is-6",textContent:i(s.$filters.durationInHours(e.item.length_ms))},null,8,L)])):l("",!0),t("p",null,[t("span",{class:"heading",textContent:i(s.$t("dialog.queue-item.path"))},null,8,P),t("span",{class:"title is-6",textContent:i(e.item.path)},null,8,R)]),t("p",null,[t("span",{class:"heading",textContent:i(s.$t("dialog.queue-item.type"))},null,8,U),t("span",X,[t("span",{textContent:i([s.$t("media.kind."+e.item.media_kind),s.$t("data.kind."+e.item.data_kind)].join(" - "))},null,8,Y)])]),e.item.samplerate?(a(),o("p",Z,[t("span",{class:"heading",textContent:i(s.$t("dialog.queue-item.quality"))},null,8,$),t("span",tt,[t("span",{textContent:i(e.item.type)},null,8,et),e.item.samplerate?(a(),o("span",{key:0,textContent:i(s.$t("dialog.queue-item.samplerate",{rate:e.item.samplerate}))},null,8,it)):l("",!0),e.item.channels?(a(),o("span",{key:1,textContent:i(s.$t("dialog.queue-item.channels",{channels:s.$filters.channels(e.item.channels)}))},null,8,st)):l("",!0),e.item.bitrate?(a(),o("span",{key:2,textContent:i(s.$t("dialog.queue-item.bitrate",{rate:e.item.bitrate}))},null,8,nt)):l("",!0)])])):l("",!0)])]),t("footer",at,[t("a",{class:"card-footer-item has-text-dark",onClick:n[4]||(n[4]=(...m)=>d.remove&&d.remove(...m))},[u(_,{class:"icon",name:"delete",size:"16"}),t("span",{class:"is-size-7",textContent:i(s.$t("dialog.queue-item.remove"))},null,8,ot)]),t("a",{class:"card-footer-item has-text-dark",onClick:n[5]||(n[5]=(...m)=>d.play&&d.play(...m))},[u(_,{class:"icon",name:"play",size:"16"}),t("span",{class:"is-size-7",textContent:i(s.$t("dialog.queue-item.play"))},null,8,lt)])])])]),t("button",{class:"modal-close is-large","aria-label":"close",onClick:n[6]||(n[6]=m=>s.$emit("close"))})])):l("",!0)]),_:1})])}const ht=r(x,[["render",mt]]);export{ht as M};