From 4fe840765914496b7a9466fe6e166720b63d7454 Mon Sep 17 00:00:00 2001 From: Rudi Grinberg Date: Mon, 10 Sep 2012 16:29:17 -0400 Subject: [PATCH] Adde configurable value for list_all_files --- airtime_mvc/application/controllers/ApiController.php | 5 ++++- python_apps/api_clients/api_client.cfg | 2 +- python_apps/api_clients/api_client.py | 6 ++++-- 3 files changed, 9 insertions(+), 4 deletions(-) diff --git a/airtime_mvc/application/controllers/ApiController.php b/airtime_mvc/application/controllers/ApiController.php index 941281ee1..20fdbf9b6 100644 --- a/airtime_mvc/application/controllers/ApiController.php +++ b/airtime_mvc/application/controllers/ApiController.php @@ -688,9 +688,12 @@ class ApiController extends Zend_Controller_Action { $request = $this->getRequest(); $dir_id = $request->getParam('dir_id'); + $all = $request->getParam('all'); + + Logging::info("All param is: $all"); $this->view->files = - Application_Model_StoredFile::listAllFiles($dir_id,$all=false); + Application_Model_StoredFile::listAllFiles($dir_id,$all); } public function listAllWatchedDirsAction() diff --git a/python_apps/api_clients/api_client.cfg b/python_apps/api_clients/api_client.cfg index fdd7c3b1b..efdcc763f 100644 --- a/python_apps/api_clients/api_client.cfg +++ b/python_apps/api_clients/api_client.cfg @@ -34,7 +34,7 @@ upload_recorded = 'upload-recorded/format/json/api_key/%%api_key%%/fileid/%%file update_media_url = 'reload-metadata/format/json/api_key/%%api_key%%/mode/%%mode%%' # URL to tell Airtime we want a listing of all files it knows about -list_all_db_files = 'list-all-files/format/json/api_key/%%api_key%%/dir_id/%%dir_id%%' +list_all_db_files = 'list-all-files/format/json/api_key/%%api_key%%/dir_id/%%dir_id%%/all/%%all%%' # URL to tell Airtime we want a listing of all dirs its watching (including the stor dir) list_all_watched_dirs = 'list-all-watched-dirs/format/json/api_key/%%api_key%%' diff --git a/python_apps/api_clients/api_client.py b/python_apps/api_clients/api_client.py index 983b59281..d2fbf23be 100644 --- a/python_apps/api_clients/api_client.py +++ b/python_apps/api_clients/api_client.py @@ -474,11 +474,12 @@ class AirtimeApiClient(): #{"files":["path/to/file1", "path/to/file2"]} #Note that these are relative paths to the given directory. The full #path is not returned. - def list_all_db_files(self, dir_id): + def list_all_db_files(self, dir_id, all_files=True): logger = self.logger try: url = self.construct_url("list_all_db_files") url = url.replace("%%dir_id%%", dir_id) + url = url.replace("%%all%%", all_files) response = self.get_response_from_server(url) response = json.loads(response) except Exception, e: @@ -488,7 +489,8 @@ class AirtimeApiClient(): try: return response["files"] except KeyError: - self.logger.error("Could not find index 'files' in dictionary: %s", str(response)) + self.logger.error("Could not find index 'files' in dictionary: %s", + str(response)) return [] def list_all_watched_dirs(self):