cc-2419: media monitor import on startup
-new method of querying db on startup.
This commit is contained in:
parent
df64b70280
commit
429d8b234c
8 changed files with 147 additions and 63 deletions
|
@ -103,6 +103,9 @@ class ApiClientInterface:
|
|||
pass
|
||||
|
||||
def update_media_metadata(self, md):
|
||||
pass
|
||||
|
||||
def list_all_db_files(self):
|
||||
pass
|
||||
|
||||
# Put here whatever tests you want to run to make sure your API is working
|
||||
|
@ -402,6 +405,22 @@ class AirTimeApiClient(ApiClientInterface):
|
|||
logger.error("Exception: %s", e)
|
||||
|
||||
return response
|
||||
|
||||
def list_all_db_files(self):
|
||||
logger = logging.getLogger()
|
||||
try:
|
||||
url = "http://%s:%s/%s/%s" % (self.config["base_url"], str(self.config["base_port"]), self.config["api_base"], self.config["list_all_db_files"])
|
||||
|
||||
url = url.replace("%%api_key%%", self.config["api_key"])
|
||||
|
||||
req = urllib2.Request(url)
|
||||
response = urllib2.urlopen(req).read()
|
||||
response = json.loads(response)
|
||||
except Exception, e:
|
||||
response = None
|
||||
logger.error("Exception: %s", e)
|
||||
|
||||
return response
|
||||
|
||||
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue