function main()
{
    $spec = array("output" => array("flag" => "o", "required" => 1, "help" => "The path for the final PDF file you're creating."), "username" => array("flag" => "u", "required" => 0, "help" => "The username of the person whose tweets you're creating a book of."), "year" => array("flag" => "y", "required" => 0, "help" => "The year of tweets you're created a book of. Defaults to the current year."), "solr" => array("flag" => "s", "required" => 0, "help" => "The Solr endpoint where your tweets are stored. Defaults to http://localhost:8983/solr/twitter/."), "exclude-retweets" => array("flag" => "t", "required" => 0, "help" => "Exclude anything that was retweeted from another user"), "exclude-replies" => array("flag" => "r", "required" => 0, "help" => "Exclude anything that was a direct reply to a tweet by another user"));
    $opts = cli_getopts($spec);
    if (!isset($opts['year'])) {
        $opts['year'] = date('Y', time());
    }
    if (!isset($opts['solr'])) {
        $opts['solr'] = 'http://localhost:8983/solr/twitter/';
    }
    $tweets = fetch_tweets_from_solr($opts);
    $tw = new twPDF($opts);
    $tw->draw($tweets);
    echo "- done -\n";
    return 1;
}
$root = dirname(dirname(__FILE__));
ini_set("include_path", "{$root}/www:{$root}/www/include");
set_time_limit(0);
#
include "include/init.php";
loadlib("cli");
loadlib("flickr_backups");
loadlib("flickr_push");
loadlib("flickr_push_subscriptions");
$features = array("backups", "flickr_push", "flickr_push_backups");
if (!features_is_enabled($features)) {
    echo "backups are currently disabled\n";
    exit;
}
$spec = array("url" => array("flag" => "u", "required" => 1, "help" => "the *root* URL of your copy of parallel-ogram (the need to specify this here is not a feature...)"));
$opts = cli_getopts($spec);
$topic = $opts['topic'];
# This sucks to have to do but I am uncertain what the
# better alternative is right now... (20120601/straup)
$root = rtrim($opts['url'], '/') . "/";
$GLOBALS['cfg']['abs_root_url'] = $root;
log_info("set 'abs_root_url' to '{$GLOBALS['cfg']['abs_root_url']}'");
$topic_map = flickr_push_topic_map("string keys");
$topics = array("my_photos", "my_faves");
foreach (flickr_backups_users() as $user) {
    foreach ($topics as $topic) {
        $sub = array('user_id' => $user['id'], 'topic_id' => $topic_map[$topic]);
        $rsp = flickr_push_subscriptions_register_subscription($sub);
        log_info("[{$user['username']}] {$topic}: {$rsp['ok']}");
        if (!$rsp['ok']) {
            log_info("[{$user['username']}] {$topic}: {$rsp['error']}");