Exemplo n.º 1
0
 /**
  * Method for to create a info readme file about the album
  *
  * @param array $items album items
  */
 public function createInfoFile($items)
 {
     $dispatcher = JDispatcher::getInstance();
     $dispatcher->trigger('onEventLogging', array(array('method' => __METHOD__ . ":" . __LINE__, 'message' => 'Starting for create info text file.', 'priority' => JLog::INFO, 'section' => 'site')));
     $PJContent = "Album Infos:\r\n";
     $PJContent .= base64_decode(JRequest::getVar('name')) . ", " . base64_decode(JRequest::getVar('artist')) . "\r\n";
     $PJContent .= "------------------------------------------------------------------------------\r\n";
     foreach ($items as $i => $item) {
         if (JFile::exists($item->pathatlocal . DIRECTORY_SEPARATOR . $item->file)) {
             $PJContent .= $item->artist . ", " . $item->album . " - " . $item->tracknumber . " - " . $item->title . " (" . PlayJoomHelper::Playtime($item->length) . ")\r\n";
         } else {
             $dispatcher->trigger('onEventLogging', array(array('method' => __METHOD__ . ":" . __LINE__, 'message' => 'Track ' . $item->title . ' isn´t available!', 'priority' => JLog::WARNING, 'section' => 'site')));
         }
     }
     $PJContent .= "\r\n";
     $PJContent .= "\r\n";
     $About = array('artist' => JRequest::getVar('artist'), 'album' => JRequest::getVar('name'), 'type' => JRequest::getVar('type'));
     require_once JPATH_COMPONENT . '/apis/lastfm.php';
     $ContentExist = PlayJoomLastfmHelper::CheckLastfmContent('album', $About);
     if ($ContentExist == true) {
         $PJContent .= "About the album:\r\n";
         $PJContent .= "------------------------------------------------------------------------------\r\n";
         $PJContent .= PlayJoomLastfmHelper::GetLastfmContent('album', $About)->album->wiki->content;
         $PJContent .= "------------------------------------------------------------------------------\r\n";
     }
     $ContentExist = PlayJoomLastfmHelper::CheckLastfmContent('artist', $About);
     if ($ContentExist == true) {
         $PJContent .= "About the artist / band:\r\n";
         $PJContent .= "------------------------------------------------------------------------------\r\n";
         $PJContent .= PlayJoomLastfmHelper::GetLastfmContent('artist', $About)->artist->bio->content;
         $PJContent .= "------------------------------------------------------------------------------\r\n";
     }
     $PJContent .= "\r\n";
     $PJContent .= "\r\n";
     $PJContent .= "------------------------------------------------------------------------------\r\n";
     $PJContent .= "Archiv created by PlayJoom Server.\r\n";
     $PJContent .= PlayJoomHelper::GetInstallInfo("description", "playjoom.xml") . "\r\n";
     $PJContent .= "\r\n";
     $PJContent .= "\r\n";
     $PJContent .= "Version: " . PlayJoomHelper::GetInstallInfo("version", "playjoom.xml") . "\r\n";
     $PJContent .= "copyright: " . PlayJoomHelper::GetInstallInfo("copyright", "playjoom.xml") . "\r\n";
     $PJContent .= "web: " . PlayJoomHelper::GetInstallInfo("authorUrl", "playjoom.xml") . "\r\n";
     $this->data[] = $PJContent;
 }
Exemplo n.º 2
0
 function display($tpl = null)
 {
     // Assign data to the view
     $this->info = $this->get('Info');
     //Get setting values from xml file
     $app = JFactory::getApplication();
     $params = $app->getParams();
     // Check for errors.
     if (count($errors = $this->get('Errors'))) {
         JError::raiseError(500, implode('<br />', $errors));
         return false;
     }
     $this->assignRef('params', $params);
     //load external data
     if (JRequest::getVar('source') == 'lastfm') {
         $About = array('artist' => JRequest::getVar('artist'), 'album' => JRequest::getVar('album'), 'genre' => JRequest::getVar('genre'), 'type' => JRequest::getVar('type'));
         require_once JPATH_COMPONENT . '/apis/lastfm.php';
         $getLastFMContent = PlayJoomLastfmHelper::GetLastfmContent(JRequest::getVar('type'), $About);
         $this->assignRef('lastFMRequest', $getLastFMContent);
     }
     // Display the view
     parent::display($tpl);
 }