Skip to content

Commit 32d679c

Browse files
committed
add live tv support
1 parent f49d0d0 commit 32d679c

File tree

3 files changed

+53
-14
lines changed

3 files changed

+53
-14
lines changed

public/php/Home/activity.php

Lines changed: 20 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,25 @@
88
$ACTIVITY = [];
99

1010
foreach ($CURRENT_ACTIVITY['response']['data']['sessions'] as $ACTIVITY_RAW) {
11-
if ($ACTIVITY_RAW['media_type'] == "episode") {
11+
if ($ACTIVITY_RAW['library_name'] == "Live TV") {
12+
$ACTIVITY[] = [
13+
'title' => "Live TV",
14+
'channel' => [
15+
'title' => $ACTIVITY_RAW['channel_call_sign'],
16+
'images' => [
17+
'logo' => $ACTIVITY_RAW['channel_thumb'],
18+
'poster' => $CONFIG->Proxy("rating_key=live&type=poster"),
19+
'art' => $CONFIG->Proxy("rating_key=live&type=art")
20+
]
21+
],
22+
'playback' => [
23+
'user' => $ACTIVITY_RAW['friendly_name'],
24+
'state' => $ACTIVITY_RAW['state'],
25+
'quality' => $ACTIVITY_RAW['stream_video_resolution'],
26+
],
27+
'mediatype' => 'live'
28+
];
29+
} else if ($ACTIVITY_RAW['media_type'] == "episode") {
1230
$ACTIVITY[] = [
1331
'title' => $ACTIVITY_RAW['title'],
1432
'series' => [
@@ -57,4 +75,4 @@
5775
header("Content-Type: application/json");
5876
echo json_encode($ACTIVITY);
5977

60-
?>
78+
?>

public/php/image.php

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,22 +5,32 @@
55
$CONFIG = new Config();
66
$IMAGE_CACHE_TIME = 60*60*24*3; //3 Days
77
$IMAGE_URL; // Could put a Placeholder image here
8+
$LIVE = false;
89

910
if (isset($_GET['radarr_id'])) {
1011
$IMAGE_URL = $CONFIG->Radarr("MediaCover/{$_GET['radarr_id']}/poster.jpg", null, false);
1112
} else if (isset($_GET['sonarr_id'])) {
1213
$IMAGE_URL = $CONFIG->Sonarr("MediaCover/{$_GET['sonarr_id']}/poster.jpg", null, false);
1314
} else if (isset($_GET['rating_key']) && isset($_GET['type'])) {
15+
if ($_GET['rating_key'] === 'live') $LIVE = true;
1416
$TYPE = $_GET['type'];
1517
if ($_GET['type'] == "art") {
16-
$OPTIONS = "&height=270&opacity=40&background=282828&blur=3&fallback=art";
18+
if ($LIVE) {
19+
$OPTIONS = "&height=270&opacity=40&background=282828&blur=3&fallback=art-live";
20+
} else {
21+
$OPTIONS = "&height=270&opacity=40&background=282828&blur=3&fallback=art";
22+
}
1723
} else {
18-
$OPTIONS = "&height=270&fallback=thumb";
24+
if ($LIVE) {
25+
$OPTIONS = "&height=270&fallback=poster-live";
26+
} else {
27+
$OPTIONS = "&height=270&fallback=poster";
28+
}
1929
}
2030
$IMAGE_URL = $CONFIG->Tautulli("pms_image_proxy", "img=/library/metadata/{$_GET['rating_key']}/{$TYPE}{$OPTIONS}", false);
2131
}
2232

2333
header("Content-Type: image/jpeg;");
2434
echo file_get_contents($IMAGE_URL);
2535

26-
?>
36+
?>

src/components/Home/Activity/ActivityItem.vue

Lines changed: 20 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,34 +1,42 @@
11
<template>
22
<li>
3-
<div class="bg_img" :style="{ 'background-image': 'url(' + (activity.series ? activity.series.images.art : activity.images.art) + ')' }">
3+
<div class="bg_img" :style="{ 'background-image': 'url(' + (activity.channel ? activity.channel.images.art : (activity.series ? activity.series.images.art : activity.images.art)) + ')' }">
44
<span>{{ activity.playback.user }}</span>
55
<span>{{ activity.playback.state }}</span>
66
</div>
7-
<div class="img" :style="{ 'background-image': 'url(' + (activity.series ? activity.series.images.poster : activity.images.poster) + ')' }">
7+
<div class="img" :style="{ 'background-image': 'url(' + (activity.channel ? activity.channel.images.poster : (activity.series ? activity.series.images.poster : activity.images.poster)) + ')' }"></div>
8+
<div v-if="activity.mediatype == 'live'" class="info" :data-type="activity.mediatype">
9+
<img :src="activity.channel.images.logo" />
10+
<p>
11+
<span>Channel:</span>
12+
{{ activity.channel.title }}
13+
</p>
814
</div>
9-
<div class="info" :data-type="activity.mediatype">
10-
<p v-if="activity.mediatype == 'episode'" v-title>
15+
<div v-if="activity.mediatype == 'episode'" class="info" :data-type="activity.mediatype">
16+
<p v-title>
1117
<span>Series:</span>
1218
{{ activity.series.title }}
1319
</p>
14-
<p v-if="activity.mediatype == 'episode'" v-title>
20+
<p v-title>
1521
<span>Episode Title:</span>
1622
{{ activity.title }}
1723
</p>
18-
<p v-if="activity.mediatype == 'episode'">
24+
<p>
1925
<span>Season:</span>
2026
{{ activity.series.season }}
2127
</p>
22-
<p v-if="activity.mediatype == 'episode'">
28+
<p>
2329
<span>Episode:</span>
2430
{{ activity.series.episode }}
2531
</p>
26-
<p v-if="activity.mediatype == 'movie'" v-title>
32+
</div>
33+
<div v-if="activity.mediatype == 'movie'" class="info" :data-type="activity.mediatype">
34+
<p>
2735
<span>Movie Title:</span>
2836
{{ activity.title }}
2937
</p>
3038
</div>
31-
<div id="progress">
39+
<div v-if="activity.mediatype != 'live'" id="progress">
3240
<span class="progress_text">{{ activity.playback.progress.time | MediaTime((+activity.playback.runtime >= 3600000)) }} / {{ activity.playback.runtime | MediaTime() }}</span>
3341
<span class="percent_text">{{ activity.playback.progress.percent + '%' }}</span>
3442
<span class="progress" :style="{ 'width': activity.playback.progress.percent + '%'}"></span>
@@ -102,6 +110,9 @@ div {
102110
left: 162px;
103111
width: 318px;
104112
height: 114px;
113+
&[data-type="live"] img {
114+
max-height: 114px;
115+
}
105116
&[data-type="movie"] {
106117
top: 145px;
107118
}

0 commit comments

Comments
 (0)