1 line
1.7 KiB
JavaScript
1 line
1.7 KiB
JavaScript
import{s as l}from"./service.541fc1e6.js";import{_ as d,G as C,r as b,o as i,c as y,w as a,a as r,t as o,b as n,F as u,d as c,n as _,e as p}from"./index.868de8fa.js";const f={name:"Emby",mixins:[l],props:{item:Object},components:{Generic:C},data:()=>({status:"",albumCount:0,songCount:0,movieCount:0,seriesCount:0,episodeCount:0}),computed:{embyCount:function(){return this.item.libraryType==="music"?`${this.songCount} songs, ${this.albumCount} albums`:this.item.libraryType==="movies"?`${this.movieCount} movies`:this.item.libraryType==="series"?`${this.episodeCount} eps, ${this.seriesCount} series`:"wrong library type \u{1F480}"}},created(){this.fetchServerStatus(),!this.item.subtitle&&this.status!=="dead"&&this.fetchServerMediaStats()},methods:{fetchServerStatus:async function(){this.fetch("/System/info/public").then(t=>{if(t.Id)this.status="running";else throw new Error}).catch(t=>{console.log(t),this.status="dead"})},fetchServerMediaStats:async function(){const t={"X-Emby-Token":this.item.apikey};var e=await this.fetch("/items/counts",{headers:t}).catch(s=>{console.log(s)});this.albumCount=e.AlbumCount,this.songCount=e.SongCount,this.movieCount=e.MovieCount,this.seriesCount=e.SeriesCount,this.episodeCount=e.EpisodeCount}}},v={class:"title is-4"},g={class:"subtitle is-6"};function S(t,e,s,k,E,m){const h=b("Generic");return i(),y(h,{item:s.item},{content:a(()=>[r("p",v,o(s.item.name),1),r("p",g,[s.item.subtitle?(i(),n(u,{key:0},[c(o(s.item.subtitle),1)],64)):(i(),n(u,{key:1},[c(o(m.embyCount),1)],64))])]),indicator:a(()=>[t.status?(i(),n("div",{key:0,class:_(["status",t.status])},o(t.status),3)):p("",!0)]),_:1},8,["item"])}const x=d(f,[["render",S],["__scopeId","data-v-951da6b7"]]);export{x as default};
|