owntone-server/htdocs/assets/ListTracks.js

2 lines
11 KiB
JavaScript
Raw Normal View History

2023-12-14 15:00:28 -05:00
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.