<commit_before><?php

require_once 'Site/SiteBotrMediaToasterCommandLineApplication.php';
require_once 'Site/dataobjects/SiteBotrMediaWrapper.php';
require_once 'Site/dataobjects/SiteMediaCdnTask.php';

/**
 * Tool used to duplicate all downloadable videos onto our local filesystem.
 * These videos are then queued for uploading to S3.
 *
 * @package   Site
 * @copyright 2011-2012 silverorange
 * @license   http://www.gnu.org/copyleft/lesser.html LGPL License 2.1
 * @todo      When we upgrade to a version of PHP that supports the curl option
 *            CURLOPT_MAX_RECV_SPEED_LARGE (>= PHP 5.4), switch to curl for the
 *            download so we can control bandwidth usage. 2 GB+ filesize support
 *            when validating downloads.
 */
class SiteBotrMediaDownloader extends SiteBotrMediaToasterCommandLineApplication
{
	// {{{ protected properties

	/**
	 * The directory containing the media hierarchy
	 *
	 * @var string
	 */
	protected $file_base;

	/**
	 * Shortname of the MediaSet to limit downloading to.
	 *
	 * @var string
	 */
	protected $media_set_shortname;

	/**
	 * Shortnames of the SiteBotrMediaDimensions to download.
	 *
	 * @var array
	 */
	protected $download_dimension_shortnames = array();

	/**
	 * List of encodings downloaded for each media entry. Used for debug
	 * messages.
	 *
	 * @var array
	 */
	protected $encodings_downloaded = array();

	/**
	 * Whether or not to re-queue all media cdn upload tasks.
	 *
	 * If true, this will queue all downloadable media, not just media that
	 * hasn't been downloaded before
	 *
	 * @var boolean
	 */
	protected $force_cdn_upload = false;

	// }}}
	// {{{ public function __construct()

	public function __construct($id, $filename, $title, $documentation)
	{
		parent::__construct($id, $filename, $title, $documentation);

		$force_queue_cdn_tasks = new SiteCommandLineArgument(
			array('--force-cdn-upload'),
			'setForceCdnUpload',
			'Optional. Re-queues all downloadable media.');

		$this->addCommandLineArgument($queue_cdn_tasks);

		$this->initModules();
		$this->parseCommandLineArguments();

		$this->locale = SwatI18NLocale::get();
	}

	// }}}
	// {{{ public function setFileBase()

	public function setFileBase($file_base)
	{
		$this->file_base = $file_base;
	}

	// }}}

	// {{{ public function setMediaSet()
<commit_msg>fix some variable names added in my last commit, r73190<commit_after><?php

require_once 'Site/SiteBotrMediaToasterCommandLineApplication.php';
require_once 'Site/dataobjects/SiteBotrMediaWrapper.php';
require_once 'Site/dataobjects/SiteMediaCdnTask.php';

/**
 * Tool used to duplicate all downloadable videos onto our local filesystem.
 * These videos are then queued for uploading to S3.
 *
 * @package   Site
 * @copyright 2011-2012 silverorange
 * @license   http://www.gnu.org/copyleft/lesser.html LGPL License 2.1
 * @todo      When we upgrade to a version of PHP that supports the curl option
 *            CURLOPT_MAX_RECV_SPEED_LARGE (>= PHP 5.4), switch to curl for the
 *            download so we can control bandwidth usage. 2 GB+ filesize support
 *            when validating downloads.
 */
class SiteBotrMediaDownloader extends SiteBotrMediaToasterCommandLineApplication
{
	// {{{ protected properties

	/**
	 * The directory containing the media hierarchy
	 *
	 * @var string
	 */
	protected $file_base;

	/**
	 * Shortname of the MediaSet to limit downloading to.
	 *
	 * @var string
	 */
	protected $media_set_shortname;

	/**
	 * Shortnames of the SiteBotrMediaDimensions to download.
	 *
	 * @var array
	 */
	protected $download_dimension_shortnames = array();

	/**
	 * List of encodings downloaded for each media entry. Used for debug
	 * messages.
	 *
	 * @var array
	 */
	protected $encodings_downloaded = array();

	/**
	 * Whether or not to re-queue all media cdn upload tasks.
	 *
	 * If true, this will queue all downloadable media, not just media that
	 * hasn't been downloaded before
	 *
	 * @var boolean
	 */
	protected $force_cdn_upload = false;

	// }}}
	// {{{ public function __construct()

	public function __construct($id, $filename, $title, $documentation)
	{
		parent::__construct($id, $filename, $title, $documentation);

		$force_cdn_upload = new SiteCommandLineArgument(
			array('--force-cdn-upload'),
			'setForceCdnUpload',
			'Optional. Re-queues all downloadable media.');

		$this->addCommandLineArgument($force_cdn_upload);

		$this->initModules();
		$this->parseCommandLineArguments();

		$this->locale = SwatI18NLocale::get();
	}

	// }}}
	// {{{ public function setFileBase()

	public function setFileBase($file_base)
	{
		$this->file_base = $file_base;
	}

	// }}}

	// {{{ public function setMediaSet()

{'fraction_non_alphanumeric': 0.11255873558308416, 'fraction_numerical': 0.007902605724049551, 'mean_word_length': 3.6736526946107784, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 15, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 24, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2624470', 'n_tokens_mistral': 1538, 'n_tokens_neox': 1378, 'n_words': 407}