CC-2993: Playlist Builder: add "View on SoundCloud" option on the menu

- fixed
- extra fix: handles the case when username or password is empty
This commit is contained in:
James 2011-10-22 11:34:04 -04:00
parent 8b2a23b88a
commit f160ded6bc
10 changed files with 125 additions and 24 deletions

View file

@ -918,6 +918,16 @@ class Application_Model_StoredFile {
return $results;
}
public function setSoundCloudLinkToFile($link_to_file)
{
$this->_file->setDbSoundCloudLinkToFile($link_to_file)
->save();
}
public function getSoundCloudLinkToFile(){
return $this->_file->getDbSoundCloudLinkToFile();
}
public function setSoundCloudFileId($p_soundcloud_id)
{
$this->_file->setDbSoundCloudId($p_soundcloud_id)
@ -958,13 +968,14 @@ class Application_Model_StoredFile {
{
for($i=0; $i<$CC_CONFIG['soundcloud-connection-retries']; $i++) {
$description = $file->getDbTrackTitle();
$tag = "";
$tag = array();
$genre = $file->getDbGenre();
$release = $file->getDbYear();
try {
$soundcloud = new Application_Model_Soundcloud();
$soundcloud_id = $soundcloud->uploadTrack($this->getFilePath(), $this->getName(), $description, $tag, $release, $genre);
$this->setSoundCloudFileId($soundcloud_id);
$soundcloud_res = $soundcloud->uploadTrack($this->getFilePath(), $this->getName(), $description, $tag, $release, $genre);
$this->setSoundCloudFileId($soundcloud_res['id']);
$this->setSoundCloudLinkToFile($soundcloud_res['permalink_url']);
break;
}
catch (Services_Soundcloud_Invalid_Http_Response_Code_Exception $e) {