aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
-rw-r--r--docs/customservices.md24
-rw-r--r--src/components/services/Emby.vue118
2 files changed, 141 insertions, 1 deletions
diff --git a/docs/customservices.md b/docs/customservices.md
index cb68e1d..49798a8 100644
--- a/docs/customservices.md
+++ b/docs/customservices.md
@@ -6,7 +6,16 @@ apikey included in the configuration file is exposed to anyone who can access th
6if your homer instance is secured behind some form of authentication or access restriction. 6if your homer instance is secured behind some form of authentication or access restriction.
7 7
8Available services are in `src/components/`. Here is an overview of all custom services that are available 8Available services are in `src/components/`. Here is an overview of all custom services that are available
9within Homer. 9within Homer:
10+ [PiHole](#pihole)
11+ [OpenWeatherMap](#openweathermap)
12+ [Medusa](#medusa)
13+ [Lidarr, Prowlarr, Sonarr and Radarr](#lidarr-prowlarr-sonarr-and-radarr)
14+ [PaperlessNG](#paperlessng)
15+ [Ping](#ping)
16+ [Prometheus](#prometheus)
17+ [Portainer](#portainer)
18+ [Emby](#emby)
10 19
11If you experiencing any issue, please have a look to the [troubleshooting](troubleshooting.md) page. 20If you experiencing any issue, please have a look to the [troubleshooting](troubleshooting.md) page.
12 21
@@ -141,3 +150,16 @@ See https://docs.portainer.io/v/ce-2.11/user/account-settings#access-tokens
141 type: "Portainer" 150 type: "Portainer"
142 apikey: "MY-SUPER-SECRET-API-KEY" 151 apikey: "MY-SUPER-SECRET-API-KEY"
143``` 152```
153
154## Emby
155
156You need to set the type to Emby, provide an api key and choose which stats to show if the subtitle is disabled.
157
158```yaml
159- name: "Emby"
160 logo: "assets/tools/sample.png"
161 url: "http://192.168.0.151/"
162 type: "Emby"
163 apikey: "MY-SUPER-SECRET-API-KEY"
164 libraryType: "music" #Choose which stats to show. Can be one of: music, series or movies.
165```
diff --git a/src/components/services/Emby.vue b/src/components/services/Emby.vue
new file mode 100644
index 0000000..25a2612
--- /dev/null
+++ b/src/components/services/Emby.vue
@@ -0,0 +1,118 @@
1<template>
2 <Generic :item="item">
3 <template #content>
4 <p class="title is-4">{{ item.name }}</p>
5 <p class="subtitle is-6">
6 <template v-if="item.subtitle">
7 {{ item.subtitle }}
8 </template>
9 <template v-else>
10 {{ embyCount }}
11 </template>
12 </p>
13 </template>
14 <template #indicator>
15 <div v-if="status" class="status" :class="status">
16 {{ status }}
17 </div>
18 </template>
19 </Generic>
20</template>
21
22<script>
23import service from "@/mixins/service.js";
24import Generic from "./Generic.vue";
25
26export default {
27 name: "Emby",
28 mixins: [service],
29 props: {
30 item: Object,
31 },
32 components: {
33 Generic,
34 },
35 data: () => ({
36 status: "",
37 albumCount: 0,
38 songCount: 0,
39 movieCount: 0,
40 seriesCount: 0,
41 episodeCount: 0,
42 }),
43 computed: {
44 embyCount: function () {
45 if (this.item.libraryType === "music")
46 return `${this.songCount} songs, ${this.albumCount} albums`;
47 else if (this.item.libraryType === "movies")
48 return `${this.movieCount} movies`;
49 else if (this.item.libraryType === "series")
50 return `${this.episodeCount} eps, ${this.seriesCount} series`;
51 else return `wrong library type 💀`;
52 },
53 },
54 created() {
55 this.fetchServerStatus();
56
57 if (!this.item.subtitle && this.status !== "dead")
58 this.fetchServerMediaStats();
59 },
60 methods: {
61 fetchServerStatus: async function () {
62 this.fetch("/System/info/public")
63 .then((response) => {
64 if (response.Id) this.status = "running";
65 else throw new Error();
66 })
67 .catch((e) => {
68 console.log(e);
69 this.status = "dead";
70 });
71 },
72 fetchServerMediaStats: async function () {
73 const headers = {
74 "X-Emby-Token": this.item.apikey,
75 };
76
77 var data = await this.fetch("/items/counts", { headers }).catch((e) => {
78 console.log(e);
79 });
80
81 this.albumCount = data.AlbumCount;
82 this.songCount = data.SongCount;
83 this.movieCount = data.MovieCount;
84 this.seriesCount = data.SeriesCount;
85 this.episodeCount = data.EpisodeCount;
86 },
87 },
88};
89</script>
90
91<style scoped lang="scss">
92.status {
93 font-size: 0.8rem;
94 color: var(--text-title);
95
96 &.running:before {
97 background-color: #94e185;
98 border-color: #78d965;
99 box-shadow: 0 0 5px 1px #94e185;
100 }
101
102 &.dead:before {
103 background-color: #c9404d;
104 border-color: #c42c3b;
105 box-shadow: 0 0 5px 1px #c9404d;
106 }
107
108 &:before {
109 content: " ";
110 display: inline-block;
111 width: 7px;
112 height: 7px;
113 margin-right: 10px;
114 border: 1px solid #000;
115 border-radius: 7px;
116 }
117}
118</style>