diff --git a/app/dashboard.php b/app/dashboard.php new file mode 100644 index 0000000..ad0732c --- /dev/null +++ b/app/dashboard.php @@ -0,0 +1,149 @@ +add(TabInnerHtml::getBehavior("dashboard_box", $htmlStr)); + + return $tab->getString(); + } + + function buildDashboard() { + $dashboard = ''; + + $hdhr = new DVRUI_HDHRjson(); + $hdhrRules = new DVRUI_Rules($hdhr); + $hdhrRules->processAllRules(); + $hdhrRecordings = new DVRUI_Recordings($hdhr); + $hdhrRecordings->processAllRecordings($hdhr); + $hdhrRecordings->sortRecordings('DD'); + + + $hardware = file_get_contents('style/dashboard_hardware.html'); + $hardware = str_replace('',getDashboardHardware($hdhr),$hardware); + $recent = file_get_contents('style/dashboard_recent.html'); + $recent = str_replace('',getRecentRecordings($hdhr,$hdhrRecordings),$recent); + $soon = file_get_contents('style/dashboard_upcoming.html'); + $soon = str_replace('',getSoon($hdhr,$hdhrRecordings,$hdhrRules),$soon); + + $dashboard .= $hardware; + $dashboard .= $recent; + $dashboard .= $soon; + + return $dashboard; + } + + function getDashboardHardware($hdhr) { + // Discover HDHR Devices + $devices = $hdhr->device_count(); + $hdhr_data = ''; + for ($i=0; $i < $devices; $i++) { + $hdhrEntry = file_get_contents('style/hdhrlist_entry.html'); + $hdhr_device_data = "" . $hdhr->get_device_id($i) . ""; + $hdhr_lineup_data = "" . $hdhr->get_device_channels($i) . " Channels"; + $hdhrEntry = str_replace('',$hdhr_device_data,$hdhrEntry); + $hdhrEntry = str_replace('',$hdhr_lineup_data,$hdhrEntry); + $hdhrEntry = str_replace('',$hdhr->get_device_model($i),$hdhrEntry); + $hdhrEntry = str_replace('',$hdhr->get_device_tuners($i) . ' tuners',$hdhrEntry); + $hdhrEntry = str_replace('',$hdhr->get_device_firmware($i),$hdhrEntry); + $hdhrEntry = str_replace('',$hdhr->get_device_legacy($i),$hdhrEntry); + $hdhrEntry = str_replace('',$hdhr->get_device_image($i),$hdhrEntry); + $hdhr_data .= $hdhrEntry ; + } + $engines = $hdhr->engine_count(); + for ($i=0; $i < $engines; $i++) { + $engineEntry = file_get_contents('style/recordenginelist_entry.html'); + $engineEntry = str_replace('',$hdhr->get_engine_image($i),$engineEntry); + $engineEntry = str_replace('',$hdhr->get_engine_name($i),$engineEntry); + $engineEntry = str_replace('',$hdhr->get_engine_version($i),$engineEntry); + $engineEntry = str_replace('',$hdhr->get_engine_space($i),$engineEntry); + $engine_discover_data = "" . $hdhr->get_engine_local_ip($i) . ""; + $engineEntry = str_replace('',$engine_discover_data,$engineEntry); + $engine_storage_data = "" . $hdhr->get_engine_storage_id($i) . ""; + $engineEntry = str_replace('',$engine_storage_data,$engineEntry); + $hdhr_data .= $engineEntry; + } + return $hdhr_data; + } + + function getRecentRecordings($hdhr, $hdhrRecordings) { + + $numRecordings = $hdhrRecordings->getRecordingCount(); + if ($numRecordings > 10) { + $numRecordings = 10; + } + + $recordingsData = ''; + for ($i=0; $i < $numRecordings; $i++) { + $recordingsEntry = file_get_contents('style/recordings_entry.html'); + $recordingsEntry = str_replace('',$hdhrRecordings->getRecordingID($i),$recordingsEntry); + $recordingsEntry = str_replace('',$hdhrRecordings->getSeriesID($i),$recordingsEntry); + $recordingsEntry = str_replace('',$hdhrRecordings->getRecordingImage($i),$recordingsEntry); + $recordingsEntry = str_replace('',$hdhrRecordings->getEpisodeNumber($i),$recordingsEntry); + $recordingsEntry = str_replace('',$hdhrRecordings->getEpisodeTitle($i),$recordingsEntry); + $recordingsEntry = str_replace('',$hdhrRecordings->getTitle($i),$recordingsEntry); + $recordingsEntry = str_replace('',$hdhrRecordings->get_PlayURL($i),$recordingsEntry); + $recordingsEntry = str_replace('',$hdhrRecordings->getRecordStartTime($i),$recordingsEntry); + $recordingsEntry = str_replace('',$hdhrRecordings->getStartTime($i),$recordingsEntry); + $recordingsEntry = str_replace('',$hdhrRecordings->getOriginalAirDate($i),$recordingsEntry); + $recordingsEntry = str_replace('',$hdhrRecordings->isRepeat($i),$recordingsEntry); + $recordingsEntry = str_replace('',$hdhrRecordings->getChannelName($i),$recordingsEntry); + $recordingsEntry = str_replace('',$hdhrRecordings->getChannelNumber($i),$recordingsEntry); + $recordingsEntry = str_replace('',$hdhrRecordings->getChannelAffiliate($i),$recordingsEntry); + $recordingsData .= $recordingsEntry; + } + + return $recordingsData; + } + + function getSoon($hdhr, $hdhrRecordings, $hdhrRules) { + $soonStr = ''; + + $upcoming = new DVRUI_Upcoming($hdhr,$hdhrRecordings); + $upcoming->initByRules($hdhrRules); + $numRules = $upcoming->getSeriesCount(); + for ($i=0; $i < $numRules; $i++) { + $upcoming->processNext($i); + } + + $upcoming->sortUpcomingByDate(); + $numShows = $upcoming->getUpcomingCount(); + if ($numShows > 10) { + $numShows = 10; + } + + for ($i=0;$i < $numShows;$i++) { + $entry = file_get_contents('style/upcoming_entry.html'); + $entry = str_replace('',$upcoming->getTitle($i),$entry); + $entry = str_replace('',$upcoming->getEpNum($i) . ' : ' . $upcoming->getEpTitle($i),$entry); + $entry = str_replace('',$upcoming->getEpOriginalAirDate($i),$entry); + $entry = str_replace('',$upcoming->getEpImg($i),$entry); + $entry = str_replace('',$upcoming->getEpStart($i),$entry); + $entry = str_replace('',$upcoming->getEpEnd($i),$entry); + $entry = str_replace('',$upcoming->getEpChannelNum($i),$entry); + $entry = str_replace('',$upcoming->getEpChannelName($i),$entry); + $soonStr .= $entry; + } + + + return $soonStr; + } + +?> \ No newline at end of file diff --git a/app/images/HDHR-DVR.png b/app/images/HDHR-DVR.png new file mode 100644 index 0000000..e11416d Binary files /dev/null and b/app/images/HDHR-DVR.png differ diff --git a/app/images/HDHR3-4DC.png b/app/images/HDHR3-4DC.png new file mode 100644 index 0000000..ca54e63 Binary files /dev/null and b/app/images/HDHR3-4DC.png differ diff --git a/app/images/HDHR3-CC.png b/app/images/HDHR3-CC.png new file mode 100644 index 0000000..8531479 Binary files /dev/null and b/app/images/HDHR3-CC.png differ diff --git a/app/images/HDHR3-US.png b/app/images/HDHR3-US.png new file mode 100644 index 0000000..d5cc42c Binary files /dev/null and b/app/images/HDHR3-US.png differ diff --git a/app/images/HDHR4-2US.png b/app/images/HDHR4-2US.png new file mode 100644 index 0000000..f2fde59 Binary files /dev/null and b/app/images/HDHR4-2US.png differ diff --git a/app/images/HDHR5-6CC.png b/app/images/HDHR5-6CC.png new file mode 100644 index 0000000..3f689db Binary files /dev/null and b/app/images/HDHR5-6CC.png differ diff --git a/app/images/HDHR5-US.png b/app/images/HDHR5-US.png new file mode 100644 index 0000000..d38ffe3 Binary files /dev/null and b/app/images/HDHR5-US.png differ diff --git a/app/images/HDTC-2US.png b/app/images/HDTC-2US.png new file mode 100644 index 0000000..344c864 Binary files /dev/null and b/app/images/HDTC-2US.png differ diff --git a/app/images/TECH4-2US.png b/app/images/TECH4-2US.png new file mode 100644 index 0000000..44c53ba Binary files /dev/null and b/app/images/TECH4-2US.png differ diff --git a/app/images/TECH4-8US.png b/app/images/TECH4-8US.png new file mode 100644 index 0000000..9419900 Binary files /dev/null and b/app/images/TECH4-8US.png differ diff --git a/app/images/TECH5-16DT.png b/app/images/TECH5-16DT.png new file mode 100644 index 0000000..e040df0 Binary files /dev/null and b/app/images/TECH5-16DT.png differ diff --git a/app/images/TECH5-36CC.png b/app/images/TECH5-36CC.png new file mode 100644 index 0000000..9de4376 Binary files /dev/null and b/app/images/TECH5-36CC.png differ diff --git a/app/images/no-preview.png b/app/images/no-preview.png new file mode 100644 index 0000000..a74c65e Binary files /dev/null and b/app/images/no-preview.png differ diff --git a/app/includes/.dvrui_common.php.swp b/app/includes/.dvrui_common.php.swp deleted file mode 100644 index 81da669..0000000 Binary files a/app/includes/.dvrui_common.php.swp and /dev/null differ diff --git a/app/includes/dvrui_common.php b/app/includes/dvrui_common.php index a520368..774eb45 100644 --- a/app/includes/dvrui_common.php +++ b/app/includes/dvrui_common.php @@ -1,4 +1,5 @@ diff --git a/app/includes/dvrui_hdhrjson.php b/app/includes/dvrui_hdhrjson.php index 8581d89..f20ec99 100644 --- a/app/includes/dvrui_hdhrjson.php +++ b/app/includes/dvrui_hdhrjson.php @@ -132,7 +132,7 @@ public function get_engine_local_ip($pos){ } public function get_engine_image($pos) { - return "https://www.silicondust.com/wp-content/uploads/2016/03/dvr-logo.png"; + return "./images/HDHR-DVR.png"; } public function get_engine_name($pos) { @@ -229,20 +229,38 @@ public function get_device_image($pos) { $device = $this->hdhrlist[$pos]; switch ($device[$this->hdhrkey_modelNum]) { case 'HDTC-2US': - return 'https://www.silicondust.com/wordpress/wp-content/uploads/2016/04/extend-logo-2.png'; + return './images/HDTC-2US.png'; case 'HDHR3-CC': - return 'https://www.silicondust.com/wordpress/wp-content/uploads/2016/04/prime-logo-2.png'; - case 'HDHR3-EU': + return './images/HDHR3-CC.png'; case 'HDHR3-4DC': - return 'https://www.silicondust.com/wordpress/wp-content/uploads/2016/04/expand-logo-2.png'; + return './images/HDHR3-4DC.png'; + case 'HDHR3-EU': case 'HDHR3-US': case 'HDHR3-DT': - return './images/HDHOMERUN_LEGACY.png'; + return './images/HDHR3-US.png'; case 'HDHR4-2US': case 'HDHR4-2DT': - return 'https://www.silicondust.com/wordpress/wp-content/uploads/2016/04/connect-logo.png'; + return './images/HDHR4-US.png'; + case 'HDHR5-DT': + case 'HDHR5-2US': + case 'HDHR5-4DC': + case 'HDHR5-4DT': + case 'HDHR5-4US': + return './images/HDHR5-US.png'; + case 'HDHR5-6CC': + return './images/HDHR5-6CC.png'; + case 'TECH4-2DT': + case 'TECH4-2US': + return './images/TECH4-2US.png'; + case 'TECH4-8US': + return './images/TECH4-8US.png'; + case 'TECH5-36CC': + return './images/TECH5-36CC.png'; + case 'TECH5-16DC': + case 'TECH5-16DT': + return './images/TECH5-16DT.png'; default: - return './images/HDHOMERUN_LEGACY.png'; + return './images/HDHR5-US.png'; } } diff --git a/app/includes/dvrui_recordings.php b/app/includes/dvrui_recordings.php index b27792a..9aba77e 100644 --- a/app/includes/dvrui_recordings.php +++ b/app/includes/dvrui_recordings.php @@ -92,7 +92,7 @@ private function processRecordingData($recording, $storageID) { $channelNumber = ''; $channelAffiliate = ''; $episodeNumber = 'X'; - $imageURL = ''; + $imageURL = NO_IMAGE; $episodeTitle = 'X'; $originalAirDate = ''; $recordStartTime = ''; diff --git a/app/includes/dvrui_rules.php b/app/includes/dvrui_rules.php index 9eff467..3c2ff0c 100644 --- a/app/includes/dvrui_rules.php +++ b/app/includes/dvrui_rules.php @@ -92,8 +92,8 @@ private function processRule($rule) { $recentOnly = 'X'; $airdate = ''; $synopsis = ""; - $image = ""; - + $image = NO_IMAGE; + if (array_key_exists($this->recording_ImageURL,$rule)){ $image = $rule[$this->recording_ImageURL]; } diff --git a/app/includes/dvrui_search.php b/app/includes/dvrui_search.php index 544ba37..9107d94 100644 --- a/app/includes/dvrui_search.php +++ b/app/includes/dvrui_search.php @@ -42,12 +42,12 @@ public function DVRUI_Search($hdhr, $searchStr) { } for ($i = 0; $i < count($search_info); $i++) { $seriesID = $search_info[$i][$this->search_SeriesID]; - $image = ""; + $image = NO_IMAGE; $title = $search_info[$i][$this->search_Title]; $originalAirDate = 0; $recordingRule = 0; - if (array_key_exists($this->search_ImageURL,$search_info[$i])){ - $image = $search_info[$i][$this->search_ImageURL]; + if (array_key_exists($this->search_ImageURL,$search_info[$i])) { + $image = $search_info[$i][$this->search_ImageURL]; } if (array_key_exists($this->search_Synopsis,$search_info[$i])){ $synopsis = $search_info[$i][$this->search_Synopsis]; diff --git a/app/includes/dvrui_upcoming.php b/app/includes/dvrui_upcoming.php index 0b13cd5..2919dd4 100644 --- a/app/includes/dvrui_upcoming.php +++ b/app/includes/dvrui_upcoming.php @@ -71,7 +71,7 @@ private function extractEpisodeInfo($episode){ $episodeNumber = ''; $episodeTitle = ''; $synopsis = ''; - $imageURL = ''; + $imageURL = NO_IMAGE; $originalAirDate = ''; $startTime = ''; $endTime = ''; @@ -112,7 +112,7 @@ private function extractEpisodeInfo($episode){ if (array_key_exists($this->epData_Synopsis,$episode)){ $synopsis = $episode[$this->epData_Synopsis]; } - if (array_key_exists($this->epData_ImageURL,$episode)){ + if (array_key_exists($this->epData_ImageURL,$episode)) { $imageURL = $episode[$this->epData_ImageURL]; } $this->upcoming_list[] = array( diff --git a/app/index.php b/app/index.php index de073b0..2029bdf 100644 --- a/app/index.php +++ b/app/index.php @@ -1,11 +1,17 @@ = 7) { + error_log( "PHP > 7 detected" ); + set_error_handler(function ($errno, $errstr) { + return strpos($errstr, 'Declaration of') === 0; + }, E_WARNING); + } error_reporting(E_ALL & ~(E_DEPRECATED | E_STRICT)); define('TINYAJAX_PATH', '.'); @@ -19,12 +25,14 @@ require_once("theme.php"); require_once("upcoming.php"); require_once("search.php"); + require_once("dashboard.php"); /* Prepare Ajax */ $ajax = new TinyAjax(); $ajax->setRequestType("POST"); // Change request-type from GET to POST $ajax->showLoading(); // Show loading while callback is in progress /* Export the PHP Interface */ + $ajax->exportFunction("openDashboardPage",""); $ajax->exportFunction("openSeriesPage",""); $ajax->exportFunction("openRulesPage","seriesid"); $ajax->exportFunction("openRecordingsPage","seriesid"); @@ -47,8 +55,8 @@ $stylesheet = getTheme(); //Build navigation menu for pages - $pageTitles = array('Series', 'Recordings', 'Upcoming','Rules', 'Search','.'); - $pageNames = array('series_page', 'recordings_page', 'upcoming_page', 'rules_page', 'search_page', 'settings_page'); + $pageTitles = array('Dashboard', 'Series', 'Recordings', 'Upcoming','Rules', 'Search','.'); + $pageNames = array('dashboard_page', 'series_page', 'recordings_page', 'upcoming_page', 'rules_page', 'search_page', 'settings_page'); $menu_data = file_get_contents('style/pagemenu.html'); $menuEntries = ''; for ($i=0; $i < count($pageNames); $i++) { @@ -71,6 +79,7 @@ // --- Build Body --- $indexPage = file_get_contents('style/index_page.html'); + $dashboarddata = file_get_contents('style/dashboard.html'); $rulesdata = file_get_contents('style/rules.html'); $recordingsdata = file_get_contents('style/recordings.html'); $seriesdata = file_get_contents('style/series.html'); @@ -82,6 +91,7 @@ $indexPage = str_replace('[[UI-Version]]',$UIVersion,$indexPage); $indexPage = str_replace('',$menu_data,$indexPage); + $indexPage = str_replace('',$dashboarddata,$indexPage); $indexPage = str_replace('',$seriesdata,$indexPage); $indexPage = str_replace('',$recordingsdata,$indexPage); $indexPage = str_replace('',$updata,$indexPage); diff --git a/app/rules.php b/app/rules.php index a6b3723..4c05ea9 100644 --- a/app/rules.php +++ b/app/rules.php @@ -123,7 +123,12 @@ function getRecordingRules($seriesid) { $reccount = $hdhrRecordings->getRecordingCountBySeries($hdhrRules->getRuleSeriesID($i)); $rulesEntry = file_get_contents('style/rules_entry.html'); $rulesEntry = str_replace('',$hdhrRules->getRuleRecID($i) ,$rulesEntry); - $rulesEntry = str_replace('',$hdhrRules->getRuleImage($i),$rulesEntry); + if (URLExists($hdhrRules->getRuleImage($i))) { + $rulesEntry = str_replace('',$hdhrRules->getRuleImage($i),$rulesEntry); + } else { + $rulesEntry = str_replace('',NO_IMAGE,$rulesEntry); + } + $rulesEntry = str_replace('',$hdhrRules->getRulePriority($i),$rulesEntry); $rulesEntry = str_replace('',$i-2,$rulesEntry); $rulesEntry = str_replace('',$i+1,$rulesEntry); @@ -143,7 +148,7 @@ function getRecordingRules($seriesid) { } // get upcoming count - $upcoming = new DVRUI_Upcoming($hdhr); + $upcoming = new DVRUI_Upcoming($hdhr, NULL); $upcoming->initBySeries($hdhrRules->getRuleSeriesID($i)); $upcomingcount = $upcoming->getUpcomingCount(); diff --git a/app/scripts/hdhomerundvr_ui.js b/app/scripts/hdhomerundvr_ui.js index bfd9c44..9fc2d75 100644 --- a/app/scripts/hdhomerundvr_ui.js +++ b/app/scripts/hdhomerundvr_ui.js @@ -203,6 +203,9 @@ function openTab(evt, tabname) { } // load the page + if (tabname == 'dashboard_page') { + openDashboardPage(); + } if (tabname == 'series_page') { openSeriesPage(""); } diff --git a/app/style/dashboard.html b/app/style/dashboard.html new file mode 100644 index 0000000..9e9df53 --- /dev/null +++ b/app/style/dashboard.html @@ -0,0 +1,4 @@ +
+
+
+
diff --git a/app/style/dashboard_hardware.html b/app/style/dashboard_hardware.html new file mode 100644 index 0000000..a45b516 --- /dev/null +++ b/app/style/dashboard_hardware.html @@ -0,0 +1,6 @@ +
+

Discovered Silicondust Devices

+
+ +
+
\ No newline at end of file diff --git a/app/style/dashboard_recent.html b/app/style/dashboard_recent.html new file mode 100644 index 0000000..719e7ba --- /dev/null +++ b/app/style/dashboard_recent.html @@ -0,0 +1,6 @@ +
+

Recent Recordings (10)

+
+ +
+
diff --git a/app/style/dashboard_upcoming.html b/app/style/dashboard_upcoming.html new file mode 100644 index 0000000..e6a0be2 --- /dev/null +++ b/app/style/dashboard_upcoming.html @@ -0,0 +1,6 @@ +
+

Upcoming Recordings (10)

+
+ +
+
diff --git a/app/style/header.html b/app/style/header.html index 327afd8..a522c52 100644 --- a/app/style/header.html +++ b/app/style/header.html @@ -29,4 +29,4 @@ - + diff --git a/app/style/index_page.html b/app/style/index_page.html index 9375cbd..8cb3488 100644 --- a/app/style/index_page.html +++ b/app/style/index_page.html @@ -13,6 +13,9 @@

[[pagetitle]]

+
+ +
diff --git a/app/themes/default/main.less b/app/themes/default/main.less index 276189f..607449e 100644 --- a/app/themes/default/main.less +++ b/app/themes/default/main.less @@ -28,8 +28,9 @@ br.clearfix { border: none; display: hidden; background: @PageBackgroundColor; - margin-top: 95px; + margin-top: 110px; } + .upcoming_datebreak { background: @EntryBorderColor; background-image: url("upcoming.png"); @@ -210,6 +211,36 @@ a.settings_page{ width: 100%; } +/* Dashboard Page ------------------------------------------------------------------------- */ +#dashboard_page { + #page; +} + +#dashboard_content { + width: 100%; +} + +.dashboard_content h4 { + font-style: bold; + color: @EntryTextColor; + text-shadow: 0 2px 2px #000; + font-size: 2em; +} + + +#dashboard_scroll { + overflow-x: scroll; + overflow-y: hidden; + white-space: nowrap; + height: 350px; +} + +#dashboard_hwlist, #recent_recordings_list, #soon_list_box { + #dashboard_scroll; +} + + + /* HDHR Tab ------------------------------------------------------------------------- */ #settings_page { diff --git a/app/vars.php b/app/vars.php index 94d814f..a360f19 100644 --- a/app/vars.php +++ b/app/vars.php @@ -1,7 +1,7 @@