diff --git a/airtime_mvc/application/controllers/ApiController.php b/airtime_mvc/application/controllers/ApiController.php index c40102f55..b3f5bcffc 100644 --- a/airtime_mvc/application/controllers/ApiController.php +++ b/airtime_mvc/application/controllers/ApiController.php @@ -686,7 +686,8 @@ class ApiController extends Zend_Controller_Action $request = $this->getRequest(); $dir_id = $request->getParam('dir_id'); - $this->view->files = Application_Model_StoredFile::listAllFiles($dir_id); + $this->view->files = + Application_Model_StoredFile::listAllFiles($dir_id,$all=true); } public function listAllWatchedDirsAction() @@ -859,7 +860,8 @@ class ApiController extends Zend_Controller_Action $watchDir = Application_Model_MusicDir::getDirByPath($rd); // get all the files that is under $dirPath - $files = Application_Model_StoredFile::listAllFiles($dir->getId(), true); + $files = Application_Model_StoredFile::listAllFiles( + $dir->getId(),$all=false, true); foreach ($files as $f) { // if the file is from this mount if (substr($f->getFilePath(), 0, strlen($rd)) === $rd) { diff --git a/airtime_mvc/application/controllers/UsersettingsController.php b/airtime_mvc/application/controllers/UsersettingsController.php index b999b8ed1..2050961e0 100644 --- a/airtime_mvc/application/controllers/UsersettingsController.php +++ b/airtime_mvc/application/controllers/UsersettingsController.php @@ -13,6 +13,7 @@ class UsersettingsController extends Zend_Controller_Action ->addActionContext('get-timeline-datatable', 'json') ->addActionContext('set-timeline-datatable', 'json') ->addActionContext('remindme', 'json') + ->addActionContext('remindme-never', 'json') ->addActionContext('donotshowregistrationpopup', 'json') ->initContext(); } @@ -88,6 +89,13 @@ class UsersettingsController extends Zend_Controller_Action Zend_Session::namespaceUnset('referrer'); Application_Model_Preference::SetRemindMeDate(); } + + public function remindmeNeverAction() + { + Zend_Session::namespaceUnset('referrer'); + //pass in true to indicate 'Remind me never' was clicked + Application_Model_Preference::SetRemindMeDate(true); + } public function donotshowregistrationpopupAction() { diff --git a/airtime_mvc/application/models/Email.php b/airtime_mvc/application/models/Email.php index 810f8edbd..cedec8e6f 100644 --- a/airtime_mvc/application/models/Email.php +++ b/airtime_mvc/application/models/Email.php @@ -35,7 +35,7 @@ class Application_Model_Email ); } else { $config = array( - 'ssl' => 'ssl' + 'ssl' => 'tls' ); } diff --git a/airtime_mvc/application/models/Preference.php b/airtime_mvc/application/models/Preference.php index b60ce28fa..16c9e44c7 100644 --- a/airtime_mvc/application/models/Preference.php +++ b/airtime_mvc/application/models/Preference.php @@ -587,10 +587,14 @@ class Application_Model_Preference } } - public static function SetRemindMeDate() + public static function SetRemindMeDate($p_never = false) { - $weekAfter = mktime(0, 0, 0, gmdate("m"), gmdate("d")+7, gmdate("Y")); - self::setValue("remindme", $weekAfter); + if ($p_never) { + self::setValue("remindme", -1); + } else { + $weekAfter = mktime(0, 0, 0, gmdate("m"), gmdate("d")+7, gmdate("Y")); + self::setValue("remindme", $weekAfter); + } } public static function GetRemindMeDate() @@ -1105,9 +1109,13 @@ class Application_Model_Preference { $today = mktime(0, 0, 0, gmdate("m"), gmdate("d"), gmdate("Y")); $remindDate = Application_Model_Preference::GetRemindMeDate(); - if ($remindDate == NULL || $today >= $remindDate) { - return true; + $retVal = false; + + if ($remindDate == NULL || ($remindDate != -1 && $today >= $remindDate)) { + $retVal = true; } + + return $retVal; } public static function getCurrentLibraryTableSetting() diff --git a/airtime_mvc/application/models/StoredFile.php b/airtime_mvc/application/models/StoredFile.php index f41cacf7c..59f335c7a 100644 --- a/airtime_mvc/application/models/StoredFile.php +++ b/airtime_mvc/application/models/StoredFile.php @@ -1006,19 +1006,21 @@ class Application_Model_StoredFile * @param $dir_id - if this is not provided, it returns all files with full path constructed. * @param $propelObj - if this is true, it returns array of proepl obj */ - public static function listAllFiles($dir_id=null, $propelObj=false) + public static function listAllFiles($dir_id=null, $all, $propelObj=false) { $con = Propel::getConnection(); + $file_exists = $all ? "" : "and f.file_exists = 'TRUE'"; + if ($propelObj) { $sql = "SELECT m.directory || f.filepath as fp" ." FROM CC_MUSIC_DIRS m" ." LEFT JOIN CC_FILES f" - ." ON m.id = f.directory WHERE m.id = $dir_id and f.file_exists = 'TRUE'"; + ." ON m.id = f.directory WHERE m.id = $dir_id $file_exists"; } else { $sql = "SELECT filepath as fp" - ." FROM CC_FILES" - ." WHERE directory = $dir_id and file_exists = 'TRUE'"; + ." FROM CC_FILES as f" + ." WHERE f.directory = $dir_id $file_exists"; } $rows = $con->query($sql)->fetchAll(); diff --git a/airtime_mvc/application/models/User.php b/airtime_mvc/application/models/User.php index 01cd96870..3e71eba91 100644 --- a/airtime_mvc/application/models/User.php +++ b/airtime_mvc/application/models/User.php @@ -231,6 +231,25 @@ class Application_Model_User $this->_userInstance->delete(); } } + public function getOwnedFiles() + { + $user = $this->_userInstance; + // do we need a find call at the end here? + return $user->getCcFilessRelatedByDbOwnerId(); + } + + public function donateFilesTo($user) + { + $my_files = $this->getOwnedFiles(); + foreach ($my_files as $file) { + $file->reassignTo($user); + } + } + + public function deleteAllFiles() + { + $my_files = $this->getOwnedFiles(); + } private function createUser() { diff --git a/airtime_mvc/application/models/airtime/CcFiles.php b/airtime_mvc/application/models/airtime/CcFiles.php index 58f79ee67..0e17aef74 100644 --- a/airtime_mvc/application/models/airtime/CcFiles.php +++ b/airtime_mvc/application/models/airtime/CcFiles.php @@ -40,5 +40,8 @@ class CcFiles extends BaseCcFiles { return $this; } + public function reassignTo($user) { + $this->setDbOwnerId( $user->getDbId() ); + } } // CcFiles diff --git a/airtime_mvc/public/js/airtime/nowplaying/register.js b/airtime_mvc/public/js/airtime/nowplaying/register.js index fc3b98a51..3d13367f1 100644 --- a/airtime_mvc/public/js/airtime/nowplaying/register.js +++ b/airtime_mvc/public/js/airtime/nowplaying/register.js @@ -26,6 +26,18 @@ $(document).ready(function(){ $(this).dialog("close"); } }, + { + id: "remind_never", + text: "Remind me never", + click: function() { + var url ='/Usersettings/remindme-never'; + $.ajax({ + url: url, + data: {format:"json"} + }); + $(this).dialog("close"); + } + }, { id: "help_airtime", text: "Yes, help Airtime", diff --git a/python_apps/media-monitor2/media/monitor/manager.py b/python_apps/media-monitor2/media/monitor/manager.py index 0a0fcfec3..fcceb153f 100644 --- a/python_apps/media-monitor2/media/monitor/manager.py +++ b/python_apps/media-monitor2/media/monitor/manager.py @@ -79,9 +79,16 @@ class Manager(Loggable): watch_dir) self.remove_watch_directory(normpath(watch_dir)) - def watch_signal(self): return self.watch_listener.signal + def watch_signal(self): + """ + Return the signal string our watch_listener is reading events from + """ + return self.watch_listener.signal def __remove_watch(self,path): + """ + Remove path from being watched (first will check if 'path' is watched) + """ # only delete if dir is actually being watched if path in self.__wd_path: wd = self.__wd_path[path] @@ -89,11 +96,16 @@ class Manager(Loggable): del(self.__wd_path[path]) def __add_watch(self,path,listener): + """ + Start watching 'path' using 'listener'. First will check if directory + is being watched before adding another watch + """ self.logger.info("Adding listener '%s' to '%s'" % ( listener.__class__.__name__, path) ) - wd = self.wm.add_watch(path, pyinotify.ALL_EVENTS, rec=True, - auto_add=True, proc_fun=listener) - self.__wd_path[path] = wd.values()[0] + if not self.has_watch(path): + wd = self.wm.add_watch(path, pyinotify.ALL_EVENTS, rec=True, + auto_add=True, proc_fun=listener) + if wd: self.__wd_path[path] = wd.values()[0] def __create_organizer(self, target_path, recorded_path): """ diff --git a/python_apps/media-monitor2/media/monitor/pure.py b/python_apps/media-monitor2/media/monitor/pure.py index 97645a15b..25a0add28 100644 --- a/python_apps/media-monitor2/media/monitor/pure.py +++ b/python_apps/media-monitor2/media/monitor/pure.py @@ -14,8 +14,8 @@ from configobj import ConfigObj from media.monitor.exceptions import FailedToSetLocale, FailedToCreateDir -supported_extensions = [u"mp3", u"ogg", u"oga"] -#supported_extensions = [u"mp3", u"ogg", u"oga", u"flac", u"aac", u"bwf"] +#supported_extensions = [u"mp3", u"ogg", u"oga"] +supported_extensions = [u"mp3", u"ogg", u"oga", u"flac", u"aac", u"bwf"] unicode_unknown = u'unknown' path_md = ['MDATA_KEY_TITLE', 'MDATA_KEY_CREATOR', 'MDATA_KEY_SOURCE', @@ -285,11 +285,11 @@ def organized_path(old_path, root_path, orig_md): # MDATA_KEY_BITRATE is in bytes/second i.e. (256000) we want to turn this # into 254kbps normal_md = default_to_f(orig_md, path_md, unicode_unknown, default_f) - if normal_md['MDATA_KEY_BITRATE']: + try: formatted = str(int(normal_md['MDATA_KEY_BITRATE']) / 1000) normal_md['MDATA_KEY_BITRATE'] = formatted + 'kbps' - else: normal_md['MDATA_KEY_BITRATE'] = unicode_unknown - + except: + normal_md['MDATA_KEY_BITRATE'] = unicode_unknown if is_airtime_recorded(normal_md): title_re = re.match("(?P.+)-(?P\d+-\d+-\d+-\d+:\d+:\d+)$",