diff --git a/airtime_mvc/application/controllers/ApiController.php b/airtime_mvc/application/controllers/ApiController.php index 007e5da3b..a5bdd3ccd 100644 --- a/airtime_mvc/application/controllers/ApiController.php +++ b/airtime_mvc/application/controllers/ApiController.php @@ -550,9 +550,12 @@ class ApiController extends Zend_Controller_Action //The key does not have any meaning as of yet but it could potentially correspond //to some unique id. $responses = array(); + Logging::log("inside reloadMetadataGroupAction"); + return; foreach ($request->getRequest()->getParams() as $action => $raw_json) { $info_json = json_decode($raw_json, $assoc=true); array_push($responses, $this->dispatchMetaDataAction($info_json, $info_json['mode'])); + Logging::log( $info_json ); } // TODO : do something with $responses here instead of doing nothing } diff --git a/python_apps/api_clients/api_client.py b/python_apps/api_clients/api_client.py index 40dbe0112..299c7a66d 100644 --- a/python_apps/api_clients/api_client.py +++ b/python_apps/api_clients/api_client.py @@ -6,7 +6,6 @@ # You will probably want to create a script on your server side to automatically # schedule a playlist one minute from the current time. ############################################################################### - import sys import time import urllib @@ -312,33 +311,36 @@ class AirTimeApiClient(): return response + def construct_url(self,config_action_key): + """Constructs the base url for every request""" + # TODO : Make other methods in this class use this this method. + url = "http://%s:%s/%s/%s" % (self.config["base_url"], str(self.config["base_port"]), self.config["api_base"], self.config[config_action_key]) + url = url.replace("%%api_key%%", self.config["api_key"]) + return url + def setup_media_monitor(self): logger = self.logger - response = None try: - url = "http://%s:%s/%s/%s" % (self.config["base_url"], str(self.config["base_port"]), self.config["api_base"], self.config["media_setup_url"]) - url = url.replace("%%api_key%%", self.config["api_key"]) - + url = self.construct_url("media_setup_url") response = self.get_response_from_server(url) response = json.loads(response) logger.info("Connected to Airtime Server. Json Media Storage Dir: %s", response) except Exception, e: response = None logger.error("Exception: %s", e) - return response def update_media_metadata(self, md, mode, is_record=False): logger = self.logger response = None try: - url = "http://%s:%s/%s/%s" % (self.config["base_url"], str(self.config["base_port"]), self.config["api_base"], self.config["update_media_url"]) - url = url.replace("%%api_key%%", self.config["api_key"]) + url = self.construct_url("update_media_url") url = url.replace("%%mode%%", mode) md = convert_dict_value_to_utf8(md) + data = urllib.urlencode(md) req = urllib2.Request(url, data) diff --git a/python_apps/media-monitor2/media/monitor/pure.py b/python_apps/media-monitor2/media/monitor/pure.py index 01aaac33c..dad84f075 100644 --- a/python_apps/media-monitor2/media/monitor/pure.py +++ b/python_apps/media-monitor2/media/monitor/pure.py @@ -20,6 +20,7 @@ class LazyProperty(object): setattr(obj,self.func_name,value) return value + class IncludeOnly(object): """ A little decorator to help listeners only be called on extensions they support diff --git a/python_apps/media-monitor2/mm2.py b/python_apps/media-monitor2/mm2.py index 7f8b43bd0..9b7107cdf 100644 --- a/python_apps/media-monitor2/mm2.py +++ b/python_apps/media-monitor2/mm2.py @@ -20,6 +20,7 @@ channels = { org = Organizer(channel=channels['org'],target_path=channels['watch'].path) watch = WatchSyncer(channel=channels['watch']) problem_files = ProblemFileHandler(channel=channels['badfile']) + # do the bootstrapping before any listening is going one #conn = Connection('localhost', 'more', 'shit', 'here') #db = DBDumper(conn).dump_block()