cc-2419: media monitor import on startup

-added multiple dir support
This commit is contained in:
martin 2011-07-04 15:08:02 -04:00
parent ae156c85b4
commit d260c66abc
5 changed files with 68 additions and 21 deletions

View file

@ -106,6 +106,9 @@ class ApiClientInterface:
pass
def list_all_db_files(self):
pass
def list_all_watched_dirs(self):
pass
# Put here whatever tests you want to run to make sure your API is working
@ -421,7 +424,24 @@ class AirTimeApiClient(ApiClientInterface):
logger.error("Exception: %s", e)
return response
def list_all_watched_dirs(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_watched_dirs"])
url = url.replace("%%api_key%%", self.config["api_key"])
logger.debug(url)
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
################################################################################