Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 7 additions & 2 deletions common/js/ogAPI2.js
Original file line number Diff line number Diff line change
Expand Up @@ -588,11 +588,16 @@ var GLOBAL_UPDATE_TARGET;
service.getNowAndNext = function () {
return $http.get( API_PATH + 'tv/currentgrid' )
.then(stripData);
}
};

service.changeChannel = function ( channelNum ) {
return $http.post( API_PATH + 'tv/change/' + channelNum );
}
};

service.getCurrentChannel = function () {
return $http.get( API_PATH + 'tv/currentchannel')
.then(stripData);
};

return service;
} )
Expand Down
57 changes: 53 additions & 4 deletions control/app/components/directives/StationCell.directive.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,11 +27,60 @@ app.directive( 'stationCell',

var hud = uibHelper.curtainModal( 'Changing...' );
$log.debug( "Changing channel to: " + scope.grid.channel.channelNumber );
ogProgramGuide.changeChannel( scope.grid.channel.channelNumber );
$rootScope.currentChannel = scope.grid;
$timeout(function(){ hud.dismiss() }, 5000);
ogProgramGuide.changeChannel( scope.grid.channel.channelNumber )
.then( function () {
return $timeout(5000);
})
.then( function () {
return ogProgramGuide.getCurrentChannel();
})
.then( function( channel ) {
if ( scope.grid.channel.channelNumber != channel.channelNumber ) {
$log.debug("channel numbers do NOT match!");
hud.dismiss();
uibHelper.headsupModal('Unable to Change Channel', 'The channel change was unsuccessful. You are not subscribed to the channel.');
} else {
$log.debug("channel change successful");
$rootScope.currentChannel = scope.grid;
hud.dismiss();
}
})
.catch( function ( err ) {
hud.dismiss();
switch ( err.status ) {
case 406:
uibHelper.headsupModal( "Problem Changing Channel", "There was an issue with changing the channel and your request could not be completed.");
break;
case 500:
uibHelper.headsupModal( "Internal Server Error", "The device was not able to change the channel.");
break;
default:
uibHelper.headsupModal( "Error: Unable to connect", "Unable to connect to the system. Please check wifi connection and try again.");
break;
}
});

}
// $rootScope.tempCurrentChannel = scope.grid;
// $timeout(function() {
// ogProgramGuide.getCurrentChannel()
// .then(function ( channel ) {
// if ($rootScope.tempCurrentChannel.channel.channelNumber != channel.data.channelNumber) {
// $log.debug("channel numbers do NOT match!");
// hud.dismiss();
// uibHelper.headsupModal('Unable to Change Channel', 'The channel change was unsuccessful. You are not subscribed to the channel.');
// } else {
// $log.debug("channel change successful");
// $rootScope.currentChannel = $rootScope.tempCurrentChannel;
// hud.dismiss();
// }
// })
// .catch(function ( err ) {
// hud.dismiss();
// uibHelper.headsupModal('Error', 'An error has occurred while getting the current channel.');
// })
// }, 5000);

};

scope.displayTime = function ( timeStr) {

Expand Down
4 changes: 2 additions & 2 deletions control/app/components/guide/guide.controller.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,15 +17,15 @@ app.controller( "guideController",

$rootScope.currentChannel = {};

function getCurrentChannel() {
function getCurrentProgramming() {
return ogProgramGuide.getNowAndNext()
.then(function (grid) {
$log.debug("Got the grid and current channel.");
$rootScope.currentChannel = grid.grid;
});
}

getCurrentChannel();
getCurrentProgramming();

function loadListings(){
ogNet.getGrid(false)
Expand Down