diff --git a/channel.js b/channel.js index 9b20c506..136a207d 100644 --- a/channel.js +++ b/channel.js @@ -45,6 +45,10 @@ Channel.prototype.loadMysql = function() { var query = 'SELECT * FROM channels WHERE name="{}"' .replace(/\{\}/, this.name); var results = db.querySync(query); + if(!results) { + console.log("channel query failed"); + return; + } var rows = results.fetchAllSync(); if(rows.length == 0) { console.log("Channel " + this.name + " is unregistered"); @@ -56,6 +60,10 @@ Channel.prototype.loadMysql = function() { var query = 'SELECT * FROM chan_{}_library' .replace(/\{\}/, this.name); var results = db.querySync(query); + if(!results) { + console.log("channel library query failed"); + return; + } var rows = results.fetchAllSync(); for(var i = 0; i < rows.length; i++) { this.library[rows[i].id] = new Media(rows[i].id, rows[i].title, rows[i].seconds, rows[i].type); diff --git a/run.sh b/run.sh new file mode 100755 index 00000000..7dfc93d1 --- /dev/null +++ b/run.sh @@ -0,0 +1,8 @@ +#!/bin/sh + +while : +do + node server.js + sleep 2 + +done