Merge branch 'devel' of dev.sourcefabric.org:airtime into devel

This commit is contained in:
Martin Konecny 2012-09-10 16:54:51 -04:00
commit 87ac1744f7
6 changed files with 14 additions and 11 deletions

View File

@ -689,9 +689,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=true);
Application_Model_StoredFile::listAllFiles($dir_id,$all);
}
public function listAllWatchedDirsAction()

View File

@ -51,11 +51,6 @@ class Application_Model_StoredFile
"owner_id" => "DbOwnerId"
);
public function __construct()
{
}
public function getId()
{
return $this->_file->getDbId();

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%%'
# 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%%'

View File

@ -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):

View File

@ -126,7 +126,10 @@ class AirtimeMessageReceiver(Loggable):
except Exception as e:
self.fatal_exception("Failed to create watched dir '%s'" %
msg['directory'],e)
else: self.new_watch(msg)
else:
self.logger.info("Created new watch directory: '%s'" %
msg['directory'])
self.new_watch(msg)
else:
self.__request_now_bootstrap( directory=msg['directory'] )
self.manager.add_watch_directory(msg['directory'])

View File

@ -239,7 +239,7 @@ def normalized_metadata(md, original_path):
"""
new_md = copy.deepcopy(md)
# replace all slashes with dashes
for k,v in new_md.iteritems(): new_md[k] = unicode(v).replace('/','-')
#for k,v in new_md.iteritems(): new_md[k] = unicode(v).replace('/','-')
# Specific rules that are applied in a per attribute basis
format_rules = {
'MDATA_KEY_TRACKNUMBER' : parse_int,