From 8a6274f7bd90bb9067653cefaeeb8529ee2927fe Mon Sep 17 00:00:00 2001
From: Moe Fwacky
Date: Thu, 2 May 2019 07:18:19 -0700
Subject: [PATCH] Add files via upload
---
adminConfig.php | 155 ++++++++++++++++++++++++++++++
config.php | 64 +++++++++++++
control.php | 67 +++++++++++++
getData.php | 246 ++++++++++++++++++++++++++++++++++++++++++++++++
index.php | 151 +++++++++++++++++++++++++++++
psConfig.php | 7 ++
schedule.php | 112 ++++++++++++++++++++++
status.php | 64 +++++++++++++
8 files changed, 866 insertions(+)
create mode 100644 adminConfig.php
create mode 100644 config.php
create mode 100644 control.php
create mode 100644 getData.php
create mode 100644 index.php
create mode 100644 psConfig.php
create mode 100644 schedule.php
create mode 100644 status.php
diff --git a/adminConfig.php b/adminConfig.php
new file mode 100644
index 0000000..73fddcb
--- /dev/null
+++ b/adminConfig.php
@@ -0,0 +1,155 @@
+
+TV: $boxname";
+ } else {
+ $boxname = trim($tvbox, $pseudochannelTrim . "_");
+ $boxes .= "TV: $boxname";
+ }
+}
+$clientcount = 1;
+foreach ($clientsxml->Server as $key => $xmlarray) {
+ $clientinfodump .= "Plex Client #$clientcount $xmlarray[name] ";
+ $clientinfodump .= " $xmlarray[address] ";
+ $clientinfodump .= " $xmlarray[machineIdentifier] ";
+ $clientcount = $clientcount + 1;
+ }
+?>
+
+
+
+
+
+
+ FakeTV Guide and Control
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ ";
+ echo $txt;
+ fwrite($myfile, $txt);
+ fclose($myfile);
+ $update = "1";
+
+ } ?>
+
+
+
+
+
+
+
+
+
+
diff --git a/config.php b/config.php
new file mode 100644
index 0000000..fdefd11
--- /dev/null
+++ b/config.php
@@ -0,0 +1,64 @@
+Server as $key => $clientdata) {
+ $clientname = $clientdata[name];
+ if($clientname == $plexClientName) {
+ $plexClientIP = $clientdata[address];
+ $plexClient = trim($plexClientIP);
+ $plexClientUID = $clientdata[machineIdentifier];
+ }
+}
+?>
diff --git a/control.php b/control.php
new file mode 100644
index 0000000..0aba2e7
--- /dev/null
+++ b/control.php
@@ -0,0 +1,67 @@
+
diff --git a/getData.php b/getData.php
new file mode 100644
index 0000000..53d73e7
--- /dev/null
+++ b/getData.php
@@ -0,0 +1,246 @@
+";
+ $top_line = "";
+ $middle_line = "
";
+ $bottom_line = "
";
+ $side_channel = "
Channel $channel_num
";
+
+ $position_half = "
";
+}
+
+if ($DisplayType == 'full') {
+ foreach ($xml->Video as $playdata) {
+ if($playdata->Player['title'] == $plexClientName) {
+ $video_duration = (int)$playdata['duration'];
+ if($playdata['type'] == "movie") {
+ if ($video_duration < "1800000") { //COMMERCIAL
+ $text_color='cyan';
+ $text_color_alt='cyan';
+ } else { //MOVIE
+ $text_color='yellow';
+ $text_color_alt='white';
+ }
+ } elseif($playdata['type'] == "show" || $playdata['parentTitle'] != "") { //TV SHOW
+ $text_color='yellow';
+ $text_color_alt='white';
+ } else {
+ $text_color='cyan';
+ $text_color_alt='cyan';
+ }
+ }
+ }
+
+# SET FULL OPTIONS
+ $time_style = "";
+ $top_line = "
";
+ $middle_line = "
";
+ $bottom_line = "
";
+ $side_channel = "
Channel $channel_num
";
+
+ $position_play_full = "
";
+ $position_idle_full = "
";
+}
+
+if(strcmp($channel_num," ")<=0){
+ $channel_num=0;
+}
+
+//If Nothing is Playing
+$text_color='cyan';
+$text_color_alt='cyan';
+if ($DisplayType == 'full') {
+ $position=$position_idle_full;
+}
+if ($DisplayType == 'half') {
+ $position=$position_half;
+}
+if ($pgrep >= 1) { //PSEUDO CHANNEL ON
+ $top_section = $time_style . $date . "
" . $position;
+ $middle_section = $top_line . "Channel $channel_num";
+ $bottom_section = $middle_line . "";
+ $nowplaying = "Channel $channel_num Standing By...";
+} else { //PSEUDO CHANNEL OFF
+ $top_section = $time_style . $date . "" . $position;
+ $middle_section = $top_line . $day . "";
+ $bottom_section = "";
+ $nowplaying = "Please Stand By...";
+}
+
+ if ($xml['size'] != '0') { //IF PLAYING CONTENT
+ foreach ($xml->Video as $clients) {
+ if($clients->Player['title'] == $plexClientName) { //If the active client on plex matches the client in the config
+ //IF PLAYING COMMERCIAL
+ if($clients['type'] == "movie" && $clients['duration'] < 1800000) {
+ #$text_color='cyan';
+ #$text_color_alt='cyan';
+ if ($DisplayType == 'full') {
+ $position=$position_idle_full;
+ }
+ if ($DisplayType == 'half') {
+ $position=$position_half;
+ }
+ $top_section = $time_style . $date . "" . $position;
+ $middle_section = $top_line . $clients['librarySectionTitle'] . "";
+ $bottom_section = "";
+ $title_clean = str_replace("_", " ", $clients['title']);
+ $nowplaying = "Now Playing: " . $title_clean . " on Channel ". $channel_num . "";
+ }
+ //IF PLAYING MOVIE
+ if($clients['type'] == "movie" && $clients['duration'] >= 1800000) {
+ $text_color='yellow';
+ $text_color_alt='white';
+ if ($DisplayType == 'half') {
+ $art = $clients['thumb'];
+ $background_art = "
";
+ $position=$position_half;
+ }
+ if ($DisplayType == 'full') {
+ $art = $clients['art'];
+ $background_art = "
";
+ $position=$position_play_full;
+ }
+
+ $top_section = $background_art . $time_style . $date . $side_channel . "" . $position;
+ $middle_section = $top_line . $clients['title'] . $middle_line . $clients['year'] . "";
+ $bottom_section = $bottom_line . $clients['tagline'] . "";
+ $nowplaying = "Now Playing: " . $clients['title'] . " (" . $clients['year'] . ")" . " on Channel ". $channel_num . "";
+ }
+ //IF PLAYING TV SHOW
+ if($clients['type'] == "show" || $clients['parentTitle'] != "") {
+ if ($DisplayType == 'half') {
+ $art = $clients['parentThumb'];
+ $background_art = "
";
+ $position=$position_half;
+ }
+ if ($DisplayType == 'full') {
+ $art = $clients['grandparentArt'];
+ $background_art = "
";
+ $position=$position_play_full;
+ $text_color='yellow';
+ $text_color_alt='white';
+ }
+ $top_section = $background_art . $time_style . $date . "" . $position;
+ $middle_section = $top_line . $clients['grandparentTitle'] . "" . $middle_line . $clients['parentTitle'] . ", Episode " . $clients['index'] . "";
+ $bottom_section = $bottom_line . $clients['title'] . "" . $side_channel . "";
+ $nowplaying = "Now Playing: " . $clients['grandparentTitle'] . " • " . $clients['parentTitle'] . ", Episode " . $clients['index'] . " • " . $clients['title'] . " on Channel ". $channel_num . "";
+ }
+ }
+ }
+ }
+
+//BUILD DAILY SCHEDULE PAGES
+$doheader = "0";
+foreach ($dircontents as $xmlfile) { //do the following for each xml schedule file
+ $xmldata = simplexml_load_file($xmlfile); //load the xml schedule file
+ foreach($xmldata->time as $attributes) { //for each entry in the schedule, do the following
+ $start_time_unix = strtotime($attributes['time-start']); //get the entry start time
+ $start_time_human = date("H:i", $start_time_unix); //convert start time to readable format
+ $duration_seconds = $attributes['duration']/1000; //get entry duration and convert to seconds
+ $duration_seconds = $duration_seconds-1;
+ $end_time_unix = $start_time_unix + $duration_seconds; //using start time and duration, calculate the end time
+ $end_time_human = date("H:i", $end_time_unix); //end time in readable format
+ $ch_file = str_replace($pseudochannelMaster . "pseudo-channel_", "ch", $xmlfile); //get channel number
+ $ch_file = str_replace("/schedules/pseudo_schedule.xml", "", $ch_file);
+ $ch_number = str_replace("ch", "", $ch_file);
+ if ($doheader != "1") {
+ $tableheader = "| Channel | Time | Title |
";
+ $chantableheader = "| ";
+ $nowtable = $tableheader;
+ $doheader = "1";
+ }
+ if ($chnum == $ch_number) {
+ $channelplaying = "font-weight:bold;font-size:1.1em";
+ } else {
+ $channelplaying = "";
+ }
+ if ($rightnow >= $start_time_unix && $rightnow <= $end_time_unix) {
+ $nowtable .= " |
|---|
| " . $ch_number . " | ";
+ $nowtable .= "" . $start_time_human . " - " . $end_time_human . " | ";
+ $nowtable .= " ";
+ if ($attributes['type'] == "TV Shows") {
+ $nowtable .= $attributes['show-title'];
+ $nowtable .= " S" . $attributes['show-season'] . "E" . $attributes['show-episode'] . " - " . $attributes['title'] . " | ";
+ } elseif ($attributes['type'] == "Commercials") {
+ $nowtable .= $attributes['type'] . "";
+ } else {
+ $nowtable .= $attributes['title'] . "";
+ }
+ }
+ if ($results[$ch_file] == "") {
+ $results[$ch_file] = $chantableheader . "Channel " . $ch_number . "
Time | Title | ";
+ }
+ if ($rightnow >= $start_time_unix && $rightnow < $end_time_unix) {
+ $isnowplaying = "font-weight:bold;font-size:1.2em";
+ } else {
+ $isnowplaying = "";
+ }
+ if ($attributes['type'] != "Commercials") {
+ $results[$ch_file] .= "";
+ $results[$ch_file] .= "| " . $start_time_human . " - " . $end_time_human . " | ";
+ $results[$ch_file] .= " ";
+ if ($attributes['type'] == "TV Shows") {
+ $results[$ch_file] .= $attributes['show-title'];
+ $results[$ch_file] .= " S" . $attributes['show-season'] . "E" . $attributes['show-episode'] . " - " . $attributes['title'] . " | ";
+ } elseif ($attributes['type'] == "Commercials") {
+ $results[$ch_file] .= $attributes['type'] . "";
+ } else {
+ $results[$ch_file] .= $attributes['title'] . "";
+ }
+ }
+ }
+}
+$nowtable .= "
";
+$results[$ch_file] .= "
";
+$results['rightnow'] = $nowtable;
+$results['top'] = "$top_section";
+$results['middle'] = "$middle_section $bottom_section";
+$results['bottom'] = "";
+$results['nowplaying'] = "$nowplaying";
+echo json_encode($results);
+?>
diff --git a/index.php b/index.php
new file mode 100644
index 0000000..b9bcb09
--- /dev/null
+++ b/index.php
@@ -0,0 +1,151 @@
+
+TV: $boxname";
+ } else {
+ $boxname = trim($tvbox, $pseudochannelTrim . "_");
+ $boxes .= "TV: $boxname";
+ }
+}
+$clientcount = 1;
+foreach ($clientsxml->Server as $key => $xmlarray) {
+ $clientinfodump .= "Plex Client #$clientcount $xmlarray[name] ";
+ $clientinfodump .= " $xmlarray[address] ";
+ $clientinfodump .= " $xmlarray[machineIdentifier] ";
+ $clientcount = $clientcount + 1;
+ }
+?>
+
+
+
+
+
+
+ FakeTV Guide and Control
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ ";
+ echo $txt;
+ fwrite($myfile, $txt);
+ fclose($myfile);
+ $update = "1";
+
+ } ?>
+
+
+
+
+
+
Pseudo Channel Web Interface
+
+
+ Settings File Updated.
";
+ } ?>
+
+
+
+
+ - Use this web interface to control your Pseudo Channel instance.
+ - Click the menu icon in the top left to access the Now Playing pages.
+ - Use the buttons at the top of the page to flip through your channels or to turn it off.
+
+
- Pseudo Channel is a near-recreation of the classic broadcast television experience using your Plex Server as a base.
+ - Use Pseudo Channel to schedule shows and random movie blocks with user-defined commercials in between.
+
+
+
+
+
+
+
+
+
+
diff --git a/psConfig.php b/psConfig.php
new file mode 100644
index 0000000..b835c39
--- /dev/null
+++ b/psConfig.php
@@ -0,0 +1,7 @@
+
+
\ No newline at end of file
diff --git a/schedule.php b/schedule.php
new file mode 100644
index 0000000..9578086
--- /dev/null
+++ b/schedule.php
@@ -0,0 +1,112 @@
+
+TV: $boxname";
+ } else {
+ $boxname = trim($tvbox, $pseudochannelTrim . "_");
+ $boxes .= "TV: $boxname";
+ }
+}
+?>
+
+
+
+
+
+
+ FakeTV Guide and Control
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
Please Stand By php echo $plexClientName; ?>
+
+
+ -
+
+
+
+ - Up
+ - Down
+ - Stop
+
+
+
+
+
+
+
+
diff --git a/status.php b/status.php
new file mode 100644
index 0000000..c9b2a20
--- /dev/null
+++ b/status.php
@@ -0,0 +1,64 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+