Ejemplo n.º 1
0
 public function getNameString(API $api)
 {
     $name = $this->getName();
     if ($name === null) {
         $name = $api->getTrans()->t('Unknown artist')->__toString();
     }
     return $name;
 }
Ejemplo n.º 2
0
 public function toAPI(API $api)
 {
     $coverUrl = null;
     if ($this->getCoverFileId() > 0) {
         $coverUrl = $api->linkToRoute('music_album_cover', array('albumIdOrSlug' => $this->getId()));
     }
     return array('name' => $this->getNameString($api), 'year' => $this->getYear(), 'cover' => $coverUrl, 'uri' => $this->getUri($api), 'slug' => $this->getid() . '-' . $this->slugify('name'), 'id' => $this->getId(), 'artists' => $this->getArtists($api));
 }
Ejemplo n.º 3
0
 public function toCollection(API $api)
 {
     return array('title' => $this->getTitle(), 'number' => $this->getNumber(), 'artistId' => $this->getArtistId(), 'albumId' => $this->getAlbumId(), 'files' => array($this->getMimetype() => $api->linkToRoute('music_file_download', array('fileId' => $this->getFileId()))), 'id' => $this->getId());
 }
Ejemplo n.º 4
0
 * License as published by the Free Software Foundation; either
 * version 3 of the License, or any later version.
 *
 * This library is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU AFFERO GENERAL PUBLIC LICENSE for more details.
 *
 * You should have received a copy of the GNU Affero General Public
 * License along with this library.  If not, see <http://www.gnu.org/licenses/>.
 *
 */
namespace OCA\Music;

use OCA\Music\Core\API;
$api = new API('music');
$api->addNavigationEntry(array('id' => $api->getAppName(), 'order' => 10, 'href' => $api->linkToRoute('music_index'), 'icon' => $api->imagePath('music.svg', 'music'), 'name' => $api->getTrans()->t('Music')));
$api->connectHook(\OC\Files\Filesystem::CLASSNAME, \OC\Files\Filesystem::signal_post_write, 'OCA\\Music\\Utility\\HookHandler', 'fileUpdated');
$api->connectHook(\OC\Files\Filesystem::CLASSNAME, \OC\Files\Filesystem::signal_delete, 'OCA\\Music\\Utility\\HookHandler', 'fileDeleted');
$api->connectHook('OCP\\Share', 'post_unshare', 'OCA\\Music\\Utility\\HookHandler', 'itemUnshared');
$api->connectHook('OCP\\Share', 'post_shared', 'OCA\\Music\\Utility\\HookHandler', 'itemShared');
$api->addRegularTask('OCA\\Music\\Backgroundjob\\CleanUp', 'run');
// load fileactions
$api->addScript('public/fileactions');
if (version_compare(join('.', $api->getVersion()), '6.0.3', '<')) {
    $api->addScript('public/stable5-fixes');
}
// load file for public sharing page
$api->addScript('public/musicFilePlayer');
// register search provider
\OC_Search::registerProvider('OCA\\Music\\Utility\\Search');