-doctrine 2.0 alpha upgrade scripts
This commit is contained in:
parent
3253d521d1
commit
7c1739247d
|
@ -38,7 +38,6 @@ class Application_Form_Preferences extends Zend_Form
|
|||
$stream_format->setLabel('Stream Label:');
|
||||
$stream_format->setMultiOptions(array("Artist - Title",
|
||||
"Show - Artist - Title",
|
||||
"Show",
|
||||
"Station name - Show name"));
|
||||
$stream_format->setValue(Application_Model_Preference::GetStreamLabelFormat());
|
||||
$this->addElement($stream_format);
|
||||
|
|
|
@ -82,6 +82,9 @@ class Application_Model_Nowplaying
|
|||
$type = "n";
|
||||
}
|
||||
|
||||
if (strtotime($item['item_ends']) > strtotime($item['show_ends']))
|
||||
$type = "over";
|
||||
|
||||
array_push($data, array($type, $item["item_starts"], $item["item_starts"], $item["item_ends"], $item["clip_length"], $item["track_title"], $item["artist_name"], $item["album_title"], $item["playlist_name"], $item["show_name"], $item["instance_id"]));
|
||||
}
|
||||
}
|
||||
|
|
|
@ -788,6 +788,7 @@ class Show_DAL{
|
|||
." WHERE ((si.starts < TIMESTAMP '$timeNow' - INTERVAL '$start seconds' AND si.ends > TIMESTAMP '$timeNow' - INTERVAL '$start seconds')"
|
||||
." OR (si.starts > TIMESTAMP '$timeNow' - INTERVAL '$start seconds' AND si.ends < TIMESTAMP '$timeNow' + INTERVAL '$end seconds')"
|
||||
." OR (si.starts < TIMESTAMP '$timeNow' + INTERVAL '$end seconds' AND si.ends > TIMESTAMP '$timeNow' + INTERVAL '$end seconds'))"
|
||||
//checking for st.starts IS NULL so that the query also returns shows that do not have any items scheduled.
|
||||
." AND (st.starts < si.ends OR st.starts IS NULL)"
|
||||
." ORDER BY st.starts";
|
||||
|
||||
|
|
|
@ -9,13 +9,13 @@ class Version20110308003959 extends AbstractMigration
|
|||
{
|
||||
public function up(Schema $schema)
|
||||
{
|
||||
$table = $schema->createTable('users');
|
||||
$table->addColumn('username', 'string');
|
||||
$table->addColumn('password', 'string');
|
||||
$table = $this->getTable("cc_show_instances");
|
||||
$table->addColumn("record", "boolean");
|
||||
}
|
||||
|
||||
public function down(Schema $schema)
|
||||
{
|
||||
$schema->dropTable('users');
|
||||
$table = $this->getTable("cc_show_instances");
|
||||
$table->dropColumn("record");
|
||||
}
|
||||
}
|
||||
|
|
|
@ -2,6 +2,6 @@
|
|||
|
||||
$dir = __DIR__;
|
||||
|
||||
$command = "php $dir/../library/doctrine/migrations/doctrine-migrations.phar --configuration=$dir/DoctrineMigrations/migrations.xml --db-configuration=$dir/../library/doctrine/migrations/migrations-db.php migrations:status";
|
||||
$command = "php $dir/../library/doctrine/migrations/doctrine-migrations.phar --configuration=$dir/DoctrineMigrations/migrations.xml --db-configuration=$dir/../library/doctrine/migrations/migrations-db.php --no-interaction migrations:diff";
|
||||
system($command);
|
||||
|
||||
|
|
|
@ -128,6 +128,9 @@ function createDataGrid(){
|
|||
$(nRow).addClass("playing-list");
|
||||
if (aData[0] == "c")
|
||||
$(nRow).attr("class", "playing-song");
|
||||
else if (aData[0] == "over"){
|
||||
//$(nRow).attr("class", "over-booked-song");
|
||||
}
|
||||
return nRow;
|
||||
},
|
||||
"fnDrawCallback": function(oSettings){
|
||||
|
|
|
@ -111,6 +111,7 @@ class AirTimeApiClient(ApiClientInterface):
|
|||
def __get_airtime_version(self, verbose = True):
|
||||
logger = logging.getLogger()
|
||||
url = self.config["base_url"] + self.config["api_base"] + self.config["version_url"]
|
||||
logger.debug("Trying to contact %s", url)
|
||||
url = url.replace("%%api_key%%", self.config["api_key"])
|
||||
|
||||
try:
|
||||
|
@ -159,7 +160,6 @@ class AirTimeApiClient(ApiClientInterface):
|
|||
for pkey in sorted(schedule.iterkeys()):
|
||||
logger.debug("Playlist #%s",str(count))
|
||||
count+=1
|
||||
#logger.info("found playlist at %s", pkey)
|
||||
playlist = schedule[pkey]
|
||||
for item in playlist["medias"]:
|
||||
filename = urlparse(item["uri"])
|
||||
|
@ -210,21 +210,18 @@ class AirTimeApiClient(ApiClientInterface):
|
|||
|
||||
# Construct the URL
|
||||
export_url = self.config["base_url"] + self.config["api_base"] + self.config["export_url"]
|
||||
#logger.debug("Exporting schedule using URL: "+export_url)
|
||||
|
||||
# Insert the start and end times into the URL
|
||||
export_url = export_url.replace('%%api_key%%', self.config["api_key"])
|
||||
export_url = export_url.replace('%%from%%', range['start'])
|
||||
export_url = export_url.replace('%%to%%', range['end'])
|
||||
logger.info("Fetching schedule from %s", export_url)
|
||||
|
||||
export_url = export_url.replace('%%api_key%%', self.config["api_key"])
|
||||
|
||||
response = ""
|
||||
status = 0
|
||||
try:
|
||||
response_json = urllib.urlopen(export_url).read()
|
||||
#logger.debug("%s", response_json)
|
||||
response = json.loads(response_json)
|
||||
#logger.info("export status %s", response['check'])
|
||||
status = response['check']
|
||||
except Exception, e:
|
||||
print e
|
||||
|
@ -242,12 +239,9 @@ class AirTimeApiClient(ApiClientInterface):
|
|||
# toRemove.append(pkey)
|
||||
# else:
|
||||
# break
|
||||
# #logger.debug("Remove keys: %s", toRemove)
|
||||
# for index in toRemove:
|
||||
# del schedule[index]
|
||||
# #logger.debug("Schedule dict: %s", schedule)
|
||||
#except Exception, e:
|
||||
# logger.debug("'Ignore Past Playlists' feature not supported by API: %s", e)
|
||||
#response["playlists"] = schedule
|
||||
|
||||
return status, response
|
||||
|
@ -257,12 +251,10 @@ class AirTimeApiClient(ApiClientInterface):
|
|||
logger = logging.getLogger()
|
||||
|
||||
try:
|
||||
logger.info("try to download from %s to %s", src, dst)
|
||||
src = src + "/api_key/" + self.config["api_key"]
|
||||
logger.debug("try to download from %s to %s", src, dst)
|
||||
# check if file exists already before downloading again
|
||||
filename, headers = urllib.urlretrieve(src, dst)
|
||||
|
||||
logger.info("downloaded %s to %s", src, dst)
|
||||
except Exception, e:
|
||||
logger.error("%s", e)
|
||||
|
||||
|
@ -276,8 +268,8 @@ class AirTimeApiClient(ApiClientInterface):
|
|||
schedule_id = playlist["schedule_id"]
|
||||
url = self.config["base_url"] + self.config["api_base"] + self.config["update_item_url"]
|
||||
url = url.replace("%%schedule_id%%", str(schedule_id))
|
||||
url = url.replace("%%api_key%%", self.config["api_key"])
|
||||
logger.debug(url)
|
||||
url = url.replace("%%api_key%%", self.config["api_key"])
|
||||
|
||||
try:
|
||||
response = urllib.urlopen(url)
|
||||
|
@ -304,8 +296,8 @@ class AirTimeApiClient(ApiClientInterface):
|
|||
url = self.config["base_url"] + self.config["api_base"] + self.config["update_start_playing_url"]
|
||||
url = url.replace("%%media_id%%", str(media_id))
|
||||
url = url.replace("%%schedule_id%%", str(schedule_id))
|
||||
url = url.replace("%%api_key%%", self.config["api_key"])
|
||||
logger.debug(url)
|
||||
url = url.replace("%%api_key%%", self.config["api_key"])
|
||||
response = urllib.urlopen(url)
|
||||
response = json.loads(response.read())
|
||||
logger.info("API-Status %s", response['status'])
|
||||
|
@ -316,27 +308,6 @@ class AirTimeApiClient(ApiClientInterface):
|
|||
|
||||
return response
|
||||
|
||||
|
||||
def generate_range_dp(self):
|
||||
pass
|
||||
#logger = logging.getLogger()
|
||||
#
|
||||
#url = self.api_url + 'schedule/generate_range_dp.php'
|
||||
#
|
||||
#try:
|
||||
# response = urllib.urlopen(url, self.api_auth)
|
||||
# response = json.loads(response.read())
|
||||
# logger.debug("Trying to contact %s", url)
|
||||
# logger.info("API-Status %s", response['status'])
|
||||
# logger.info("API-Message %s", response['message'])
|
||||
#
|
||||
#except Exception, e:
|
||||
# print e
|
||||
# api_status = False
|
||||
# logger.critical("Unable to handle the request - %s", e)
|
||||
#
|
||||
#return response
|
||||
|
||||
def get_liquidsoap_data(self, pkey, schedule):
|
||||
logger = logging.getLogger()
|
||||
playlist = schedule[pkey]
|
||||
|
|
|
@ -7,9 +7,9 @@ end
|
|||
def append_title(m) =
|
||||
if !stream_metadata_type == 1 then
|
||||
[("artist","#{!show_name} - #{m['title']}")]
|
||||
#elsif !stream_metadata_type == 2 then
|
||||
# [("artist", ""), ("title", !show_name)]
|
||||
elsif !stream_metadata_type == 2 then
|
||||
[("artist", ""), ("title", !show_name)]
|
||||
elsif !stream_metadata_type == 3 then
|
||||
[("artist",!station_name), ("title", !show_name)]
|
||||
else
|
||||
[]
|
||||
|
|
Loading…
Reference in New Issue