Skip to content
This repository has been archived by the owner on Aug 28, 2022. It is now read-only.

Commit

Permalink
upcoming page by series id
Browse files Browse the repository at this point in the history
  • Loading branch information
avandeputte authored Oct 21, 2016
1 parent 8d0ecd1 commit 0a85524
Show file tree
Hide file tree
Showing 5 changed files with 55 additions and 17 deletions.
2 changes: 1 addition & 1 deletion app/index.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
$ajax->exportFunction("openHDHRPage","");
$ajax->exportFunction("openServerPage","");
$ajax->exportFunction("openSearchPage","searchString");
$ajax->exportFunction("openUpcomingPage","");
$ajax->exportFunction("openUpcomingPage","seriesid");
$ajax->exportFunction("deleteRecordingByID","id, rerecord, seriesid");
$ajax->exportFunction("deleteRuleByID","id");
$ajax->exportFunction("deleteRuleFromSearch","searchstring, id");
Expand Down
1 change: 1 addition & 0 deletions app/rules.php
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,7 @@ function getRecordingRules($seriesid) {
$rulesEntry = str_replace('<!-- dvr_rules_channels -->',$hdhrRules->getRuleChannels($i),$rulesEntry);
$rulesEntry = str_replace('<!-- dvr_reccount -->',$reccount,$rulesEntry);
$rulesEntry = str_replace('<!-- dvr_rules_recent -->',$hdhrRules->getRuleRecent($i),$rulesEntry);
$rulesEntry = str_replace('<!-- dvr_series_id -->',$hdhrRules->getRuleSeriesID($i),$rulesEntry);
if(strlen($hdhrRules->getRuleAfterAirDate($i)) > 5 ){
$rulesEntry = str_replace('<!-- dvr_rules_airdate -->',", After Original Airdate: " . $hdhrRules->getRuleAfterAirDate($i),$rulesEntry);
}
Expand Down
20 changes: 17 additions & 3 deletions app/series.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
require_once("includes/dvrui_hdhrjson.php");
require_once("includes/dvrui_recordings.php");
require_once("includes/dvrui_rules.php");
require_once("includes/dvrui_upcoming.php");

function openSeriesPage() {
// prep
Expand All @@ -22,7 +23,7 @@ function openSeriesPage() {
$hdhrRules = new DVRUI_Rules($hdhr);
$hdhrRules->processAllRules();
$numSeries = $hdhrSeries->getRecordingCount();
$htmlStr = processSeriesData($hdhrRules,$hdhrSeries, $hdhrRecordings, $numSeries);
$htmlStr = processSeriesData($hdhr, $hdhrRules,$hdhrSeries, $hdhrRecordings, $numSeries);
//get data
$result = ob_get_contents();
ob_end_clean();
Expand All @@ -33,9 +34,11 @@ function openSeriesPage() {
}


function processSeriesData($hdhrRules, $hdhrSeries, $hdhrRecordings, $numSeries) {
function processSeriesData($hdhr, $hdhrRules, $hdhrSeries, $hdhrRecordings, $numSeries) {
$seriesData = '';

for ($i=0; $i < $numSeries; $i++) {
$upcomingcount = "";
$reccount = $hdhrRecordings->getRecordingCountBySeries($hdhrSeries->getSeriesID($i));
$rulecount = $hdhrRules->getRuleCountBySeries($hdhrSeries->getSeriesID($i));
if($reccount == 0){
Expand All @@ -45,6 +48,17 @@ function processSeriesData($hdhrRules, $hdhrSeries, $hdhrRecordings, $numSeries)
}else{
$reccount = $reccount . " recordings";
}
if($rulecount > 0){
$upcoming = new DVRUI_Upcoming($hdhr);
$upcoming->initBySeries($hdhrSeries->getSeriesID($i));
$upcomingcount = $upcoming->getUpcomingCount();

if($upcomingcount == 0){
$upcomingcount = "no upcoming";
}else{
$upcomingcount = $upcomingcount . " upcoming";
}
}

if($rulecount == 0){
$rulecount = "no rules";
Expand All @@ -53,13 +67,13 @@ function processSeriesData($hdhrRules, $hdhrSeries, $hdhrRecordings, $numSeries)
}else{
$rulecount = $rulecount . " rules";
}

$seriesEntry = file_get_contents('style/series_entry.html');
$seriesEntry = str_replace('<!-- dvr_series_id -->',$hdhrSeries->getSeriesID($i),$seriesEntry);
$seriesEntry = str_replace('<!-- dvr_recordings_image -->',$hdhrSeries->getRecordingImage($i),$seriesEntry);
$seriesEntry = str_replace('<!-- dvr_recordings_title -->',$hdhrSeries->getTitle($i),$seriesEntry);
$seriesEntry = str_replace('<!-- dvr_recordings_count -->',$reccount,$seriesEntry);
$seriesEntry = str_replace('<!-- dvr_rules_count -->',$rulecount,$seriesEntry);
$seriesEntry = str_replace('<!-- dvr_upcoming_count -->',$upcomingcount,$seriesEntry);


$seriesData .= $seriesEntry;
Expand Down
47 changes: 35 additions & 12 deletions app/upcoming.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,16 @@
$upcoming_list_pos = 0;
$upcoming;

function openUpcomingPage() {
function openUpcomingPage($seriesid) {
// prep
ob_start();
$tab = new TinyAjaxBehavior();

//create output
$htmlStr = getUpcoming();

if(strlen($seriesid) > 3){
$htmlStr = getSeriesUpcoming($seriesid);
}else{
$htmlStr = getUpcoming();
}
//get data
$result = ob_get_contents();
ob_end_clean();
Expand All @@ -33,7 +35,8 @@ function getUpcoming() {
$hdhr = new DVRUI_HDHRjson();
$hdhrRules = new DVRUI_Rules($hdhr);
$hdhrRules->processAllRules();
$upcoming = new DVRUI_Upcoming($hdhrRules);
$upcoming = new DVRUI_Upcoming($hdhr);
$upcoming->initByRules($hdhrRules);
$numRules = $upcoming->getSeriesCount();
for ($i=0; $i < $numRules; $i++) {
$upcoming->processNext($i);
Expand All @@ -53,20 +56,40 @@ function getUpcoming() {
$entryData .= $entry;
}

$authRevealID = 'UpcomingAuth';
$authReveal = file_get_contents('style/reveal.html');
$htmlStr = file_get_contents('style/upcoming_list.html');

$authReveal = str_replace('<!-- dvrui_reveal -->',$authRevealID,$authReveal);
$authReveal = str_replace('<!-- drvui_reveal_title -->', 'AuthKey Used:',$authReveal);
$authReveal = str_replace('<!-- drvui_reveal_content -->', $hdhrRules->getAuth(),$authReveal);
$htmlStr = str_replace('<!-- dvr_upcoming_count -->','Found: ' . $numShows . ' Shows. ',$htmlStr);
$htmlStr = str_replace('<!-- dvr_upcoming_list -->',$entryData,$htmlStr);


return $htmlStr;
}

$htmlStr = str_replace('<!-- dvrui_auth_reveal -->',$authRevealID,$htmlStr);
function getSeriesUpcoming($seriesid) {
$htmlStr = '';
$entryData = '';
$hdhr = new DVRUI_HDHRjson();
$upcoming = new DVRUI_Upcoming($hdhr);
$upcoming->initBySeries($seriesid);

$upcoming->sortUpcomingByDate();
$numShows = $upcoming->getUpcomingCount();
for ($i=0; $i < $numShows; $i++) {
$entry = file_get_contents('style/upcoming_entry.html');
$entry = str_replace('<!-- dvr_upcoming_title -->',$upcoming->getTitle($i),$entry);
$entry = str_replace('<!-- dvr_upcoming_episode -->',$upcoming->getEpNum($i) . ' : ' . $upcoming->getEpTitle($i),$entry);
$entry = str_replace('<!-- dvr_upcoming_image -->',$upcoming->getEpImg($i),$entry);
$entry = str_replace('<!-- dvr_upcoming_synopsis -->',$upcoming->getEpSynopsis($i),$entry);
$entry = str_replace('<!-- dvr_upcoming_start -->',$upcoming->getEpStart($i),$entry);
$entry = str_replace('<!-- dvr_upcoming_stop -->',$upcoming->getEpEnd($i),$entry);
$entry = str_replace('<!-- dvr_upcoming_channels -->',$upcoming->getEpChannelNum($i),$entry);
$entryData .= $entry;
}

$htmlStr = file_get_contents('style/upcoming_list.html');
$htmlStr = str_replace('<!-- dvr_upcoming_count -->','Found: ' . $numShows . ' Shows. ',$htmlStr);
$htmlStr = str_replace('<!-- dvr_upcoming_list -->',$entryData,$htmlStr);

$htmlStr .= $authReveal;

return $htmlStr;
}
Expand Down
2 changes: 1 addition & 1 deletion app/vars.php
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?php
final class DVRUI_Vars
{
const DVRUI_version ="0.4.6";
const DVRUI_version ="0.5.0";
const DVRUI_name ="HDHomeRun DVR UI";
const DVRUI_git ="https://github.com/demonrik/HDHR-DVRUI.git";

Expand Down

0 comments on commit 0a85524

Please sign in to comment.