Ejemplo n.º 1
0
function refreshYouTubeStats()
{
    global $database;
    include_once 'functions_cast.php';
    include_once 'functions_youtube.php';
    $youtubeids = array();
    foreach (getCasts() as $cast) {
        $meta = getCastHeader($cast);
        if ($meta == false) {
            continue;
        }
        if ($meta['YOUTUBE'] == '') {
            continue;
        }
        array_push($youtubeids, $meta['YOUTUBE']);
    }
    $viewStats = getVideoViews($youtubeids);
    $storestats = $database->prepare("INSERT INTO youtubestats (videoid, count) VALUES (:videoid, :count)\n\t\tON DUPLICATE KEY UPDATE videoid=VALUES(videoid), count=VALUES(count);");
    // DRUNK ON SQL - this fails if the key is missing q.q {trying to avoid updating if count !> stored count}
    //	$storestats = $database->prepare( "INSERT INTO youtubestats (videoid, count)
    //		SELECT :videoid, :count FROM youtubestats WHERE videoid=:videoid AND count < :count
    //		ON DUPLICATE KEY UPDATE videoid=VALUES(videoid), count=VALUES(count);" );
    try {
        $database->beginTransaction();
        foreach ($viewStats as $video => $count) {
            $storestats->execute(array('videoid' => $video, 'count' => $count));
        }
        $database->commit();
    } catch (Exception $e) {
        return false;
    }
    return true;
}
Ejemplo n.º 2
0
\t\t</header>
\t\t<div class="panel-body panel-body-table">
\t\t\t<table id="casts" class="table table-striped table-hover tablesorter">
\t\t\t\t<thead>
\t\t\t\t\t<tr>
\t\t\t\t\t\t<th class="col-sm-1">No.
\t\t\t\t\t\t<th class="hidden-xxs">Reco​rded
\t\t\t\t\t\t<th class="col-sm-4">Title
\t\t\t\t\t\t<th class="col-xs-1">Rating
\t\t\t\t\t\t<th class="col-sm-2">Hosts
\t\t\t\t\t\t<th>Guests
\t\t\t\t\t</tr>
\t\t\t\t</thead>
\t\t\t\t<tbody>
CASTTABLE;
    foreach (getCasts() as $castdir) {
        $meta = getCastHeader($castdir);
        /* if published unset, skip this entry */
        $wip = "";
        if ($meta['PUBLISHED'] === '') {
            $meta['TITLE'] = 'Edit In Progress';
            $wip = "class=\"in-progress\" ";
        }
        $meta['TITLE'] = slenc($meta['TITLE']);
        // we add a zero width space to allow this to wrap better on mobile
        $meta['RECORDED'] = preg_replace('/-/', '-​', $meta['RECORDED'], 1);
        $rating = $meta['RATING'] == 'Explicit' ? '<i class="text-danger"> <abbr title="Explicit">E</abbr></i>' : ($meta['RATING'] == 'Clean' ? '<i class="text-success"> <abbr title="Clean">C</abbr></i>' : ($meta['RATING'] != '' ? '<i><abbr title="Tolerable">T</abbr></i>' : ''));
        $listHosts = "";
        $listGuests = "";
        foreach ($meta['HOSTS'] as $Host) {
            $listHosts .= nameplate($Host, 22);
Ejemplo n.º 3
0
/**
 * Returns data similar to getCastHeader(), metadata about an episode, rather than the episode slug
 * if you need that reference, it is returned in the array as [ 'SLUG' ]
 * @return array a dictionary of metadata for this file, with all keys in uppercase
 */
function getLatestCast()
{
    $latest = getCasts(true);
    if (!$latest) {
        return false;
    }
    return getCastHeader($latest);
}
Ejemplo n.º 4
0
header("Access-Control-Allow-Origin: *");
date_default_timezone_set('UTC');
if (!isset($_GET['t']) || $_GET['t'] == "ogg") {
    $type = "ogg";
    $mime = "audio/ogg";
} else {
    $type = "mp3";
    $mime = "audio/mpeg";
}
include_once '../includes/functions_cast.php';
function slenc($u)
{
    return htmlspecialchars($u, ENT_NOQUOTES, "UTF-8");
}
/* gives us a list, like s02e03, s02e02, etc of all of our casts */
$casts = getCasts();
/* naïve as f**k, but we know this. */
$latestCast = date("D, d M Y H:i:s O", filemtime($castNotesRepo . '/' . $casts[0]));
// it is important that the atom:link self reference is truly referencial, do our best to provide that
// note: this can leaky and/or broken on some server configs;
$server = 'http://';
if (!empty($_SERVER['HTTPS']) && $_SERVER["HTTPS"] == "on") {
    $server = 'https://';
}
$server .= $_SERVER['SERVER_NAME'];
$server .= (!empty($_SERVER['SERVER_PORT']) and $_SERVER['SERVER_PORT'] != '443') ? ":" . $_SERVER['SERVER_PORT'] : '';
/* for sake of reading/modification, use HEREDOC syntax */
echo <<<CASTHEAD
<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:media="http://search.yahoo.com/mrss/" xmlns:itunes="http://www.itunes.com/dtds/podcast-1.0.dtd" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:cc="http://web.resource.org/cc/">
\t<channel>