Adde configurable value for list_all_files

This commit is contained in:
Rudi Grinberg 2012-09-10 16:29:17 -04:00
parent c4f486e539
commit 4fe8407659
3 changed files with 9 additions and 4 deletions

View File

@ -688,9 +688,12 @@ class ApiController extends Zend_Controller_Action
{ {
$request = $this->getRequest(); $request = $this->getRequest();
$dir_id = $request->getParam('dir_id'); $dir_id = $request->getParam('dir_id');
$all = $request->getParam('all');
Logging::info("All param is: $all");
$this->view->files = $this->view->files =
Application_Model_StoredFile::listAllFiles($dir_id,$all=false); Application_Model_StoredFile::listAllFiles($dir_id,$all);
} }
public function listAllWatchedDirsAction() public function listAllWatchedDirsAction()

View File

@ -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%%' 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 # 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) # 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%%' list_all_watched_dirs = 'list-all-watched-dirs/format/json/api_key/%%api_key%%'

View File

@ -474,11 +474,12 @@ class AirtimeApiClient():
#{"files":["path/to/file1", "path/to/file2"]} #{"files":["path/to/file1", "path/to/file2"]}
#Note that these are relative paths to the given directory. The full #Note that these are relative paths to the given directory. The full
#path is not returned. #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 logger = self.logger
try: try:
url = self.construct_url("list_all_db_files") url = self.construct_url("list_all_db_files")
url = url.replace("%%dir_id%%", dir_id) url = url.replace("%%dir_id%%", dir_id)
url = url.replace("%%all%%", all_files)
response = self.get_response_from_server(url) response = self.get_response_from_server(url)
response = json.loads(response) response = json.loads(response)
except Exception, e: except Exception, e:
@ -488,7 +489,8 @@ class AirtimeApiClient():
try: try:
return response["files"] return response["files"]
except KeyError: 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 [] return []
def list_all_watched_dirs(self): def list_all_watched_dirs(self):