コード例 #1
0
ファイル: RSS.inc.php プロジェクト: radicalsuz/amp
 function itemSetToRSSArray($podcast_item_set)
 {
     if (!$podcast_item_set->isReady()) {
         return null;
     }
     while ($item = $podcast_item_set->getData()) {
         $items[] = array("title" => $item['title'], "pubDate" => date('D, j M Y G:i:s T', strtotime($item['date'])), "guid" => $this->getGuid($item['file']), "enclosure" => array("_attributes" => array("url" => $this->getFileLink($item['file']), "length" => Podcast::convert_time($item['length']), "type" => "audio/mpeg")), "link" => $this->getItemLink($item['id']), "itunes:author" => $item['author'], "itunes:subtitle" => $item['subtitle'], "itunes:summary" => $item['description'], "description" => $item['description'], "itunes:category" => $item['category'], "itunes:duration" => $item['length'], "itunes:explicit" => 'no', "itunes:keywords" => $item['keywords']);
     }
     return $items;
 }
コード例 #2
0
 /**
  * Load the component Podcast.
  * 
  * @param \Cx\Core\ContentManager\Model\Entity\Page $page       The resolved page
  */
 public function load(\Cx\Core\ContentManager\Model\Entity\Page $page)
 {
     global $subMenuTitle, $objTemplate, $_CORELANG;
     switch ($this->cx->getMode()) {
         case \Cx\Core\Core\Controller\Cx::MODE_FRONTEND:
             $objPodcast = new Podcast(\Env::get('cx')->getPage()->getContent());
             \Env::get('cx')->getPage()->setContent($objPodcast->getPage($podcastFirstBlock));
             break;
         case \Cx\Core\Core\Controller\Cx::MODE_BACKEND:
             $this->cx->getTemplate()->addBlockfile('CONTENT_OUTPUT', 'content_master', 'LegacyContentMaster.html');
             $objTemplate = $this->cx->getTemplate();
             \Permission::checkAccess(87, 'static');
             $subMenuTitle = $_CORELANG['TXT_PODCAST'];
             $objPodcast = new PodcastManager();
             $objPodcast->getPage();
             break;
         default:
             break;
     }
 }
コード例 #3
0
ファイル: Recast.php プロジェクト: benallfree/recast
 function recast_shortcode($attrs, $content = '')
 {
     if ($this->q('p')) {
         $podcast = Podcast::find($this->q('p'));
         $fname = dirname(__FILE__) . "/../views/podcasts/view.php";
         return $this->make($fname, array('podcast' => $podcast));
     } else {
         $args = array('meta_key' => 'episode_count', 'orderby' => 'meta_value_num desc');
         $podcasts = Podcast::all($args);
         $fname = dirname(__FILE__) . "/../views/podcasts/list.php";
         return $this->make($fname, array('podcasts' => $podcasts));
     }
 }
コード例 #4
0
ファイル: media_file.php プロジェクト: rthees/podlove
 /**
  * Dynamically return file url from release, format and show.
  *
  * @return string
  */
 public function get_file_url()
 {
     $podcast = Podcast::get_instance();
     $episode = $this->episode();
     $episode_asset = EpisodeAsset::find_by_id($this->episode_asset_id);
     $file_type = FileType::find_by_id($episode_asset->file_type_id);
     if (!$episode_asset || !$file_type || !$episode->slug) {
         return '';
     }
     $template = $episode_asset->url_template;
     $template = str_replace('%media_file_base_url%', $podcast->media_file_base_uri, $template);
     $template = str_replace('%episode_slug%', $episode->slug, $template);
     $template = str_replace('%format_extension%', $file_type->extension, $template);
     return $template;
 }
コード例 #5
0
ファイル: feed.php プロジェクト: rthees/podlove
 /**
  * Get title for browser feed discovery.
  *
  * This title is used by clients to show the user the subscribe option he
  * has. Therefore, the most obvious thing to do is to display the show
  * title and the file extension in paranthesis.
  *
  * Fallback to internal feed name.
  * 
  * @return string
  */
 public function title_for_discovery()
 {
     $podcast = Podcast::get_instance();
     $episode_asset = $this->episode_asset();
     if (!$episode_asset) {
         return $this->name;
     }
     $file_type = $episode_asset->file_type();
     if (!$file_type) {
         return $this->name;
     }
     $file_extension = $file_type->extension;
     $title = sprintf(__('Podcast Feed: %s (%s)', 'podcast'), $podcast->title, $this->name);
     $title = apply_filters('podlove_feed_title_for_discovery', $title, $this->title, $file_extension, $this->id);
     return $title;
 }
コード例 #6
0
ファイル: episode.php プロジェクト: rthees/podlove
 public function get_cover_art()
 {
     $podcast = Podcast::get_instance();
     if ($podcast->supports_cover_art == 0) {
         return;
     }
     if ($podcast->supports_cover_art == 'manual') {
         return $this->cover_art;
     }
     $cover_art_file_id = $podcast->supports_cover_art;
     if (!($asset = EpisodeAsset::find_one_by_id($cover_art_file_id))) {
         return false;
     }
     if (!($file = MediaFile::find_by_episode_id_and_episode_asset_id($this->id, $asset->id))) {
         return false;
     }
     return $file->get_file_url();
 }
コード例 #7
0
ファイル: supprimer.php プロジェクト: Hugow10/podcastoi
<?php

include "connexionBDD.php";
include "modeles/podcastModel.php";
if (isset($_GET['pod_supr'])) {
    $id = $_GET['pod_supr'];
    $podcast = new Podcast("", "", "", "", "", "");
    $podcast->supprimePodcast($id);
    header("location:podcast.php");
}
コード例 #8
0
ファイル: podcast.ajax.php プロジェクト: bl00m/ampache
 *
 */
/**
 * Sub-Ajax page, requires AJAX_INCLUDE
 */
if (!defined('AJAX_INCLUDE')) {
    exit;
}
switch ($_REQUEST['action']) {
    case 'sync':
        if (!Access::check('interface', '75')) {
            debug_event('DENIED', $GLOBALS['user']->username . ' attempted to sync podcast', 1);
            exit;
        }
        if (isset($_REQUEST['podcast_id'])) {
            $podcast = new Podcast($_REQUEST['podcast_id']);
            if ($podcast->id) {
                $podcast->sync_episodes(true);
            } else {
                debug_event('podcast', 'Cannot found podcast', 1);
            }
        } elseif (isset($_REQUEST['podcast_episode_id'])) {
            $episode = new Podcast_Episode($_REQUEST['podcast_episode_id']);
            if ($episode->id) {
                $episode->gather();
            } else {
                debug_event('podcast', 'Cannot found podcast episode', 1);
            }
        }
        $results['rfc3514'] = '0x1';
        break;
コード例 #9
0
ファイル: podcast.php プロジェクト: rafale57/podcastoi
<?php

include "header.php";
include "aside.php";
include "footer.php";
include 'connexionBDD.php';
include 'podcastModel.php';
$titrePod = "";
$auteurPod = "";
$datePod = "";
$descPod = "";
$urlPod = "";
if (isset($_POST['url'])) {
    $url = htmlentities($_POST['url']);
    $podcast = new Podcast("", "", "", "", "", "");
    $podcast->recuperePodcast($url);
}
if (isset($_GET['podcast'])) {
    $idPodSel = $_GET['podcast'];
    $sql2 = "SELECT * FROM podcast WHERE id_pod='{$idPodSel}'";
    $res2 = @mysql_query($sql2) or die('Erreur requete SQL' . "  " . mysql_error());
    if ($res2) {
        while ($data = mysql_fetch_assoc($res2)) {
            $titrePod = $data['titre'];
            $auteurPod = $data['auteur'];
            $datePod = $data['date'];
            $descPod = $data['description'];
            $urlPod = $data['url'];
        }
    }
}
コード例 #10
0
ファイル: webService.php プロジェクト: Hugow10/podcastoi
<?php

include "modeles/podcastModel.php";
include "connexionBDD.php";
//si la requete est valide pour un ajout de podcast:
if (isset($_POST['url']) && isset($_POST['nomAbonnement'])) {
    //si l'url est correcte
    if (!empty($_POST['url']) && !empty($_POST['nomAbonnement'])) {
        $url = htmlentities($_POST['url']);
        $nom = htmlentities($_POST['nomAbonnement']);
        $podcast = new Podcast("", "", "", "", "", "");
        $podcast->recuperePodcast($url, $nom);
        wsReponse(200, 'Requete valide', NULL);
    } else {
        wsReponse(500, 'Requete invalide', NULL);
    }
} else {
    if (isset($_POST['podcast'])) {
        $id = $_POST['podcast'];
    } else {
        wsReponse(500, 'Internal Server Error', NULL);
    }
}
function wsReponse($status, $status_message, $data)
{
    header('HTTP/1.1 $status $status_message', true, $status);
    $reponse['status'] = $status;
    $reponse['status_message'] = $status_message;
    $reponse['data'] = $data;
    $reponse_json = json_encode($reponse);
    echo $reponse_json;
コード例 #11
0
ファイル: show_podcasts.inc.php プロジェクト: bl00m/ampache
            <th class="cel_action essential"><?php 
echo T_('Actions');
?>
</th>
        </tr>
    </thead>
    <tbody>
        <?php 
if (AmpConfig::get('ratings')) {
    Rating::build_cache('podcast', $object_ids);
}
if (AmpConfig::get('userflags')) {
    Userflag::build_cache('podcast', $object_ids);
}
foreach ($object_ids as $podcast_id) {
    $libitem = new Podcast($podcast_id);
    $libitem->format();
    ?>
        <tr id="podcast_<?php 
    echo $libitem->id;
    ?>
" class="<?php 
    echo UI::flip_class();
    ?>
">
            <?php 
    require AmpConfig::get('prefix') . UI::find_template('show_podcast_row.inc.php');
    ?>
        </tr>
        <?php 
}
コード例 #12
0
ファイル: podcast.class.php プロジェクト: bl00m/ampache
 public static function create(array $data)
 {
     $feed = $data['feed'];
     // Feed must be http/https
     if (strpos($feed, "http://") !== 0 && strpos($feed, "https://") !== 0) {
         AmpError::add('feed', T_('Wrong feed url'));
     }
     $catalog_id = intval($data['catalog']);
     if ($catalog_id <= 0) {
         AmpError::add('catalog', T_('Target catalog required'));
     } else {
         $catalog = Catalog::create_from_id($catalog_id);
         if ($catalog->gather_types !== "podcast") {
             AmpError::add('catalog', T_('Wrong target catalog type'));
         }
     }
     if (AmpError::occurred()) {
         return false;
     }
     $title = T_('Unknown');
     $website = null;
     $description = null;
     $language = null;
     $copyright = null;
     $generator = null;
     $lastbuilddate = 0;
     $episodes = array();
     $arturl = '';
     $xmlstr = file_get_contents($feed);
     if ($xmlstr === false) {
         AmpError::add('feed', T_('Cannot access the feed.'));
     } else {
         $xml = simplexml_load_string($xmlstr);
         if ($xml === false) {
             AmpError::add('feed', T_('Cannot read the feed.'));
         } else {
             $title = html_entity_decode($xml->channel->title);
             $website = $xml->channel->link;
             $description = html_entity_decode($xml->channel->description);
             $language = $xml->channel->language;
             $copyright = html_entity_decode($xml->channel->copyright);
             $generator = html_entity_decode($xml->channel->generator);
             $lastbuilddatestr = $xml->channel->lastBuildDate;
             if ($lastbuilddatestr) {
                 $lastbuilddate = strtotime($lastbuilddatestr);
             }
             if ($xml->channel->image) {
                 $arturl = $xml->channel->image->url;
             }
             $episodes = $xml->channel->item;
         }
     }
     if (AmpError::occurred()) {
         return false;
     }
     $sql = "INSERT INTO `podcast` (`feed`, `catalog`, `title`, `website`, `description`, `language`, `copyright`, `generator`, `lastbuilddate`) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?)";
     $db_results = Dba::write($sql, array($feed, $catalog_id, $title, $website, $description, $language, $copyright, $generator, $lastbuilddate));
     if ($db_results) {
         $id = Dba::insert_id();
         $podcast = new Podcast($id);
         $dirpath = $podcast->get_root_path();
         if (!is_dir($dirpath)) {
             if (mkdir($dirpath) === false) {
                 debug_event('podcast', 'Cannot create directory ' . $dirpath, 1);
             }
         }
         if (!empty($arturl)) {
             $art = new Art($id, 'podcast');
             $art->insert_url($arturl);
         }
         if (count($episodes) > 0) {
             $podcast->add_episodes($episodes);
         }
     }
     return $db_results;
 }
コード例 #13
0
    }
}
Podcast::property('title');
Podcast::property('subtitle');
Podcast::property('cover_image');
Podcast::property('summary');
Podcast::property('author_name');
Podcast::property('owner_name');
Podcast::property('owner_email');
Podcast::property('publisher_name');
Podcast::property('publisher_url');
Podcast::property('license_type');
Podcast::property('license_name');
Podcast::property('license_url');
Podcast::property('license_cc_allow_modifications');
Podcast::property('license_cc_allow_commercial_use');
Podcast::property('license_cc_license_jurisdiction');
Podcast::property('keywords');
Podcast::property('category_1');
Podcast::property('category_2');
Podcast::property('category_3');
Podcast::property('explicit');
Podcast::property('label');
Podcast::property('episode_prefix');
Podcast::property('media_file_base_uri');
Podcast::property('uri_delimiter');
Podcast::property('limit_items');
Podcast::property('language');
Podcast::property('complete');
Podcast::property('flattr');
// @deprecated since 2.3.0 (now: wp_option "podlove_flattr")
コード例 #14
0
ファイル: upnp_api.class.php プロジェクト: bl00m/ampache
 public static function _musicChilds($prmPath, $prmQuery, $start, $count)
 {
     $mediaItems = array();
     $maxCount = 0;
     $queryData = array();
     parse_str($prmQuery, $queryData);
     $parent = 'amp://music' . $prmPath;
     $pathreq = explode('/', $prmPath);
     if ($pathreq[0] == '' && count($pathreq) > 0) {
         array_shift($pathreq);
     }
     switch ($pathreq[0]) {
         case 'artists':
             switch (count($pathreq)) {
                 case 1:
                     // Get artists list
                     //$artists = Catalog::get_artists();
                     //list($maxCount, $artists) = self::_slice($artists, $start, $count);
                     $artists = Catalog::get_artists(null, $count, $start);
                     list($maxCount, $artists) = array(999999, $artists);
                     foreach ($artists as $artist) {
                         $artist->format();
                         $mediaItems[] = self::_itemArtist($artist, $parent);
                     }
                     break;
                 case 2:
                     // Get artist's albums list
                     $artist = new Artist($pathreq[1]);
                     if ($artist->id) {
                         $album_ids = $artist->get_albums();
                         list($maxCount, $album_ids) = self::_slice($album_ids, $start, $count);
                         foreach ($album_ids as $album_id) {
                             $album = new Album($album_id);
                             $album->format();
                             $mediaItems[] = self::_itemAlbum($album, $parent);
                         }
                     }
                     break;
             }
             break;
         case 'albums':
             switch (count($pathreq)) {
                 case 1:
                     // Get albums list
                     //!!$album_ids = Catalog::get_albums();
                     //!!list($maxCount, $album_ids) = self::_slice($album_ids, $start, $count);
                     $album_ids = Catalog::get_albums($count, $start);
                     list($maxCount, $album_ids) = array(999999, $album_ids);
                     foreach ($album_ids as $album_id) {
                         $album = new Album($album_id);
                         $album->format();
                         $mediaItems[] = self::_itemAlbum($album, $parent);
                     }
                     break;
                 case 2:
                     // Get album's songs list
                     $album = new Album($pathreq[1]);
                     if ($album->id) {
                         $song_ids = $album->get_songs();
                         list($maxCount, $song_ids) = self::_slice($song_ids, $start, $count);
                         foreach ($song_ids as $song_id) {
                             $song = new Song($song_id);
                             $song->format();
                             $mediaItems[] = self::_itemSong($song, $parent);
                         }
                     }
                     break;
             }
             break;
         case 'songs':
             switch (count($pathreq)) {
                 case 1:
                     // Get songs list
                     $catalogs = Catalog::get_catalogs();
                     foreach ($catalogs as $catalog_id) {
                         $catalog = Catalog::create_from_id($catalog_id);
                         $songs = $catalog->get_songs();
                         list($maxCount, $songs) = self::_slice($songs, $start, $count);
                         foreach ($songs as $song) {
                             $song->format();
                             $mediaItems[] = self::_itemSong($song, $parent);
                         }
                     }
                     break;
             }
             break;
         case 'playlists':
             switch (count($pathreq)) {
                 case 1:
                     // Get playlists list
                     $pl_ids = Playlist::get_playlists();
                     list($maxCount, $pl_ids) = self::_slice($pl_ids, $start, $count);
                     foreach ($pl_ids as $pl_id) {
                         $playlist = new Playlist($pl_id);
                         $playlist->format();
                         $mediaItems[] = self::_itemPlaylist($playlist, $parent);
                     }
                     break;
                 case 2:
                     // Get playlist's songs list
                     $playlist = new Playlist($pathreq[1]);
                     if ($playlist->id) {
                         $items = $playlist->get_items();
                         list($maxCount, $items) = self::_slice($items, $start, $count);
                         foreach ($items as $item) {
                             if ($item['object_type'] == 'song') {
                                 $song = new Song($item['object_id']);
                                 $song->format();
                                 $mediaItems[] = self::_itemSong($song, $parent);
                             }
                         }
                     }
                     break;
             }
             break;
         case 'smartplaylists':
             switch (count($pathreq)) {
                 case 1:
                     // Get playlists list
                     $pl_ids = Search::get_searches();
                     list($maxCount, $pl_ids) = self::_slice($pl_ids, $start, $count);
                     foreach ($pl_ids as $pl_id) {
                         $playlist = new Search($pl_id, 'song');
                         $playlist->format();
                         $mediaItems[] = self::_itemPlaylist($playlist, $parent);
                     }
                     break;
                 case 2:
                     // Get playlist's songs list
                     $playlist = new Search($pathreq[1], 'song');
                     if ($playlist->id) {
                         $items = $playlist->get_items();
                         list($maxCount, $items) = self::_slice($items, $start, $count);
                         foreach ($items as $item) {
                             if ($item['object_type'] == 'song') {
                                 $song = new Song($item['object_id']);
                                 $song->format();
                                 $mediaItems[] = self::_itemSong($song, $parent);
                             }
                         }
                     }
                     break;
             }
             break;
         case 'live_streams':
             switch (count($pathreq)) {
                 case 1:
                     // Get radios list
                     $radios = Live_Stream::get_all_radios();
                     list($maxCount, $radios) = self::_slice($radios, $start, $count);
                     foreach ($radios as $radio_id) {
                         $radio = new Live_Stream($radio_id);
                         $radio->format();
                         $mediaItems[] = self::_itemLiveStream($radio, $parent);
                     }
                     break;
             }
             break;
         case 'podcasts':
             switch (count($pathreq)) {
                 case 1:
                     // Get podcasts list
                     $podcasts = Catalog::get_podcasts();
                     list($maxCount, $podcasts) = self::_slice($podcasts, $start, $count);
                     foreach ($podcasts as $podcast) {
                         $podcast->format();
                         $mediaItems[] = self::_itemPodcast($podcast, $parent);
                     }
                     break;
                 case 2:
                     // Get podcast episodes list
                     $podcast = new Podcast($pathreq[1]);
                     if ($podcast->id) {
                         $episodes = $podcast->get_episodes();
                         list($maxCount, $episodes) = self::_slice($episodes, $start, $count);
                         foreach ($episodes as $episode_id) {
                             $episode = new Podcast_Episode($episode_id);
                             $episode->format();
                             $mediaItems[] = self::_itemPodcastEpisode($episode, $parent);
                         }
                     }
                     break;
             }
             break;
         default:
             $mediaItems[] = self::_musicMetadata('artists');
             $mediaItems[] = self::_musicMetadata('albums');
             $mediaItems[] = self::_musicMetadata('songs');
             $mediaItems[] = self::_musicMetadata('playlists');
             $mediaItems[] = self::_musicMetadata('smartplaylists');
             if (AmpConfig::get('live_stream')) {
                 $mediaItems[] = self::_musicMetadata('live_streams');
             }
             if (AmpConfig::get('podcast')) {
                 $mediaItems[] = self::_musicMetadata('podcasts');
             }
             break;
     }
     if ($maxCount == 0) {
         $maxCount = count($mediaItems);
     }
     return array($maxCount, $mediaItems);
 }
コード例 #15
0
ファイル: podcast.php プロジェクト: rthees/podlove
     * Generate a human readable title.
     * 
     * Return name and, if available, the subtitle. Separated by a dash.
     * 
     * @return string
     */
    public function full_title()
    {
        $t = $this->title;
        if ($this->subtitle) {
            $t = $t . ' - ' . $this->subtitle;
        }
        return $t;
    }
}
$podcast = Podcast::get_instance();
$podcast->property('title');
$podcast->property('slug');
// identifier
// Identifiers
// nsfw    - slug (url/file)
// NSFW    - podcast id / short name
// NSFW002 - episode id
// 2       - episode number
$podcast->property('subtitle');
$podcast->property('cover_image');
$podcast->property('summary');
$podcast->property('author_name');
$podcast->property('owner_name');
$podcast->property('owner_email');
$podcast->property('keywords');
コード例 #16
0
ファイル: podcast.php プロジェクト: bl00m/ampache
            UI::access_denied();
            exit;
        }
        $podcast_id = scrub_in($_REQUEST['podcast_id']);
        show_confirmation(T_('Podcast Deletion'), T_('Are you sure you want to delete this podcast?'), AmpConfig::get('web_path') . "/podcast.php?action=confirm_delete&podcast_id=" . $podcast_id, 1, 'delete_podcast');
        break;
    case 'confirm_delete':
        if (!Access::check('interface', 75) || AmpConfig::get('demo_mode')) {
            UI::access_denied();
            exit;
        }
        $podcast = new Podcast($_REQUEST['podcast_id']);
        if ($podcast->remove()) {
            show_confirmation(T_('Podcast Deletion'), T_('Podcast has been deleted.'), AmpConfig::get('web_path') . '/browse.php?action=podcast');
        } else {
            show_confirmation(T_('Podcast Deletion'), T_('Cannot delete this podcast.'), AmpConfig::get('web_path') . '/browse.php?action=podcast');
        }
        break;
    case 'show':
        $podcast_id = intval($_REQUEST['podcast']);
        if ($podcast_id > 0) {
            $podcast = new Podcast($podcast_id);
            $podcast->format();
            $object_ids = $podcast->get_episodes();
            $object_type = 'podcast_episode';
            require_once AmpConfig::get('prefix') . UI::find_template('show_podcast.inc.php');
        }
        break;
}
// end data collection
UI::show_footer();
コード例 #17
0
ファイル: subsonic_api.class.php プロジェクト: bl00m/ampache
 /**
  * deletePodcastChannel
  * Delete an existing podcast channel
  * Takes the podcast id in parameter.
  */
 public static function deletepodcastchannel($input)
 {
     self::check_version($input, "1.9.0");
     $id = self::check_parameter($input, 'id');
     if (AmpConfig::get('podcast') && Access::check('interface', 75)) {
         $podcast = new Podcast(Subsonic_XML_Data::getAmpacheId($id));
         if ($podcast->id) {
             if ($podcast->remove()) {
                 $r = Subsonic_XML_Data::createSuccessResponse();
             } else {
                 $r = Subsonic_XML_Data::createError(Subsonic_XML_Data::SSERROR_GENERIC);
             }
         } else {
             $r = Subsonic_XML_Data::createError(Subsonic_XML_Data::SSERROR_DATA_NOTFOUND);
         }
     } else {
         $r = Subsonic_XML_Data::createError(Subsonic_XML_Data::SSERROR_UNAUTHORIZED);
     }
     self::apiOutput($input, $r);
 }
コード例 #18
0
 public function gather()
 {
     if (!empty($this->source)) {
         $podcast = new Podcast($this->podcast);
         $file = $podcast->get_root_path();
         if (!empty($file)) {
             $pinfo = pathinfo($this->source);
             $file .= DIRECTORY_SEPARATOR . $this->id . '-' . $pinfo['basename'];
             debug_event('podcast_episode', 'Downloading ' . $this->source . ' to ' . $file . ' ...', 5);
             if (file_put_contents($file, fopen($this->source, 'r')) !== false) {
                 debug_event('podcast_episode', 'Download completed.', 5);
                 $this->file = $file;
                 $vainfo = new vainfo($this->file);
                 $vainfo->get_info();
                 $key = vainfo::get_tag_type($vainfo->tags);
                 $infos = vainfo::clean_tag_info($vainfo->tags, $key, $file);
                 // No time information, get it from file
                 if ($this->time <= 0) {
                     $this->time = $infos['time'];
                 }
                 $this->size = $infos['size'];
                 $sql = "UPDATE `podcast_episode` SET `file` = ?, `size` = ?, `time` = ?, `state` = 'completed' WHERE `id` = ?";
                 Dba::write($sql, array($this->file, $this->size, $this->time, $this->id));
             } else {
                 debug_event('podcast_episode', 'Error when downloading podcast episode.', 1);
             }
         }
     } else {
         debug_event('podcast_episode', 'Cannot download podcast episode ' . $this->id . ', empty source.', 3);
     }
 }
コード例 #19
0
 /**
  * Get the SQL LIMIT segment for this feed.
  *
  * Depending on settings it can be LIMIT <num> or empty.
  * 
  * @return string
  */
 public function get_post_limit_sql($posts_per_page = false)
 {
     if ($posts_per_page === false) {
         $posts_per_page = (int) $this->limit_items;
     }
     if ($posts_per_page === self::ITEMS_WP_LIMIT) {
         $posts_per_page = (int) get_option('posts_per_rss');
     }
     if ($posts_per_page > 0) {
         return $posts_per_page;
     }
     // no limit
     if ($posts_per_page === self::ITEMS_NO_LIMIT) {
         return '';
     }
     if ($posts_per_page === self::ITEMS_GLOBAL_LIMIT) {
         $podcast = Podcast::get();
         if ((int) $podcast->limit_items !== self::ITEMS_GLOBAL_LIMIT) {
             return $this->get_post_limit_sql($podcast->limit_items);
         }
     }
     // default to no limit; however, this should never happen
     return '';
 }
コード例 #20
0
$notempty = 0;
for ($i = 0; $i != $limit; $i++) {
    if (isset($podcasts[$i])) {
        echo "<li id=\"time" . $i . "\"";
        if ($podcasts[$i]->duration > 1) {
            echo " class=\"large\"";
        }
        echo ">";
        $podcasts[$i]->toItem($date);
        $first = true;
        $notempty = $podcasts[$i]->duration - 1;
        echo "</li>\n";
    } else {
        if ($first && $notempty == 0) {
            echo "<li id=\"time" . $i . "\">";
            Podcast::emptyToItem($i);
            echo "</li>\n";
        } else {
            if ($notempty != 0) {
                $notempty = $notempty - 1;
            }
        }
    }
}
if ($aujourdhui) {
    if ($limit != $now + 1) {
        echo '<li class="suspension"><p title="Patientez un peu, le podcast sera bientôt en ligne...">...</p></li>';
    }
    echo '<li id="directlink"><p onclick="play_live(true, true)"';
    echo ' onmouseover="document.getElementById(\'direct\').style.display=\'block\';"  onmouseout="document.getElementById(\'direct\').style.display=\'none\';" >direct</p>';
    echo "<div id=\"direct\" class=\"time_popup\">Écouter la radio en direct</div>";