-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathepisode.php
executable file
·90 lines (78 loc) · 2.83 KB
/
episode.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
<?php
include 'config.php';
include 'header.php';
// Get the show id from last page
$showid = $_GET['showid'];
$seasonid = $_GET['seasonid'];
// Check if username is available, set URL
$feed = $ip."/api/".$api."/?cmd=show.seasons&tvdbid=".$showid."&season=".$seasonid;
$feed2 = $ip."/api/".$api."/?cmd=show&tvdbid=".$showid;
$feed3 = "https://api.trakt.tv/show/episode/summary.json/".$trakt_api."/".$showid."/1/1";
// fetch trakt api
if ($trakt_enabled == "1")
{
$sbJSON = json_decode(file_get_contents($feed));
$tvdata = json_decode(file_get_contents($feed2));
$trakt = json_decode(file_get_contents($feed3));
}
else
{
$sbJSON = json_decode(file_get_contents($feed));
$tvdata = json_decode(file_get_contents($feed2));
}
// Grab Show Title
$title = $tvdata->{data}->{show_name};
//Display Browser Title
echo "<title>".$title." | Season ".$seasonid." | ".$site_name."</title>";
echo "<center>";
// What are you!?
echo "<h1>".$title." - Season ".$seasonid."</h1><br>";
echo "<button><a href='seasonlist.php?showid=".$showid."'>Back</a></button><br><br>";
// trakt.tv banner intragration
if ($trakt_enabled == "1")
{
printf("<img src=".$trakt->{show}->{images}->{banner}."><br><br>");
}
else
{
// Display Show Banner
printf("<img src=".$ip."/api/".$api."/?cmd=show.getbanner&tvdbid=".$showid."><br><br>");
}
// Define episode counter
$counter = "1";
// Run through each feed item
foreach($sbJSON->{data} as $show) {
// Show Details
echo "<button><a href='epdata.php?showid=".$showid."&seasonid=".$seasonid."&ep=".$counter."'><b>Episode:</b> " . $counter . "</a></button><br />";
echo "<b>Name:</b> " . $show->{name} . "<br />";
echo "<b>Aired:</b> " . $show->{airdate} . "<br />";
echo "<b>Quality:</b> " . $show->{quality} . " - Size: " . round($show->{file_size}/1024/1024,2) . " MB<br />";
if ($show->{status} == "Archived")
{
echo "<b>Status:</b><font color='#41A317'> Archived </font><br /><br />";
}
elseif ($show->{status} == "Snatched")
{
echo "<b>Status:</b><font color='#ec9fea'> Snatched </font><br /><br />";
}
elseif ($show->{status} == "Downloaded")
{
echo "<b>Status:</b><font color='#92e49f'> Downloaded </font><br /><br />";
}
elseif ($show->{status} == "Wanted")
{
echo "<b>Status:</b><font color='#306EFF'> Wanted </font><br /><br />";
}
elseif ($show->{status} == "Unaired")
{
echo "<b>Status:</b><font color='#f0e3ba'> Unaired </font><br /><br />";
}
else
{
echo "<b>Status:</b><font color='#8dceed'> Skipped </font><br /><br />";
}
$counter = $counter + "1";
}
include 'footer.php';
echo "</center>";
?>