mirror of
https://github.com/owntone/owntone-server.git
synced 2024-12-27 23:55:57 -05:00
2 lines
11 KiB
JavaScript
2 lines
11 KiB
JavaScript
import{S as v}from"./spotify-web-api.js";import{_ as p,e as _,r as m,o as i,c as o,d as u,w,a as t,t as a,k as c,T as $,F as C,f as q,q as x,g as y,h as z,B as T}from"./index.js";const B={name:"ModalDialogTrack",props:["show","track"],emits:["close","play-count-changed"],data(){return{spotify_track:{}}},watch:{track(){if(this.track&&this.track.data_kind==="spotify"&&this.track.media_kind!=="podcast"){const s=new v;s.setAccessToken(this.$store.state.spotify.webapi_token),s.getTrack(this.track.path.slice(this.track.path.lastIndexOf(":")+1)).then(n=>{this.spotify_track=n})}else this.spotify_track={}}},methods:{mark_new(){_.library_track_update(this.track.id,{play_count:"reset"}).then(()=>{this.$emit("play-count-changed"),this.$emit("close")})},mark_played(){_.library_track_update(this.track.id,{play_count:"increment"}).then(()=>{this.$emit("play-count-changed"),this.$emit("close")})},open_album(){this.track.data_kind==="spotify"&&this.track.media_kind!=="podcast"?this.$router.push({name:"music-spotify-album",params:{id:this.spotify_track.album.id}}):this.track.media_kind==="podcast"?this.$router.push({name:"podcast",params:{id:this.track.album_id}}):this.track.media_kind==="audiobook"?this.$router.push({name:"audiobooks-album",params:{id:this.track.album_id}}):this.track.media_kind==="music"&&this.$router.push({name:"music-album",params:{id:this.track.album_id}})},open_album_artist(){this.track.data_kind==="spotify"?this.$router.push({name:"music-spotify-artist",params:{id:this.spotify_track.artists[0].id}}):this.track.media_kind==="music"||this.track.media_kind==="podcast"?this.$router.push({name:"music-artist",params:{id:this.track.album_artist_id}}):this.track.media_kind==="audiobook"&&this.$router.push({name:"audiobooks-artist",params:{id:this.track.album_artist_id}})},open_genre(){this.$router.push({name:"genre-albums",params:{name:this.track.genre},query:{media_kind:this.track.media_kind}})},play(){this.$emit("close"),_.player_play_uri(this.track.uri,!1)},queue_add(){this.$emit("close"),_.queue_add(this.track.uri)},queue_add_next(){this.$emit("close"),_.queue_add_next(this.track.uri)}}},I={key:0,class:"modal is-active"},L={class:"modal-content fd-modal-card"},M={class:"card"},A={class:"card-content"},D=["textContent"],N=["textContent"],O={key:0,class:"buttons"},P=["textContent"],S=["textContent"],V={class:"content is-small"},j={key:0},F=["textContent"],K=["textContent"],E={key:1},H=["textContent"],W=["textContent"],G={key:2},J=["textContent"],Q=["textContent"],R={key:3},U=["textContent"],X=["textContent"],Y={key:4},Z=["textContent"],tt=["textContent"],et={key:5},st=["textContent"],at=["textContent"],nt={key:6},it=["textContent"],ot=["textContent"],lt={key:7},dt=["textContent"],ct=["textContent"],rt=["textContent"],_t=["textContent"],ut=["textContent"],kt={class:"title is-6"},ht=["textContent"],mt={key:8},Ct=["textContent"],pt={class:"title is-6"},gt=["textContent"],xt=["textContent"],yt=["textContent"],ft=["textContent"],bt=["textContent"],vt=["textContent"],wt=["textContent"],$t=["textContent"],qt={key:9},zt=["textContent"],Tt=["textContent"],Bt={class:"card-footer"},It=["textContent"],Lt=["textContent"],Mt=["textContent"];function At(s,n,e,g,h,l){const k=m("mdicon");return i(),o("div",null,[u($,{name:"fade"},{default:w(()=>[e.show?(i(),o("div",I,[t("div",{class:"modal-background",onClick:n[0]||(n[0]=d=>s.$emit("close"))}),t("div",L,[t("div",M,[t("div",A,[t("p",{class:"title is-4",textContent:a(e.track.title)},null,8,D),t("p",{class:"subtitle",textContent:a(e.track.artist)},null,8,N),e.track.media_kind==="podcast"?(i(),o("div",O,[e.track.play_count>0?(i(),o("a",{key:0,class:"button is-small",onClick:n[1]||(n[1]=(...d)=>l.mark_new&&l.mark_new(...d)),textContent:a(s.$t("dialog.track.mark-as-new"))},null,8,P)):c("",!0),e.track.play_count===0?(i(),o("a",{key:1,class:"button is-small",onClick:n[2]||(n[2]=(...d)=>l.mark_played&&l.mark_played(...d)),textContent:a(s.$t("dialog.track.mark-as-played"))},null,8,S)):c("",!0)])):c("",!0),t("div",V,[e.track.album?(i(),o("p",j,[t("span",{class:"heading",textContent:a(s.$t("dialog.track.album"))},null,8,F),t("a",{class:"title is-6 has-text-link",onClick:n[3]||(n[3]=(...d)=>l.open_album&&l.open_album(...d)),textContent:a(e.track.album)},null,8,K)])):c("",!0),e.track.album_artist&&e.track.media_kind!=="audiobook"?(i(),o("p",E,[t("span",{class:"heading",textContent:a(s.$t("dialog.track.album-artist"))},null,8,H),t("a",{class:"title is-6 has-text-link",onClick:n[4]||(n[4]=(...d)=>l.open_album_artist&&l.open_album_artist(...d)),textContent:a(e.track.album_artist)},null,8,W)])):c("",!0),e.track.composer?(i(),o("p",G,[t("span",{class:"heading",textContent:a(s.$t("dialog.track.composer"))},null,8,J),t("span",{class:"title is-6",textContent:a(e.track.composer)},null,8,Q)])):c("",!0),e.track.date_released?(i(),o("p",R,[t("span",{class:"heading",textContent:a(s.$t("dialog.track.release-date"))},null,8,U),t("span",{class:"title is-6",textContent:a(s.$filters.date(e.track.date_released))},null,8,X)])):e.track.year?(i(),o("p",Y,[t("span",{class:"heading",textContent:a(s.$t("dialog.track.year"))},null,8,Z),t("span",{class:"title is-6",textContent:a(e.track.year)},null,8,tt)])):c("",!0),e.track.genre?(i(),o("p",et,[t("span",{class:"heading",textContent:a(s.$t("dialog.track.genre"))},null,8,st),t("a",{class:"title is-6 has-text-link",onClick:n[5]||(n[5]=(...d)=>l.open_genre&&l.open_genre(...d)),textContent:a(e.track.genre)},null,8,at)])):c("",!0),e.track.disc_number?(i(),o("p",nt,[t("span",{class:"heading",textContent:a(s.$t("dialog.track.position"))},null,8,it),t("span",{class:"title is-6",textContent:a([e.track.disc_number,e.track.track_number].join(" / "))},null,8,ot)])):c("",!0),e.track.length_ms?(i(),o("p",lt,[t("span",{class:"heading",textContent:a(s.$t("dialog.track.duration"))},null,8,dt),t("span",{class:"title is-6",textContent:a(s.$filters.durationInHours(e.track.length_ms))},null,8,ct)])):c("",!0),t("p",null,[t("span",{class:"heading",textContent:a(s.$t("dialog.track.path"))},null,8,rt),t("span",{class:"title is-6",textContent:a(e.track.path)},null,8,_t)]),t("p",null,[t("span",{class:"heading",textContent:a(s.$t("dialog.track.type"))},null,8,ut),t("span",kt,[t("span",{textContent:a([s.$t("media.kind."+e.track.media_kind),s.$t("data.kind."+e.track.data_kind)].join(" - "))},null,8,ht)])]),e.track.samplerate?(i(),o("p",mt,[t("span",{class:"heading",textContent:a(s.$t("dialog.track.quality"))},null,8,Ct),t("span",pt,[t("span",{textContent:a(e.track.type)},null,8,gt),e.track.samplerate?(i(),o("span",{key:0,textContent:a(s.$t("dialog.track.samplerate",{rate:e.track.samplerate}))},null,8,xt)):c("",!0),e.track.channels?(i(),o("span",{key:1,textContent:a(s.$t("dialog.track.channels",{channels:s.$filters.channels(e.track.channels)}))},null,8,yt)):c("",!0),e.track.bitrate?(i(),o("span",{key:2,textContent:a(s.$t("dialog.track.bitrate",{rate:e.track.bitrate}))},null,8,ft)):c("",!0)])])):c("",!0),t("p",null,[t("span",{class:"heading",textContent:a(s.$t("dialog.track.added-on"))},null,8,bt),t("span",{class:"title is-6",textContent:a(s.$filters.datetime(e.track.time_added))},null,8,vt)]),t("p",null,[t("span",{class:"heading",textContent:a(s.$t("dialog.track.rating"))},null,8,wt),t("span",{class:"title is-6",textContent:a(s.$t("dialog.track.rating-value",{rating:Math.floor(e.track.rating/10)}))},null,8,$t)]),e.track.comment?(i(),o("p",qt,[t("span",{class:"heading",textContent:a(s.$t("dialog.track.comment"))},null,8,zt),t("span",{class:"title is-6",textContent:a(e.track.comment)},null,8,Tt)])):c("",!0)])]),t("footer",Bt,[t("a",{class:"card-footer-item has-text-dark",onClick:n[6]||(n[6]=(...d)=>l.queue_add&&l.queue_add(...d))},[u(k,{class:"icon",name:"playlist-plus",size:"16"}),t("span",{class:"is-size-7",textContent:a(s.$t("dialog.track.add"))},null,8,It)]),t("a",{class:"card-footer-item has-text-dark",onClick:n[7]||(n[7]=(...d)=>l.queue_add_next&&l.queue_add_next(...d))},[u(k,{class:"icon",name:"playlist-play",size:"16"}),t("span",{class:"is-size-7",textContent:a(s.$t("dialog.track.add-next"))},null,8,Lt)]),t("a",{class:"card-footer-item has-text-dark",onClick:n[8]||(n[8]=(...d)=>l.play&&l.play(...d))},[u(k,{class:"icon",name:"play",size:"16"}),t("span",{class:"is-size-7",textContent:a(s.$t("dialog.track.play"))},null,8,Mt)])])])]),t("button",{class:"modal-close is-large","aria-label":"close",onClick:n[9]||(n[9]=d=>s.$emit("close"))})])):c("",!0)]),_:1})])}const Dt=p(B,[["render",At]]),Nt={name:"ProgressBar",props:["max","value"]},Ot=["value","max"];function Pt(s,n,e,g,h,l){return e.value>0?(i(),o("progress",{key:0,class:"progress is-info",value:e.value,max:e.max},null,8,Ot)):c("",!0)}const St=p(Nt,[["render",Pt],["__scopeId","data-v-b2fd846d"]]),Vt={name:"ListTracks",components:{ModalDialogTrack:Dt,ProgressBar:St},props:["tracks","uris","expression","show_progress","show_icon"],emits:["play-count-changed"],data(){return{show_details_modal:!1,selected_track:{}}},methods:{play_track(s){this.uris?_.player_play_uri(this.uris,!1,this.tracks.items.indexOf(s)):this.expression?_.player_play_expression(this.expression,!1,this.tracks.items.indexOf(s)):_.player_play_uri(s.uri,!1)},open_dialog(s){this.selected_track=s,this.show_details_modal=!0}}},jt={key:0,class:"mt-6 mb-5 py-2"},Ft=["id","textContent"],Kt=["onClick"],Et={key:0,class:"media-left is-clickable"},Ht={class:"media-content is-clickable is-clipped"},Wt=["textContent"],Gt=["textContent"],Jt=["textContent"],Qt={class:"media-right"},Rt=["onClick"];function Ut(s,n,e,g,h,l){const k=m("mdicon"),d=m("progress-bar"),f=m("modal-dialog-track");return i(),o(C,null,[(i(!0),o(C,null,q(e.tracks,r=>(i(),o(C,{key:r.itemId},[r.isItem?(i(),o("div",{key:1,class:x(["media is-align-items-center",{"with-progress":e.show_progress}]),onClick:b=>l.play_track(r.item)},[e.show_icon?(i(),o("figure",Et,[u(k,{class:"icon",name:"file-outline",size:"16"})])):c("",!0),t("div",Ht,[t("h1",{class:x(["title is-6",{"has-text-grey":r.item.media_kind==="podcast"&&r.item.play_count>0}]),textContent:a(r.item.title)},null,10,Wt),t("h2",{class:"subtitle is-7 has-text-grey has-text-weight-bold",textContent:a(r.item.artist)},null,8,Gt),t("h2",{class:"subtitle is-7 has-text-grey",textContent:a(r.item.album)},null,8,Jt),e.show_progress?(i(),y(d,{key:0,max:r.item.length_ms,value:r.item.seek_ms},null,8,["max","value"])):c("",!0)]),t("div",Qt,[t("a",{onClick:z(b=>l.open_dialog(r.item),["prevent","stop"])},[u(k,{class:"icon has-text-dark",name:"dots-vertical",size:"16"})],8,Rt)])],10,Kt)):(i(),o("div",jt,[t("span",{id:"index_"+r.groupKey,class:"tag is-info is-light is-small has-text-weight-bold",textContent:a(r.groupKey)},null,8,Ft)]))],64))),128)),(i(),y(T,{to:"#app"},[u(f,{show:h.show_details_modal,track:h.selected_track,onClose:n[0]||(n[0]=r=>h.show_details_modal=!1),onPlayCountChanged:n[1]||(n[1]=r=>s.$emit("play-count-changed"))},null,8,["show","track"])]))],64)}const Zt=p(Vt,[["render",Ut]]);export{Zt as L};
|