aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/components/services
diff options
context:
space:
mode:
Diffstat (limited to 'src/components/services')
-rw-r--r--src/components/services/Emby.vue43
1 files changed, 22 insertions, 21 deletions
diff --git a/src/components/services/Emby.vue b/src/components/services/Emby.vue
index da8a020..4d54344 100644
--- a/src/components/services/Emby.vue
+++ b/src/components/services/Emby.vue
@@ -7,7 +7,7 @@
7 {{ item.subtitle }} 7 {{ item.subtitle }}
8 </template> 8 </template>
9 <template v-else> 9 <template v-else>
10 {{ embyCount }} 10 {{ embyCount }}
11 </template> 11 </template>
12 </p> 12 </p>
13 </template> 13 </template>
@@ -42,18 +42,19 @@ export default {
42 }), 42 }),
43 computed: { 43 computed: {
44 embyCount: function () { 44 embyCount: function () {
45 if(this.item.libraryType === 'music') 45 if (this.item.libraryType === "music")
46 return `${this.songCount} songs, ${this.albumCount} albums` 46 return `${this.songCount} songs, ${this.albumCount} albums`;
47 if(this.item.libraryType === 'movies') 47 else if (this.item.libraryType === "movies")
48 return `${this.movieCount} movies` 48 return `${this.movieCount} movies`;
49 if(this.item.libraryType === 'series') 49 else if (this.item.libraryType === "series")
50 return `${this.episodeCount} eps, ${this.seriesCount} series` 50 return `${this.episodeCount} eps, ${this.seriesCount} series`;
51 else return `wrong library type 💀`;
51 }, 52 },
52 }, 53 },
53 created() { 54 created() {
54 this.fetchServerStatus(); 55 this.fetchServerStatus();
55 56
56 if(!this.item.subtitle && this.status !== "dead") 57 if (!this.item.subtitle && this.status !== "dead")
57 this.fetchServerMediaStats(); 58 this.fetchServerMediaStats();
58 }, 59 },
59 methods: { 60 methods: {
@@ -61,25 +62,25 @@ export default {
61 const headers = { 62 const headers = {
62 "X-Emby-Token": this.item.apikey, 63 "X-Emby-Token": this.item.apikey,
63 }; 64 };
64 65
65 await this.fetch("/System/info/public", { headers }) 66 await this.fetch("/System/info/public", { headers })
66 .then(response => { 67 .then((response) => {
67 if(response.Id) 68 if (response.Id) this.status = "running";
68 this.status = "running"; 69 else this.status = "dead";
69 else 70 })
70 this.status = "dead"; 71 .catch((e) => {
71 }) 72 console.log(e);
72 .catch((e) => { 73 this.status = "dead";
73 console.log(e); 74 });
74 this.status = "dead";
75 });
76 }, 75 },
77 fetchServerMediaStats: async function () { 76 fetchServerMediaStats: async function () {
78 const headers = { 77 const headers = {
79 "X-Emby-Token": this.item.apikey, 78 "X-Emby-Token": this.item.apikey,
80 }; 79 };
81 80
82 var data = await this.fetch("/items/counts", { headers }).catch((e) => { console.log(e); }); 81 var data = await this.fetch("/items/counts", { headers }).catch((e) => {
82 console.log(e);
83 });
83 84
84 this.albumCount = data.AlbumCount; 85 this.albumCount = data.AlbumCount;
85 this.songCount = data.SongCount; 86 this.songCount = data.SongCount;