Merge branch 'devel' of dev.sourcefabric.org:airtime into devel
This commit is contained in:
commit
0e82083ba1
15 changed files with 404 additions and 320 deletions
|
@ -1100,7 +1100,17 @@ class Application_Model_Preference
|
|||
return function ($x) { return $x; };
|
||||
} else {
|
||||
$ds = unserialize($v);
|
||||
return function ($x) use ($ds) { return $ds['ColReorder'][$x]; } ;
|
||||
return function ($x) use ($ds) {
|
||||
if ( in_array($x, $ds['ColReorder'] ) ) {
|
||||
return $ds['ColReorder'][$x];
|
||||
} else {
|
||||
Logging::warn("Index $x does not exist preferences");
|
||||
Logging::warn("Defaulting to identity and printing
|
||||
preferences");
|
||||
Logging::warn($ds);
|
||||
return $x;
|
||||
}
|
||||
} ;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -344,12 +344,12 @@ SELECT showt.name AS show_name,
|
|||
JOIN cc_show AS showt ON (showt.id = si.show_id)
|
||||
WHERE si.modified_instance = FALSE
|
||||
$showPredicate
|
||||
AND (si.starts >= '{$p_start}'
|
||||
AND ((si.starts >= '{$p_start}'
|
||||
AND si.starts < '{$p_end}')
|
||||
OR (si.ends > '{$p_start}'
|
||||
AND si.ends <= '{$p_end}')
|
||||
OR (si.starts <= '{$p_start}'
|
||||
AND si.ends >= '{$p_end}')
|
||||
AND si.ends >= '{$p_end}'))
|
||||
ORDER BY si_starts,
|
||||
sched_starts;
|
||||
SQL;
|
||||
|
|
|
@ -23,7 +23,8 @@ class Application_Model_Soundcloud
|
|||
return $token;
|
||||
}
|
||||
|
||||
public function uploadTrack($filepath, $filename, $description, $tags=array(), $release=null, $genre=null)
|
||||
public function uploadTrack($filepath, $filename, $description,
|
||||
$tags=array(), $release=null, $genre=null)
|
||||
{
|
||||
if ($this->getToken()) {
|
||||
if (count($tags)) {
|
||||
|
@ -33,7 +34,7 @@ class Application_Model_Soundcloud
|
|||
$tags = Application_Model_Preference::GetSoundCloudTags();
|
||||
}
|
||||
|
||||
$downloadable = Application_Model_Preference::GetSoundCloudDownloadbleOption() == '1'?true:false;
|
||||
$downloadable = Application_Model_Preference::GetSoundCloudDownloadbleOption() == '1';
|
||||
|
||||
$track_data = array(
|
||||
'track[sharing]' => 'private',
|
||||
|
@ -51,7 +52,6 @@ class Application_Model_Soundcloud
|
|||
|
||||
//YYYY-MM-DD-HH-mm-SS
|
||||
$release = explode("-", $release);
|
||||
|
||||
$track_data['track[release_year]'] = $release[0];
|
||||
$track_data['track[release_month]'] = $release[1];
|
||||
$track_data['track[release_day]'] = $release[2];
|
||||
|
@ -86,6 +86,13 @@ class Application_Model_Soundcloud
|
|||
throw new NoSoundCloundToken();
|
||||
}
|
||||
}
|
||||
|
||||
public static function uploadSoundcloud($id)
|
||||
{
|
||||
$cmd = "/usr/lib/airtime/utils/soundcloud-uploader $id > /dev/null &";
|
||||
Logging::info("Uploading soundcloud with command: $cmd");
|
||||
exec($cmd);
|
||||
}
|
||||
}
|
||||
|
||||
class NoSoundCloundToken extends Exception {}
|
||||
|
|
|
@ -1170,7 +1170,9 @@ SQL;
|
|||
$release = $file->getDbYear();
|
||||
try {
|
||||
$soundcloud = new Application_Model_Soundcloud();
|
||||
$soundcloud_res = $soundcloud->uploadTrack($this->getFilePath(), $this->getName(), $description, $tag, $release, $genre);
|
||||
$soundcloud_res = $soundcloud->uploadTrack(
|
||||
$this->getFilePath(), $this->getName(), $description,
|
||||
$tag, $release, $genre);
|
||||
$this->setSoundCloudFileId($soundcloud_res['id']);
|
||||
$this->setSoundCloudLinkToFile($soundcloud_res['permalink_url']);
|
||||
$this->setSoundCloudUploadTime(new DateTime("now"), new DateTimeZone("UTC"));
|
||||
|
|
|
@ -35,7 +35,6 @@ class Application_Model_User
|
|||
public function isHostOfShow($showId)
|
||||
{
|
||||
$userId = $this->_userInstance->getDbId();
|
||||
|
||||
return CcShowHostsQuery::create()
|
||||
->filterByDbShow($showId)
|
||||
->filterByDbHost($userId)->count() > 0;
|
||||
|
@ -63,10 +62,9 @@ class Application_Model_User
|
|||
|
||||
if ($type === UTYPE_ADMIN ||
|
||||
$type === UTYPE_PROGRAM_MANAGER ||
|
||||
CcShowHostsQuery::create()->filterByDbShow($p_showId)->filterByDbHost($this->getId())->count() > 0) {
|
||||
self::isHostOfShow($p_showId)) {
|
||||
$result = true;
|
||||
}
|
||||
|
||||
return $result;
|
||||
}
|
||||
|
||||
|
@ -210,7 +208,7 @@ class Application_Model_User
|
|||
$this->_userInstance->delete();
|
||||
}
|
||||
}
|
||||
public function getOwnedFiles()
|
||||
public function getOwnedFiles()
|
||||
{
|
||||
$user = $this->_userInstance;
|
||||
// do we need a find call at the end here?
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue