mirror of
https://github.com/owntone/owntone-server.git
synced 2024-12-28 08:05:56 -05:00
2 lines
5.7 KiB
JavaScript
2 lines
5.7 KiB
JavaScript
|
import{_ as k,e as h,r as p,o as _,c as u,d as n,w as c,a as e,h as $,t as l,j as x,Z as P,k as w,T as z,$ as D,S as A,g as L}from"./index.js";import{C as T}from"./ContentWithHeading.js";import{G as C}from"./GroupByList.js";import{L as B}from"./ListAlbums.js";import{L as E}from"./ListTracks.js";import"./CoverArtwork.js";import"./ModalDialogAlbum.js";import"./spotify-web-api.js";const N={name:"ModalDialogAddRss",props:["show"],emits:["close","podcast-added"],data(){return{url:"",loading:!1}},watch:{show(){this.show&&(this.loading=!1,setTimeout(()=>{this.$refs.url_field.focus()},10))}},methods:{add_stream(){this.loading=!0,h.library_add(this.url).then(()=>{this.$emit("close"),this.$emit("podcast-added"),this.url=""}).catch(()=>{this.loading=!1})}}},S={key:0,class:"modal is-active"},G={class:"modal-content fd-modal-card"},M={class:"card-content"},O=["textContent"],R={class:"field"},U={class:"control is-expanded has-icons-left"},V=["placeholder","disabled"],I=["textContent"],j={key:0,class:"card-footer"},H={class:"card-footer-item has-text-dark"},W=["textContent"],q={key:1,class:"card-footer is-clipped"},K=["textContent"],Z=["textContent"];function F(t,s,m,g,a,o){const r=p("mdicon");return _(),u("div",null,[n(z,{name:"fade"},{default:c(()=>[m.show?(_(),u("div",S,[e("div",{class:"modal-background",onClick:s[0]||(s[0]=d=>t.$emit("close"))}),e("div",G,[e("form",{class:"card",onSubmit:s[4]||(s[4]=$((...d)=>o.add_stream&&o.add_stream(...d),["prevent"]))},[e("div",M,[e("p",{class:"title is-4",textContent:l(t.$t("dialog.add.rss.title"))},null,8,O),e("div",R,[e("p",U,[x(e("input",{ref:"url_field","onUpdate:modelValue":s[1]||(s[1]=d=>a.url=d),class:"input is-shadowless",type:"url",pattern:"http[s]?://.*",required:"",placeholder:t.$t("dialog.add.rss.placeholder"),disabled:a.loading},null,8,V),[[P,a.url]]),n(r,{class:"icon is-left",name:"rss",size:"16"})]),e("p",{class:"help",textContent:l(t.$t("dialog.add.rss.help"))},null,8,I)])]),a.loading?(_(),u("footer",j,[e("a",H,[n(r,{class:"icon",name:"web",size:"16"}),e("span",{class:"is-size-7",textContent:l(t.$t("dialog.add.rss.processing"))},null,8,W)])])):(_(),u("footer",q,[e("a",{class:"card-footer-item has-text-dark",onClick:s[2]||(s[2]=d=>t.$emit("close"))},[n(r,{class:"icon",name:"cancel",size:"16"}),e("span",{class:"is-size-7",textContent:l(t.$t("dialog.add.rss.cancel"))},null,8,K)]),e("a",{class:"card-footer-item has-background-info has-text-white has-text-weight-bold",onClick:s[3]||(s[3]=(...d)=>o.add_stream&&o.add_stream(...d))},[n(r,{class:"icon",name:"playlist-plus",size:"16"}),e("span",{class:"is-size-7",textContent:l(t.$t("dialog.add.rss.add"))},null,8,Z)])]))],32)]),e("button",{class:"modal-close is-large","aria-label":"close",onClick:s[5]||(s[5]=d=>t.$emit("close"))})])):w("",!0)]),_:1})])}const J=k(N,[["render",F]]),f={load(t){return Promise.all([h.library_albums("podcast"),h.library_podcasts_new_episodes()])},set(t,s){t.albums=new C(s[0].data),t.new_episodes=new C(s[1].data.tracks)}},Q={name:"PagePodcasts",components:{ContentWithHeading:T,ListTracks:E,ListAlbums:B,ModalDialogAddRss:J},beforeRouteEnter(t,s,m){f.load(t).then(g=>{m(a=>f.set(a,g))})},beforeRouteUpdate(t,s,m){const g=this;f.load(t).then(a=>{f.set(g,a),m()})},data(){return{albums:[],new_episodes:{items:[]},show_url_modal:!1}},computed:{rss(){return this.$store.state.rss_count}},methods:{mark_all_played(){this.new_episodes.items.forEach(t=>{h.library_track_update(t.id,{play_count:"increment"})}),this.new_episodes.items={}},open_add_podcast_dialog(t){this.show_url_modal=!0},reload_new_episodes(){h.library_podcasts_new_episodes().then(({data:t})=>{this.new_episodes=new C(t.tracks)})},reload_podcasts(){h.library_albums("podcast").then(({data:t})=>{this.albums=new C(t),this.reload_new_episodes()})},update_rss(){this.$store.commit(D,"rss"),this.$store.commit(A,!0)}}},X=["textContent"],Y={class:"buttons is-centered"},ss=["textContent"],ts=["textContent"],es=["textContent"],os={class:"buttons is-centered"},as=["textContent"],ns=["textContent"];function ls(t,s,m,g,a,o){const r=p("mdicon"),d=p("list-tracks"),b=p("content-
|