/**
  * Generates a playlist from the specified media item
  * @param IStreamable $media the media item
  * @param string $format the desired playlist format. Defaults to null, 
  * meaning the configured default format will be used
  * @return Playlist the playlist
  */
 private function createPlaylist($media, $format = null)
 {
     // Create the playlist
     $name = $media->getDisplayName();
     $playlist = PlaylistFactory::create($name, $format);
     // Add the playlist items
     foreach ($media->getItemLinks() as $itemLink) {
         // The item used in the playlist is not necessarily the same item
         // as $media
         $item = new PlaylistItem($itemLink);
         $playlist->addItem($item);
     }
     return $playlist;
 }
 /**
  * Renders the "Watch as playlist" button
  */
 private function renderWatchButton()
 {
     // Select the default playlist format by default
     $dropdownOptions = array(Setting::getString('playlistFormat') => array('selected' => 'selected'));
     echo TbHtml::dropDownListControlGroup('playlistFormat', 'playlistFormat', PlaylistFactory::getTypes(), array('label' => Yii::t('Settings', 'Playlist format'), 'options' => $dropdownOptions));
     echo TbHtml::submitButton(Yii::t('RetrieveMediaWidget', 'Watch as playlist'), $this->getWatchButtonsOptions());
 }
Beispiel #3
0
    /**
     * Returns the settings definitions
     * @return array
     */
    public function getDefinitions()
    {
        return array('language' => array('label' => Yii::t('Settings', 'Application language'), 'separator' => array('icon' => 'fa fa-pencil-square-o', 'label' => Yii::t('Settings', 'Look and feel')), 'type' => self::TYPE_DROPDOWN, 'default' => 'en', 'description' => Yii::t('Settings', 'Changing this will reset the default language for all users'), 'listData' => LanguageManager::getAvailableLanguages(), 'order' => 50), 'applicationName' => array('label' => Yii::t('Settings', 'Application name'), 'type' => self::TYPE_TEXT, 'default' => 'XBMC Video Server', 'order' => 100), 'applicationSubtitle' => array('label' => Yii::t('Settings', 'Application subtitle'), 'type' => self::TYPE_TEXT, 'default' => Yii::t('Misc', 'Free your library'), 'order' => 125), 'playlistFormat' => array('label' => Yii::t('Settings', 'Playlist format'), 'type' => self::TYPE_DROPDOWN, 'default' => 'm3u', 'listData' => PlaylistFactory::getTypes(), 'order' => 150), 'singleFilePlaylist' => array('label' => Yii::t('Settings', "Don't use playlists when item consists of a single file"), 'type' => self::TYPE_CHECKBOX, 'default' => '0', 'description' => Yii::t('Settings', 'You may have to right-click and copy the address in order to stream (not download) the file'), 'order' => 200), 'showHelpBlocks' => array('label' => Yii::t('Settings', 'Show help blocks throughout the site'), 'type' => self::TYPE_CHECKBOX, 'default' => '1', 'order' => 300), 'pagesize' => array('label' => Yii::t('Settings', 'Amount of results to show per page'), 'type' => self::TYPE_TEXT, 'default' => '60', 'description' => Yii::t('Settings', 'Leave empty to disable pagination altogether'), 'htmlOptions' => array('span' => 1), 'order' => 500), 'ignoreArticle' => array('label' => Yii::t('Settings', 'Ignore article ("the") in results'), 'type' => self::TYPE_CHECKBOX, 'default' => '', 'order' => 550), 'requestTimeout' => array('label' => Yii::t('Settings', 'Request timeout'), 'separator' => array('icon' => 'fa fa-lock', 'label' => Yii::t('Settings', 'Security and performance')), 'type' => self::TYPE_TEXT, 'default' => '30', 'description' => Yii::t('Settings', 'Determines how long the application should wait for a response from XBMC. Increase this if you get timeout errors.'), 'htmlOptions' => array('span' => 1), 'order' => 625), 'cacheApiCalls' => array('label' => Yii::t('Settings', 'Cache all API results'), 'type' => self::TYPE_CHECKBOX, 'default' => '0', 'description' => Yii::t('Settings', 'Useful on slow hardware. A refresh button will appear in the menu which flushes the cache'), 'order' => 650), 'useHttpsForVfsUrls' => array('label' => Yii::t('Settings', 'Use HTTPS when streaming'), 'type' => self::TYPE_CHECKBOX, 'default' => '0', 'description' => Yii::t('Settings', 'When checked, streaming will be done over HTTPS if 
					the application is accessed over HTTPS. This will usually only 
					work if the server uses a real signed certificate, thus it is 
					not enabled by default.'), 'order' => 700), 'allowUserPowerOff' => array('label' => Yii::t('Settings', 'Allow users to power off backends'), 'type' => self::TYPE_CHECKBOX_LIST, 'default' => '', 'listData' => array(Setting::POWER_OPTION_SHUTDOWN => Yii::t('Settings', 'Shutdown'), Setting::POWER_OPTION_SUSPEND => Yii::t('Settings', 'Suspend'), Setting::POWER_OPTION_HIBERNATE => Yii::t('Settings', 'Hibernate'), Setting::POWER_OPTION_REBOOT => Yii::t('Settings', 'Reboot')), 'description' => Yii::t('Settings', 'Administrators are not affected by this setting and can always power off backends.'), 'order' => 750), 'whitelist' => array('label' => Yii::t('Settings', 'Access whitelist'), 'type' => self::TYPE_TEXT_WIDE, 'default' => '', 'description' => Yii::t('Settings', "If specified, access is restricted to the defined \n\t\t\t\t\twhitelist. Valid values are IP addresses, IP subnets and \n\t\t\t\t\tdomain names (including wildcards). Example: 192.168.1.0/24,1.2.3.4,example.com,*.user.com"), 'order' => 800));
    }