aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--.cvsignore1
-rw-r--r--INSTALL.txt67
-rw-r--r--README.txt29
-rw-r--r--cdn/video_s3/includes/S3.php1365
-rw-r--r--cdn/video_s3/includes/amazon_s3.inc145
-rw-r--r--cdn/video_s3/video_s3.admin.inc134
-rw-r--r--cdn/video_s3/video_s3.info10
-rw-r--r--cdn/video_s3/video_s3.install107
-rw-r--r--cdn/video_s3/video_s3.module114
-rw-r--r--css/video.css134
-rw-r--r--images/play.pngbin6951 -> 0 bytes
-rw-r--r--includes/common.inc448
-rw-r--r--includes/conversion.inc262
-rw-r--r--includes/metadata.inc57
-rw-r--r--includes/transcoder.inc96
-rw-r--r--includes/video_helper.inc116
-rw-r--r--js/flowplayer-3.2.0.min.js24
-rw-r--r--js/jquery.media.js458
-rw-r--r--js/jquery.metadata.js148
-rw-r--r--js/video.js84
-rw-r--r--plugins/ffmpeg.inc275
-rw-r--r--plugins/ffmpeg_wrapper.inc406
-rw-r--r--plugins/video_zencoder/includes/LICENSE20
-rw-r--r--plugins/video_zencoder/includes/README.markdown199
-rw-r--r--plugins/video_zencoder/includes/Zencoder.php239
-rw-r--r--plugins/video_zencoder/includes/lib/JSON.php806
-rw-r--r--plugins/video_zencoder/includes/zencoder.inc280
-rw-r--r--plugins/video_zencoder/video_zencoder.admin.inc302
-rw-r--r--plugins/video_zencoder/video_zencoder.info10
-rw-r--r--plugins/video_zencoder/video_zencoder.install116
-rw-r--r--plugins/video_zencoder/video_zencoder.module104
-rw-r--r--plugins/zencoder.inc307
-rw-r--r--theme/video-play-dcr.tpl.php17
-rw-r--r--theme/video-play-divx.tpl.php20
-rw-r--r--theme/video-play-flash.tpl.php20
-rw-r--r--theme/video-play-flv.tpl.php14
-rw-r--r--theme/video-play-quicktime.tpl.php32
-rw-r--r--theme/video-play-realmedia.tpl.php22
-rw-r--r--theme/video-play-theora.tpl.php23
-rw-r--r--theme/video-play-windowsmedia.tpl.php21
-rw-r--r--transcoders/video_ffmpeg.inc312
-rw-r--r--transcoders/video_ffmpeg_wrapper.inc243
-rw-r--r--translations/de.po560
-rw-r--r--translations/video.pot548
-rw-r--r--types/uploadfield/uploadfield.css114
-rw-r--r--types/uploadfield/uploadfield.info18
-rw-r--r--types/uploadfield/uploadfield.install25
-rw-r--r--types/uploadfield/uploadfield.module540
-rw-r--r--types/uploadfield/uploadfield.theme.inc18
-rw-r--r--types/uploadfield/uploadfield_convert.inc102
-rw-r--r--types/uploadfield/uploadfield_file.inc123
-rw-r--r--types/uploadfield/uploadfield_formatter.inc173
-rw-r--r--types/uploadfield/uploadfield_thumb.inc47
-rw-r--r--types/uploadfield/uploadfield_transcode.inc13
-rw-r--r--types/uploadfield/uploadfield_widget.inc308
-rw-r--r--types/videoftp/videoftp.info12
-rw-r--r--types/videoftp/videoftp.install25
-rw-r--r--types/videoftp/videoftp.module200
-rw-r--r--types/videoftp/videoftp.theme.inc57
-rw-r--r--types/videoftp/videoftp_widget.inc313
-rw-r--r--video.admin.inc306
-rw-r--r--video.info12
-rw-r--r--video.install127
-rw-r--r--video.module865
-rw-r--r--video.theme.inc111
-rw-r--r--video_formatter.inc177
-rw-r--r--video_scheduler.php225
-rw-r--r--views/video.views.inc77
-rw-r--r--views/video_views_handler_field_data.inc60
69 files changed, 1 insertions, 12742 deletions
diff --git a/.cvsignore b/.cvsignore
index c1d825f..dc9c5f0 100644
--- a/.cvsignore
+++ b/.cvsignore
@@ -1,2 +1,3 @@
.cvsignore_1
+.DS_Store
.project
diff --git a/INSTALL.txt b/INSTALL.txt
deleted file mode 100644
index 88a2214..0000000
--- a/INSTALL.txt
+++ /dev/null
@@ -1,67 +0,0 @@
-// $Id$
-
-REQUIREMENTS
-------------------------------------
-Required :
- CCK Module.
- Filefield Module.
-
-
-
-INSTALL INSTRUCTIONS FOR VIDEO.MODULE
--------------------------------------
-- See : http://video.heidisoft.com/content/welcome-video-module-documentation
-
-
-MIGRATE INSTRUCTIONS TO VIDEO.MODULE
--------------------------------------
-- See : http://drupal.org/node/713482
-
-
-FFMPEG CONFIGURATIONS
----------------------
-
-This helper module facilitates uploading new videos using the video module. It
-features a batch processing queue for videos to be transcoded and automatic
-thumbnail generation.
-
-Install instructions
---------------------
-
-1. Activate the auto conversion and auto thumbnails when cerating content
-2. Setup it's advanced options to meet your needs
-3. Move (or symlink) video_render.php and video_scheduler.php into your Drupal root
-4. Check permissions of the files and folders (/tmp/video and files/* must be writa
-ble by the webserver or the user executling the cron job)
-5. You now have two options to execute the video_scheduler.php script:
-
- 5.1 Schedule the execution of video_scheduler.php using unix cron
-
- The crontab should look something like this:
-
- # m h dom mon dow user command
- */20 * * * * www-data cd /absolute/path/to/drupal/ ; php video_scheduler.php http://www.example.com/path_to_drupal
-
- This will execute the video_scheduler every 20 minutes.
-
- Note that the video_scheduler doesn't produce any output and cannot be called
- from the web. It will, however, put some information in the watchdog.
-
-
-
-Troubleshooting
-------------------------
-
-Configuring and installing ffmpeg in a web server environment might be pretty difficult.
-In order to help you troubleshoot the transcoding process the ffmpeg helper puts debugging
-informations on the drupal logs. I strongly suggest to have a look at them if you are experiencing
- problems with transcoding.
-
-The ffmpeg puts in the drupal logs the commands it was trying to execute. You might try
-to rerun them on a command shell in order understand what went wrong.
-
-or contact a Drupal developer
-
-
-
-
diff --git a/README.txt b/README.txt
deleted file mode 100644
index e495dd4..0000000
--- a/README.txt
+++ /dev/null
@@ -1,29 +0,0 @@
-// $Id$
-------------
-
- to embed videos into drupal pages, using CCK and filefield support.
-This module add the possibility to create video nodes which are containers
- to embed videos into drupal pages, using CCK and filefield support.
-
-For information about supported file types see FILE_TYPES.txt
-http://video.heidisoft.com/content/welcome-video-module-documentation
-
-For general instructions read video.module handbook:
-http://video.heidisoft.com/content/features
-
-Please submit bugs/features/support requests at:
- http://video.heidisoft.com/content/welcome-video-module-documentation
- http://video.heidisoft.com/contact
-
-
-Maintainers
------------
-
- Heshan Wanigasooriya :heshan at heidisoft dot com, heshanmw at gmail dot com
-<<<<<<< README.txt
- Dennis : http://drupal.org/user/384543
- Glen Marianko : http://drupal.org/usr/527446 http://linkedin.com/in/glenergetic twitter: @glenergetic
-=======
- Dennis : http://drupal.org/user/384543
- Glen Marianko : http://drupal.org/usr/527446 http://linkedin.com/in/glenergetic twitter: @glenergetic
->>>>>>> 1.8.4.5.4.5.2.3
diff --git a/cdn/video_s3/includes/S3.php b/cdn/video_s3/includes/S3.php
deleted file mode 100644
index 77af0f6..0000000
--- a/cdn/video_s3/includes/S3.php
+++ /dev/null
@@ -1,1365 +0,0 @@
-<?php
-/**
-* $Id$
-*
-* Copyright (c) 2008, Donovan Schönknecht. All rights reserved.
-*
-* Redistribution and use in source and binary forms, with or without
-* modification, are permitted provided that the following conditions are met:
-*
-* - Redistributions of source code must retain the above copyright notice,
-* this list of conditions and the following disclaimer.
-* - Redistributions in binary form must reproduce the above copyright
-* notice, this list of conditions and the following disclaimer in the
-* documentation and/or other materials provided with the distribution.
-*
-* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
-* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
-* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
-* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
-* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
-* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
-* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
-* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
-* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
-* POSSIBILITY OF SUCH DAMAGE.
-*
-* Amazon S3 is a trademark of Amazon.com, Inc. or its affiliates.
-*/
-
-/**
-* Amazon S3 PHP class
-*
-* @link http://undesigned.org.za/2007/10/22/amazon-s3-php-class
-* @version 0.4.0
-*/
-class S3 {
- // ACL flags
- const ACL_PRIVATE = 'private';
- const ACL_PUBLIC_READ = 'public-read';
- const ACL_PUBLIC_READ_WRITE = 'public-read-write';
- const ACL_AUTHENTICATED_READ = 'authenticated-read';
-
- public static $useSSL = true;
-
- private static $__accessKey; // AWS Access key
- private static $__secretKey; // AWS Secret key
-
-
- /**
- * Constructor - if you're not using the class statically
- *
- * @param string $accessKey Access key
- * @param string $secretKey Secret key
- * @param boolean $useSSL Enable SSL
- * @return void
- */
- public function __construct($accessKey = null, $secretKey = null, $useSSL = true) {
- if ($accessKey !== null && $secretKey !== null)
- self::setAuth($accessKey, $secretKey);
- self::$useSSL = $useSSL;
- }
-
-
- /**
- * Set AWS access key and secret key
- *
- * @param string $accessKey Access key
- * @param string $secretKey Secret key
- * @return void
- */
- public static function setAuth($accessKey, $secretKey) {
- self::$__accessKey = $accessKey;
- self::$__secretKey = $secretKey;
- }
-
-
- /**
- * Get a list of buckets
- *
- * @param boolean $detailed Returns detailed bucket list when true
- * @return array | false
- */
- public static function listBuckets($detailed = false) {
- $rest = new S3Request('GET', '', '');
- $rest = $rest->getResponse();
- if ($rest->error === false && $rest->code !== 200)
- $rest->error = array('code' => $rest->code, 'message' => 'Unexpected HTTP status');
- if ($rest->error !== false) {
- trigger_error(sprintf("S3::listBuckets(): [%s] %s", $rest->error['code'], $rest->error['message']), E_USER_WARNING);
- return false;
- }
- $results = array();
- if (!isset($rest->body->Buckets)) return $results;
-
- if ($detailed) {
- if (isset($rest->body->Owner, $rest->body->Owner->ID, $rest->body->Owner->DisplayName))
- $results['owner'] = array(
- 'id' => (string)$rest->body->Owner->ID, 'name' => (string)$rest->body->Owner->ID
- );
- $results['buckets'] = array();
- foreach ($rest->body->Buckets->Bucket as $b)
- $results['buckets'][] = array(
- 'name' => (string)$b->Name, 'time' => strtotime((string)$b->CreationDate)
- );
- } else
- foreach ($rest->body->Buckets->Bucket as $b) $results[] = (string)$b->Name;
-
- return $results;
- }
-
-
- /*
- * Get contents for a bucket
- *
- * If maxKeys is null this method will loop through truncated result sets
- *
- * @param string $bucket Bucket name
- * @param string $prefix Prefix
- * @param string $marker Marker (last file listed)
- * @param string $maxKeys Max keys (maximum number of keys to return)
- * @param string $delimiter Delimiter
- * @param boolean $returnCommonPrefixes Set to true to return CommonPrefixes
- * @return array | false
- */
- public static function getBucket($bucket, $prefix = null, $marker = null, $maxKeys = null, $delimiter = null, $returnCommonPrefixes = false) {
- $rest = new S3Request('GET', $bucket, '');
- if ($prefix !== null && $prefix !== '') $rest->setParameter('prefix', $prefix);
- if ($marker !== null && $marker !== '') $rest->setParameter('marker', $marker);
- if ($maxKeys !== null && $maxKeys !== '') $rest->setParameter('max-keys', $maxKeys);
- if ($delimiter !== null && $delimiter !== '') $rest->setParameter('delimiter', $delimiter);
- $response = $rest->getResponse();
- if ($response->error === false && $response->code !== 200)
- $response->error = array('code' => $response->code, 'message' => 'Unexpected HTTP status');
- if ($response->error !== false) {
- trigger_error(sprintf("S3::getBucket(): [%s] %s", $response->error['code'], $response->error['message']), E_USER_WARNING);
- return false;
- }
-
- $results = array();
-
- $nextMarker = null;
- if (isset($response->body, $response->body->Contents))
- foreach ($response->body->Contents as $c) {
- $results[(string)$c->Key] = array(
- 'name' => (string)$c->Key,
- 'time' => strtotime((string)$c->LastModified),
- 'size' => (int)$c->Size,
- 'hash' => substr((string)$c->ETag, 1, -1)
- );
- $nextMarker = (string)$c->Key;
- }
-
- if ($returnCommonPrefixes && isset($response->body, $response->body->CommonPrefixes))
- foreach ($response->body->CommonPrefixes as $c)
- $results[(string)$c->Prefix] = array('prefix' => (string)$c->Prefix);
-
- if (isset($response->body, $response->body->IsTruncated) &&
- (string)$response->body->IsTruncated == 'false') return $results;
-
- if (isset($response->body, $response->body->NextMarker))
- $nextMarker = (string)$response->body->NextMarker;
-
- // Loop through truncated results if maxKeys isn't specified
- if ($maxKeys == null && $nextMarker !== null && (string)$response->body->IsTruncated == 'true')
- do {
- $rest = new S3Request('GET', $bucket, '');
- if ($prefix !== null && $prefix !== '') $rest->setParameter('prefix', $prefix);
- $rest->setParameter('marker', $nextMarker);
- if ($delimiter !== null && $delimiter !== '') $rest->setParameter('delimiter', $delimiter);
-
- if (($response = $rest->getResponse(true)) == false || $response->code !== 200) break;
-
- if (isset($response->body, $response->body->Contents))
- foreach ($response->body->Contents as $c) {
- $results[(string)$c->Key] = array(
- 'name' => (string)$c->Key,
- 'time' => strtotime((string)$c->LastModified),
- 'size' => (int)$c->Size,
- 'hash' => substr((string)$c->ETag, 1, -1)
- );
- $nextMarker = (string)$c->Key;
- }
-
- if ($returnCommonPrefixes && isset($response->body, $response->body->CommonPrefixes))
- foreach ($response->body->CommonPrefixes as $c)
- $results[(string)$c->Prefix] = array('prefix' => (string)$c->Prefix);
-
- if (isset($response->body, $response->body->NextMarker))
- $nextMarker = (string)$response->body->NextMarker;
-
- } while ($response !== false && (string)$response->body->IsTruncated == 'true');
-
- return $results;
- }
-
-
- /**
- * Put a bucket
- *
- * @param string $bucket Bucket name
- * @param constant $acl ACL flag
- * @param string $location Set as "EU" to create buckets hosted in Europe
- * @return boolean
- */
- public static function putBucket($bucket, $acl = self::ACL_PRIVATE, $location = false) {
- $rest = new S3Request('PUT', $bucket, '');
- $rest->setAmzHeader('x-amz-acl', $acl);
-
- if ($location !== false) {
- $dom = new DOMDocument;
- $createBucketConfiguration = $dom->createElement('CreateBucketConfiguration');
- $locationConstraint = $dom->createElement('LocationConstraint', strtoupper($location));
- $createBucketConfiguration->appendChild($locationConstraint);
- $dom->appendChild($createBucketConfiguration);
- $rest->data = $dom->saveXML();
- $rest->size = strlen($rest->data);
- $rest->setHeader('Content-Type', 'application/xml');
- }
- $rest = $rest->getResponse();
-
- if ($rest->error === false && $rest->code !== 200)
- $rest->error = array('code' => $rest->code, 'message' => 'Unexpected HTTP status');
- if ($rest->error !== false) {
- trigger_error(sprintf("S3::putBucket({$bucket}, {$acl}, {$location}): [%s] %s",
- $rest->error['code'], $rest->error['message']), E_USER_WARNING);
- return false;
- }
- return true;
- }
-
-
- /**
- * Delete an empty bucket
- *
- * @param string $bucket Bucket name
- * @return boolean
- */
- public static function deleteBucket($bucket) {
- $rest = new S3Request('DELETE', $bucket);
- $rest = $rest->getResponse();
- if ($rest->error === false && $rest->code !== 204)
- $rest->error = array('code' => $rest->code, 'message' => 'Unexpected HTTP status');
- if ($rest->error !== false) {
- trigger_error(sprintf("S3::deleteBucket({$bucket}): [%s] %s",
- $rest->error['code'], $rest->error['message']), E_USER_WARNING);
- return false;
- }
- return true;
- }
-
-
- /**
- * Create input info array for putObject()
- *
- * @param string $file Input file
- * @param mixed $md5sum Use MD5 hash (supply a string if you want to use your own)
- * @return array | false
- */
- public static function inputFile($file, $md5sum = true) {
- if (!file_exists($file) || !is_file($file) || !is_readable($file)) {
- trigger_error('S3::inputFile(): Unable to open input file: '.$file, E_USER_WARNING);
- return false;
- }
- return array('file' => $file, 'size' => filesize($file),
- 'md5sum' => $md5sum !== false ? (is_string($md5sum) ? $md5sum :
- base64_encode(md5_file($file, true))) : '');
- }
-
-
- /**
- * Create input array info for putObject() with a resource
- *
- * @param string $resource Input resource to read from
- * @param integer $bufferSize Input byte size
- * @param string $md5sum MD5 hash to send (optional)
- * @return array | false
- */
- public static function inputResource(&$resource, $bufferSize, $md5sum = '') {
- if (!is_resource($resource) || $bufferSize < 0) {
- trigger_error('S3::inputResource(): Invalid resource or buffer size', E_USER_WARNING);
- return false;
- }
- $input = array('size' => $bufferSize, 'md5sum' => $md5sum);
- $input['fp'] =& $resource;
- return $input;
- }
-
-
- /**
- * Put an object
- *
- * @param mixed $input Input data
- * @param string $bucket Bucket name
- * @param string $uri Object URI
- * @param constant $acl ACL constant
- * @param array $metaHeaders Array of x-amz-meta-* headers
- * @param array $requestHeaders Array of request headers or content type as a string
- * @return boolean
- */
- public static function putObject($input, $bucket, $uri, $acl = self::ACL_PRIVATE, $metaHeaders = array(), $requestHeaders = array()) {
- if ($input === false) return false;
- $rest = new S3Request('PUT', $bucket, $uri);
-
- if (is_string($input)) $input = array(
- 'data' => $input, 'size' => strlen($input),
- 'md5sum' => base64_encode(md5($input, true))
- );
-
- // Data
- if (isset($input['fp']))
- $rest->fp =& $input['fp'];
- elseif (isset($input['file']))
- $rest->fp = @fopen($input['file'], 'rb');
- elseif (isset($input['data']))
- $rest->data = $input['data'];
-
- // Content-Length (required)
- if (isset($input['size']) && $input['size'] >= 0)
- $rest->size = $input['size'];
- else {
- if (isset($input['file']))
- $rest->size = filesize($input['file']);
- elseif (isset($input['data']))
- $rest->size = strlen($input['data']);
- }
-
- // Custom request headers (Content-Type, Content-Disposition, Content-Encoding)
- if (is_array($requestHeaders))
- foreach ($requestHeaders as $h => $v) $rest->setHeader($h, $v);
- elseif (is_string($requestHeaders)) // Support for legacy contentType parameter
- $input['type'] = $requestHeaders;
-
- // Content-Type
- if (!isset($input['type'])) {
- if (isset($requestHeaders['Content-Type']))
- $input['type'] =& $requestHeaders['Content-Type'];
- elseif (isset($input['file']))
- $input['type'] = self::__getMimeType($input['file']);
- else
- $input['type'] = 'application/octet-stream';
- }
-
- // We need to post with Content-Length and Content-Type, MD5 is optional
- if ($rest->size >= 0 && ($rest->fp !== false || $rest->data !== false)) {
- $rest->setHeader('Content-Type', $input['type']);
- if (isset($input['md5sum'])) $rest->setHeader('Content-MD5', $input['md5sum']);
-
- $rest->setAmzHeader('x-amz-acl', $acl);
- foreach ($metaHeaders as $h => $v) $rest->setAmzHeader('x-amz-meta-'.$h, $v);
- $rest->getResponse();
- } else
- $rest->response->error = array('code' => 0, 'message' => 'Missing input parameters');
-
- if ($rest->response->error === false && $rest->response->code !== 200)
- $rest->response->error = array('code' => $rest->response->code, 'message' => 'Unexpected HTTP status');
- if ($rest->response->error !== false) {
- trigger_error(sprintf("S3::putObject(): [%s] %s", $rest->response->error['code'], $rest->response->error['message']), E_USER_WARNING);
- return false;
- }
- return true;
- }
-
-
- /**
- * Put an object from a file (legacy function)
- *
- * @param string $file Input file path
- * @param string $bucket Bucket name
- * @param string $uri Object URI
- * @param constant $acl ACL constant
- * @param array $metaHeaders Array of x-amz-meta-* headers
- * @param string $contentType Content type
- * @return boolean
- */
- public static function putObjectFile($file, $bucket, $uri, $acl = self::ACL_PRIVATE, $metaHeaders = array(), $contentType = null) {
- return self::putObject(self::inputFile($file), $bucket, $uri, $acl, $metaHeaders, $contentType);
- }
-
-
- /**
- * Put an object from a string (legacy function)
- *
- * @param string $string Input data
- * @param string $bucket Bucket name
- * @param string $uri Object URI
- * @param constant $acl ACL constant
- * @param array $metaHeaders Array of x-amz-meta-* headers
- * @param string $contentType Content type
- * @return boolean
- */
- public static function putObjectString($string, $bucket, $uri, $acl = self::ACL_PRIVATE, $metaHeaders = array(), $contentType = 'text/plain') {
- return self::putObject($string, $bucket, $uri, $acl, $metaHeaders, $contentType);
- }
-
-
- /**
- * Get an object
- *
- * @param string $bucket Bucket name
- * @param string $uri Object URI
- * @param mixed $saveTo Filename or resource to write to
- * @return mixed
- */
- public static function getObject($bucket, $uri, $saveTo = false) {
- $rest = new S3Request('GET', $bucket, $uri);
- if ($saveTo !== false) {
- if (is_resource($saveTo))
- $rest->fp =& $saveTo;
- else
- if (($rest->fp = @fopen($saveTo, 'wb')) !== false)
- $rest->file = realpath($saveTo);
- else
- $rest->response->error = array('code' => 0, 'message' => 'Unable to open save file for writing: '.$saveTo);
- }
- if ($rest->response->error === false) $rest->getResponse();
-
- if ($rest->response->error === false && $rest->response->code !== 200)
- $rest->response->error = array('code' => $rest->response->code, 'message' => 'Unexpected HTTP status');
- if ($rest->response->error !== false) {
- trigger_error(sprintf("S3::getObject({$bucket}, {$uri}): [%s] %s",
- $rest->response->error['code'], $rest->response->error['message']), E_USER_WARNING);
- return false;
- }
- return $rest->response;
- }
-
-
- /**
- * Get object information
- *
- * @param string $bucket Bucket name
- * @param string $uri Object URI
- * @param boolean $returnInfo Return response information
- * @return mixed | false
- */
- public static function getObjectInfo($bucket, $uri, $returnInfo = true) {
- $rest = new S3Request('HEAD', $bucket, $uri);
- $rest = $rest->getResponse();
- if ($rest->error === false && ($rest->code !== 200 && $rest->code !== 404))
- $rest->error = array('code' => $rest->code, 'message' => 'Unexpected HTTP status');
- if ($rest->error !== false) {
- trigger_error(sprintf("S3::getObjectInfo({$bucket}, {$uri}): [%s] %s",
- $rest->error['code'], $rest->error['message']), E_USER_WARNING);
- return false;
- }
- return $rest->code == 200 ? $returnInfo ? $rest->headers : true : false;
- }
-
-
- /**
- * Copy an object
- *
- * @param string $bucket Source bucket name
- * @param string $uri Source object URI
- * @param string $bucket Destination bucket name
- * @param string $uri Destination object URI
- * @param constant $acl ACL constant
- * @param array $metaHeaders Optional array of x-amz-meta-* headers
- * @param array $requestHeaders Optional array of request headers (content type, disposition, etc.)
- * @return mixed | false
- */
- public static function copyObject($srcBucket, $srcUri, $bucket, $uri, $acl = self::ACL_PRIVATE, $metaHeaders = array(), $requestHeaders = array()) {
- $rest = new S3Request('PUT', $bucket, $uri);
- $rest->setHeader('Content-Length', 0);
- foreach ($requestHeaders as $h => $v) $rest->setHeader($h, $v);
- foreach ($metaHeaders as $h => $v) $rest->setAmzHeader('x-amz-meta-'.$h, $v);
- $rest->setAmzHeader('x-amz-acl', $acl);
- $rest->setAmzHeader('x-amz-copy-source', sprintf('/%s/%s', $srcBucket, $srcUri));
- if (sizeof($requestHeaders) > 0 || sizeof($metaHeaders) > 0)
- $rest->setAmzHeader('x-amz-metadata-directive', 'REPLACE');
- $rest = $rest->getResponse();
- if ($rest->error === false && $rest->code !== 200)
- $rest->error = array('code' => $rest->code, 'message' => 'Unexpected HTTP status');
- if ($rest->error !== false) {
- trigger_error(sprintf("S3::copyObject({$srcBucket}, {$srcUri}, {$bucket}, {$uri}): [%s] %s",
- $rest->error['code'], $rest->error['message']), E_USER_WARNING);
- return false;
- }
- return isset($rest->body->LastModified, $rest->body->ETag) ? array(
- 'time' => strtotime((string)$rest->body->LastModified),
- 'hash' => substr((string)$rest->body->ETag, 1, -1)
- ) : false;
- }
-
-
- /**
- * Set logging for a bucket
- *
- * @param string $bucket Bucket name
- * @param string $targetBucket Target bucket (where logs are stored)
- * @param string $targetPrefix Log prefix (e,g; domain.com-)
- * @return boolean
- */
- public static function setBucketLogging($bucket, $targetBucket, $targetPrefix = null) {
- // The S3 log delivery group has to be added to the target bucket's ACP
- if ($targetBucket !== null && ($acp = self::getAccessControlPolicy($targetBucket, '')) !== false) {
- // Only add permissions to the target bucket when they do not exist
- $aclWriteSet = false;
- $aclReadSet = false;
- foreach ($acp['acl'] as $acl)
- if ($acl['type'] == 'Group' && $acl['uri'] == 'http://acs.amazonaws.com/groups/s3/LogDelivery') {
- if ($acl['permission'] == 'WRITE') $aclWriteSet = true;
- elseif ($acl['permission'] == 'READ_ACP') $aclReadSet = true;
- }
- if (!$aclWriteSet) $acp['acl'][] = array(
- 'type' => 'Group', 'uri' => 'http://acs.amazonaws.com/groups/s3/LogDelivery', 'permission' => 'WRITE'
- );
- if (!$aclReadSet) $acp['acl'][] = array(
- 'type' => 'Group', 'uri' => 'http://acs.amazonaws.com/groups/s3/LogDelivery', 'permission' => 'READ_ACP'
- );
- if (!$aclReadSet || !$aclWriteSet) self::setAccessControlPolicy($targetBucket, '', $acp);
- }
-
- $dom = new DOMDocument;
- $bucketLoggingStatus = $dom->createElement('BucketLoggingStatus');
- $bucketLoggingStatus->setAttribute('xmlns', 'http://s3.amazonaws.com/doc/2006-03-01/');
- if ($targetBucket !== null) {
- if ($targetPrefix == null) $targetPrefix = $bucket . '-';
- $loggingEnabled = $dom->createElement('LoggingEnabled');
- $loggingEnabled->appendChild($dom->createElement('TargetBucket', $targetBucket));
- $loggingEnabled->appendChild($dom->createElement('TargetPrefix', $targetPrefix));
- // TODO: Add TargetGrants?
- $bucketLoggingStatus->appendChild($loggingEnabled);
- }
- $dom->appendChild($bucketLoggingStatus);
-
- $rest = new S3Request('PUT', $bucket, '');
- $rest->setParameter('logging', null);
- $rest->data = $dom->saveXML();
- $rest->size = strlen($rest->data);
- $rest->setHeader('Content-Type', 'application/xml');
- $rest = $rest->getResponse();
- if ($rest->error === false && $rest->code !== 200)
- $rest->error = array('code' => $rest->code, 'message' => 'Unexpected HTTP status');
- if ($rest->error !== false) {
- trigger_error(sprintf("S3::setBucketLogging({$bucket}, {$uri}): [%s] %s",
- $rest->error['code'], $rest->error['message']), E_USER_WARNING);
- return false;
- }
- return true;
- }
-
-
- /**
- * Get logging status for a bucket
- *
- * This will return false if logging is not enabled.
- * Note: To enable logging, you also need to grant write access to the log group
- *
- * @param string $bucket Bucket name
- * @return array | false
- */
- public static function getBucketLogging($bucket) {
- $rest = new S3Request('GET', $bucket, '');
- $rest->setParameter('logging', null);
- $rest = $rest->getResponse();
- if ($rest->error === false && $rest->code !== 200)
- $rest->error = array('code' => $rest->code, 'message' => 'Unexpected HTTP status');
- if ($rest->error !== false) {
- trigger_error(sprintf("S3::getBucketLogging({$bucket}): [%s] %s",
- $rest->error['code'], $rest->error['message']), E_USER_WARNING);
- return false;
- }
- if (!isset($rest->body->LoggingEnabled)) return false; // No logging
- return array(
- 'targetBucket' => (string)$rest->body->LoggingEnabled->TargetBucket,
- 'targetPrefix' => (string)$rest->body->LoggingEnabled->TargetPrefix,
- );
- }
-
-
- /**
- * Disable bucket logging
- *
- * @param string $bucket Bucket name
- * @return boolean
- */
- public static function disableBucketLogging($bucket) {
- return self::setBucketLogging($bucket, null);
- }
-
-
- /**
- * Get a bucket's location
- *
- * @param string $bucket Bucket name
- * @return string | false
- */
- public static function getBucketLocation($bucket) {
- $rest = new S3Request('GET', $bucket, '');
- $rest->setParameter('location', null);
- $rest = $rest->getResponse();
- if ($rest->error === false && $rest->code !== 200)
- $rest->error = array('code' => $rest->code, 'message' => 'Unexpected HTTP status');
- if ($rest->error !== false) {
- trigger_error(sprintf("S3::getBucketLocation({$bucket}): [%s] %s",
- $rest->error['code'], $rest->error['message']), E_USER_WARNING);
- return false;
- }
- return (isset($rest->body[0]) && (string)$rest->body[0] !== '') ? (string)$rest->body[0] : 'US';
- }
-
-
- /**
- * Set object or bucket Access Control Policy
- *
- * @param string $bucket Bucket name
- * @param string $uri Object URI
- * @param array $acp Access Control Policy Data (same as the data returned from getAccessControlPolicy)
- * @return boolean
- */
- public static function setAccessControlPolicy($bucket, $uri = '', $acp = array()) {
- $dom = new DOMDocument;
- $dom->formatOutput = true;
- $accessControlPolicy = $dom->createElement('AccessControlPolicy');
- $accessControlList = $dom->createElement('AccessControlList');
-
- // It seems the owner has to be passed along too
- $owner = $dom->createElement('Owner');
- $owner->appendChild($dom->createElement('ID', $acp['owner']['id']));
- $owner->appendChild($dom->createElement('DisplayName', $acp['owner']['name']));
- $accessControlPolicy->appendChild($owner);
-
- foreach ($acp['acl'] as $g) {
- $grant = $dom->createElement('Grant');
- $grantee = $dom->createElement('Grantee');
- $grantee->setAttribute('xmlns:xsi', 'http://www.w3.org/2001/XMLSchema-instance');
- if (isset($g['id'])) { // CanonicalUser (DisplayName is omitted)
- $grantee->setAttribute('xsi:type', 'CanonicalUser');
- $grantee->appendChild($dom->createElement('ID', $g['id']));
- } elseif (isset($g['email'])) { // AmazonCustomerByEmail
- $grantee->setAttribute('xsi:type', 'AmazonCustomerByEmail');
- $grantee->appendChild($dom->createElement('EmailAddress', $g['email']));
- } elseif ($g['type'] == 'Group') { // Group
- $grantee->setAttribute('xsi:type', 'Group');
- $grantee->appendChild($dom->createElement('URI', $g['uri']));
- }
- $grant->appendChild($grantee);
- $grant->appendChild($dom->createElement('Permission', $g['permission']));
- $accessControlList->appendChild($grant);
- }
-
- $accessControlPolicy->appendChild($accessControlList);
- $dom->appendChild($accessControlPolicy);
-
- $rest = new S3Request('PUT', $bucket, $uri);
- $rest->setParameter('acl', null);
- $rest->data = $dom->saveXML();
- $rest->size = strlen($rest->data);
- $rest->setHeader('Content-Type', 'application/xml');
- $rest = $rest->getResponse();
- if ($rest->error === false && $rest->code !== 200)
- $rest->error = array('code' => $rest->code, 'message' => 'Unexpected HTTP status');
- if ($rest->error !== false) {
- trigger_error(sprintf("S3::setAccessControlPolicy({$bucket}, {$uri}): [%s] %s",
- $rest->error['code'], $rest->error['message']), E_USER_WARNING);
- return false;
- }
- return true;
- }
-
-
- /**
- * Get object or bucket Access Control Policy
- *
- * @param string $bucket Bucket name
- * @param string $uri Object URI
- * @return mixed | false
- */
- public static function getAccessControlPolicy($bucket, $uri = '') {
- $rest = new S3Request('GET', $bucket, $uri);
- $rest->setParameter('acl', null);
- $rest = $rest->getResponse();
- if ($rest->error === false && $rest->code !== 200)
- $rest->error = array('code' => $rest->code, 'message' => 'Unexpected HTTP status');
- if ($rest->error !== false) {
- trigger_error(sprintf("S3::getAccessControlPolicy({$bucket}, {$uri}): [%s] %s",
- $rest->error['code'], $rest->error['message']), E_USER_WARNING);
- return false;
- }
-
- $acp = array();
- if (isset($rest->body->Owner, $rest->body->Owner->ID, $rest->body->Owner->DisplayName)) {
- $acp['owner'] = array(
- 'id' => (string)$rest->body->Owner->ID, 'name' => (string)$rest->body->Owner->DisplayName
- );
- }
- if (isset($rest->body->AccessControlList)) {
- $acp['acl'] = array();
- foreach ($rest->body->AccessControlList->Grant as $grant) {
- foreach ($grant->Grantee as $grantee) {
- if (isset($grantee->ID, $grantee->DisplayName)) // CanonicalUser
- $acp['acl'][] = array(
- 'type' => 'CanonicalUser',
- 'id' => (string)$grantee->ID,
- 'name' => (string)$grantee->DisplayName,
- 'permission' => (string)$grant->Permission
- );
- elseif (isset($grantee->EmailAddress)) // AmazonCustomerByEmail
- $acp['acl'][] = array(
- 'type' => 'AmazonCustomerByEmail',
- 'email' => (string)$grantee->EmailAddress,
- 'permission' => (string)$grant->Permission
- );
- elseif (isset($grantee->URI)) // Group
- $acp['acl'][] = array(
- 'type' => 'Group',
- 'uri' => (string)$grantee->URI,
- 'permission' => (string)$grant->Permission
- );
- else continue;
- }
- }
- }
- return $acp;
- }
-
-
- /**
- * Delete an object
- *
- * @param string $bucket Bucket name
- * @param string $uri Object URI
- * @return boolean
- */
- public static function deleteObject($bucket, $uri) {
- $rest = new S3Request('DELETE', $bucket, $uri);
- $rest = $rest->getResponse();
- if ($rest->error === false && $rest->code !== 204)
- $rest->error = array('code' => $rest->code, 'message' => 'Unexpected HTTP status');
- if ($rest->error !== false) {
- trigger_error(sprintf("S3::deleteObject(): [%s] %s",
- $rest->error['code'], $rest->error['message']), E_USER_WARNING);
- return false;
- }
- return true;
- }
-
-
- /**
- * Get a query string authenticated URL
- *
- * @param string $bucket Bucket name
- * @param string $uri Object URI
- * @param integer $lifetime Lifetime in seconds
- * @param boolean $hostBucket Use the bucket name as the hostname
- * @param boolean $https Use HTTPS ($hostBucket should be false for SSL verification)
- * @return string
- */
- public static function getAuthenticatedURL($bucket, $uri, $lifetime, $hostBucket = false, $https = false) {
- $expires = REQUEST_TIME + $lifetime;
- $uri = str_replace('%2F', '/', rawurlencode($uri)); // URI should be encoded (thanks Sean O'Dea)
- return sprintf(($https ? 'https' : 'http').'://%s/%s?AWSAccessKeyId=%s&Expires=%u&Signature=%s',
- $hostBucket ? $bucket : $bucket.'.s3.amazonaws.com', $uri, self::$__accessKey, $expires,
- urlencode(self::__getHash("GET\n\n\n{$expires}\n/{$bucket}/{$uri}")));
- }
-
- /**
- * Get upload POST parameters for form uploads
- *
- * @param string $bucket Bucket name
- * @param string $uriPrefix Object URI prefix
- * @param constant $acl ACL constant
- * @param integer $lifetime Lifetime in seconds
- * @param integer $maxFileSize Maximum filesize in bytes (default 5MB)
- * @param string $successRedirect Redirect URL or 200 / 201 status code
- * @param array $amzHeaders Array of x-amz-meta-* headers
- * @param array $headers Array of request headers or content type as a string
- * @param boolean $flashVars Includes additional "Filename" variable posted by Flash
- * @return object
- */
- public static function getHttpUploadPostParams($bucket, $uriPrefix = '', $acl = self::ACL_PRIVATE, $lifetime = 3600, $maxFileSize = 5242880, $successRedirect = "201", $amzHeaders = array(), $headers = array(), $flashVars = false) {
- // Create policy object
- $policy = new stdClass;
- $policy->expiration = gmdate('Y-m-d\TH:i:s\Z', (REQUEST_TIME + $lifetime));
- $policy->conditions = array();
- $obj = new stdClass; $obj->bucket = $bucket; array_push($policy->conditions, $obj);
- $obj = new stdClass; $obj->acl = $acl; array_push($policy->conditions, $obj);
-
- $obj = new stdClass; // 200 for non-redirect uploads
- if (is_numeric($successRedirect) && in_array((int)$successRedirect, array(200, 201)))
- $obj->success_action_status = (string)$successRedirect;
- else // URL
- $obj->success_action_redirect = $successRedirect;
- array_push($policy->conditions, $obj);
-
- array_push($policy->conditions, array('starts-with', '$key', $uriPrefix));
- if ($flashVars) array_push($policy->conditions, array('starts-with', '$Filename', ''));
- foreach (array_keys($headers) as $headerKey)
- array_push($policy->conditions, array('starts-with', '$'.$headerKey, ''));
- foreach ($amzHeaders as $headerKey => $headerVal) {
- $obj = new stdClass; $obj->{$headerKey} = (string)$headerVal; array_push($policy->conditions, $obj);
- }
- array_push($policy->conditions, array('content-length-range', 0, $maxFileSize));
- $policy = base64_encode(str_replace('\/', '/', json_encode($policy)));
-
- // Create parameters
- $params = new stdClass;
- $params->AWSAccessKeyId = self::$__accessKey;
- $params->key = $uriPrefix.'${filename}';
- $params->acl = $acl;
- $params->policy = $policy; unset($policy);
- $params->signature = self::__getHash($params->policy);
- if (is_numeric($successRedirect) && in_array((int)$successRedirect, array(200, 201)))
- $params->success_action_status = (string)$successRedirect;
- else
- $params->success_action_redirect = $successRedirect;
- foreach ($headers as $headerKey => $headerVal) $params->{$headerKey} = (string)$headerVal;
- foreach ($amzHeaders as $headerKey => $headerVal) $params->{$headerKey} = (string)$headerVal;
- return $params;
- }
-
- /**
- * Create a CloudFront distribution
- *
- * @param string $bucket Bucket name
- * @param boolean $enabled Enabled (true/false)
- * @param array $cnames Array containing CNAME aliases
- * @param string $comment Use the bucket name as the hostname
- * @return array | false
- */
- public static function createDistribution($bucket, $enabled = true, $cnames = array(), $comment = '') {
- self::$useSSL = true; // CloudFront requires SSL
- $rest = new S3Request('POST', '', '2008-06-30/distribution', 'cloudfront.amazonaws.com');
- $rest->data = self::__getCloudFrontDistributionConfigXML($bucket.'.s3.amazonaws.com', $enabled, $comment, (string)microtime(true), $cnames);
- $rest->size = strlen($rest->data);
- $rest->setHeader('Content-Type', 'application/xml');
- $rest = self::__getCloudFrontResponse($rest);
-
- if ($rest->error === false && $rest->code !== 201)
- $rest->error = array('code' => $rest->code, 'message' => 'Unexpected HTTP status');
- if ($rest->error !== false) {
- trigger_error(sprintf("S3::createDistribution({$bucket}, ".(int)$enabled.", '$comment'): [%s] %s",
- $rest->error['code'], $rest->error['message']), E_USER_WARNING);
- return false;
- } elseif ($rest->body instanceof SimpleXMLElement)
- return self::__parseCloudFrontDistributionConfig($rest->body);
- return false;
- }
-
-
- /**
- * Get CloudFront distribution info
- *
- * @param string $distributionId Distribution ID from listDistributions()
- * @return array | false
- */
- public static function getDistribution($distributionId) {
- self::$useSSL = true; // CloudFront requires SSL
- $rest = new S3Request('GET', '', '2008-06-30/distribution/'.$distributionId, 'cloudfront.amazonaws.com');
- $rest = self::__getCloudFrontResponse($rest);
-
- if ($rest->error === false && $rest->code !== 200)
- $rest->error = array('code' => $rest->code, 'message' => 'Unexpected HTTP status');
- if ($rest->error !== false) {
- trigger_error(sprintf("S3::getDistribution($distributionId): [%s] %s",
- $rest->error['code'], $rest->error['message']), E_USER_WARNING);
- return false;
- } elseif ($rest->body instanceof SimpleXMLElement) {
- $dist = self::__parseCloudFrontDistributionConfig($rest->body);
- $dist['hash'] = $rest->headers['hash'];
- return $dist;
- }
- return false;
- }
-
-
- /**
- * Update a CloudFront distribution
- *
- * @param array $dist Distribution array info identical to output of getDistribution()
- * @return array | false
- */
- public static function updateDistribution($dist) {
- self::$useSSL = true; // CloudFront requires SSL
- $rest = new S3Request('PUT', '', '2008-06-30/distribution/'.$dist['id'].'/config', 'cloudfront.amazonaws.com');
- $rest->data = self::__getCloudFrontDistributionConfigXML($dist['origin'], $dist['enabled'], $dist['comment'], $dist['callerReference'], $dist['cnames']);
- $rest->size = strlen($rest->data);
- $rest->setHeader('If-Match', $dist['hash']);
- $rest = self::__getCloudFrontResponse($rest);
-
- if ($rest->error === false && $rest->code !== 200)
- $rest->error = array('code' => $rest->code, 'message' => 'Unexpected HTTP status');
- if ($rest->error !== false) {
- trigger_error(sprintf("S3::updateDistribution({$dist['id']}, ".(int)$enabled.", '$comment'): [%s] %s",
- $rest->error['code'], $rest->error['message']), E_USER_WARNING);
- return false;
- } else {
- $dist = self::__parseCloudFrontDistributionConfig($rest->body);
- $dist['hash'] = $rest->headers['hash'];
- return $dist;
- }
- return false;
- }
-
-
- /**
- * Delete a CloudFront distribution
- *
- * @param array $dist Distribution array info identical to output of getDistribution()
- * @return boolean
- */
- public static function deleteDistribution($dist) {
- self::$useSSL = true; // CloudFront requires SSL
- $rest = new S3Request('DELETE', '', '2008-06-30/distribution/'.$dist['id'], 'cloudfront.amazonaws.com');
- $rest->setHeader('If-Match', $dist['hash']);
- $rest = self::__getCloudFrontResponse($rest);
-
- if ($rest->error === false && $rest->code !== 204)
- $rest->error = array('code' => $rest->code, 'message' => 'Unexpected HTTP status');
- if ($rest->error !== false) {
- trigger_error(sprintf("S3::deleteDistribution({$dist['id']}): [%s] %s",
- $rest->error['code'], $rest->error['message']), E_USER_WARNING);
- return false;
- }
- return true;
- }
-
-
- /**
- * Get a list of CloudFront distributions
- *
- * @return array
- */
- public static function listDistributions() {
- self::$useSSL = true; // CloudFront requires SSL
- $rest = new S3Request('GET', '', '2008-06-30/distribution', 'cloudfront.amazonaws.com');
- $rest = self::__getCloudFrontResponse($rest);
-
- if ($rest->error === false && $rest->code !== 200)
- $rest->error = array('code' => $rest->code, 'message' => 'Unexpected HTTP status');
- if ($rest->error !== false) {
- trigger_error(sprintf("S3::listDistributions(): [%s] %s",
- $rest->error['code'], $rest->error['message']), E_USER_WARNING);
- return false;
- } elseif ($rest->body instanceof SimpleXMLElement && isset($rest->body->DistributionSummary)) {
- $list = array();
- if (isset($rest->body->Marker, $rest->body->MaxItems, $rest->body->IsTruncated)) {
- //$info['marker'] = (string)$rest->body->Marker;
- //$info['maxItems'] = (int)$rest->body->MaxItems;
- //$info['isTruncated'] = (string)$rest->body->IsTruncated == 'true' ? true : false;
- }
- foreach ($rest->body->DistributionSummary as $summary) {
- $list[(string)$summary->Id] = self::__parseCloudFrontDistributionConfig($summary);
- }
- return $list;
- }
- return array();
- }
-
-
- /**
- * Get a DistributionConfig DOMDocument
- *
- * @internal Used to create XML in createDistribution() and updateDistribution()
- * @param string $bucket Origin bucket
- * @param boolean $enabled Enabled (true/false)
- * @param string $comment Comment to append
- * @param string $callerReference Caller reference
- * @param array $cnames Array of CNAME aliases
- * @return string
- */
- private static function __getCloudFrontDistributionConfigXML($bucket, $enabled, $comment, $callerReference = '0', $cnames = array()) {
- $dom = new DOMDocument('1.0', 'UTF-8');
- $dom->formatOutput = true;
- $distributionConfig = $dom->createElement('DistributionConfig');
- $distributionConfig->setAttribute('xmlns', 'http://cloudfront.amazonaws.com/doc/2008-06-30/');
- $distributionConfig->appendChild($dom->createElement('Origin', $bucket));
- $distributionConfig->appendChild($dom->createElement('CallerReference', $callerReference));
- foreach ($cnames as $cname)
- $distributionConfig->appendChild($dom->createElement('CNAME', $cname));
- if ($comment !== '') $distributionConfig->appendChild($dom->createElement('Comment', $comment));
- $distributionConfig->appendChild($dom->createElement('Enabled', $enabled ? 'true' : 'false'));
- $dom->appendChild($distributionConfig);
- return $dom->saveXML();
- }
-
-
- /**
- * Parse a CloudFront distribution config
- *
- * @internal Used to parse the CloudFront DistributionConfig node to an array
- * @param object &$node DOMNode
- * @return array
- */
- private static function __parseCloudFrontDistributionConfig(&$node) {
- $dist = array();
- if (isset($node->Id, $node->Status, $node->LastModifiedTime, $node->DomainName)) {
- $dist['id'] = (string)$node->Id;
- $dist['status'] = (string)$node->Status;
- $dist['time'] = strtotime((string)$node->LastModifiedTime);
- $dist['domain'] = (string)$node->DomainName;
- }
- if (isset($node->CallerReference))
- $dist['callerReference'] = (string)$node->CallerReference;
- if (isset($node->Comment))
- $dist['comment'] = (string)$node->Comment;
- if (isset($node->Enabled, $node->Origin)) {
- $dist['origin'] = (string)$node->Origin;
- $dist['enabled'] = (string)$node->Enabled == 'true' ? true : false;
- } elseif (isset($node->DistributionConfig)) {
- $dist = array_merge($dist, self::__parseCloudFrontDistributionConfig($node->DistributionConfig));
- }
- if (isset($node->CNAME)) {
- $dist['cnames'] = array();
- foreach ($node->CNAME as $cname) $dist['cnames'][(string)$cname] = (string)$cname;
- }
- return $dist;
- }
-
-
- /**
- * Grab CloudFront response
- *
- * @internal Used to parse the CloudFront S3Request::getResponse() output
- * @param object &$rest S3Request instance
- * @return object
- */
- private static function __getCloudFrontResponse(&$rest) {
- $rest->getResponse();
- if ($rest->response->error === false && isset($rest->response->body) &&
- is_string($rest->response->body) && substr($rest->response->body, 0, 5) == '<?xml') {
- $rest->response->body = simplexml_load_string($rest->response->body);
- // Grab CloudFront errors
- if (isset($rest->response->body->Error, $rest->response->body->Error->Code,
- $rest->response->body->Error->Message)) {
- $rest->response->error = array(
- 'code' => (string)$rest->response->body->Error->Code,
- 'message' => (string)$rest->response->body->Error->Message
- );
- unset($rest->response->body);
- }
- }
- return $rest->response;
- }
-
-
- /**
- * Get MIME type for file
- *
- * @internal Used to get mime types
- * @param string &$file File path
- * @return string
- */
- public static function __getMimeType(&$file) {
- $type = false;
- // Fileinfo documentation says fileinfo_open() will use the
- // MAGIC env var for the magic file
- if (extension_loaded('fileinfo') && isset($_ENV['MAGIC']) &&
- ($finfo = finfo_open(FILEINFO_MIME, $_ENV['MAGIC'])) !== false) {
- if (($type = finfo_file($finfo, $file)) !== false) {
- // Remove the charset and grab the last content-type
- $type = explode(' ', str_replace('; charset=', ';charset=', $type));
- $type = array_pop($type);
- $type = explode(';', $type);
- $type = trim(array_shift($type));
- }
- finfo_close($finfo);
-
- // If anyone is still using mime_content_type()
- } elseif (function_exists('mime_content_type'))
- $type = trim(mime_content_type($file));
-
- if ($type !== false && strlen($type) > 0) return $type;
-
- // Otherwise do it the old fashioned way
- static $exts = array(
- 'jpg' => 'image/jpeg', 'gif' => 'image/gif', 'png' => 'image/png',
- 'tif' => 'image/tiff', 'tiff' => 'image/tiff', 'ico' => 'image/x-icon',
- 'swf' => 'application/x-shockwave-flash', 'pdf' => 'application/pdf',
- 'zip' => 'application/zip', 'gz' => 'application/x-gzip',
- 'tar' => 'application/x-tar', 'bz' => 'application/x-bzip',
- 'bz2' => 'application/x-bzip2', 'txt' => 'text/plain',
- 'asc' => 'text/plain', 'htm' => 'text/html', 'html' => 'text/html',
- 'css' => 'text/css', 'js' => 'text/javascript',
- 'xml' => 'text/xml', 'xsl' => 'application/xsl+xml',
- 'ogg' => 'application/ogg', 'mp3' => 'audio/mpeg', 'wav' => 'audio/x-wav',
- 'avi' => 'video/x-msvideo', 'mpg' => 'video/mpeg', 'mpeg' => 'video/mpeg',
- 'mov' => 'video/quicktime', 'flv' => 'video/x-flv', 'php' => 'text/x-php'
- );
- $ext = strtolower(pathInfo($file, PATHINFO_EXTENSION));
- return isset($exts[$ext]) ? $exts[$ext] : 'application/octet-stream';
- }
-
-
- /**
- * Generate the auth string: "AWS AccessKey:Signature"
- *
- * @internal Used by S3Request::getResponse()
- * @param string $string String to sign
- * @return string
- */
- public static function __getSignature($string) {
- return 'AWS '.self::$__accessKey.':'.self::__getHash($string);
- }
-
-
- /**
- * Creates a HMAC-SHA1 hash
- *
- * This uses the hash extension if loaded
- *
- * @internal Used by __getSignature()
- * @param string $string String to sign
- * @return string
- */
- private static function __getHash($string) {
- return base64_encode(extension_loaded('hash') ?
- hash_hmac('sha1', $string, self::$__secretKey, true) : pack('H*', sha1(
- (str_pad(self::$__secretKey, 64, chr(0x00)) ^ (str_repeat(chr(0x5c), 64))) .
- pack('H*', sha1((str_pad(self::$__secretKey, 64, chr(0x00)) ^
- (str_repeat(chr(0x36), 64))) . $string)))));
- }
-
-}
-
-final class S3Request {
- private $verb, $bucket, $uri, $resource = '', $parameters = array(),
- $amzHeaders = array(), $headers = array(
- 'Host' => '', 'Date' => '', 'Content-MD5' => '', 'Content-Type' => ''
- );
- public $fp = false, $size = 0, $data = false, $response;
-
-
- /**
- * Constructor
- *
- * @param string $verb Verb
- * @param string $bucket Bucket name
- * @param string $uri Object URI
- * @return mixed
- */
- function __construct($verb, $bucket = '', $uri = '', $defaultHost = 's3.amazonaws.com') {
- $this->verb = $verb;
- $this->bucket = strtolower($bucket);
- $this->uri = $uri !== '' ? '/'.str_replace('%2F', '/', rawurlencode($uri)) : '/';
-
- if ($this->bucket !== '') {
- $this->headers['Host'] = $this->bucket.'.'.$defaultHost;
- $this->resource = '/'.$this->bucket.$this->uri;
- } else {
- $this->headers['Host'] = $defaultHost;
- //$this->resource = strlen($this->uri) > 1 ? '/'.$this->bucket.$this->uri : $this->uri;
- $this->resource = $this->uri;
- }
- $this->headers['Date'] = gmdate('D, d M Y H:i:s T');
-
- $this->response = new STDClass;
- $this->response->error = false;
- }
-
-
- /**
- * Set request parameter
- *
- * @param string $key Key
- * @param string $value Value
- * @return void
- */
- public function setParameter($key, $value) {
- $this->parameters[$key] = $value;
- }
-
-
- /**
- * Set request header
- *
- * @param string $key Key
- * @param string $value Value
- * @return void
- */
- public function setHeader($key, $value) {
- $this->headers[$key] = $value;
- }
-
-
- /**
- * Set x-amz-meta-* header
- *
- * @param string $key Key
- * @param string $value Value
- * @return void
- */
- public function setAmzHeader($key, $value) {
- $this->amzHeaders[$key] = $value;
- }
-
-
- /**
- * Get the S3 response
- *
- * @return object | false
- */
- public function getResponse() {
- $query = '';
- if (sizeof($this->parameters) > 0) {
- $query = substr($this->uri, -1) !== '?' ? '?' : '&';
- foreach ($this->parameters as $var => $value)
- if ($value == null || $value == '') $query .= $var.'&';
- // Parameters should be encoded (thanks Sean O'Dea)
- else $query .= $var.'='.rawurlencode($value).'&';
- $query = substr($query, 0, -1);
- $this->uri .= $query;
-
- if (array_key_exists('acl', $this->parameters) ||
- array_key_exists('location', $this->parameters) ||
- array_key_exists('torrent', $this->parameters) ||
- array_key_exists('logging', $this->parameters))
- $this->resource .= $query;
- }
- $url = ((S3::$useSSL && extension_loaded('openssl')) ?
- 'https://':'http://').$this->headers['Host'].$this->uri;
- //var_dump($this->bucket, $this->uri, $this->resource, $url);
-
- // Basic setup
- $curl = curl_init();
- curl_setopt($curl, CURLOPT_USERAGENT, 'S3/php');
-
- if (S3::$useSSL) {
- curl_setopt($curl, CURLOPT_SSL_VERIFYHOST, 1);
- curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, 1);
- }
-
- curl_setopt($curl, CURLOPT_URL, $url);
-
- // Headers
- $headers = array(); $amz = array();
- foreach ($this->amzHeaders as $header => $value)
- if (strlen($value) > 0) $headers[] = $header.': '.$value;
- foreach ($this->headers as $header => $value)
- if (strlen($value) > 0) $headers[] = $header.': '.$value;
-
- // Collect AMZ headers for signature
- foreach ($this->amzHeaders as $header => $value)
- if (strlen($value) > 0) $amz[] = strtolower($header).':'.$value;
-
- // AMZ headers must be sorted
- if (sizeof($amz) > 0) {
- sort($amz);
- $amz = "\n".implode("\n", $amz);
- } else $amz = '';
-
- // Authorization string (CloudFront stringToSign should only contain a date)
- $headers[] = 'Authorization: ' . S3::__getSignature(
- $this->headers['Host'] == 'cloudfront.amazonaws.com' ? $this->headers['Date'] :
- $this->verb."\n".$this->headers['Content-MD5']."\n".
- $this->headers['Content-Type']."\n".$this->headers['Date'].$amz."\n".$this->resource
- );
-
- curl_setopt($curl, CURLOPT_HTTPHEADER, $headers);
- curl_setopt($curl, CURLOPT_HEADER, false);
- curl_setopt($curl, CURLOPT_RETURNTRANSFER, false);
- curl_setopt($curl, CURLOPT_WRITEFUNCTION, array(&$this, '__responseWriteCallback'));
- curl_setopt($curl, CURLOPT_HEADERFUNCTION, array(&$this, '__responseHeaderCallback'));
- curl_setopt($curl, CURLOPT_FOLLOWLOCATION, true);
-
- // Request types
- switch ($this->verb) {
- case 'GET': break;
- case 'PUT': case 'POST': // POST only used for CloudFront
- if ($this->fp !== false) {
- curl_setopt($curl, CURLOPT_PUT, true);
- curl_setopt($curl, CURLOPT_INFILE, $this->fp);
- if ($this->size >= 0)
- curl_setopt($curl, CURLOPT_INFILESIZE, $this->size);
- } elseif ($this->data !== false) {
- curl_setopt($curl, CURLOPT_CUSTOMREQUEST, $this->verb);
- curl_setopt($curl, CURLOPT_POSTFIELDS, $this->data);
- if ($this->size >= 0)
- curl_setopt($curl, CURLOPT_BUFFERSIZE, $this->size);
- } else
- curl_setopt($curl, CURLOPT_CUSTOMREQUEST, $this->verb);
- break;
- case 'HEAD':
- curl_setopt($curl, CURLOPT_CUSTOMREQUEST, 'HEAD');
- curl_setopt($curl, CURLOPT_NOBODY, true);
- break;
- case 'DELETE':
- curl_setopt($curl, CURLOPT_CUSTOMREQUEST, 'DELETE');
- break;
- default: break;
- }
-
- // Execute, grab errors
- if (curl_exec($curl))
- $this->response->code = curl_getinfo($curl, CURLINFO_HTTP_CODE);
- else
- $this->response->error = array(
- 'code' => curl_errno($curl),
- 'message' => curl_error($curl),
- 'resource' => $this->resource
- );
-
- @curl_close($curl);
-
- // Parse body into XML
- if ($this->response->error === false && isset($this->response->headers['type']) &&
- $this->response->headers['type'] == 'application/xml' && isset($this->response->body)) {
- $this->response->body = simplexml_load_string($this->response->body);
-
- // Grab S3 errors
- if (!in_array($this->response->code, array(200, 204)) &&
- isset($this->response->body->Code, $this->response->body->Message)) {
- $this->response->error = array(
- 'code' => (string)$this->response->body->Code,
- 'message' => (string)$this->response->body->Message
- );
- if (isset($this->response->body->Resource))
- $this->response->error['resource'] = (string)$this->response->body->Resource;
- unset($this->response->body);
- }
- }
-
- // Clean up file resources
- if ($this->fp !== false && is_resource($this->fp)) fclose($this->fp);
-
- return $this->response;
- }
-
-
- /**
- * CURL write callback
- *
- * @param resource &$curl CURL resource
- * @param string &$data Data
- * @return integer
- */
- private function __responseWriteCallback(&$curl, &$data) {
- if ($this->response->code == 200 && $this->fp !== false)
- return fwrite($this->fp, $data);
- else
- $this->response->body .= $data;
- return strlen($data);
- }
-
-
- /**
- * CURL header callback
- *
- * @param resource &$curl CURL resource
- * @param string &$data Data
- * @return integer
- */
- private function __responseHeaderCallback(&$curl, &$data) {
- if (($strlen = strlen($data)) <= 2) return $strlen;
- if (substr($data, 0, 4) == 'HTTP')
- $this->response->code = (int)substr($data, 9, 3);
- else {
- list($header, $value) = explode(': ', trim($data), 2);
- if ($header == 'Last-Modified')
- $this->response->headers['time'] = strtotime($value);
- elseif ($header == 'Content-Length')
- $this->response->headers['size'] = (int)$value;
- elseif ($header == 'Content-Type')
- $this->response->headers['type'] = $value;
- elseif ($header == 'ETag')
- $this->response->headers['hash'] = $value{0} == '"' ? substr($value, 1, -1) : $value;
- elseif (preg_match('/^x-amz-meta-.*$/', $header))
- $this->response->headers[$header] = is_numeric($value) ? (int)$value : $value;
- }
- return $strlen;
- }
-
-}
diff --git a/cdn/video_s3/includes/amazon_s3.inc b/cdn/video_s3/includes/amazon_s3.inc
deleted file mode 100644
index f53b087..0000000
--- a/cdn/video_s3/includes/amazon_s3.inc
+++ /dev/null
@@ -1,145 +0,0 @@
-<?php
-//$Id$
-/*
- * @file
- * Class file to handle amazon s3 transfers.
- *
- */
-
-// Include our class file.
-require_once('S3.php');
-
-define('VIDEO_S3_PENDING', 0);
-define('VIDEO_S3_WORKING', 1);
-define('VIDEO_S3_ACTIVE', 2);
-define('VIDEO_S3_FAILED', 3);
-
-class video_amazon_s3 {
- private $access_key;
- private $secret_key;
- private $ssl;
- private $limit;
- private $bucket;
-
- public $s3;
-
- public function __construct() {
- $this->access_key = variable_get('amazon_s3_access_key', '');
- $this->secret_key = variable_get('amazon_s3_secret_access_key','');
- $this->ssl = variable_get('amazon_s3_ssl',FALSE);
- $this->limit = variable_get('amazon_s3_limit',5);
- $this->bucket = variable_get('amazon_s3_bucket', '');
- }
-
- public function connect($access_key = '', $secret_key = '', $ssl = FALSE) {
- $access_key = $access_key ? $access_key : $this->access_key;
- $secret_key = $secret_key ? $secret_key : $this->secret_key;
- $ssl = $ssl ? $ssl : $this->ssl;
- // Make our connection to Amazon.
- $this->s3 = new S3($access_key, $secret_key, $ssl);
- }
-
- /*
- * Verifies the existence of a file id, returns the row or false if none found.
- */
- public function verify($fid) {
- $sql = db_query("SELECT * FROM {video_s3} WHERE fid=%d", $fid);
- $row = db_fetch_object($sql);
- return $row;
- }
-
- /*
- * Gets a video object from the database.
- */
- public function get($fid) {
- $sql = db_query("SELECT * FROM {video_s3} WHERE fid=%d AND status=%d", $fid, VIDEO_S3_ACTIVE);
- $row = db_fetch_object($sql);
- return $row;
- }
-
- /*
- * Inserts file object into the database.
- */
- public function insert($fid) {
- db_query("INSERT INTO {video_s3} (fid, status) VALUES (%d, %d)", $fid, VIDEO_S3_PENDING);
- }
-
- /*
- * Updates the database after a successful transfer to amazon.
- */
- public function update($video) {
- $result = db_query("UPDATE {video_s3} SET bucket='%s', filename='%s', filepath='%s', filemime='%s', filesize='%s', status=%d, completed=%d WHERE vid=%d",
- $video->bucket, $video->filename, $video->filepath, $video->filemime, $video->filesize, VIDEO_S3_ACTIVE, REQUEST_TIME, $video->vid);
- return $result;
- }
-
- public function working($vid) {
- db_query("UPDATE {video_s3} SET status=%d WHERE vid=%d", VIDEO_S3_WORKING, $vid);
- }
-
- public function failed($vid) {
- db_query("UPDATE {video_s3} SET status=%d WHERE vid=%d", VIDEO_S3_FAILED, $vid);
- }
-
- public function delete($fid) {
- // Lets get our file no matter the status and delete it.
- if($video = $this->verify($fid)) {
- if($video->bucket) {
- // It has been pushed to amazon so lets remove it.
- $this->s3->deleteObject($video->bucket, $video->filename);
- }
- // Lets delete our record from the database.
- db_query("DELETE FROM {video_s3} WHERE vid=%d", $video->vid);
- }
- }
-
- /*
- * Selects the pending queue to be transfered to amazon.
- */
- public function queue() {
- $video = false;
- $sql = db_query("SELECT vid, fid FROM {video_s3} WHERE status=%d LIMIT %d", VIDEO_S3_PENDING, $this->limit);
- while($row = db_fetch_object($sql)) {
- // We need to check if this file id exists in our transcoding table.
- $sql_video = db_query("SELECT * FROM {video_files} WHERE fid=%d", $row->fid);
- if($sql_video_row = db_fetch_object($sql_video)) {
- // This is a transcoded file, lets verify it has been transcoded and if so lets push it to amazon.
- module_load_include('inc', 'video', '/includes/conversion');
- if($sql_video_row->status == VIDEO_RENDERING_COMPLETE) {
- $video = $sql_video_row;
- }
- }
- else {
- // This is a regular video file, lets get our file object from the files table and push it to amazon.
- $sql_files = db_query("SELECT * FROM {files} WHERE fid=%d", $row->fid);
- if($sql_files_row = db_fetch_object($sql_files)) {
- $video = $sql_files_row;
- }
- }
- // If we have a video lets go ahead and send it.
- if($video) {
- // Update our status to working.
- $this->working($row->vid);
- $filepath = $video->filepath;
- $filename = basename($video->filepath);
- if ($this->s3->putObjectFile($filepath, $this->bucket, $filename, S3::ACL_PUBLIC_READ)) {
- // Update our table.
- $video->bucket = $this->bucket;
- $video->vid = $row->vid;
- $prefix = $this->ssl ? 'https://' : 'http://';
- $video->filepath = $prefix . $video->bucket .'.s3.amazonaws.com/'. $filename;
- if($this->update($video)) {
- watchdog('amazon_s3', t('Successfully uploaded our file: !file into the bucket %bucket on the Amazon S3 server.', array('!file' => $filepath, '%bucket' => $this->bucket)), array(), WATCHDOG_INFO);
- }
- }
- else {
- watchdog('amazon_s3', 'Failed to upload our file to the amazon s3 server.', array(), WATCHDOG_ERROR);
- $this->failed($row->vid);
- }
- }
- else {
- watchdog('amazon_s3', 'We did not find the file id: '.$row->fid.' or it is still queued for ffmpeg processing.', array(), WATCHDOG_DEBUG);
- }
- }
- }
-} \ No newline at end of file
diff --git a/cdn/video_s3/video_s3.admin.inc b/cdn/video_s3/video_s3.admin.inc
deleted file mode 100644
index ea038a4..0000000
--- a/cdn/video_s3/video_s3.admin.inc
+++ /dev/null
@@ -1,134 +0,0 @@
-<?php
-// $Id$
-/**
- * @file
- * Provides admin functions for the s3 amazon webservices.
- */
-
-function video_s3_admin_settings() {
- $form = array();
- $form['amazon_s3'] = array(
- '#type' => 'checkbox',
- '#title' => t('Enable Amazon S3.'),
- '#default_value' => variable_get('amazon_s3', FALSE),
- '#description' => t('If you would like to use Amazon S3 to store and serve up your video files enable this and fill out your access keys.'),
- );
- $form['amazon_s3_ssl'] = array(
- '#type' => 'checkbox',
- '#title' => t('Enable SSL?'),
- '#default_value' => variable_get('amazon_s3_ssl', FALSE),
- '#description' => t('If you would like to use ssl when transfering your files enable this option.'),
- );
- $form['amazon_s3_access_key'] = array(
- '#type' => 'textfield',
- '#title' => t('Access Key ID'),
- '#default_value' => variable_get('amazon_s3_access_key', ''),
- '#size' => 50,
- );
- $form['amazon_s3_secret_access_key'] = array(
- '#type' => 'password',
- '#title' => t('Secret Access Key'),
- '#default_value' => variable_get('amazon_s3_secret_access_key', ''),
- '#description' => t('Once saved, you do not need to re-enter your secret key. If you need to update your key, then fill this out to update it.'),
- '#size' => 50,
- );
- //@todo Maybe move this to the admin settings page instead of global?
- $form['amazon_s3_bucket'] = array(
- '#type' => 'textfield',
- '#title' => t('Bucket'),
- '#description' => t('Enter the bucket you wish to store your videos in. If the bucket doesn\'t exist the system will attempt to create it.'),
- '#default_value' => variable_get('amazon_s3_bucket', ''),
- '#size' => 50,
- );
- $form['#validate'] = array('video_s3_admin_settings_validate');
-
- //lets show our buckets in table format with a delete link.
- if(variable_get('amazon_s3', FALSE)) { //@todo add permissions
- //were enabled, that means they have successfully connected and created a bucket.
- module_load_include('inc', 'video_s3', '/includes/amazon_s3');
- $s3 = new video_amazon_s3;
- $s3->connect();
- $buckets = $s3->s3->listBuckets();
- // Setup our header.
- $header = array(t('Bucket Name'), t('Total Objects'), t('Actions'));
- $rows = array();
- foreach($buckets as $bucket) {
- $objects = count($s3->s3->getBucket($bucket));
- $actions = l(t('Delete'), 'admin/settings/video/amazon_s3/bucket/'. $bucket .'/delete');
- $rows[] = array($bucket, $objects, $actions);
- }
- $form['amazon_info'] = array(
- '#type' => 'fieldset',
- '#title' => t('Amazon S3 Information'),
- '#collapsible' => TRUE,
- '#collapsed' => TRUE,
- );
- $form['amazon_info']['buckets'] = array(
- '#type' => 'markup',
- '#value' => theme('table', $header, $rows),
- );
- }
- return system_settings_form($form);
-}
-
-function video_s3_admin_settings_validate(&$form, &$form_state) {
- // Check for CURL
- if (!extension_loaded('curl') && !@dl(PHP_SHLIB_SUFFIX == 'so' ? 'curl.so' : 'php_curl.dll')) {
- form_set_error('amazon_s3', t('The CURL extension is not loaded.'));
- } else {
- $bucket = $form_state['values']['amazon_s3_bucket'];
- // S3 buckets must contain only lower case alphanumeric characters, dots and dashes.
- if(!preg_match("/^[a-z.-]+$/", $bucket)) {
- form_set_error('amazon_s3_bucket', t('S3 buckets must contain only lower case alphanumeric characters, dots and dashes.'));
- }
- else {
- $access_key = $form_state['values']['amazon_s3_access_key'];
- // check our secret key.
- if(!empty($form_state['values']['amazon_s3_secret_access_key'])) {
- $secret_key = $form_state['values']['amazon_s3_secret_access_key'];
- }
- else {
- // Add our secret key back in to persist its value.
- $form_state['values']['amazon_s3_secret_access_key'] = variable_get('amazon_s3_secret_access_key','');
- $secret_key = variable_get('amazon_s3_secret_access_key','');
- }
- $ssl = isset($form_state['values']['amazon_s3_ssl']) && $form_state['values']['amazon_s3_ssl'] ? TRUE : FALSE;
- // Lets verify our credentials and verify our bucket exists, if not attempt to create it.
- module_load_include('inc', 'video_s3', '/includes/amazon_s3');
- $s3 = new video_amazon_s3;
- $s3->connect($access_key, $secret_key, $ssl);
- $buckets = $s3->s3->listBuckets();
- if ( !$buckets || !(in_array( $bucket, $buckets ))) {
- // Create a bucket with public read access
- if ($s3->s3->putBucket($bucket, S3::ACL_PUBLIC_READ)) {
- drupal_set_message(t('Successfully created the bucket %bucket.', array('%bucket' => $bucket)));
- }
- else {
- form_set_error('amazon_s3_bucket', t('Could not verify or create the bucket %bucket.', array('%bucket' => $bucket)));
- }
- }
- }
- }
-}
-
-/*
- * Deletes a bucket from your Amazon S3 server.
- */
-function video_s3_bucket_delete($bucket) {
- module_load_include('inc', 'video_s3', '/includes/amazon_s3');
- $s3 = new video_amazon_s3;
- $s3->connect();
- $buckets = $s3->s3->listBuckets();
- if(is_array($buckets) && in_array($bucket, $buckets)) {
- if($s3->s3->deleteBucket($bucket)) {
- drupal_set_message(t('Successfully deleted the bucket %bucket', array('%bucket' => $bucket)));
- }
- else {
- drupal_set_message(t('Could not delete the bucket %bucket', array('%bucket' => $bucket)), 'error');
- }
- }
- else {
- drupal_set_message(t('The bucket %bucket does not exist for deletion.', array('%bucket' => $bucket)), 'error');
- }
- drupal_goto('admin/settings/video/amazon_s3');
-} \ No newline at end of file
diff --git a/cdn/video_s3/video_s3.info b/cdn/video_s3/video_s3.info
deleted file mode 100644
index 949460b..0000000
--- a/cdn/video_s3/video_s3.info
+++ /dev/null
@@ -1,10 +0,0 @@
-;$Id$
-
-name = Amazon S3 on Video
-description = Leverages the Video module and Amazon Simple Storage Service (Amazon S3) to serve and store your video's saving bandwidth.
-package = "Video"
-dependencies[] = video
-core = 7.x
-files[]=video_s3.module
-files[]=video_s3.install
-files[]=video_s3.admin.inc \ No newline at end of file
diff --git a/cdn/video_s3/video_s3.install b/cdn/video_s3/video_s3.install
deleted file mode 100644
index b43734a..0000000
--- a/cdn/video_s3/video_s3.install
+++ /dev/null
@@ -1,107 +0,0 @@
-<?php
-// $Id$
-/**
- * @file
- * Provides installation functions for video_s3.module.
- */
-
-/**
- * Implementation of hook_schema().
- */
-function video_s3_schema() {
- $schema['video_s3'] = array(
- 'description' => t('Store video s3 cdn'),
- 'fields' => array(
- 'vid' => array(
- 'description' => t('Auto Increment id'),
- 'type' => 'serial',
- 'unsigned' => TRUE,
- 'not null' => TRUE,
- ),
- 'fid' => array(
- 'description' => t('Original file id'),
- 'type' => 'int',
- 'unsigned' => TRUE,
- 'not null' => TRUE,
- 'default' => 0,
- ),
- 'nid' => array(
- 'description' => t('Node id'),
- 'type' => 'int',
- 'unsigned' => TRUE,
- 'not null' => TRUE,
- 'default' => 0,
- ),
- 'bucket' => array(
- 'type' => 'varchar',
- 'length' => '255',
- 'default' => '',
- 'description' => t('The bucket the video is stored in.'),
- ),
- 'filename' => array(
- 'type' => 'varchar',
- 'length' => '255',
- 'default' => '',
- 'description' => t('The filename of the video.'),
- ),
- 'filepath' => array(
- 'type' => 'varchar',
- 'length' => '255',
- 'default' => '',
- 'description' => t('The filepath of the video.'),
- ),
- 'filemime' => array(
- 'type' => 'varchar',
- 'length' => '255',
- 'default' => '',
- 'description' => t('The filemime of the video.'),
- ),
- 'filesize' => array(
- 'description' => t('Filesize of the video.'),
- 'type' => 'int',
- 'unsigned' => TRUE,
- 'not null' => TRUE,
- 'default' => 0,
- ),
- 'status' => array(
- 'description' => t('Status of the cdn transfer'),
- 'type' => 'int',
- 'unsigned' => TRUE,
- 'not null' => TRUE,
- 'default' => 0,
- ),
- 'completed' => array(
- 'description' => t('Time of successful completion to amazon.'),
- 'type' => 'int',
- 'not null' => TRUE,
- 'default' => 0,
- ),
- ),
- 'indexes' => array(
- 'status' => array('status'),
- 'file' => array('fid'),
- ),
- 'primary key' => array('vid'),
- );
- return $schema;
-}
-
-/**
- * Implementation of hook_install().
- */
-function video_s3_install() {
- drupal_install_schema('video_s3');
-}
-
-/**
- * Implementation of hook_uninstall().
- */
-function video_s3_uninstall() {
- drupal_uninstall_schema('video_s3');
- // Delete our variables.
- variable_del('amazon_s3');
- variable_del('amazon_s3_ssl');
- variable_del('amazon_s3_access_key');
- variable_del('amazon_s3_secret_access_key');
- variable_del('amazon_s3_bucket');
-} \ No newline at end of file
diff --git a/cdn/video_s3/video_s3.module b/cdn/video_s3/video_s3.module
deleted file mode 100644
index 2355872..0000000
--- a/cdn/video_s3/video_s3.module
+++ /dev/null
@@ -1,114 +0,0 @@
-<?php
-// $Id$
-/**
- * @file
- * Provides wrapper functions for the s3 amazon webservices.
- */
-
-/*
- * Implementation of hook_perm().
- */
-function video_s3_perm() {
- return array('administer amazon s3');
-}
-/*
- * Implmentation of hook_help().
- */
-function video_s3_help($path, $arg) {
- switch($path) {
- case 'admin/settings/video/amazon_s3':
- $output = t('Use Amazon Simple Storage Service (Amazon S3) to store your video files. This free\'s up bandwidth from your site, providing a faster experience for your users. Simply enable this module and enter your authentication details and your done!');
- return $output;
- }
-}
-
-/*
- * Implementation of hook_menu().
- */
-function video_s3_menu() {
- $items = array();
- $items['admin/settings/video/amazon_s3'] = array(
- 'title' => 'Amazon S3',
- 'description' => 'Configure your Amazon S3 settings.',
- 'page callback' => 'drupal_get_form',
- 'page arguments' => array('video_s3_admin_settings'),
- 'access arguments' => array('administer site configuration'),
- 'file' => 'video_s3.admin.inc',
- 'type' => MENU_LOCAL_TASK,
- 'weight' => 10,
- );
- $items['admin/settings/video/amazon_s3/bucket/%/delete'] = array(
- 'title' => 'Delete Bucket',
- 'page callback' => 'video_s3_bucket_delete',
- 'page arguments' => array(5),
- 'access arguments' => array('administer amazon s3'),
- 'file' => 'video_s3.admin.inc',
- 'type' => MENU_CALLBACK,
- );
- return $items;
-}
-
-/*
- * Implementation of hook_cron().
- */
-function video_s3_cron() {
- module_load_include('inc', 'video_s3', '/includes/amazon_s3');
- $s3 = new video_amazon_s3;
- $s3->connect();
- // Lets run our queue.
- $s3->queue();
-}
-
-/**
- * Implementation of hook_file_delete().
- */
-function video_s3_file_delete($file) {
- module_load_include('inc', 'video_s3', '/includes/amazon_s3');
- $s3 = new video_amazon_s3;
- $s3->connect();
- // Lets run our queue.
- $s3->delete($file->fid);
-}
-
-/*
- * Implementation of hook_form_alter().
- */
-function video_s3_form_alter(&$form, &$form_state, $form_id) {
- if (isset($form['type']) && isset($form['#node']) && $form['type']['#value'] .'_node_form' == $form_id) {
- $form['buttons']['submit']['#submit'][] = 'video_s3_node_update_submit';
- }
-}
-
-/*
- * Submit hanlder to update our s3 table to include the node id.
- */
-function video_s3_node_update_submit($form, &$form_state) {
- //lets update our video rending table to include the node id created
- if (isset($form_state['nid']) && isset($form_state['values']['video_id']) && is_array($form_state['values']['video_id'])) {
- foreach($form_state['values']['video_id'] as $fid) {
- //lets update our table to include the nid
- db_query("UPDATE {video_s3} SET nid=%d WHERE fid=%d", $form_state['nid'], $fid);
- }
- }
-}
-
-/**
- * Implementing hook_video_submit
- * @param <type> $element
- * @param <type> $form_state
- */
-function video_s3_video_submit(&$element, &$form_state) {
- $file = $element['#value'];
- //we need to check if this fid has already been added to the database AND that there is in fact a fid
- if (is_array($file) && isset($file['fid']) && !empty($file['fid'])) {
- module_load_include('inc', 'video_s3', '/includes/amazon_s3');
- $s3 = new video_amazon_s3;
- $s3->connect();
- // Lets verify that we haven't added this video already. Multiple validation fails will cause this to be ran more than once
- if(!$video = $s3->verify($file['fid'])) {
- // Video has not been added to the queue yet so lets add it.
- $s3->insert($file['fid']);
- drupal_set_message(t('Video submission queued for transfer to your Amazon S3 server. Will be there shortly.'));
- }
- }
-}
diff --git a/css/video.css b/css/video.css
deleted file mode 100644
index f369145..0000000
--- a/css/video.css
+++ /dev/null
@@ -1,134 +0,0 @@
-/* $Id$ */
-
-.filefield-element .filefield-file-info, .video_thumbnail {
- min-width: 100px;
- min-height: 100px;
-}
-
-.filefield-element .imagefield-preview {
- min-width: 100px;
- min-height: 100px;
-}
-
-.filefield-element .imagefield-text {
- max-width: 40em; /* Reflect the maxlength of the ALT attribute (80 characters). */
-}
-
-.filefield-element .uploadfield-text {
- max-width: 40em;
-}
-
-.video_thumbnail {
- min-width: 100px;
- min-height: 100px;
-}
-
-.uploadfield {
-
-}
-
-.uploadfield-nodelink {
-
-}
-
-.uploadfield-video-thumb {
-
-}
-
-.uploadfield-video-thumb img{
- width : 250px;
-/* min-width: 100px; */
- min-height: 210px;
-
-}
-
-.uploadfield-video-thumb span{
- /* This is the overlay image for use as a play button. */
- background: url(../images/play.png) no-repeat;
-
- /* This is the size of our button. DOES NOT WORK WITH DEFAULT THUMB SIZE! */
- width: 50px;
- height: 112px;
- position : absolute;
- margin : 65px 100px;
-}
-
-.uploadfield-video-thumb span:hover {
- background-position: -50px 0px;
-}
-
-.video-width-text {
- width:10px;
-}
-
-.video-thumb-selection{
-
-}
-
-.video-thumb-selection .form-item {
-
-}
-
-.video-thumbnails{
-/* display : block;*/
-}
-.video-thumbnails .form-item{
- float:left;
- margin-right:10px;
- max-width:30%;
- padding-right:10px;
-}
-
-.video-bypass-auto-conversion{
-
-}
-.video-default-thumbnail{
-
-}
-
-.video-data{
-
-}
-
-.video_image_teaser {
- float: left;
- padding: 0.5em;
-}
-
-br.video_image_clear {
- clear: both;
-}
-
-.video_image_view {
- /* inser here rules for node page image */
-}
-
-.video-ffmpeg-helper-inprogress {
- border: 1px solid red;
- padding: .5em;
-}
-
-/* override filefield entry */
-.widget-edit{
- max-width:70%;
-}
-
-.widget-edit .form-item { white-space: normal !important; }
-
-.admin_flv_player_wrapper { display: none; }
-/*
- * VIDEO OJBECT FIXES CROSS BROWSER
- */
-* html object.video-object {
- display: none;
-}
-
-* html object.video-object/**/ {
- display: inline;
-}
-
-* html object.video-object {
- display/**/: none;
-}
-
- \ No newline at end of file
diff --git a/images/play.png b/images/play.png
deleted file mode 100644
index 1a61c7b..0000000
--- a/images/play.png
+++ /dev/null
Binary files differ
diff --git a/includes/common.inc b/includes/common.inc
deleted file mode 100644
index ce9d89c..0000000
--- a/includes/common.inc
+++ /dev/null
@@ -1,448 +0,0 @@
-<?php
-//$Id$
-/**
- * @file
- * Add some common functions for the various video types supported
- *
- * @todo Configure default players by video filetype (user configurable?)
- */
-
-
-/**
- * Get the object for the suitable player for the parameter resource
- */
-function _video_common_get_player($element) {
- $field = content_fields($element['#field_name'], $element['#type_name']);
- $resolution = array_filter(explode(':', $field['widget']['default_resolution']));
- $element['#item']['data']['height'] = $element['#item']['data']['width'] * ($resolution[1]/$resolution[0]);
-
- $op = _video_get_filetype($element['#item']['filename']);
- //play HQ mp4 videos in flash player
- if(variable_get('mp4_play_in_flowplayer', FALSE) && $op == 'mp4'){
- $op = 'mp4f';
- }
- switch ($op) {
- case 'divx':
- return theme('video_play_divx', $element);
- case 'mov':
- case '3gp':
- case '3g2':
- case 'mp4': // video/mp4
- return theme('video_play_quicktime', $element);
- case 'rm':
- return theme('video_play_realmedia', $element);
- case 'mp4f':
- case 'f4v' :
- case 'flv' : // flowplayer also supprts MP4, H.264 (.extension?)
- return theme('video_play_flash', $element);
- case 'swf':
- return theme('video_play_swf', $element);
- case 'dir':
- case 'dcr':
- return theme('video_play_dcr', $element);
- case 'asf':
- case 'wmv':
- case 'avi':
- case 'mpg':
- case 'mpeg':
- return theme('video_play_windowsmedia', $element);
- case 'ogg':
- return theme('video_play_ogg_theora', $element);
- default:
- drupal_set_message('No video player is configured for ' .$op, 'error');
- break;
- }
-}
-
-
-/**
- * Pull the file extension from a filename
- *
- * @param $vidfile
- * string filename to get the filetype from.
- *
- * @return
- * string value of file type or boolean FALSE on error
- */
-function _video_get_filetype($vidfile) {
- if (strstr($vidfile, '.')) { //If file contains a "." then get the file extension after the ".
- $file_type = end(explode('.', $vidfile));
- }
- else {
- $file_type = FALSE;
- }
-
- return strtolower($file_type);
-}
-
-/*********************************************************************
- * Themeable functions for playing videos. They print a page with a player embedded.
- *********************************************************************/
-
-/**
- * Play videos from in FLV Flash video format
- *
- * @param $node
- * object with node information
- *
- * @return
- * string of content to display
- */
-function theme_video_play_flash($element) {
-//TODO : remove item height set in here
- $video = file_create_url($element['#item']['filepath']);
- // echo file_create_url($element['#item']['filepath']);
- $width = isset($element['#item']['data']['width']) ? $element['#item']['data']['width'] : '';
- $height = isset($element['#item']['data']['height']) ? $element['#item']['data']['height'] : '';
- $width = empty($width) ? '350px' : $width .'px';
- $height = empty($height) ? '285px' : $height .'px';
- $id = $element['#formatter'];
-
- if (module_exists('flowplayer')) {
- $output = theme('flowplayer', array(
- 'clip' => array(
- 'url' => $video,
- //TODO: Make settings for this
- 'autoPlay' => variable_get('video_autoplay', TRUE), // Turn autoplay off
- 'autoBuffering' => variable_get('video_autobuffering', TRUE),
- ),
- ),
- $id, array(
- 'style' => "width: $width; height: $height",
- )
- );
- }
- else {
- $output='<p>Use <b>SwfTools Module</b> to play FLV files if you only convert/upload FLV videos or <b>FlowPlayer Module</b> must be enabled in order to play FLV videos with other types.</p>';
- }
- return $output;
-}
-
-/**
- * Play Flash .swf files.
- *
- * @param $node
- * object with node information
- *
- * @return
- * string of content to display
- */
-function theme_video_play_swf($element) {
-
- $video = file_create_url($element['#item']['filepath']);
- $width = isset($element['#item']['data']['width']) ? $element['#item']['data']['width'] : '';
- $height = isset($element['#item']['data']['height']) ? $element['#item']['data']['height'] : '';
- $width = empty($width) ? '350px' : $width .'px';
- $height = empty($height) ? '285px' : $height .'px';
-
-
- // this will be executed by not Internet Explorer browsers
- $output = '<!--[if !IE]> <-->
- <object type="application/x-shockwave-flash" width="'. $width .'" height="'. $height .'"
- data="'. $video .'">
- <!--> <![endif]-->' . "\n";
-
- // this will be executed by Internet Explorer
- $output .= '<!--[if IE]>
- <object type="application/x-shockwave-flash" width="'. $width .'" height="'. $height .'"
- classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"
- codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,40,0">
- <![endif]-->' . "\n";
-
- // params will be passed to both IE or not IE browsers
- $output .= '<param name="movie" value="'. $video .'" />'. "\n" .
- '<param name="wmode" value="transparent" />' . "\n"
- . //_video_get_parameters($node) .
- '<p>'. t('Your browser is not able to display this multimedia content.') .'</p>
- </object>';
-/*
- $output = theme('video_format_play', $output, t('http://www.macromedia.com/go/getflashplayer'), t('Link to Flash player download'), t('Download the latest Flash player'));*/
- return $output;
-}
-
-
-
-/**
- * Play Director .dcr/.dir files.
- *
- * @param $node
- * object with node information
- *
- * @return
- * string of content to display
- */
-
-function theme_video_play_dcr($element) {
-
- $video = file_create_url($element['#item']['filepath']);
- $width = isset($element['#item']['data']['width']) ? $element['#item']['data']['width'] : '';
- $height = isset($element['#item']['data']['height']) ? $element['#item']['data']['height'] : '';
- $width = empty($width) ? '350px' : $width .'px';
- $height = empty($height) ? '285px' : $height .'px';
-
- // this will be executed by not Internet Explorer browsers
- $output = '<!--[if !IE]> <-->
- <object type="application/x-director" width="'. $width .'" height="'. $height .'"
- data="'. $video .'">
- <!--> <![endif]-->' . "\n";
-
- // this will be executed by Internet Explorer
- $output .= '<!--[if IE]>
- <object type="application/x-director" width="'. $width .'" height="'. $height .'"
- classid="clsid:166B1BCA-3F9C-11CF-8075-444553540000"
- codebase="http://download.macromedia.com/pub/shockwave/cabs/director/sw.cab#version=10,0,0,0">
- <![endif]-->' . "\n";
-
- // params will be passed to both IE or not IE browsers
- $output .= '<param name="src" value="'. $video .'" />' . "\n"
- . //_video_get_parameters($node) .
- '<p>'. t('Your browser is not able to display this multimedia content.') .'</p>
- </object>';
-/*
- $output = theme('video_format_play', $output, t('http://www.macromedia.com/shockwave/download/'),
- t('Link to Macromedia Shockwave Player Download Page'),
- t('Download latest Shockwave Player'));*/
- return $output;
-}
-
-/**
- * Play videos from in DivX format
- *
- * @see http://developer.apple.com/internet/ieembedprep.html
- * @param $node
- * object with node information
- *
- * @return
- * string of content to display
- */
-function theme_video_play_divx($element) {
-//Increase the height to accommodate the player controls on the bottom.
- $video = file_create_url($element['#item']['filepath']);
- $width = isset($element['#item']['data']['width']) ? $element['#item']['data']['width'] : '';
- $height = isset($element['#item']['data']['height']) ? $element['#item']['data']['height'] : '';
- $width = empty($width) ? '350px' : $width .'px';
- $height = empty($height) ? '285px' : $height .'px';
-
- //$url = _video_get_fileurl($node->vidfile);
-
- $output = '<!-- [if IE] -->
- <object classid="clsid:67DABFBF-D0AB-41fa-9C46-CC0F21721616" width="'.$width.'" height="'.$height.'" codebase="http://go.divx.com/plugin/DivXBrowserPlugin.cab">
- <!--> <![endif]-->'. "\n";
- // this will be executed by not Internet Explorer browsers
- $output = '<!-- [if !IE] -->
- <object type="video/divx" data="'.$video.'" width="'.$width.'" height="'.$height.'" mode="zero">
- <!--> <![endif]-->'."\n";
-
- $output .= '<param name="src" value="'.$video.'"/>'."\n";
- $output .= '<param name="mode" value="zero"/>'."\n";
- $output .= '</object>';
- /*
- $output = theme('video_format_play', $output,t('http://www.divx.com/divx/webplayer/'),
- t('Link to DivX Download Page'),
- t('Download latest DivX Web Player'));*/
- return $output;
-}
-
-/**
- * Play videos from in Quicktime format
- *
- * @see http://developer.apple.com/internet/ieembedprep.html
- * @param $node
- * object with node information
- *
- * @return
- * string of content to display
- */
-function theme_video_play_quicktime($element) {
-//Increase the height to accommodate the player controls on the bottom.
- $video = file_create_url($element['#item']['filepath']);
- $width = isset($element['#item']['data']['width']) ? $element['#item']['data']['width'] : '';
- $height = isset($element['#item']['data']['height']) ? $element['#item']['data']['height'] : '';
- $width = empty($width) ? '350px' : $width .'px';
- $height = empty($height) ? '285px' : $height .'px';
-
-
- // this will be executed by not Internet Explorer browsers
- $output = '<!--[if !IE]> <-->
- <object type="video/quicktime" width="'. $width .'" height="'. $height .'"
- data="'. $video .'">
- <!--> <![endif]-->' . "\n";
-
- // this will be executed by Internet Explorer
- $output .= '<!--[if IE]>
- <object classid="clsid:02BF25D5-8C17-4B23-BC80-D3488ABDDC6B"
- codebase="http://www.apple.com/qtactivex/qtplugin.cab"
- width="'. $width .'" height="'. $height .'" scale="tofit" >
- <![endif]-->' . "\n";
-
- // params will be passed to both IE or not IE browsers
- //GMM: kioskmode enabled so users don't bypass download security video through player
- $output .= '<param name="src" value="'. $video .'" />
- <param name="AUTOPLAY" value="'.(variable_get('video_autoplay', TRUE) ? TRUE : FALSE).'" />
- <param name="KIOSKMODE" value="true" />
- <param name="CONTROLLER" value="true" />' . "\n"
- . //_video_get_parameters($node) .
- '<p>'. t('Your browser is not able to display this multimedia content.') .'</p>
- </object>'; // only one </object> needed becouse only one opening tag has been parsed by browsers
-
- return $output;
-}
-
-/**
- * Play videos from in Realmedia format
- *
- * @param $node
- * object with node information
- *
- * @return
- * string of content to display
- */
-function theme_video_play_realmedia($element) {
-// Real's embeded player includes the controls
-// in the height
- $video = file_create_url($element['#item']['filepath']);
- $width = isset($element['#item']['data']['width']) ? $element['#item']['data']['width'] : '';
- $height = isset($element['#item']['data']['height']) ? $element['#item']['data']['height'] : '';
- $width = empty($width) ? '350px' : $width .'px';
- $height = empty($height) ? '285px' : $height .'px';
-
- // this will be executed by not Internet Explorer browsers
- $output = '<!--[if !IE]> <-->
- <object type="audio/x-pn-realaudio-plugin" width="'. $width .'" height="'. $height .'"
- data="'. $video .'">
- <!--> <![endif]-->' . "\n";
-
- // this will be executed by Internet Explorer
- $output .= '<!--[if IE]>
- <object type="audio/x-pn-realaudio-plugin" width="'. $width .'" height="'. $height .'"
- classid="clsid:CFCDAA03-8BE4-11cf-B84B-0020AFBBCCFA" >
- <![endif]-->' . "\n";
-
- // params will be passed to both IE or not IE browsers
- $output .= '<param name="src" value="'. $video .'" />
- <param name="_ExtentX" value="7276" />
- <param name="" value="3307" />
- <param name="AUTOSTART" value="'.(variable_get('video_autoplay', TRUE) ? 'true' : 'false').'" />
- <param name="SHUFFLE" value="0" />
- <param name="PREFETCH" value="0" />
- <param name="NOLABELS" value="0" />
- <param name="CONTROLS" value="All" />
- <param name="CONSOLE" value="Clip1" />
- <param name="LOOP" value="0" />
- <param name="NUMLOOP" value="0" />
- <param name="CENTER" value="0" />
- <param name="MAINTAINASPECT" value="1" />
- <param name="BACKGROUNDCOLOR" value="#000000" />'
- . //_video_get_parameters($node) .
- '<p>'. t('Your browser is not able to display this multimedia content.') .'</p>
- </object>'; // only one </object> needed becouse only one opening tag has been parsed by browsers
-
-/*
- $output = theme('video_format_play', $output, t('http://www.real.com/'),
- t('Link to Real'),
- t('Download latest Realmedia Player'));*/
- return $output;
-}
-
-/**
- * Play videos from in WindowsMediaVideo format
- *
- * @param $node
- * object with node information
- *
- * @return
- * string of content to display
- */
-function theme_video_play_windowsmedia($element) {
-// Windows Media's embeded player includes the controls in the height
- $video = file_create_url($element['#item']['filepath']);
- $width = isset($element['#item']['data']['width']) ? $element['#item']['data']['width'] : '';
- $height = isset($element['#item']['data']['height']) ? $element['#item']['data']['height'] : '';
- $width = empty($width) ? '350px' : $width .'px';
- $height = empty($height) ? '285px' : $height .'px';
-
- // this will be executed by not Internet Explorer browsers
- $output = '<!--[if !IE]> <-->
- <object type="application/x-mplayer2" width="'. $width .'" height="'. $height .'"
- data="'. $video .'">
- <!--> <![endif]-->' . "\n";
-
- // this will be executed by Internet Explorer
- $output .= '<!--[if IE]>
- <object type="application/x-oleobject" width="'. $width .'" height="'. $height .'"
- classid="clsid:6BF52A52-394A-11d3-B153-00C04F79FAA6" >
- <![endif]-->' . "\n";
-
- // params will be passed to both IE or not IE browsers
- $output .= '<param name="src" value="'. $video .'" />
- <param name="URL" value="'.$video.'" />
- <param name="animationatStart" value="true" />
- <param name="transparentatStart" value="true" />
- <param name="autoStart" value="'.(variable_get('video_autoplay', TRUE) ? 'true' : 'false').'" />
- <param name="showControls" value="true" />
- <param name="loop" value="true" />'
- . //_video_get_parameters($node) .
- '<p>'. t('Your browser is not able to display this multimedia content.') .'</p>
- </object>'; // only one </object> needed becouse only one opening tag has been parsed by browsers
-
- return $output;
-}
-
-
-
-
-/**
- * Play Ogg Theora videos with Cortado Applet
- *
- * @param $node
- * object with node information
- *
- * @return
- * string of content to display
- */
-function theme_video_play_ogg_theora($element) {
- global $base_url;
- $cortado_location = variable_get('video_cortado', $base_url . '/cortado.jar');
- //$url = _video_get_fileurl($node->vidfile);
- $video = file_create_url($element['#item']['filepath']);
-
- $width = ($node->video_scaled_x ? $node->video_scaled_x : '425');
- $height = ($node->video_scaled_y ? $node->video_scaled_y : '350');
-
- $output = '
- <!--[if !IE]>-->
- <object classid="java:com.fluendo.player.Cortado.class"
- type="application/x-java-applet"
- archive="' . $cortado_location . '"
- width="' . $width . '" height="' . $height . '" >
- <!--<![endif]-->
- <object classid="clsid:8AD9C840-044E-11D1-B3E9-00805F499D93"
- codebase="http://java.sun.com/update/1.5.0/jinstall-1_5_0-windows-i586.cab"
- width="' . $width . '" height="' . $height . '" >
- <param name="code" value="com.fluendo.player.Cortado" />
- <!--[if !IE]>-->
- </object>
- <!--<![endif]-->
- <!-- IE and Konqueror browser need the archive param -->
- <param name="archive" value="' . $cortado_location . '" />
- <param name="url" value="' . $video . '"/>
- <param name="local" value="false" />
- <param name="keepaspect" value="true" />
- <param name="video" value="true" />
- <param name="audio" value="true" />
- <param name="seekable" value="true" />
- <param name="duration" value="' . $node->playtime_seconds . '" />
- <param name="bufferSize" value="200" />
- <strong>
- This browser does not have a Java Plug-in.<br />
- <a href="http://java.com/download/">
- Get the latest Java Plug-in here.
- </a>
- </strong>
- </object>
- ';
-/*
- $output = theme('video_format_play', $output,
- t('http://java.com/download/'), t('Link to java.com'), t('Download Java'));*/
- return $output;
-} \ No newline at end of file
diff --git a/includes/conversion.inc b/includes/conversion.inc
deleted file mode 100644
index 4f66bfa..0000000
--- a/includes/conversion.inc
+++ /dev/null
@@ -1,262 +0,0 @@
-<?php
-//$Id$
-/*
- * @file
- * Class file to handle video conversion using ffmpeg.
- *
- */
-define('VIDEO_RENDERING_PENDING', 1);
-define('VIDEO_RENDERING_ACTIVE', 5);
-define('VIDEO_RENDERING_COMPLETE', 10);
-define('VIDEO_RENDERING_FAILED', 20);
-
-class video_conversion {
-
- /**
- * Our main function to call when converting queued up jobs.
- */
- public function run_queue() {
- if ($videos = $this->select_queue()) {
- foreach ($videos as $video) {
- $this->process($video);
- }
- }
- }
-
- /**
- * Select videos from our queue
- *
- * @return
- * An array containing all the videos to be proccessed.
- */
- private function select_queue() {
- $total_videos = variable_get('video_ffmpeg_instances', 5);
- $videos = array();
- $result = db_query_range('SELECT f.*, vf.vid, vf.nid, vf.dimensions, vf.status as video_status FROM {video_files} vf LEFT JOIN {files} f ON vf.fid = f.fid WHERE vf.status = %d AND f.status = %d ORDER BY f.timestamp',
- VIDEO_RENDERING_PENDING, FILE_STATUS_PERMANENT, 0, $total_videos);
-
- while ($row = db_fetch_object($result)) {
- $videos[] = $row;
- }
- return $videos;
- }
-
- /**
- * Process the video through ffmpeg.
- *
- * @param $video
- * This can either be the file object or the file id (fid)
- *
- * @return
- * TRUE of FALSE if video was converted successfully.
- */
- public function process($video) {
- if (is_object($video) && isset($video->fid)) {
- $return = $this->render($video);
- }
- else {
- $video_object = $this->load_video($video);
- $return = $this->render($video_object);
- }
- return $return;
- }
-
- private function render($video) {
- if (!is_object($video)) {
- watchdog('video_conversion', 'Video object is not present', array(), WATCHDOG_ERROR);
- return FALSE;
- }
- // Make sure this video is pending or do nothing.
- if($video->video_status == VIDEO_RENDERING_PENDING) {
- // This will update our current video status to active.
- $this->change_status($video->vid, VIDEO_RENDERING_ACTIVE);
- // Get the converted file object
- //we are going to move our video to an "original" folder
- //we are going to transcode the video to the "converted" folder
- $pathinfo = pathinfo($video->filepath);
- $original = $pathinfo['dirname'] .'/original';
- $converted = $pathinfo['dirname'] .'/converted';
-
- if (!field_file_check_directory($original, FILE_CREATE_DIRECTORY)) {
- watchdog('video_transcoder', 'Video conversion failed. Could not create the directory: '.$orginal, array(), WATCHDOG_ERROR);
- return false;
- }
- if (!field_file_check_directory($converted, FILE_CREATE_DIRECTORY)) {
- watchdog('video_transcoder', 'Video conversion failed. Could not create the directory: '.$converted, array(), WATCHDOG_ERROR);
- return false;
- }
-
- $original = $original .'/'. $video->filename;
- //lets move our video and then convert it.
- if(file_move($video, $original)) {
- //update our filename after the move to maintain filename uniqueness.
- $converted = $converted .'/'. pathinfo($video->filepath, PATHINFO_FILENAME) .'.'. $this->video_extension();
- // Update our filepath since we moved it
- $update = drupal_write_record('files', $video, 'fid');
- //call our transcoder
- $command_output = $this->convert_video($video, $converted);
- //lets check to make sure our file exists, if not error out
- if(!file_exists($converted) || !filesize($converted)) {
- watchdog('video_conversion', 'Video conversion failed. FFMPEG reported the following output: '.$command_output, array(), WATCHDOG_ERROR);
- $this->change_status($video->vid, VIDEO_RENDERING_FAILED);
- return FALSE;
- }
- // Setup our converted video object
- $video_info = pathinfo($converted);
- //update our converted video
- $video->converted = new stdClass();
- $video->converted->vid = $video->vid;
- $video->converted->filename = $video_info['basename'];
- $video->converted->filepath = $converted;
- $video->converted->filemime = file_get_mimetype($converted);
- $video->converted->filesize = filesize($converted);
- $video->converted->status = VIDEO_RENDERING_COMPLETE;
- $video->converted->completed = REQUEST_TIME;
- //clear our cache so our video path is updated.
- cache_clear_all('*', 'cache_content', true);
- // Update our video_files table with the converted video information.
- $result = db_query("UPDATE {video_files} SET filename='%s', filepath='%s', filemime='%s', filesize=%d, status=%d, completed=%d WHERE vid=%d",
- $video->converted->filename, $video->converted->filepath, $video->converted->filemime, $video->converted->filesize, $video->converted->status, $video->converted->completed, $video->converted->vid);
-
- // Update our node id to published. We do not do a node_load as it causes editing problems when saving.
- db_query("UPDATE {node} SET status=%d WHERE nid=%d", 1, $video->nid);
- watchdog('video_conversion', 'Successfully converted %orig to %dest', array('%orig' => $video->filepath, '%dest' => $video->converted->filepath), WATCHDOG_INFO);
- return TRUE;
- }
- else {
- watchdog('video_conversion', 'Cound not move the video to the original folder.', array(), WATCHDOG_ERROR);
- $this->change_status($video->vid, VIDEO_RENDERING_FAILED);
- return FALSE;
- }
- }
- return NULL;
- }
-
- /**
- * Calls the transcoder class to convert the video.
- *
- * @param $job
- * Video object to be transcoded
- *
- * @return
- * TRUE or FALSE
- */
- private function convert_video($video, $converted) {
- //get our dimensions and pass them along.
- $dimensions = $this->dimensions($video);
- module_load_include('inc', 'video', '/includes/transcoder');
- $transcoder = new video_transcoder;
- return $transcoder->convert_video($video, $converted, $dimensions);
- }
-
- private function video_extension() {
- module_load_include('inc', 'video', '/includes/transcoder');
- $transcoder = new video_transcoder;
- return $transcoder->video_converted_extension();
- }
-
- /*
- * Function determines the dimensions you want and compares with the actual wxh of the video.
- *
- * If they are not exact or the aspect ratio does not match, we then figure out how much padding
- * we should add. We will either add a black bar on the top/bottom or on the left/right.
- *
- * @TODO I need to look more at this function. I don't really like the guess work here. Need to implement
- * a better way to check the end WxH. Maybe compare the final resolution to our defaults? I don't think
- * that just checking to make sure the final number is even is accurate enough.
- */
- public function dimensions($video) {
- //lets setup our dimensions. Make sure our aspect ratio matches the dimensions to be used, if not lets add black bars.
- $aspect_ratio = _video_aspect_ratio($video->filepath);
- $ratio = $aspect_ratio['ratio'];
- $width = $aspect_ratio ['width'];
- $height = $aspect_ratio['height'];
-
- $wxh = explode('x', $video->dimensions);
- $output_width = $wxh[0];
- $output_height = $wxh[1];
- $output_ratio = number_format($output_width / $output_height, 4);
-
- if($output_ratio != $ratio && $width && $height) {
- $options = array();
- // Figure out our black bar padding.
- if ($ratio < $output_width / $output_height) {
- $end_width = $output_height * $ratio;
- $end_height = $output_height;
- }
- else {
- $end_height = $output_width / $ratio;
- $end_width = $output_width;
- }
-
- // We need to get back to an even resolution and maybe compare with our defaults?
- // @TODO Make this more exact on actual video dimensions instead of making sure the wxh are even numbers
-
- if ($end_width == $output_width) {
- // We need to pad the top/bottom of the video
- $padding = round($output_height - $end_height);
- $pad1 = $pad2 = floor($padding / 2);
- if ($pad1 %2 !== 0) {
- $pad1++;
- $pad2--;
- }
- $options[] = '-padtop '. $pad1;
- $options[] = '-padbottom '. $pad2;
- }
- else {
- // We are padding the left/right of the video.
- $padding = round($output_width - $end_width);
- $pad1 = $pad2 = floor($padding / 2); //@todo does padding need to be an even number?
- if ($pad1 %2 !== 0) {
- $pad1++;
- $pad2--;
- }
- $options[] = '-padleft '. $pad1;
- $options[] = '-padright '. $pad2;
- }
-
- $end_width = round($end_width) %2 !==0 ? round($end_width) + 1 : round($end_width);
- $end_height = round($end_height) %2 !==0 ? round($end_height) + 1 : round($end_height);
- //add our size to the beginning to make sure it hits our -s
- array_unshift($options, $end_width .'x'. $end_height);
- return implode(' ', $options);
- }
- else {
- return $video->dimensions;
- }
- }
-
- /**
- * Load a file based on the file id ($fid)
- *
- * @param $fid
- * Integer of the file id to be loaded.
- */
- public function load_video($fid) {
- $result = db_query('SELECT f.*, vf.vid, vf.nid, vf.dimensions, vf.status as video_status FROM {video_files} vf LEFT JOIN {files} f ON vf.fid = f.fid WHERE f.fid=vf.fid AND f.fid = %d', $fid);
- return db_fetch_object($result);
- }
-
- /**
- * Load a converted video based on the file id ($fid)
- *
- * @todo: Need to figure something out here for multiple files (HTML 5)
- * @param $fid
- * Integer of the file id to be loaded.
- */
- public function load_converted_video($fid) {
- $result = db_query('SELECT * FROM {video_files} WHERE fid = %d', $fid);
- return db_fetch_object($result);
- }
-
- /**
- * Change the status of the file.
- *
- * @param (int) $vid
- * @param (int) $status
- */
- public function change_status($vid, $status) {
- $result = db_query('UPDATE {video_files} SET status = %d WHERE vid = %d ', $status, $vid);
- }
-}
-?> \ No newline at end of file
diff --git a/includes/metadata.inc b/includes/metadata.inc
deleted file mode 100644
index 905a7fa..0000000
--- a/includes/metadata.inc
+++ /dev/null
@@ -1,57 +0,0 @@
-<?php
-//$Id$
-/*
- * @file
- * Class file used to store metadata on the video.
- *
- */
-
-class video_metadata {
- protected $params = array();
- protected $nice = 'nice -n 19';
- protected $meta_command = '-UP';
- protected $meta_command_path = '/usr/bin/flvtool2';
-
- public function __construct() {
- $this->params['cmd_path'] = variable_get('video_metadata_path', $this->meta_command_path);
- }
-
- public function run_command($options) {
- $command = $this->nice .' '. $this->params['cmd_path'].' '.$options.' 2>&1';
- watchdog('video_metadata', 'Executing command: '. $command, array(), WATCHDOG_DEBUG);
- ob_start();
- passthru($command, $command_return);
- $output = ob_get_contents();
- ob_end_clean();
- return $output;
- }
-
- public function process($video) {
- $command_output = $this->run_command($this->meta_command .' '. $video);
- return $command_output;
- }
-
-
- public function admin_settings() {
- $form = array();
- $form['video_metadata'] = array(
- '#type' => 'checkbox',
- '#title' => t('Enable Metadata'),
- '#default_value' => variable_get('video_metadata', FALSE),
- '#description' => t('Enables metadata for videos by using flvtool2. It cuts FLV files and adds cue Points (onCuePoint). If you are converting your files to FLV then this is highly recommended.'),
- );
- $form['video_metadata_path'] = array(
- '#type' => 'textfield',
- '#title' => t('Path to FLVTool2'),
- '#description' => t('Absolute path to flvtool2.'),
- '#default_value' => variable_get('video_metadata_path', $this->meta_command_path),
- );
- $form['video_metadata_dimensions'] = array(
- '#type' => 'textarea',
- '#title' => t('Selectable Dimensions when uploading videos.'),
- '#description' => t('Enter one dimension per line as Video Resolutions. Each resolution must be in the form of WxH where W=Width and H=Height in pixels. Example dimensions are 1280x720.'),
- '#default_value' => variable_get("video_metadata_dimensions", video_default_dimensions()),
- );
- return $form;
- }
-} \ No newline at end of file
diff --git a/includes/transcoder.inc b/includes/transcoder.inc
deleted file mode 100644
index 96b9f57..0000000
--- a/includes/transcoder.inc
+++ /dev/null
@@ -1,96 +0,0 @@
-<?php
-//$Id$
-/*
- * @file
- * Class file used to wrap the transcoder functions.
- *
- * @todo need more commenting
- */
-
-class video_transcoder {
- private $transcoder;
-
- public function __construct() {
- //get our configured transcoder.
- $transcoder = variable_get('vid_convertor', 'video_ffmpeg');
- module_load_include('inc', 'video', '/transcoders/' . $transcoder);
- if(class_exists($transcoder)) {
- $this->transcoder = new $transcoder;
- }
- else {
- drupal_set_message(t('The transcoder is not configured properly.'), 'error');
- }
- }
-
- public function generate_thumbnails($video) {
- return $this->transcoder->generate_thumbnails($video);
- }
-
- public function convert_video($video, $converted, $dimensions) {
- $output = $this->transcoder->convert_video($video, $converted, $dimensions);
- // If they are using metadata.
- if (variable_get('video_metadata', FALSE)) {
- module_load_include('inc', 'video', '/includes/metadata');
- $metadata = new video_metadata;
- $metadata->process($converted);
- }
- return $output;
- }
-
- public function admin_settings() {
- $form = array();
- $options = $this->_transcoders();
- $form['vid_convertor'] = array(
- '#type' => 'radios',
- '#title' => t('Video transcoder'),
- '#default_value' => variable_get('vid_convertor', 'video_ffmpeg'),
- '#options' => $options['radios'],
- '#description' => t('Selecting a video transcoder will help you convert videos and generate thumbnails. !list', array('!list' => theme('item_list', $options['help']))),
- '#prefix' => '<div id="transcoder-radios">',
- '#suffix' => '</div>',
- );
- $form = $form + $options['admin_settings'];
- return $form;
- }
-
- private function _transcoders() {
- // Lets find our transcoder classes and build our radio options
- // We do this by scanning our transcoders folder
- $form = array('radios' => array(), 'help' => array(), 'admin_settings' => array());
- $path = drupal_get_path('module', 'video') .'/transcoders';
- $files = file_scan_directory($path, '^.*\.inc$');
- foreach($files as $file) {
- module_load_include('inc', 'video', '/transcoders/' . $file->name);
- $focus = new $file->name;
- $form['radios'][$focus->get_value()] = $focus->get_name();
- $form['help'][] = $focus->get_help();
- $form['admin_settings'] = $form['admin_settings'] + $focus->admin_settings();
- }
- //we need to move our video/thumbnail fieldsets to the bottom of our form as they are used for each trancoder
- $autothumb = $form['admin_settings']['autothumb'];
- $autoconv = $form['admin_settings']['autoconv'];
- unset($form['admin_settings']['autothumb'], $form['admin_settings']['autoconv']);
- $form['admin_settings']['autothumb'] = $autothumb;
- $form['admin_settings']['autoconv'] = $autoconv;
- return $form;
- }
-
- public function get_dimensions($video) {
- return $this->transcoder->get_dimensions($video);
- }
-
- public function video_converted_extension() {
- return $this->transcoder->video_converted_extension();
- }
-}
-
-interface transcoder_interface {
- public function run_command($command);
- public function generate_thumbnails($video);
- public function convert_video($video, $converted, $dimensions);
- public function get_playtime($video);
- public function get_name();
- public function get_value();
- public function get_help();
- public function admin_settings();
-} \ No newline at end of file
diff --git a/includes/video_helper.inc b/includes/video_helper.inc
deleted file mode 100644
index 3eaa5d1..0000000
--- a/includes/video_helper.inc
+++ /dev/null
@@ -1,116 +0,0 @@
-<?php
-//$Id$
-/*
- * @file
- * Class file used to create our video and thumbnail objects.
- *
- */
-
-class video_helper {
-
- public function video_object($element) {
- $field = content_fields($element['#field_name'], $element['#type_name']);
- //setup our width x height
- $dimensions = explode("x", $element['#item']['data']['dimensions']);
- $player_dimensions = explode("x", $element['#item']['data']['player_dimensions']);
- if(!isset($dimensions[0]) || !isset($dimensions[1])) {
- $dimensions = explode("x", $field['widget']['default_dimensions']);
- if(!isset($dimensions[0]) || !isset($dimensions[1])) {
- drupal_set_message(t('Something is wrong with your dimensions. Make sure you enter dimensions in the form of WxH.'), 'error');
- }
- }
- if(!isset($player_dimensions[0]) || !isset($player_dimensions[1])) {
- $player_dimensions = explode("x", $field['widget']['default_player_dimensions']);
- if(!isset($player_dimensions[0]) || !isset($player_dimensions[1])) {
- drupal_set_message(t('Something is wrong with your player dimensions. Make sure you enter the player dimensions in the form of WxH.'), 'error');
- }
- }
-
- // Build our video object for all types.
- $video = new stdClass();
- $video->fid = $element['#item']['fid'];
- $video->original = $element['#item'];
- $video->filepath = $element['#item']['filepath'];
- $video->url = file_create_url($element['#item']['filepath']);
- $video->extension = pathinfo($element['#item']['filename'], PATHINFO_EXTENSION);
- $video->width = trim($dimensions[0]);
- $video->height = trim($dimensions[1]);
- $video->player_width = trim($player_dimensions[0]);
- $video->player_height = trim($player_dimensions[1]);
- $video->thumbnail = $this->thumbnail_object($element);
- $video->formatter = $element['#formatter'];
- $video->autoplay = variable_get('video_autoplay', TRUE);
- $video->autobuffering = variable_get('video_autobuffering', TRUE);
- $video->theora_player = variable_get('video_ogg_player', 'http://theora.org/cortado.jar');
-
- // TODO : add hook_video_load API to load videos
- // Lets find out if we have pushed this file to the cdn if enabled.
- $cdn = false;
- if(variable_get('amazon_s3', FALSE)) {
- module_load_include('inc', 'video_s3', '/includes/amazon_s3');
- $s3 = new video_amazon_s3;
- if($amazon = $s3->get($video->fid)) {
- $cdn = true;
- // Fix our filepath
- $video->filepath = $amazon->filepath;
- $video->url = $amazon->filepath;
- $video->extension = pathinfo($amazon->filepath, PATHINFO_EXTENSION);
- }
- }
- // If no cdn, lets find out if we have transcoded this file and update our paths.
- if(!$cdn) {
- //lets find out if we are overriding this video with a converted one.
- if (isset($field['widget']['autoconversion']) && $field['widget']['autoconversion'] && !$element['#item']['data']['bypass_autoconversion']) {
- module_load_include('inc', 'video', '/includes/conversion');
- $conversion = new video_conversion;
- $converted = $conversion->load_converted_video($video->fid);
- $video->filepath = $converted->filepath;
- $video->url = file_create_url($converted->filepath);
- $video->extension = pathinfo($converted->filepath, PATHINFO_EXTENSION);
- }
- }
- // Moved to last to recheck incase we changed our extension above.
- $video->flash_player = variable_get('video_extension_'.$video->extension.'_flash_player', '');
-
- // Return our object
- return $video;
- }
-
- public function thumbnail_object($element) {
- $field = content_fields($element['#field_name'], $element['#type_name']);
- // Build our thumbnail object
- $thumbnail = new stdClass();
- $thumbnail->filepath = '';
- $thumbnail->url = '';
- //@todo future enhancements for our thumbnails
- $thumbnail->alt = '';
- $thumbnail->title = '';
- $thumbnail->description = '';
-
- // Setup our thumbnail path.
- $use_default_img = $element['#item']['data']['use_default_video_thumb'];
- if ($use_default_img && !empty($field['widget']['default_video_thumb']['filepath'])) {
- $thumbnail->filepath = $field['widget']['default_video_thumb']['filepath'];
- }
- elseif ($element['#item']['data']['video_thumb']) {
- $thumbnail->filepath = $element['#item']['data']['video_thumb'];
- }
- else {
- //need some type of default if nothing is present
- //drupal_set_message(t('No thumbnail has been configured for the video.'), 'error');
- }
- //lets check for an imagecache preset
- if (isset($element['imagecache_preset'])) {
- $thumbnail->url = imagecache_create_url($element['imagecache_preset'], $thumbnail->filepath);
- $thumbnail->filepath = imagecache_create_path($element['imagecache_preset'], $thumbnail->filepath);
- } else {
- $thumbnail->url = file_create_url($thumbnail->filepath);
- }
-
- //swftools appends sites/default/files to the front of our path...
- //@todo Is this a setting? Need to figure this out.
- $thumbnail->swfthumb = $thumbnail->filepath;
- // Return our object
- return $thumbnail;
- }
-} \ No newline at end of file
diff --git a/js/flowplayer-3.2.0.min.js b/js/flowplayer-3.2.0.min.js
deleted file mode 100644
index 2baa001..0000000
--- a/js/flowplayer-3.2.0.min.js
+++ /dev/null
@@ -1,24 +0,0 @@
-/*
- * flowplayer.js 3.2.0. The Flowplayer API
- *
- * Copyright 2009 Flowplayer Oy
- *
- * This file is part of Flowplayer.
- *
- * Flowplayer is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * Flowplayer is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with Flowplayer. If not, see <http://www.gnu.org/licenses/>.
- *
- * Date: 2010-05-03 20:23:59 +0000 (Mon, 03 May 2010)
- * Revision: 468
- */
-(function(){function g(o){console.log("$f.fireEvent",[].slice.call(o))}function k(q){if(!q||typeof q!="object"){return q}var o=new q.constructor();for(var p in q){if(q.hasOwnProperty(p)){o[p]=k(q[p])}}return o}function m(t,q){if(!t){return}var o,p=0,r=t.length;if(r===undefined){for(o in t){if(q.call(t[o],o,t[o])===false){break}}}else{for(var s=t[0];p<r&&q.call(s,p,s)!==false;s=t[++p]){}}return t}function c(o){return document.getElementById(o)}function i(q,p,o){if(typeof p!="object"){return q}if(q&&p){m(p,function(r,s){if(!o||typeof s!="function"){q[r]=s}})}return q}function n(s){var q=s.indexOf(".");if(q!=-1){var p=s.slice(0,q)||"*";var o=s.slice(q+1,s.length);var r=[];m(document.getElementsByTagName(p),function(){if(this.className&&this.className.indexOf(o)!=-1){r.push(this)}});return r}}function f(o){o=o||window.event;if(o.preventDefault){o.stopPropagation();o.preventDefault()}else{o.returnValue=false;o.cancelBubble=true}return false}function j(q,o,p){q[o]=q[o]||[];q[o].push(p)}function e(){return"_"+(""+Math.random()).slice(2,10)}var h=function(t,r,s){var q=this,p={},u={};q.index=r;if(typeof t=="string"){t={url:t}}i(this,t,true);m(("Begin*,Start,Pause*,Resume*,Seek*,Stop*,Finish*,LastSecond,Update,BufferFull,BufferEmpty,BufferStop").split(","),function(){var v="on"+this;if(v.indexOf("*")!=-1){v=v.slice(0,v.length-1);var w="onBefore"+v.slice(2);q[w]=function(x){j(u,w,x);return q}}q[v]=function(x){j(u,v,x);return q};if(r==-1){if(q[w]){s[w]=q[w]}if(q[v]){s[v]=q[v]}}});i(this,{onCuepoint:function(x,w){if(arguments.length==1){p.embedded=[null,x];return q}if(typeof x=="number"){x=[x]}var v=e();p[v]=[x,w];if(s.isLoaded()){s._api().fp_addCuepoints(x,r,v)}return q},update:function(w){i(q,w);if(s.isLoaded()){s._api().fp_updateClip(w,r)}var v=s.getConfig();var x=(r==-1)?v.clip:v.playlist[r];i(x,w,true)},_fireEvent:function(v,y,w,A){if(v=="onLoad"){m(p,function(B,C){if(C[0]){s._api().fp_addCuepoints(C[0],r,B)}});return false}A=A||q;if(v=="onCuepoint"){var z=p[y];if(z){return z[1].call(s,A,w)}}if(y&&"onBeforeBegin,onMetaData,onStart,onUpdate,onResume".indexOf(v)!=-1){i(A,y);if(y.metaData){if(!A.duration){A.duration=y.metaData.duration}else{A.fullDuration=y.metaData.duration}}}var x=true;m(u[v],function(){x=this.call(s,A,y,w)});return x}});if(t.onCuepoint){var o=t.onCuepoint;q.onCuepoint.apply(q,typeof o=="function"?[o]:o);delete t.onCuepoint}m(t,function(v,w){if(typeof w=="function"){j(u,v,w);delete t[v]}});if(r==-1){s.onCuepoint=this.onCuepoint}};var l=function(p,r,q,t){var o=this,s={},u=false;if(t){i(s,t)}m(r,function(v,w){if(typeof w=="function"){s[v]=w;delete r[v]}});i(this,{animate:function(y,z,x){if(!y){return o}if(typeof z=="function"){x=z;z=500}if(typeof y=="string"){var w=y;y={};y[w]=z;z=500}if(x){var v=e();s[v]=x}if(z===undefined){z=500}r=q._api().fp_animate(p,y,z,v);return o},css:function(w,x){if(x!==undefined){var v={};v[w]=x;w=v}r=q._api().fp_css(p,w);i(o,r);return o},show:function(){this.display="block";q._api().fp_showPlugin(p);return o},hide:function(){this.display="none";q._api().fp_hidePlugin(p);return o},toggle:function(){this.display=q._api().fp_togglePlugin(p);return o},fadeTo:function(y,x,w){if(typeof x=="function"){w=x;x=500}if(w){var v=e();s[v]=w}this.display=q._api().fp_fadeTo(p,y,x,v);this.opacity=y;return o},fadeIn:function(w,v){return o.fadeTo(1,w,v)},fadeOut:function(w,v){return o.fadeTo(0,w,v)},getName:function(){return p},getPlayer:function(){return q},_fireEvent:function(w,v,x){if(w=="onUpdate"){var y=q._api().fp_getPlugin(p);if(!y){return}i(o,y);delete o.methods;if(!u){m(y.methods,function(){var A=""+this;o[A]=function(){var B=[].slice.call(arguments);var C=q._api().fp_invoke(p,A,B);return C==="undefined"||C===undefined?o:C}});u=true}}var z=s[w];if(z){z.apply(o,v);if(w.slice(0,1)=="_"){delete s[w]}}return o}})};function b(q,G,t){var w=this,v=null,D=false,u,s,F=[],y={},x={},E,r,p,C,o,A;i(w,{id:function(){return E},isLoaded:function(){return(v!==null&&!D)},getParent:function(){return q},hide:function(H){if(H){q.style.height="0px"}if(w.isLoaded()){v.style.height="0px"}return w},show:function(){q.style.height=A+"px";if(w.isLoaded()){v.style.height=o+"px"}return w},isHidden:function(){return w.isLoaded()&&parseInt(v.style.height,10)===0},load:function(J){if(!w.isLoaded()&&w._fireEvent("onBeforeLoad")!==false){var H=function(){u=q.innerHTML;if(u&&!flashembed.isSupported(G.version)){q.innerHTML=""}flashembed(q,G,{config:t});if(J){J.cached=true;j(x,"onLoad",J)}};var I=0;m(a,function(){this.unload(function(K){if(++I==a.length){H()}})})}return w},unload:function(J){if(this.isFullscreen()&&/WebKit/i.test(navigator.userAgent)){if(J){J(false)}return w}if(u.replace(/\s/g,"")!==""){if(w._fireEvent("onBeforeUnload")===false){if(J){J(false)}return w}D=true;try{if(v){v.fp_close();w._fireEvent("onUnload")}}catch(H){}var I=function(){v=null;q.innerHTML=u;D=false;if(J){J(true)}};setTimeout(I,50)}else{if(J){J(false)}}return w},getClip:function(H){if(H===undefined){H=C}return F[H]},getCommonClip:function(){return s},getPlaylist:function(){return F},getPlugin:function(H){var J=y[H];if(!J&&w.isLoaded()){var I=w._api().fp_getPlugin(H);if(I){J=new l(H,I,w);y[H]=J}}return J},getScreen:function(){return w.getPlugin("screen")},getControls:function(){return w.getPlugin("controls")._fireEvent("onUpdate")},getLogo:function(){try{return w.getPlugin("logo")._fireEvent("onUpdate")}catch(H){}},getPlay:function(){return w.getPlugin("play")._fireEvent("onUpdate")},getConfig:function(H){return H?k(t):t},getFlashParams:function(){return G},loadPlugin:function(K,J,M,L){if(typeof M=="function"){L=M;M={}}var I=L?e():"_";w._api().fp_loadPlugin(K,J,M,I);var H={};H[I]=L;var N=new l(K,null,w,H);y[K]=N;return N},getState:function(){return w.isLoaded()?v.fp_getState():-1},play:function(I,H){var J=function(){if(I!==undefined){w._api().fp_play(I,H)}else{w._api().fp_play()}};if(w.isLoaded()){J()}else{if(D){setTimeout(function(){w.play(I,H)},50)}else{w.load(function(){J()})}}return w},getVersion:function(){var I="flowplayer.js 3.2.0";if(w.isLoaded()){var H=v.fp_getVersion();H.push(I);return H}return I},_api:function(){if(!w.isLoaded()){throw"Flowplayer "+w.id()+" not loaded when calling an API method"}return v},setClip:function(H){w.setPlaylist([H]);return w},getIndex:function(){return p}});m(("Click*,Load*,Unload*,Keypress*,Volume*,Mute*,Unmute*,PlaylistReplace,ClipAdd,Fullscreen*,FullscreenExit,Error,MouseOver,MouseOut").split(","),function(){var H="on"+this;if(H.indexOf("*")!=-1){H=H.slice(0,H.length-1);var I="onBefore"+H.slice(2);w[I]=function(J){j(x,I,J);return w}}w[H]=function(J){j(x,H,J);return w}});m(("pause,resume,mute,unmute,stop,toggle,seek,getStatus,getVolume,setVolume,getTime,isPaused,isPlaying,startBuffering,stopBuffering,isFullscreen,toggleFullscreen,reset,close,setPlaylist,addClip,playFeed,setKeyboardShortcutsEnabled,isKeyboardShortcutsEnabled").split(","),function(){var H=this;w[H]=function(J,I){if(!w.isLoaded()){return w}var K=null;if(J!==undefined&&I!==undefined){K=v["fp_"+H](J,I)}else{K=(J===undefined)?v["fp_"+H]():v["fp_"+H](J)}return K==="undefined"||K===undefined?w:K}});w._fireEvent=function(Q){if(typeof Q=="string"){Q=[Q]}var R=Q[0],O=Q[1],M=Q[2],L=Q[3],K=0;if(t.debug){g(Q)}if(!w.isLoaded()&&R=="onLoad"&&O=="player"){v=v||c(r);o=v.clientHeight;m(F,function(){this._fireEvent("onLoad")});m(y,function(S,T){T._fireEvent("onUpdate")});s._fireEvent("onLoad")}if(R=="onLoad"&&O!="player"){return}if(R=="onError"){if(typeof O=="string"||(typeof O=="number"&&typeof M=="number")){O=M;M=L}}if(R=="onContextMenu"){m(t.contextMenu[O],function(S,T){T.call(w)});return}if(R=="onPluginEvent"){var H=O.name||O;var I=y[H];if(I){I._fireEvent("onUpdate",O);I._fireEvent(M,Q.slice(3))}return}if(R=="onPlaylistReplace"){F=[];var N=0;m(O,function(){F.push(new h(this,N++,w))})}if(R=="onClipAdd"){if(O.isInStream){return}O=new h(O,M,w);F.splice(M,0,O);for(K=M+1;K<F.length;K++){F[K].index++}}var P=true;if(typeof O=="number"&&O<F.length){C=O;var J=F[O];if(J){P=J._fireEvent(R,M,L)}if(!J||P!==false){P=s._fireEvent(R,M,L,J)}}m(x[R],function(){P=this.call(w,O,M);if(this.cached){x[R].splice(K,1)}if(P===false){return false}K++});return P};function B(){if($f(q)){$f(q).getParent().innerHTML="";p=$f(q).getIndex();a[p]=w}else{a.push(w);p=a.length-1}A=parseInt(q.style.height,10)||q.clientHeight;E=q.id||"fp"+e();r=G.id||E+"_api";G.id=r;t.playerId=E;if(typeof t=="string"){t={clip:{url:t}}}if(typeof t.clip=="string"){t.clip={url:t.clip}}t.clip=t.clip||{};if(q.getAttribute("href",2)&&!t.clip.url){t.clip.url=q.getAttribute("href",2)}s=new h(t.clip,-1,w);t.playlist=t.playlist||[t.clip];var H=0;m(t.playlist,function(){var J=this;if(typeof J=="object"&&J.length){J={url:""+J}}m(t.clip,function(K,L){if(L!==undefined&&J[K]===undefined&&typeof L!="function"){J[K]=L}});t.playlist[H]=J;J=new h(J,H,w);F.push(J);H++});m(t,function(J,K){if(typeof K=="function"){if(s[J]){s[J](K)}else{j(x,J,K)}delete t[J]}});m(t.plugins,function(J,K){if(K){y[J]=new l(J,K,w)}});if(!t.plugins||t.plugins.controls===undefined){y.controls=new l("controls",null,w)}y.canvas=new l("canvas",null,w);function I(J){if(!w.isLoaded()&&w._fireEvent("onBeforeClick")!==false){w.load()}return f(J)}u=q.innerHTML;if(u.replace(/\s/g,"")!==""){if(q.addEventListener){q.addEventListener("click",I,false)}else{if(q.attachEvent){q.attachEvent("onclick",I)}}}else{if(q.addEventListener){q.addEventListener("click",f,false)}w.load()}}if(typeof q=="string"){var z=c(q);if(!z){throw"Flowplayer cannot access element: "+q}else{q=z;B()}}else{B()}}var a=[];function d(o){this.length=o.length;this.each=function(p){m(o,p)};this.size=function(){return o.length}}window.flowplayer=window.$f=function(){var p=null;var o=arguments[0];if(!arguments.length){m(a,function(){if(this.isLoaded()){p=this;return false}});return p||a[0]}if(arguments.length==1){if(typeof o=="number"){return a[o]}else{if(o=="*"){return new d(a)}m(a,function(){if(this.id()==o.id||this.id()==o||this.getParent()==o){p=this;return false}});return p}}if(arguments.length>1){var t=arguments[1],q=(arguments.length==3)?arguments[2]:{};if(typeof t=="string"){t={src:t}}t=i({bgcolor:"#000000",version:[9,0],expressInstall:"http://static.flowplayer.org/swf/expressinstall.swf",cachebusting:true},t);if(typeof o=="string"){if(o.indexOf(".")!=-1){var s=[];m(n(o),function(){s.push(new b(this,k(t),k(q)))});return new d(s)}else{var r=c(o);return new b(r!==null?r:o,t,q)}}else{if(o){return new b(o,t,q)}}}return null};i(window.$f,{fireEvent:function(){var o=[].slice.call(arguments);var q=$f(o[0]);return q?q._fireEvent(o.slice(1)):null},addPlugin:function(o,p){b.prototype[o]=p;return $f},each:m,extend:i});if(typeof jQuery=="function"){jQuery.fn.flowplayer=function(q,p){if(!arguments.length||typeof arguments[0]=="number"){var o=[];this.each(function(){var r=$f(this);if(r){o.push(r)}});return arguments.length?o[arguments[0]]:new d(o)}return this.each(function(){$f(this,k(q),p?k(p):{})})}}})();(function(){var h=document.all,j="http://www.adobe.com/go/getflashplayer",c=typeof jQuery=="function",e=/(\d+)[^\d]+(\d+)[^\d]*(\d*)/,b={width:"100%",height:"100%",id:"_"+(""+Math.random()).slice(9),allowfullscreen:true,allowscriptaccess:"always",quality:"high",version:[3,0],onFail:null,expressInstall:null,w3c:false,cachebusting:false};if(window.attachEvent){window.attachEvent("onbeforeunload",function(){__flash_unloadHandler=function(){};__flash_savedUnloadHandler=function(){}})}function i(l,f){if(f){for(key in f){if(f.hasOwnProperty(key)){l[key]=f[key]}}}return l}function a(f,n){var m=[];for(var l in f){if(f.hasOwnProperty(l)){m[l]=n(f[l])}}return m}window.flashembed=function(f,m,l){if(typeof f=="string"){f=document.getElementById(f.replace("#",""))}if(!f){return}if(typeof m=="string"){m={src:m}}return new d(f,i(i({},b),m),l)};var g=i(window.flashembed,{conf:b,getVersion:function(){var f;try{f=navigator.plugins["Shockwave Flash"].description.slice(16)}catch(n){try{var l=new ActiveXObject("ShockwaveFlash.ShockwaveFlash.7");f=l&&l.GetVariable("$version")}catch(m){}}f=e.exec(f);return[f[1],f[3]]},asString:function(l){if(l===null||l===undefined){return null}var f=typeof l;if(f=="object"&&l.push){f="array"}switch(f){case"string":l=l.replace(new RegExp('(["\\\\])',"g"),"\\$1");l=l.replace(/^\s?(\d+\.?\d+)%/,"$1pct");return'"'+l+'"';case"array":return"["+a(l,function(o){return g.asString(o)}).join(",")+"]";case"function":return'"function()"';case"object":var m=[];for(var n in l){if(l.hasOwnProperty(n)){m.push('"'+n+'":'+g.asString(l[n]))}}return"{"+m.join(",")+"}"}return String(l).replace(/\s/g," ").replace(/\'/g,'"')},getHTML:function(o,l){o=i({},o);var n='<object width="'+o.width+'" height="'+o.height+'" id="'+o.id+'"" name="'+o.id+'"';if(o.cachebusting){o.src+=((o.src.indexOf("?")!=-1?"&":"?")+Math.random())}if(o.w3c||!h){n+=' data="'+o.src+'" type="application/x-shockwave-flash"'}else{n+=' classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"'}n+=">";if(o.w3c||h){n+='<param name="movie" value="'+o.src+'" />'}o.width=o.height=o.id=o.w3c=o.src=null;o.onFail=o.version=o.expressInstall=null;for(var m in o){if(o[m]){n+='<param name="'+m+'" value="'+o[m]+'" />'}}var p="";if(l){for(var f in l){if(l[f]){var q=l[f];p+=f+"="+(/function|object/.test(typeof q)?g.asString(q):q)+"&"}}p=p.slice(0,-1);n+='<param name="flashvars" value=\''+p+"' />"}n+="</object>";return n},isSupported:function(f){return k[0]>f[0]||k[0]==f[0]&&k[1]>=f[1]}});var k=g.getVersion();function d(f,n,m){if(g.isSupported(n.version)){f.innerHTML=g.getHTML(n,m)}else{if(n.expressInstall&&g.isSupported([6,65])){f.innerHTML=g.getHTML(i(n,{src:n.expressInstall}),{MMredirectURL:location.href,MMplayerType:"PlugIn",MMdoctitle:document.title})}else{if(!f.innerHTML.replace(/\s/g,"")){f.innerHTML="<h2>Flash version "+n.version+" or greater is required</h2><h3>"+(k[0]>0?"Your version is "+k:"You have no flash plugin installed")+"</h3>"+(f.tagName=="A"?"<p>Click here to download latest version</p>":"<p>Download latest version from <a href='"+j+"'>here</a></p>");if(f.tagName=="A"){f.onclick=function(){location.href=j}}}if(n.onFail){var l=n.onFail.call(this);if(typeof l=="string"){f.innerHTML=l}}}}if(h){window[n.id]=document.getElementById(n.id)}i(this,{getRoot:function(){return f},getOptions:function(){return n},getConf:function(){return m},getApi:function(){return f.firstChild}})}if(c){jQuery.tools=jQuery.tools||{version:"3.2.0"};jQuery.tools.flashembed={conf:b};jQuery.fn.flashembed=function(l,f){return this.each(function(){$(this).data("flashembed",flashembed(this,l,f))})}}})(); \ No newline at end of file
diff --git a/js/jquery.media.js b/js/jquery.media.js
deleted file mode 100644
index dcffa3c..0000000
--- a/js/jquery.media.js
+++ /dev/null
@@ -1,458 +0,0 @@
-/*
- * jQuery Media Plugin for converting elements into rich media content.
- *
- * Examples and documentation at: http://malsup.com/jquery/media/
- * Copyright (c) 2007-2008 M. Alsup
- * Dual licensed under the MIT and GPL licenses:
- * http://www.opensource.org/licenses/mit-license.php
- * http://www.gnu.org/licenses/gpl.html
- *
- * @author: M. Alsup
- * @version: 0.92 (24-SEP-2009)
- * @requires jQuery v1.1.2 or later
- * $Id$
- *
- * Supported Media Players:
- * - Flash
- * - Quicktime
- * - Real Player
- * - Silverlight
- * - Windows Media Player
- * - iframe
- *
- * Supported Media Formats:
- * Any types supported by the above players, such as:
- * Video: asf, avi, flv, mov, mpg, mpeg, mp4, qt, smil, swf, wmv, 3g2, 3gp
- * Audio: aif, aac, au, gsm, mid, midi, mov, mp3, m4a, snd, rm, wav, wma
- * Other: bmp, html, pdf, psd, qif, qtif, qti, tif, tiff, xaml
- *
- * Thanks to Mark Hicken and Brent Pedersen for helping me debug this on the Mac!
- * Thanks to Dan Rossi for numerous bug reports and code bits!
- * Thanks to Skye Giordano for several great suggestions!
- * Thanks to Richard Connamacher for excellent improvements to the non-IE behavior!
- */
-;(function($) {
-
-/**
- * Chainable method for converting elements into rich media.
- *
- * @param options
- * @param callback fn invoked for each matched element before conversion
- * @param callback fn invoked for each matched element after conversion
- */
-$.fn.media = function(options, f1, f2) {
- if (options == 'undo') {
- return this.each(function() {
- var $this = $(this);
- var html = $this.data('media.origHTML');
- if (html)
- $this.replaceWith(html);
- });
- }
-
- return this.each(function() {
- if (typeof options == 'function') {
- f2 = f1;
- f1 = options;
- options = {};
- }
- var o = getSettings(this, options);
- // pre-conversion callback, passes original element and fully populated options
- if (typeof f1 == 'function') f1(this, o);
-
- var r = getTypesRegExp();
- var m = r.exec(o.src.toLowerCase()) || [''];
-
- o.type ? m[0] = o.type : m.shift();
- for (var i=0; i < m.length; i++) {
- fn = m[i].toLowerCase();
- if (isDigit(fn[0])) fn = 'fn' + fn; // fns can't begin with numbers
- if (!$.fn.media[fn])
- continue; // unrecognized media type
- // normalize autoplay settings
- var player = $.fn.media[fn+'_player'];
- if (!o.params) o.params = {};
- if (player) {
- var num = player.autoplayAttr == 'autostart';
- o.params[player.autoplayAttr || 'autoplay'] = num ? (o.autoplay ? 1 : 0) : o.autoplay ? true : false;
- }
- var $div = $.fn.media[fn](this, o);
-
- $div.css('backgroundColor', o.bgColor).width(o.width);
-
- if (o.canUndo) {
- var $temp = $('<div></div>').append(this);
- $div.data('media.origHTML', $temp.html()); // store original markup
- }
-
- // post-conversion callback, passes original element, new div element and fully populated options
- if (typeof f2 == 'function') f2(this, $div[0], o, player.name);
- break;
- }
- });
-};
-
-/**
- * Non-chainable method for adding or changing file format / player mapping
- * @name mapFormat
- * @param String format File format extension (ie: mov, wav, mp3)
- * @param String player Player name to use for the format (one of: flash, quicktime, realplayer, winmedia, silverlight or iframe
- */
-$.fn.media.mapFormat = function(format, player) {
- if (!format || !player || !$.fn.media.defaults.players[player]) return; // invalid
- format = format.toLowerCase();
- if (isDigit(format[0])) format = 'fn' + format;
- $.fn.media[format] = $.fn.media[player];
- $.fn.media[format+'_player'] = $.fn.media.defaults.players[player];
-};
-
-// global defautls; override as needed
-$.fn.media.defaults = {
- standards: false, // use object tags only (no embeds for non-IE browsers)
- canUndo: true, // tells plugin to store the original markup so it can be reverted via: $(sel).mediaUndo()
- width: 400,
- height: 400,
- autoplay: 0, // normalized cross-player setting
- bgColor: '#ffffff', // background color
- params: { wmode: 'transparent'}, // added to object element as param elements; added to embed element as attrs
- attrs: {}, // added to object and embed elements as attrs
- flvKeyName: 'file', // key used for object src param (thanks to Andrea Ercolino)
- flashvars: {}, // added to flash content as flashvars param/attr
- flashVersion: '7', // required flash version
- expressInstaller: null, // src for express installer
-
- // default flash video and mp3 player (@see: http://jeroenwijering.com/?item=Flash_Media_Player)
- flvPlayer: 'mediaplayer.swf',
- mp3Player: 'mediaplayer.swf',
-
- // @see http://msdn2.microsoft.com/en-us/library/bb412401.aspx
- silverlight: {
- inplaceInstallPrompt: 'true', // display in-place install prompt?
- isWindowless: 'true', // windowless mode (false for wrapping markup)
- framerate: '24', // maximum framerate
- version: '0.9', // Silverlight version
- onError: null, // onError callback
- onLoad: null, // onLoad callback
- initParams: null, // object init params
- userContext: null // callback arg passed to the load callback
- }
-};
-
-// Media Players; think twice before overriding
-$.fn.media.defaults.players = {
- flash: {
- name: 'flash',
- title: 'Flash',
- types: 'flv,mp3,swf',
- mimetype: 'application/x-shockwave-flash',
- pluginspage: 'http://www.adobe.com/go/getflashplayer',
- ieAttrs: {
- classid: 'clsid:d27cdb6e-ae6d-11cf-96b8-444553540000',
- type: 'application/x-oleobject',
- codebase: 'http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=' + $.fn.media.defaults.flashVersion
- }
- },
- quicktime: {
- name: 'quicktime',
- title: 'QuickTime',
- mimetype: 'video/quicktime',
- pluginspage: 'http://www.apple.com/quicktime/download/',
- types: 'aif,aiff,aac,au,bmp,gsm,mov,mid,midi,mpg,mpeg,mp4,m4a,psd,qt,qtif,qif,qti,snd,tif,tiff,wav,3g2,3gp',
- ieAttrs: {
- classid: 'clsid:02BF25D5-8C17-4B23-BC80-D3488ABDDC6B',
- codebase: 'http://www.apple.com/qtactivex/qtplugin.cab'
- }
- },
- realplayer: {
- name: 'real',
- title: 'RealPlayer',
- types: 'ra,ram,rm,rpm,rv,smi,smil',
- mimetype: 'audio/x-pn-realaudio-plugin',
- pluginspage: 'http://www.real.com/player/',
- autoplayAttr: 'autostart',
- ieAttrs: {
- classid: 'clsid:CFCDAA03-8BE4-11cf-B84B-0020AFBBCCFA'
- }
- },
- winmedia: {
- name: 'winmedia',
- title: 'Windows Media',
- types: 'asx,asf,avi,wma,wmv',
- mimetype: $.browser.mozilla && isFirefoxWMPPluginInstalled() ? 'application/x-ms-wmp' : 'application/x-mplayer2',
- pluginspage: 'http://www.microsoft.com/Windows/MediaPlayer/',
- autoplayAttr: 'autostart',
- oUrl: 'url',
- ieAttrs: {
- classid: 'clsid:6BF52A52-394A-11d3-B153-00C04F79FAA6',
- type: 'application/x-oleobject'
- }
- },
- // special cases
- iframe: {
- name: 'iframe',
- types: 'html,pdf'
- },
- silverlight: {
- name: 'silverlight',
- types: 'xaml'
- }
-};
-
-//
-// everything below here is private
-//
-
-
-// detection script for FF WMP plugin (http://www.therossman.org/experiments/wmp_play.html)
-// (hat tip to Mark Ross for this script)
-function isFirefoxWMPPluginInstalled() {
- var plugs = navigator.plugins;
- for (var i = 0; i < plugs.length; i++) {
- var plugin = plugs[i];
- if (plugin['filename'] == 'np-mswmp.dll')
- return true;
- }
- return false;
-}
-
-var counter = 1;
-
-for (var player in $.fn.media.defaults.players) {
- var types = $.fn.media.defaults.players[player].types;
- $.each(types.split(','), function(i,o) {
- if (isDigit(o[0])) o = 'fn' + o;
- $.fn.media[o] = $.fn.media[player] = getGenerator(player);
- $.fn.media[o+'_player'] = $.fn.media.defaults.players[player];
- });
-};
-
-function getTypesRegExp() {
- var types = '';
- for (var player in $.fn.media.defaults.players) {
- if (types.length) types += ',';
- types += $.fn.media.defaults.players[player].types;
- };
- return new RegExp('\\.(' + types.replace(/,/ig,'|') + ')\\b$');
-};
-
-function getGenerator(player) {
- return function(el, options) {
- return generate(el, options, player);
- };
-};
-
-function isDigit(c) {
- return '0123456789'.indexOf(c) > -1;
-};
-
-// flatten all possible options: global defaults, meta, option obj
-function getSettings(el, options) {
- options = options || {};
- var $el = $(el);
- var cls = el.className || '';
- // support metadata plugin (v1.0 and v2.0)
- var meta = $.metadata ? $el.metadata() : $.meta ? $el.data() : {};
- meta = meta || {};
- var w = meta.width || parseInt(((cls.match(/w:(\d+)/)||[])[1]||0));
- var h = meta.height || parseInt(((cls.match(/h:(\d+)/)||[])[1]||0));
-
- if (w) meta.width = w;
- if (h) meta.height = h;
- if (cls) meta.cls = cls;
-
- var a = $.fn.media.defaults;
- var b = options;
- var c = meta;
-
- var p = { params: { bgColor: options.bgColor || $.fn.media.defaults.bgColor } };
- var opts = $.extend({}, a, b, c);
- $.each(['attrs','params','flashvars','silverlight'], function(i,o) {
- opts[o] = $.extend({}, p[o] || {}, a[o] || {}, b[o] || {}, c[o] || {});
- });
-
- if (typeof opts.caption == 'undefined') opts.caption = $el.text();
-
- // make sure we have a source!
- opts.src = opts.src || $el.attr('href') || $el.attr('src') || 'unknown';
- return opts;
-};
-
-//
-// Flash Player
-//
-
-// generate flash using SWFObject library if possible
-$.fn.media.swf = function(el, opts) {
- if (!window.SWFObject && !window.swfobject) {
- // roll our own
- if (opts.flashvars) {
- var a = [];
- for (var f in opts.flashvars)
- a.push(f + '=' + opts.flashvars[f]);
- if (!opts.params) opts.params = {};
- opts.params.flashvars = a.join('&');
- }
- return generate(el, opts, 'flash');
- }
-
- var id = el.id ? (' id="'+el.id+'"') : '';
- var cls = opts.cls ? (' class="' + opts.cls + '"') : '';
- var $div = $('<div' + id + cls + '>');
-
- // swfobject v2+
- if (window.swfobject) {
- $(el).after($div).appendTo($div);
- if (!el.id) el.id = 'movie_player_' + counter++;
-
- // replace el with swfobject content
- swfobject.embedSWF(opts.src, el.id, opts.width, opts.height, opts.flashVersion,
- opts.expressInstaller, opts.flashvars, opts.params, opts.attrs);
- }
- // swfobject < v2
- else {
- $(el).after($div).remove();
- var so = new SWFObject(opts.src, 'movie_player_' + counter++, opts.width, opts.height, opts.flashVersion, opts.bgColor);
- if (opts.expressInstaller) so.useExpressInstall(opts.expressInstaller);
-
- for (var p in opts.params)
- if (p != 'bgColor') so.addParam(p, opts.params[p]);
- for (var f in opts.flashvars)
- so.addVariable(f, opts.flashvars[f]);
- so.write($div[0]);
- }
-
- if (opts.caption) $('<div>').appendTo($div).html(opts.caption);
- return $div;
-};
-
-// map flv and mp3 files to the swf player by default
-$.fn.media.flv = $.fn.media.mp3 = function(el, opts) {
- var src = opts.src;
- var player = /\.mp3\b/i.test(src) ? $.fn.media.defaults.mp3Player : $.fn.media.defaults.flvPlayer;
- var key = opts.flvKeyName;
- src = encodeURIComponent(src);
- opts.src = player;
- opts.src = opts.src + '?'+key+'=' + (src);
- var srcObj = {};
- srcObj[key] = src;
- opts.flashvars = $.extend({}, srcObj, opts.flashvars );
- return $.fn.media.swf(el, opts);
-};
-
-//
-// Silverlight
-//
-$.fn.media.xaml = function(el, opts) {
- if (!window.Sys || !window.Sys.Silverlight) {
- if ($.fn.media.xaml.warning) return;
- $.fn.media.xaml.warning = 1;
- alert('You must include the Silverlight.js script.');
- return;
- }
-
- var props = {
- width: opts.width,
- height: opts.height,
- background: opts.bgColor,
- inplaceInstallPrompt: opts.silverlight.inplaceInstallPrompt,
- isWindowless: opts.silverlight.isWindowless,
- framerate: opts.silverlight.framerate,
- version: opts.silverlight.version
- };
- var events = {
- onError: opts.silverlight.onError,
- onLoad: opts.silverlight.onLoad
- };
-
- var id1 = el.id ? (' id="'+el.id+'"') : '';
- var id2 = opts.id || 'AG' + counter++;
- // convert element to div
- var cls = opts.cls ? (' class="' + opts.cls + '"') : '';
- var $div = $('<div' + id1 + cls + '>');
- $(el).after($div).remove();
-
- Sys.Silverlight.createObjectEx({
- source: opts.src,
- initParams: opts.silverlight.initParams,
- userContext: opts.silverlight.userContext,
- id: id2,
- parentElement: $div[0],
- properties: props,
- events: events
- });
-
- if (opts.caption) $('<div>').appendTo($div).html(opts.caption);
- return $div;
-};
-
-//
-// generate object/embed markup
-//
-function generate(el, opts, player) {
- var $el = $(el);
- var o = $.fn.media.defaults.players[player];
-
- if (player == 'iframe') {
- var o = $('<iframe' + ' width="' + opts.width + '" height="' + opts.height + '" >');
- o.attr('src', opts.src);
- o.css('backgroundColor', o.bgColor);
- }
- else if ($.browser.msie) {
- var a = ['<object width="' + opts.width + '" height="' + opts.height + '" '];
- for (var key in opts.attrs)
- a.push(key + '="'+opts.attrs[key]+'" ');
- for (var key in o.ieAttrs || {}) {
- var v = o.ieAttrs[key];
- if (key == 'codebase' && window.location.protocol == 'https:')
- v = v.replace('http','https');
- a.push(key + '="'+v+'" ');
- }
- a.push('></ob'+'ject'+'>');
- var p = ['<param name="' + (o.oUrl || 'src') +'" value="' + opts.src + '">'];
- for (var key in opts.params)
- p.push('<param name="'+ key +'" value="' + opts.params[key] + '">');
- var o = document.createElement(a.join(''));
- for (var i=0; i < p.length; i++)
- o.appendChild(document.createElement(p[i]));
- }
- else if (o.standards) {
- // Rewritten to be standards compliant by Richard Connamacher
- var a = ['<object type="' + o.mimetype +'" width="' + opts.width + '" height="' + opts.height +'"'];
- if (opts.src) a.push(' data="' + opts.src + '" ');
- a.push('>');
- a.push('<param name="' + (o.oUrl || 'src') +'" value="' + opts.src + '">');
- for (var key in opts.params) {
- if (key == 'wmode' && player != 'flash') // FF3/Quicktime borks on wmode
- continue;
- a.push('<param name="'+ key +'" value="' + opts.params[key] + '">');
- }
- // Alternate HTML
- a.push('<div><p><strong>'+o.title+' Required</strong></p><p>'+o.title+' is required to view this media. <a href="'+o.pluginspage+'">Download Here</a>.</p></div>');
- a.push('</ob'+'ject'+'>');
- }
- else {
- var a = ['<embed width="' + opts.width + '" height="' + opts.height + '" style="display:block"'];
- if (opts.src) a.push(' src="' + opts.src + '" ');
- for (var key in opts.attrs)
- a.push(key + '="'+opts.attrs[key]+'" ');
- for (var key in o.eAttrs || {})
- a.push(key + '="'+o.eAttrs[key]+'" ');
- for (var key in opts.params) {
- if (key == 'wmode' && player != 'flash') // FF3/Quicktime borks on wmode
- continue;
- a.push(key + '="'+opts.params[key]+'" ');
- }
- a.push('></em'+'bed'+'>');
- }
- // convert element to div
- var id = el.id ? (' id="'+el.id+'"') : '';
- var cls = opts.cls ? (' class="' + opts.cls + '"') : '';
- var $div = $('<div' + id + cls + '>');
- $el.after($div).remove();
- ($.browser.msie || player == 'iframe') ? $div.append(o) : $div.html(a.join(''));
- if (opts.caption) $('<div>').appendTo($div).html(opts.caption);
- return $div;
-};
-
-
-})(jQuery);
diff --git a/js/jquery.metadata.js b/js/jquery.metadata.js
deleted file mode 100644
index e011f52..0000000
--- a/js/jquery.metadata.js
+++ /dev/null
@@ -1,148 +0,0 @@
-/*
- * Metadata - jQuery plugin for parsing metadata from elements
- *
- * Copyright (c) 2006 John Resig, Yehuda Katz, J�örn Zaefferer, Paul McLanahan
- *
- * Dual licensed under the MIT and GPL licenses:
- * http://www.opensource.org/licenses/mit-license.php
- * http://www.gnu.org/licenses/gpl.html
- *
- * Revision: $Id$
- *
- */
-
-/**
- * Sets the type of metadata to use. Metadata is encoded in JSON, and each property
- * in the JSON will become a property of the element itself.
- *
- * There are four supported types of metadata storage:
- *
- * attr: Inside an attribute. The name parameter indicates *which* attribute.
- *
- * class: Inside the class attribute, wrapped in curly braces: { }
- *
- * elem: Inside a child element (e.g. a script tag). The
- * name parameter indicates *which* element.
- * html5: Values are stored in data-* attributes.
- *
- * The metadata for an element is loaded the first time the element is accessed via jQuery.
- *
- * As a result, you can define the metadata type, use $(expr) to load the metadata into the elements
- * matched by expr, then redefine the metadata type and run another $(expr) for other elements.
- *
- * @name $.metadata.setType
- *
- * @example <p id="one" class="some_class {item_id: 1, item_label: 'Label'}">This is a p</p>
- * @before $.metadata.setType("class")
- * @after $("#one").metadata().item_id == 1; $("#one").metadata().item_label == "Label"
- * @desc Reads metadata from the class attribute
- *
- * @example <p id="one" class="some_class" data="{item_id: 1, item_label: 'Label'}">This is a p</p>
- * @before $.metadata.setType("attr", "data")
- * @after $("#one").metadata().item_id == 1; $("#one").metadata().item_label == "Label"
- * @desc Reads metadata from a "data" attribute
- *
- * @example <p id="one" class="some_class"><script>{item_id: 1, item_label: 'Label'}</script>This is a p</p>
- * @before $.metadata.setType("elem", "script")
- * @after $("#one").metadata().item_id == 1; $("#one").metadata().item_label == "Label"
- * @desc Reads metadata from a nested script element
- *
- * @example <p id="one" class="some_class" data-item_id="1" data-item_label="Label">This is a p</p>
- * @before $.metadata.setType("html5")
- * @after $("#one").metadata().item_id == 1; $("#one").metadata().item_label == "Label"
- * @desc Reads metadata from a series of data-* attributes
- *
- * @param String type The encoding type
- * @param String name The name of the attribute to be used to get metadata (optional)
- * @cat Plugins/Metadata
- * @descr Sets the type of encoding to be used when loading metadata for the first time
- * @type undefined
- * @see metadata()
- */
-
-(function($) {
-
-$.extend({
- metadata : {
- defaults : {
- type: 'class',
- name: 'metadata',
- cre: /({.*})/,
- single: 'metadata'
- },
- setType: function( type, name ){
- this.defaults.type = type;
- this.defaults.name = name;
- },
- get: function( elem, opts ){
- var settings = $.extend({},this.defaults,opts);
- // check for empty string in single property
- if ( !settings.single.length ) settings.single = 'metadata';
-
- var data = $.data(elem, settings.single);
- // returned cached data if it already exists
- if ( data ) return data;
-
- data = "{}";
-
- var getData = function(data) {
- if(typeof data != "string") return data;
-
- if( data.indexOf('{') < 0 ) {
- data = eval("(" + data + ")");
- }
- }
-
- var getObject = function(data) {
- if(typeof data != "string") return data;
-
- data = eval("(" + data + ")");
- return data;
- }
-
- if ( settings.type == "html5" ) {
- var object = {};
- $( elem.attributes ).each(function() {
- var name = this.nodeName;
- if(name.match(/^data-/)) name = name.replace(/^data-/, '');
- else return true;
- object[name] = getObject(this.nodeValue);
- });
- } else {
- if ( settings.type == "class" ) {
- var m = settings.cre.exec( elem.className );
- if ( m )
- data = m[1];
- } else if ( settings.type == "elem" ) {
- if( !elem.getElementsByTagName ) return;
- var e = elem.getElementsByTagName(settings.name);
- if ( e.length )
- data = $.trim(e[0].innerHTML);
- } else if ( elem.getAttribute != undefined ) {
- var attr = elem.getAttribute( settings.name );
- if ( attr )
- data = attr;
- }
- object = getObject(data.indexOf("{") < 0 ? "{" + data + "}" : data);
- }
-
- $.data( elem, settings.single, object );
- return object;
- }
- }
-});
-
-/**
- * Returns the metadata object for the first member of the jQuery object.
- *
- * @name metadata
- * @descr Returns element's metadata object
- * @param Object opts An object contianing settings to override the defaults
- * @type jQuery
- * @cat Plugins/Metadata
- */
-$.fn.metadata = function( opts ){
- return $.metadata.get( this[0], opts );
-};
-
-})(jQuery); \ No newline at end of file
diff --git a/js/video.js b/js/video.js
deleted file mode 100644
index e724e8b..0000000
--- a/js/video.js
+++ /dev/null
@@ -1,84 +0,0 @@
-// $Id$
-
-/**
- * @file
- * Adds some show/hide to the admin form to make the UXP easier.
- *
- */
-
-$(document).ready(function() {
- //lets see if we have any jmedia movies
- if($.fn.media) {
- $('.jmedia').media();
- }
-
- video_hide_all_options();
- $("input[name='vid_convertor']").change(function() {
- video_hide_all_options();
- });
-
- $('.video_select').each(function() {
- var ext = $(this).attr('rel');
- $('select', this).change(function() {
- if($(this).val() == 'video_play_flv') {
- $('#flv_player_'+ext).show();
- } else {
- $('#flv_player_'+ext).hide();
- }
- });
- if($('select', this).val() == 'video_play_flv') {
- $('#flv_player_'+ext).show();
- }
- });
-
- if(Drupal.settings.video) {
- $.fn.media.defaults.flvPlayer = Drupal.settings.video.flvplayer;
-
- }
-
- //lets setup our colorbox videos
- $('.video-box').each(function() {
- var url = $(this).attr('href');
- var data = $(this).metadata();
- var width = data.width;
- var height= data.height;
- var player = Drupal.settings.video.player; //player can be either jwplayer or flowplayer.
- $(this).colorbox({
- html: '<a id="video-overlay" href="'+url+'" style="height:'+height+'; width:'+width+'; display: block;"></a>',
- onComplete:function() {
- if(player == 'flowplayer') {
- flowplayer("video-overlay", Drupal.settings.video.flvplayer, {
- clip: {
- autoPlay: Drupal.settings.video.autoplay,
- autoBuffering: Drupal.settings.video.autobuffer
- }
- });
- } else {
- $('#video-overlay').media({ flashvars: {autostart: Drupal.settings.video.autoplay}, width:width, height:height });
- }
- },
- });
- });
-});
-
-function video_hide_all_options() {
- $("input[name='vid_convertor']").each(function() {
- var id = $(this).val();
- $('#'+id).hide();
- if ($(this).is(':checked')) {
- $('#' + id).show();
- }
- });
-}
-
-function videoftp_thumbnail_change() {
- // Add handlers for the video thumbnail radio buttons to update the large thumbnail onchange.
- $(".video-thumbnails input").each(function() {
- var path = $(this).val();
- if($(this).is(':checked')) {
- var holder = $(this).attr('rel');
- $('.'+holder+' img').attr('src', Drupal.settings.basePath + path);
- }
- });
-
-}
diff --git a/plugins/ffmpeg.inc b/plugins/ffmpeg.inc
deleted file mode 100644
index a83653a..0000000
--- a/plugins/ffmpeg.inc
+++ /dev/null
@@ -1,275 +0,0 @@
-<?php
-//$Id$
-
-/**
- * @file
- * Provide a api for video conversion and auto thumbnailing using ffmpeg.
- *
- * @author Heshan Wanigasooriya <heshan at heidisoft.com, heshanmw at gmail dot com>
- * TODO: add common settings from video module configurations and extend it from ffmpeg.inc
- * since we need to have executable path of ffmpeg to ffmpeg.inc we need to have it
- */
-
-/**
- * Define some constants
- */
-defined('VIDEO_RENDERING_PENDING')
- or define('VIDEO_RENDERING_PENDING', 1);
-defined('VIDEO_RENDERING_ACTIVE')
- or define('VIDEO_RENDERING_ACTIVE', 5);
-defined('VIDEO_RENDERING_COMPLETE')
- or define('VIDEO_RENDERING_COMPLETE', 10);
-defined('VIDEO_RENDERING_FAILED')
- or define('VIDEO_RENDERING_FAILED', 20);
-
-// nice value to append at the beginning of the command
-defined('VIDEO_RENDERING_NICE')
- or define('VIDEO_RENDERING_NICE', 'nice -n 19');
-
-
-// TODO : add cron API to video module
-function ffmpeg_cron() {
- global $base_url;
-
- if(variable_get('video_ffmpeg_helper_auto_cvr_cron', true)) {
- exec("php video_scheduler.php $base_url > /dev/null &");
- }
-}
-
-
-/**
- * Get some informations from the video file
- */
-function ffmpeg_get_video_info($vidfile) {
- static $ffmpeg_info;
- $fid = $vidfile['fid'];
- // $command_output = cache_get($fid);
- // if(empty($command_output)) {
- // escape file name for safety
- $file = escapeshellarg($vidfile['filepath']);
- // create the full command to execute
- $command = variable_get('video_transcoder_path', '/usr/bin/ffmpeg') . ' -i ' . $file;
-
- //execute the command
- ob_start();
- passthru($command." 2>&1", $command_return);
- $command_output = ob_get_contents();
- ob_end_clean();
-
- // cache the result for further calls
- // $ffmpeg_info[$vidfile['fid']] = $command_output;
- // cache_set($vidfile['fid'], $command_output);
- // }
-
- return $command_output;
-}
-
-
-/**
- * Return the video resolution
- */
-function ffmpeg_auto_resolution(&$node) {
-
- if(!variable_get('video_ffmpeg_helper_auto_resolution', false)) {
-
- // call ffmpeg -i
- $ffmpeg_output = ffmpeg_get_video_info($node);
-
- // get resolution
- $pattern = '/Video: .*, ([0-9]{2,4}x[0-9]{2,4})/';
- preg_match_all($pattern, $ffmpeg_output, $matches, PREG_PATTERN_ORDER);
- $resolution = $matches[1][0];
-
- return explode("x", $resolution);
- }
- return null;
-}
-
-
-/**
- * Return the playtime seconds of a video
- */
-function ffmpeg_auto_playtime($file) {
-
- if(!variable_get('video_ffmpeg_helper_auto_playtime', false)) {
-
- // call ffmpeg -i
- $ffmpeg_output = ffmpeg_get_video_info($file);
-
- // get playtime
- $pattern = '/Duration: ([0-9]{2}:[0-9]{2}:[0-9]{2}\.[0-9])/';
- preg_match_all($pattern, $ffmpeg_output, $matches, PREG_PATTERN_ORDER);
- $playtime = $matches[1][0];
-
- // ffmpeg return lenght as 00:00:31.1 Let's get playtime from that
- $hmsmm = explode(":", $playtime);
-
- $tmp = explode(".", $hmsmm[2]);
- $seconds = $tmp[0];
-
- $hours = $hmsmm[0];
- $minutes = $hmsmm[1];
-
- return $seconds + ($hours * 3600) + ($minutes * 60);
- }
-}
-
-/**
- * Generates a thumbnail from the video file
- * Implementing hook_auto_thumbnail on inc
- *
- * @param $vidfile
- * object with element information
- *
- * @return
- * a drupal file objects
- */
-function ffmpeg_auto_thumbnail($vidfile) {
- global $user;
- $uploaded_file = $vidfile;
- $fid = $uploaded_file["fid"];
-
- // are we debugging?
- // escape the filename for safety
- $videofile = escapeshellarg($uploaded_file['filepath']);
- $thumb_path = variable_get('video_thumb_path', 'video_thumbs');
- //files will save in files/video_thumbs/#fileId folder
- $tmp = file_directory_path(). '/' . $thumb_path . '/' . $fid;
- // Ensure the destination directory exists and is writable.
- $directories = explode('/', $tmp);
- // array_pop($directories); // Remove the file itself.
- // Get the file system directory.
- $file_system = file_directory_path();
- foreach ($directories as $directory) {
- $full_path = isset($full_path) ? $full_path . '/' . $directory : $directory;
- // Don't check directories outside the file system path.
- if (strpos($full_path, $file_system) === 0) {
- field_file_check_directory($full_path, FILE_CREATE_DIRECTORY);
- }
- }
- $count = variable_get('no_of_video_thumbs', 5);
- $duration = ffmpeg_auto_playtime($vidfile);
- $files = NULL;
- for($i = 1; $i <= $count; $i++) {
- // get ffmpeg configurations
- $seek = ($duration/$count) * $i;
- $thumbfile = $tmp . "/video-thumb-for-$fid-$i.png";
- //skip files already exists, this will save ffmpeg traffic
- if (!is_file($thumbfile)) {
- $tnail = variable_get('video_transcoder_path', '/usr/bin/ffmpeg');
- $options = preg_replace(array('/%videofile/', '/%thumbfile/', '/%seek/'), array($videofile, $thumbfile, $seek), variable_get('video_ffmpeg_thumbnailer_options', '-i %videofile -an -y -f mjpeg -ss %seek -vframes 1 %thumbfile'));
- // $options = preg_replace(array('/%videofile/', '/%tmp/', '/%id/', '/%interval/'), array($videofile, $tmp, $i, ($duration/$count)), variable_get('video_image_thumbnailer_options', '-ss %id*%interval -i %videofile -vframes 1 %thumbfile'));
- // ffmpeg -ss $i*$interval -i intro.mov -vframes 1 -s 320x240 thumb_$i.jpg
- //ffmpeg -i superstunt_8uiarzrh.mp4 -r 0.1 -ss 00:00:5 -f image2 img/images%02d.png
- ////ffmpeg -i superstunt_8uiarzrh.mp4 -r 0.05 -ss 00:00:5 -f image2 img/images%1d.jpg
- // executes the command
- $command = "$tnail $options";
- ob_start();
- passthru($command." 2>&1", $tnail_return);
- $tnail_output = ob_get_contents();
- ob_end_clean();
- if (!file_exists($thumbfile)) {
- $error_param = array(
- '%file' => $thumbfile,
- '%cmd' => $command,
- '%out' => $tnail_output,
- );
- $error_msg = t("error generating thumbnail for video: generated file %file does not exist.<br />Command Executed:<br />%cmd<br />Command Output:<br />%out", $error_param);
- // let's log this
- watchdog('video_ffmpeg',$error_msg, array(), WATCHDOG_ERROR);
- }
- }
- // Begin building file object.
- //TODO : use file_munge_filename()
- $file = new stdClass();
- $file->uid = $user->uid;
- $file->status = FILE_STATUS_TEMPORARY;
- $file->filename = trim("video-thumb-for-$fid-$i.png");
- $file->filepath = $thumbfile;
- $file->filemime = file_get_mimetype("video-thumb-for-$fid-$i.png");
- $file->filesize = filesize($thumbfile);
- $file->timestamp = REQUEST_TIME;
- $files[] = $file;
- }
- return $files;
-}
-
-/**
- * Implementing hook_chcek_exepath() on inc
- * To check the the path is executable or not
- * @param <type> path to check
- * @return bool TRUE/FALSE
- */
-function ffmpeg_check_exe_path($path=NULL) {
- if (!$path) {
- $path = variable_get('video_transcoder_path', '/usr/bin/ffmpeg');
- }
- if (function_exists('is_executable')) {
- $test = 'is_executable';
- } else {
- $test = 'file_exists';
- }
- return $test($path);
-}
-
-/**
- * Implementing hook_auto_convert();
- * @param <type> $job
- */
-function ffmpeg_auto_convert(&$job) {
- $videofile = escapeshellarg($job->filepath); // escape file name for safety
- $convfile = tempnam(file_directory_temp(), 'video-rendering');
- $audiobitrate = variable_get('video_ffmpeg_helper_auto_cvr_audio_bitrate', 64);
- $videobitrate = variable_get('video_ffmpeg_helper_auto_cvr_video_bitrate', 200);
- $size = _video_render_get_size();
- $converter = variable_get('video_transcoder_path', '/usr/bin/ffmpeg');
-
- $options = preg_replace(array('/%videofile/', '/%convertfile/', '/%audiobitrate/', '/%size/', '/%videobitrate/'),
- array($videofile, $convfile, $audiobitrate, $size, $videobitrate),
- variable_get('video_ffmpeg_helper_auto_cvr_options',
- '-y -i %videofile -f flv -ar 22050 -ab %audiobitrate -s %size -b %videobitrate -qscale 1 %convertfile'));
-
- // set to the converted file output
- $job->convfile = $convfile;
-
- $command = VIDEO_RENDERING_NICE . " $converter $options";
-
- //print('executing ' . $command); die;
- watchdog('video_render', 'executing: ' . $command, array(), WATCHDOG_DEBUG);
-// watchdog('video_render', 'Starting : ' . REQUEST_TIME);
- //execute the command
- ob_start();
- passthru($command." 2>&1", $command_return);
- $command_output = ob_get_contents();
- ob_end_clean();
-// watchdog('video_render', 'Completed');
- //print $command_output;
-
- if (!file_exists($job->convfile) || !filesize($job->convfile)) {
- watchdog('video_render', 'video conversion failed. ffmpeg reported the following output: ' . $command_output, array(), WATCHDOG_ERROR);
- // _video_render_set_video_encoded_fid($job->nid, $job->vid, -1);
- // _video_render_job_change_status($job->nid, $job->vid, VIDEO_RENDERING_FAILED);
- }
- else {
- $file_name = basename($job->filename . ".flv");
- $file = new stdClass();
- $file->uid = $job->uid;
- $file->status = FILE_STATUS_PERMANENT;
- $file->filename = basename($file_name);
- $file->filepath = $job->convfile;
- $file->filemime = file_get_mimetype($file_name);
- $file->filesize = filesize($job->convfile);
- $file->timestamp = REQUEST_TIME;
-
- $job->converted = $file;
- }
-}
-
-
-/**
- * Calculate the converted video size basing on the width set on administration.
- * Aspect ration is maintained.
- */
-function _video_render_get_size() {
- return variable_get('video_ffmpeg_width', 640) . 'x' . variable_get('video_ffmpeg_height', 480);
-} \ No newline at end of file
diff --git a/plugins/ffmpeg_wrapper.inc b/plugins/ffmpeg_wrapper.inc
deleted file mode 100644
index fd98e64..0000000
--- a/plugins/ffmpeg_wrapper.inc
+++ /dev/null
@@ -1,406 +0,0 @@
-<?php
-//$Id$
-
-/**
- * @file
- * Provide a api for video conversion and auto thumbnailing using ffmpeg.
- *
- * You must have ffmpeg_wrapper module installed in order to use this
- *
- * @author Heshan Wanigasooriya <heshan at heidisoft.com, heshanmw at gmail dot com>
- */
-
-/**
- * Define some constants
- */
-defined('VIDEO_RENDERING_PENDING')
- or define('VIDEO_RENDERING_PENDING', 1);
-defined('VIDEO_RENDERING_ACTIVE')
- or define('VIDEO_RENDERING_ACTIVE', 5);
-defined('VIDEO_RENDERING_COMPLETE')
- or define('VIDEO_RENDERING_COMPLETE', 10);
-defined('VIDEO_RENDERING_FAILED')
- or define('VIDEO_RENDERING_FAILED', 20);
-
-// nice value to append at the beginning of the command
-defined('VIDEO_RENDERING_NICE')
- or define('VIDEO_RENDERING_NICE', 'nice -n 19');
-
-
-// TODO : add cron API to video module
-function ffmpeg_wrapper_cron() {
- global $base_url;
-
- if(variable_get('video_ffmpeg_helper_auto_cvr_cron', true)) {
- exec("php video_scheduler.php $base_url > /dev/null &");
- }
-}
-
-
-/**
- * Get some informations from the video file
- */
-function ffmpeg_wrapper_get_video_info($vidfile) {
- static $ffmpeg_info;
- $fid = $vidfile['fid'];
- // $command_output = cache_get($fid);
- // if(empty($command_output)) {
- // escape file name for safety
- $file = escapeshellarg($vidfile['filepath']);
- // create the full command to execute
- $command = variable_get('video_transcoder_path', '/usr/bin/ffmpeg') . ' -i ' . $file;
-
- //execute the command
- ob_start();
- passthru($command." 2>&1", $command_return);
- $command_output = ob_get_contents();
- ob_end_clean();
-
- // cache the result for further calls
- // $ffmpeg_info[$vidfile['fid']] = $command_output;
- // cache_set($vidfile['fid'], $command_output);
- // }
-
- return $command_output;
-}
-
-
-/**
- * Return the video resolution
- */
-function ffmpeg_wrapper_auto_resolution(&$vidfile) {
-
- if(!variable_get('video_ffmpeg_helper_auto_resolution', false)) {
-
- // call ffmpeg -i
- $filepath = escapeshellarg($vidfile['filepath']);
- $ffmpeg_output = ffmpeg_wrapper_file_data($filepath);
-
- // get resolution
- $pattern = '/Video: .*, ([0-9]{2,4}x[0-9]{2,4})/';
- preg_match_all($pattern, $ffmpeg_output, $matches, PREG_PATTERN_ORDER);
- $resolution = $matches[1][0];
-
- return explode("x", $resolution);
- }
- return null;
-}
-
-
-/**
- * Return the playtime seconds of a video
- */
-function ffmpeg_wrapper_auto_playtime($file) {
-
- if(!variable_get('video_ffmpeg_helper_auto_playtime', false)) {
-
- // call ffmpeg -i
- $ffmpeg_output = ffmpeg_wrapper_get_video_info($file);
-
- // get playtime
- $pattern = '/Duration: ([0-9]{2}:[0-9]{2}:[0-9]{2}\.[0-9])/';
- preg_match_all($pattern, $ffmpeg_output, $matches, PREG_PATTERN_ORDER);
- $playtime = $matches[1][0];
-
- // ffmpeg return lenght as 00:00:31.1 Let's get playtime from that
- $hmsmm = explode(":", $playtime);
-
- $tmp = explode(".", $hmsmm[2]);
- $seconds = $tmp[0];
-
- $hours = $hmsmm[0];
- $minutes = $hmsmm[1];
-
- return $seconds + ($hours * 3600) + ($minutes * 60);
- }
-}
-
-/**
- * Generates a thumbnail from the video file
- * Implementing hook_auto_thumbnail on inc
- *
- * @param $vidfile
- * object with element information
- *
- * @return
- * a drupal file objects
- */
-function ffmpeg_wrapper_auto_thumbnail($vidfile) {
- global $user;
- $uploaded_file = $vidfile;
- $fid = $uploaded_file["fid"];
-
- // are we debugging?
- // escape the filename for safety
- $videofile = escapeshellarg($uploaded_file['filepath']);
- $thumb_path = variable_get('video_thumb_path', 'video_thumbs');
- //files will save in files/video_thumbs/#fileId folder
- $tmp = file_directory_path(). '/' . $thumb_path . '/' . $fid;
- // Ensure the destination directory exists and is writable.
- $directories = explode('/', $tmp);
- // array_pop($directories); // Remove the file itself.
- // Get the file system directory.
- $file_system = file_directory_path();
- foreach ($directories as $directory) {
- $full_path = isset($full_path) ? $full_path . '/' . $directory : $directory;
- // Don't check directories outside the file system path.
- if (strpos($full_path, $file_system) === 0) {
- field_file_check_directory($full_path, FILE_CREATE_DIRECTORY);
- }
- }
- $count = variable_get('no_of_video_thumbs', 5);
- // set file path
- $filepath = $vidfile['filepath'];
- // calling ffmpeg_wrapper_file_data function
- $file_data = ffmpeg_wrapper_file_data($filepath);
- $duration = $file_data['duration'];
- $files = NULL;
- for($i = 1; $i <= $count; $i++) {
- // get ffmpeg configurations
- $seek = ($duration/$count) * $i;
- $thumbfile = $tmp . "/video-thumb-for-$fid-$i.png";
- //skip files already exists, this will save ffmpeg traffic
- if (!is_file($thumbfile)) {
-// $tnail = variable_get('video_transcoder_path', '/usr/bin/ffmpeg');
- $options = preg_replace(array('/%videofile/', '/%thumbfile/', '/%seek/'), array($videofile, $thumbfile, $seek), variable_get('video_ffmpeg_thumbnailer_options', '-i %videofile -an -y -f mjpeg -ss %seek -vframes 1 %thumbfile'));
- // executes the command
- $tnail_output = ffmpeg_wrapper_run_command($options, $error_check = true, $path = '');
-// $command = "$tnail $options";
-// ob_start();
-// passthru($command." 2>&1", $tnail_return);
-// $tnail_output = ob_get_contents();
-// ob_end_clean();
- if (!file_exists($thumbfile)) {
- $error_param = array(
- '%file' => $thumbfile,
- '%cmd' => $options,
- '%out' => $tnail_output,
- );
- $error_msg = t("error generating thumbnail for video: generated file %file does not exist.<br />Command Executed:<br />%cmd<br />Command Output:<br />%out", $error_param);
- // let's log this
- watchdog('video_ffmpeg',$error_msg);
- }
- }
- // Begin building file object.
- //TODO : use file_munge_filename()
- $file = new stdClass();
- $file->uid = $user->uid;
- $file->status = FILE_STATUS_TEMPORARY;
- $file->filename = trim("video-thumb-for-$fid-$i.png");
- $file->filepath = $thumbfile;
- $file->filemime = file_get_mimetype("video-thumb-for-$fid-$i.png");
- $file->filesize = filesize($thumbfile);
- $file->timestamp = REQUEST_TIME;
- $files[] = $file;
- }
- return $files;
-}
-
-/**
- * Implementing hook_chcek_exepath() on inc
- * To check the the path is executable or not
- * @param <type> path to check
- * @return bool TRUE/FALSE
- */
-function ffmpeg_wrapper_check_exe_path($path = NULL) {
- return ffmpeg_wrapper_executable();
-}
-
-/**
- * Implementing hook_auto_convert();
- * @param <type> $job
- */
-//function ffmpeg_wrapper_auto_convert(&$job) {
-// $videofile = escapeshellarg($job->filepath); // escape file name for safety
-// $convfile = tempnam(file_directory_temp(), 'video-rendering');
-// $audiobitrate = variable_get('video_ffmpeg_helper_auto_cvr_audio_bitrate', 64);
-// $videobitrate = variable_get('video_ffmpeg_helper_auto_cvr_video_bitrate', 200);
-// $size = _video_render_get_size();
-//// $converter = variable_get('video_transcoder_path', '/usr/bin/ffmpeg');
-//
-// $options = preg_replace(array('/%videofile/', '/%convertfile/', '/%audiobitrate/', '/%size/', '/%videobitrate/'),
-// array($videofile, $convfile, $audiobitrate, $size, $videobitrate),
-// variable_get('video_ffmpeg_helper_auto_cvr_options',
-// '-y -i %videofile -f flv -ar 22050 -ab %audiobitrate -s %size -b %videobitrate -qscale 1 %convertfile'));
-//
-// // set to the converted file output
-// $job->convfile = $convfile;
-//
-// // run conversion commands from ffmpeg_wrapper module
-// $command_output = ffmpeg_wrapper_run_command($options, $error_check = true, $path = '');
-//
-//// $command = VIDEO_RENDERING_NICE . " $converter $options";
-//
-// //print('executing ' . $command); die;
-// watchdog('video_render', 'executing: ' . $options);
-//// watchdog('video_render', 'Starting : ' . REQUEST_TIME);
-// //execute the command
-//// ob_start();
-//// passthru($command." 2>&1", $command_return);
-//// $command_output = ob_get_contents();
-//// ob_end_clean();
-//// watchdog('video_render', 'Completed');
-// //print $command_output;
-//
-// if (!file_exists($job->convfile) || !filesize($job->convfile)) {
-// watchdog('video_render', 'video conversion failed. ffmpeg reported the following output: ' . $command_output);
-// // _video_render_set_video_encoded_fid($job->nid, $job->vid, -1);
-// // _video_render_job_change_status($job->nid, $job->vid, VIDEO_RENDERING_FAILED);
-// }
-// else {
-// $file_name = basename($job->filename . ".flv");
-// $file = new stdClass();
-// $file->uid = $job->uid;
-// $file->status = FILE_STATUS_PERMANENT;
-// $file->filename = basename($file_name);
-// $file->filepath = $job->convfile;
-// $file->filemime = file_get_mimetype($file_name);
-// $file->filesize = filesize($job->convfile);
-// $file->timestamp = REQUEST_TIME;
-//
-// $job->converted = $file;
-// }
-//}
-
-
-/**
- * This runs FFmpeg based on the form data passed into it.
- * @param string $input_file
- * path to the file to operate on
- * @param array $params
- * configuration options in the format set in the ffmpeg_wrapper_configuration_form()
- * @param string $output_file_path
- * where to place the file, assumes same dir as $input_file. No trailing slash
- * @param object $ffmpeg_object
- * contains debug information that calling functions can utilize
- * @return string
- *
- */
-function ffmpeg_wrapper_auto_convert(&$job) {
-
- $ffmpeg_object = new stdClass();
- // check configuration are pass of then use global $conf
- if(empty ($params)){
- global $conf;
- $params = $conf;
- }
-
- $input_file = $job->filepath; // escape file name for safety
-
- // first error check, make sure that we can decode this kind of file
- if (! ffmpeg_wrapper_can_decode($input_file)) {
- $message = 'FFmpeg Wrapper can not decode this file: !file';
- $variables = array('!file' => l($input_file, file_create_url($input_file)));
- watchdog('video_render', $message, $variables, WATCHDOG_ERROR);
- $ffmpeg_object->errors[] = $message;
- return false;
- }
-
- // build the output file path if we don't have one. Use the output type as the extension.
- $output_file = file_create_filename(basename($input_file) .'.'. $params['ffmpeg_output_type'], ($output_file_path ? $output_file_path : dirname($input_file)));
-
- // did the admin define a specific FFmpeg comand to run?
- // we only run what the admin specified
- if ($params['ffmpeg_video_custom']) {
- $options[] = str_replace(array('%in_file', '%out_file'), array($input_file, $output_file), $params['ffmpeg_video_custom_command']);
- }
- // build a standard configuration
- else {
- // build the ffmpeg command structure out
- $options = array();
-
- // input file
- $options[] = "-i '". $input_file ."'";
-
- // build the watermark config
- if ($params['ffmpeg_video_wm']) {
- $options[] = "-vhook '". ffmpeg_wrapper_path_to_vhook('watermark.so') ." -f ". $params['ffmpeg_video_wm_file'] ."'";
- }
-
- // build the audio config
- if ($params['ffmpeg_audio_advanced']) {
-
- // use a specifc codec?
- if ($params['ffmpeg_audio_acodec']) {
- $options[] = '-acodec '. $params['ffmpeg_audio_acodec'];
- }
-
- // use a specific sample rate?
- if ($params['ffmpeg_audio_ar'] ) {
- $options[] = '-ar '. $params['ffmpeg_audio_ar'];
- }
-
- // use a specific bit rate?
- if ($params['ffmpeg_audio_ab']) {
- $options[] = '-ab '. $params['ffmpeg_audio_ab'];
- }
- }
-
- // build the video config
- if ($params['ffmpeg_video_advanced']) {
-
- // is codec set?
- if ($params['ffmpeg_video_vcodec']) {
- $options[] = '-vcodec '. $params['ffmpeg_video_vcodec'];
- }
-
- // is frame size set?
- if ($params['ffmpeg_video_size']) {
- $options[] = '-s '. $params[$params['ffmpeg_video_size'] == 'other' ? 'ffmpeg_video_size_other' : 'ffmpeg_video_size'];
- }
-
- // is the bit rate set?
- if ($params['ffmpeg_video_br']) {
- $options[] = '-b '. $params['ffmpeg_video_br'];
- }
-
- // is frame rate set?
- if ($params['ffmpeg_video_fps']) {
- $options[] = '-r '. $params['ffmpeg_video_fps'];
- }
- }
-
- // implement truncating
- if ($params['ffmpeg_time_advanced']) {
- $options[] = '-t '. $params['ffmpeg_time'];
- }
-
- // add the output file
- $options[] = "'". $output_file ."'";
- }
-
- $ffmpeg_object->command = implode(" ", $options);
-
- // run ffmpeg with error checking
- if (! $success = ffmpeg_wrapper_run_command($ffmpeg_object->command)) {
- watchdog('video_render', 'video conversion failed. ffmpeg reported the following output: ' . $success);
- return false;
- }
-
- // successful convert, make a note in the log
- $message = 'FFmpeg converted this file: @file';
- $message .= '<br />'. 'FFmpeg ran this command: <br /><pre> !command </pre>';
- $variables = array('@file' => $output_file, '!command' => $ffmpeg_object->command);
- watchdog('video_render', $message, $variables, WATCHDOG_NOTICE);
-
- $ffmpeg_object->output_file = $output_file;
-
- if (!file_exists($output_file) || !filesize($output_file)) {
- watchdog('video_render', 'video conversion failed. ffmpeg reported the following output: ' . $command_output);
- // _video_render_set_video_encoded_fid($job->nid, $job->vid, -1);
- // _video_render_job_change_status($job->nid, $job->vid, VIDEO_RENDERING_FAILED);
- }
- else {
- $file_name = basename($output_file);
- $file = new stdClass();
- $file->uid = $job->uid;
- $file->status = FILE_STATUS_PERMANENT;
- $file->filename = basename($file_name);
- $file->filepath = $output_file;
- $file->filemime = file_get_mimetype($file_name);
- $file->filesize = filesize($output_file);
- $file->timestamp = REQUEST_TIME;
-
- $job->converted = $file;
- }
-}
diff --git a/plugins/video_zencoder/includes/LICENSE b/plugins/video_zencoder/includes/LICENSE
deleted file mode 100644
index d1f0a51..0000000
--- a/plugins/video_zencoder/includes/LICENSE
+++ /dev/null
@@ -1,20 +0,0 @@
-Copyright (c) 2010 Zencoder
-
-Permission is hereby granted, free of charge, to any person obtaining
-a copy of this software and associated documentation files (the
-"Software"), to deal in the Software without restriction, including
-without limitation the rights to use, copy, modify, merge, publish,
-distribute, sublicense, and/or sell copies of the Software, and to
-permit persons to whom the Software is furnished to do so, subject to
-the following conditions:
-
-The above copyright notice and this permission notice shall be
-included in all copies or substantial portions of the Software.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
diff --git a/plugins/video_zencoder/includes/README.markdown b/plugins/video_zencoder/includes/README.markdown
deleted file mode 100644
index 0be2256..0000000
--- a/plugins/video_zencoder/includes/README.markdown
+++ /dev/null
@@ -1,199 +0,0 @@
-Zencoder API PHP Library
-==========================
-
-Author: [Steve Heffernan](http://www.steveheffernan.com) (steve (a) zencoder (.) c&#1;om)
-Company: [Zencoder - Online Video Encoder](http://zencoder.com)
-Version: 1.1
-Date: 2010-06-04
-Repository: <http://github.com/zencoder/zencoder-php/>
-
-For more details on the Zencoder API requirements visit
-<http://zencoder.com/docs/api>
-
-
-ENCODING JOB
-------------
-The ZencoderJob object creates an encoding job using [cURL](http://zencoder.com/docs/glossary/curl/)
-to send [JSON](http://zencoder.com/docs/glossary/json/) formatted parameters to Zencoder's encoding API.
-
-### Step 1
-Visit the [API builder](https://app.zencoder.com/api_builder) in your account,
-and execute a successful encoding job.
-
-### Step 2
-Copy the successful JSON string, starting with the first curly brace "{",
-and pass it as the parameters for a new ZencoderJob object. Execute the script on your server to test that it works.
-
-#### Example
- <pre>
- <?php
-
- // Make sure this points to a copy of Zencoder.php on the same server as this script.
- require_once("zencoder-php/Zencoder.php");
-
- // New Encoding Job
- $encoding_job = new ZencoderJob('
- {
- "api_key": "93h630j1dsyshjef620qlkavnmzui3",
- "input": "s3://bucket-name/file-name.avi"
- "outputs": [
- {
- "label": "web"
- }
- ]
- }
- ');
-
- // Check if it worked
- if ($encoding_job->created) {
- // Success
- echo "w00t! \n\n";
- echo "Job ID: ".$encoding_job->id."\n";
- echo "Output '".$encoding_job->outputs["web"]->label."' ID: ".$encoding_job->outputs["web"]->id."\n";
- // Store Job/Output IDs to update their status when notified or to check their progress.
- } else {
- // Failed
- echo "Fail :(\n\n";
- echo "Errors:\n";
- foreach($encoding_job->errors as $error) {
- echo $error."\n";
- }
- }
-
- echo "\nAll Job Attributes:\n";
- var_dump($encoding_job);
-
- ?>
- </pre>
-
-### Step 3
-Modify the above script to meet your needs.
-Your [API Request History](https://app.zencoder.com/api_requests) may come in handy.
-You can revisit your [API builder](https://app.zencoder.com/api_builder) to add/update parameters of the JSON.
-
-You can translate the JSON string into nested associative arrays so that you can dynamically change attributes like "input".
-The previous JSON example would become:
-
- $encoding_job = new ZencoderJob(array(
- "api_key" => "93h630j1dsyshjef620qlkavnmzui3",
- "input" => "s3://bucket-name/file-name.avi",
- "outputs" => array(
- array(
- "label" => "web"
- )
- )
- ));
-
-
-GENERAL API REQUESTS
---------------------
-A general API request can be used for all API functionality including **Job Listing**, **Job Details**, **Account Creation**, **Account Details** (even Job Creation if desired). See the [API docs](http://zencoder.com/docs/api/) for all possible API requests.
-The first argument is the **API URL**.
-The second argument is your **API Key**.
-The third argument is the **request parameters** if needed. It can either be a JSON string or an array of parameters.
-
-
-#### Example Job List Request
-
- $request = new ZencoderRequest(
- 'https://app.zencoder/api/jobs',
- '93h630j1dsyshjef620qlkavnmzui3'
- );
-
- if ($request->successful) {
- print_r($request->results);
- } else {
- foreach($request->errors as $error) {
- echo $error."\n";
- }
- }
-
-#### Example Account Creation Request
-
- $request = new ZencoderRequest(
- 'https://app.zencoder/api/account',
- false, // API key isn't needed for new account creation
- array(
- "terms_of_service" => "1",
- "email" => "test@example.com",
- "password" => "1234"
- )
- );
-
- if ($request->successful) {
- print_r($request->results);
- } else {
- foreach($request->errors as $error) {
- echo $error."\n";
- }
- }
-
-
-NOTIFICATION HANDLING
-----------------------
-The ZencoderOutputNotification class is used to capture and parse JSON data sent from
-Zencoder to your app when an output file has been completed.
-
-
-
-### Step 1
-Create a script to receive notifications, and upload it to a location on your server that is publicly accessible.
-
-#### Example
- <?php
-
- // Make sure this points to a copy of Zencoder.php on the same server as this script.
- require("Zencoder.php");
-
- // Catch notification
- $notification = ZencoderOutputNotification::catch_and_parse();
-
- // Check output/job state
- if($notification->output->state == "finished") {
- echo "w00t!\n";
-
- // If you're encoding to multiple outputs and only care when all of the outputs are finished
- // you can check if the entire job is finished.
- if($notification->job->state == "finished") {
- echo "Dubble w00t!";
- }
- } elseif ($notification->output->state == "cancelled") {
- echo "Cancelled!\n";
- } else {
- echo "Fail!\n";
- echo $notification->output->error_message."\n";
- echo $notification->output->error_link;
- }
-
- ?>
-
-### Step 2
-In the parameters for an encoding job, add the URL for your script to the notifications array of each output you want to be notified for.
-Then submit the job to test if it works.
-
-**You can view the results at:**
-<https://app.zencoder.com/notifications>
-
-#### Example
- ...
- "outputs" => array(
- array(
- "label" => "web",
- "notifications" => array("http://example.com.com/encoding/notification.php")
- ),
- array(
- "label" => "iPhone",
- "notifications" => array("http://example.com.com/encoding/notification.php")
- )
- )
- ...
-
-
-### Step 3
-Modify the above script to meet your needs.
-Your [notifications page](https://app.zencoder.com/notifications) will come in handy.
-
-VERSIONS
----------
- Version 1.1 - 2010-06-04 Added General API Requests
- Version 1.0 - 2010-04-02 Jobs and Notifications. \ No newline at end of file
diff --git a/plugins/video_zencoder/includes/Zencoder.php b/plugins/video_zencoder/includes/Zencoder.php
deleted file mode 100644
index df52526..0000000
--- a/plugins/video_zencoder/includes/Zencoder.php
+++ /dev/null
@@ -1,239 +0,0 @@
-<?php
-/*
-
- Zencoder API PHP Library
- Version: 1.0
- See the README file for info on how to use this library.
-
-*/
-define('ZENCODER_LIBRARY_NAME', "ZencoderPHP");
-define('ZENCODER_LIBRARY_VERSION', "1.0");
-
-// Add JSON functions for PHP < 5.2.0
-if(!function_exists('json_encode')) {
- require_once('lib/JSON.php');
- $GLOBALS['JSON_OBJECT'] = new Services_JSON(SERVICES_JSON_LOOSE_TYPE);
- function json_encode($value) { return $GLOBALS['JSON_OBJECT']->encode($value); }
- function json_decode($value) { return $GLOBALS['JSON_OBJECT']->decode($value); }
-}
-
-class ZencoderJob {
-
- var $new_job_url = "https://app.zencoder.com/api/jobs"; //https://app.zencoder.com/api/jobs
- //https://zencoder-staging.heroku.com/api/jobs
- var $new_job_params = array();
- var $new_job_json;
- var $created = false;
- var $errors = array();
-
- // Attributes
- var $id;
- var $outputs = array();
-
- // Initialize
- function ZencoderJob($params, $options = array()) {
-
- // Build using params if not sending request
- if($options["build"]) {
- $this->update_attributes($params);
- return true;
- }
-
- $this->new_job_params = $params;
- $this->created = $this->create();
- }
-
- // Send Job Request to API
- function create() {
- // Send request
- $request = new ZencoderRequest($this->new_job_url, false, $this->new_job_params);
-
- if($request->successful) {
- $this->update_attributes($request->results);
- return true;
- } else {
- $this->errors = array_merge($this->errors, $request->errors);
- return false;
- }
- }
-
- // Add/Update attributes on the job object.
- function update_attributes($attributes = array()) {
- foreach($attributes as $attr_name => $attr_value) {
- // Create output file objects
- if($attr_name == "outputs" && is_array($attr_value)) {
- $this->create_outputs($attr_value);
- } elseif (!function_exists($this->$attr_name)) {
- $this->$attr_name = $attr_value;
- }
- }
- }
-
- // Create output file objects from returned parameters.
- // Use the Label for the key if avaiable.
- function create_outputs($outputs = array()) {
- foreach($outputs as $output_attrs) {
- if($output_attrs["label"]) {
- $this->outputs[$output_attrs["label"]] = new ZencoderOutputFile($output_attrs);
- } else {
- $this->outputs[] = new ZencoderOutputFile($output_attrs);
- }
- }
- }
-}
-
-class ZencoderOutputFile {
-
- var $id;
- var $label;
- var $url;
- var $state;
- var $error_message;
- var $error_link;
-
- function ZencoderOutputFile($attributes = array()) {
- $this->update_attributes($attributes);
- }
-
- // Add/Update attributes on the file object.
- function update_attributes($attributes = array()) {
- foreach($attributes as $attr_name => $attr_value) {
- if(!function_exists($this->$attr_name)) {
- $this->$attr_name = $attr_value;
- }
- }
- }
-}
-
-// General API request class
-class ZencoderRequest {
-
- var $successful = false;
- var $errors = array();
- var $raw_results;
- var $results;
-
- function ZencoderRequest($url, $api_key = "", $params = "") {
-
- // Add api_key to url if supplied
- if($api_key) {
- $url .= "?api_key=".$api_key;
- }
-
- // Get JSON
- if(is_string($params)) {
- $json = trim($params);
- } else if(is_array($params)) {
- $json = json_encode($params);
- } else {
- $json = false;
- }
-
- // Create request
- $request = new ZencoderCURL($url, $json);
-
- // Check for connection errors
- if ($request->connected == false) {
- $this->errors[] = $request->error;
- return;
- }
-
- $status_code = intval($request->status_code);
- $this->raw_results = $request->results;
-
- // Parse returned JSON
- $this->results = json_decode($this->raw_results, true);
-
- // Return based on HTTP status code
- if($status_code >= 200 && $status_code <= 206) {
- $this->successful = true;
- } else {
- // Get job request errors if any
- if(is_array($this->results["errors"])) {
- foreach($this->results["errors"] as $error) {
- $this->errors[] = $error;
- }
- } else {
- $this->errors[] = "Unknown Error\n\nHTTP Status Code: ".$request->status_code."\n"."Raw Results: \n".$request->raw_results;
- }
- }
- }
-}
-
-// ZencoderCURL
-// The connection class to perform the actual request to the surver
-// using cURL http://php.net/manual/en/book.curl.php
-class ZencoderCURL {
-
- var $options = array(
- CURLOPT_RETURNTRANSFER => 1, // Return content of the url
- CURLOPT_HEADER => 0, // Don't return the header in result
- CURLOPT_HTTPHEADER => array("Content-Type: application/json", "Accept: application/json"),
- CURLOPT_CONNECTTIMEOUT => 0, // Time in seconds to timeout send request. 0 is no timeout.
- CURLOPT_FOLLOWLOCATION => 1, // Follow redirects.
- );
-
- var $connected;
- var $results;
- var $status_code;
- var $error;
-
- // Initialize
- function ZencoderCURL($url, $json, $options = array()) {
-
- // Add library details to request
- $this->options[CURLOPT_HTTPHEADER][] = "Zencoder-Library-Name: ".ZENCODER_LIBRARY_NAME;
- $this->options[CURLOPT_HTTPHEADER][] = "Zencoder-Library-Version: ".ZENCODER_LIBRARY_VERSION;
-
- // If posting data
- if($json) {
- $this->options[CURLOPT_POST] = 1;
- $this->options[CURLOPT_POSTFIELDS] = $json;
- }
-
- // Add cURL options to defaults (can't use array_merge)
- foreach($options as $option_key => $option) {
- $this->options[$option_key] = $option;
- }
-
- // Initialize session
- $ch = curl_init($url);
-
- // Set transfer options
- curl_setopt_array($ch, $this->options);
-
- // Execute session and store returned results
- $this->results = curl_exec($ch);
-
- // Store the HTTP status code given (201, 404, etc.)
- $this->status_code = curl_getinfo($ch, CURLINFO_HTTP_CODE);
-
- // Check for cURL error
- if (curl_errno($ch)) {
- $this->error = 'cURL connection error ('.curl_errno($ch).'): '.htmlspecialchars(curl_error($ch)).' <a href="http://www.google.com/search?q='.urlencode("curl error ".curl_error($ch)).'">Search</a>';
- $this->connected = false;
- } else {
- $this->connected = true;
- }
-
- // Close session
- curl_close($ch);
- }
-}
-
-// Capture incoming notifications from Zencoder to your app
-class ZencoderOutputNotification {
-
- var $output;
- var $job;
-
- function ZencoderOutputNotification($params) {
- if($params["output"]) $this->output = new ZencoderOutputFile($params["output"]);
- if($params["job"]) $this->job = new ZencoderJob($params["job"], array("build" => true));
- }
-
- function catch_and_parse() {
- $notificiation_data = json_decode(trim(file_get_contents('php://input')), true);
- return new ZencoderOutputNotification($notificiation_data);
- }
-}
diff --git a/plugins/video_zencoder/includes/lib/JSON.php b/plugins/video_zencoder/includes/lib/JSON.php
deleted file mode 100644
index 229799b..0000000
--- a/plugins/video_zencoder/includes/lib/JSON.php
+++ /dev/null
@@ -1,806 +0,0 @@
-<?php
-/* vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4: */
-
-/**
- * Converts to and from JSON format.
- *
- * JSON (JavaScript Object Notation) is a lightweight data-interchange
- * format. It is easy for humans to read and write. It is easy for machines
- * to parse and generate. It is based on a subset of the JavaScript
- * Programming Language, Standard ECMA-262 3rd Edition - December 1999.
- * This feature can also be found in Python. JSON is a text format that is
- * completely language independent but uses conventions that are familiar
- * to programmers of the C-family of languages, including C, C++, C#, Java,
- * JavaScript, Perl, TCL, and many others. These properties make JSON an
- * ideal data-interchange language.
- *
- * This package provides a simple encoder and decoder for JSON notation. It
- * is intended for use with client-side Javascript applications that make
- * use of HTTPRequest to perform server communication functions - data can
- * be encoded into JSON notation for use in a client-side javascript, or
- * decoded from incoming Javascript requests. JSON format is native to
- * Javascript, and can be directly eval()'ed with no further parsing
- * overhead
- *
- * All strings should be in ASCII or UTF-8 format!
- *
- * LICENSE: Redistribution and use in source and binary forms, with or
- * without modification, are permitted provided that the following
- * conditions are met: Redistributions of source code must retain the
- * above copyright notice, this list of conditions and the following
- * disclaimer. Redistributions in binary form must reproduce the above
- * copyright notice, this list of conditions and the following disclaimer
- * in the documentation and/or other materials provided with the
- * distribution.
- *
- * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED
- * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
- * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN
- * NO EVENT SHALL CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
- * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
- * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
- * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR
- * TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE
- * USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
- * DAMAGE.
- *
- * @category
- * @package Services_JSON
- * @author Michal Migurski <mike-json@teczno.com>
- * @author Matt Knapp <mdknapp[at]gmail[dot]com>
- * @author Brett Stimmerman <brettstimmerman[at]gmail[dot]com>
- * @copyright 2005 Michal Migurski
- * @version CVS: $Id$
- * @license http://www.opensource.org/licenses/bsd-license.php
- * @link http://pear.php.net/pepr/pepr-proposal-show.php?id=198
- */
-
-/**
- * Marker constant for Services_JSON::decode(), used to flag stack state
- */
-define('SERVICES_JSON_SLICE', 1);
-
-/**
- * Marker constant for Services_JSON::decode(), used to flag stack state
- */
-define('SERVICES_JSON_IN_STR', 2);
-
-/**
- * Marker constant for Services_JSON::decode(), used to flag stack state
- */
-define('SERVICES_JSON_IN_ARR', 3);
-
-/**
- * Marker constant for Services_JSON::decode(), used to flag stack state
- */
-define('SERVICES_JSON_IN_OBJ', 4);
-
-/**
- * Marker constant for Services_JSON::decode(), used to flag stack state
- */
-define('SERVICES_JSON_IN_CMT', 5);
-
-/**
- * Behavior switch for Services_JSON::decode()
- */
-define('SERVICES_JSON_LOOSE_TYPE', 16);
-
-/**
- * Behavior switch for Services_JSON::decode()
- */
-define('SERVICES_JSON_SUPPRESS_ERRORS', 32);
-
-/**
- * Converts to and from JSON format.
- *
- * Brief example of use:
- *
- * <code>
- * // create a new instance of Services_JSON
- * $json = new Services_JSON();
- *
- * // convert a complexe value to JSON notation, and send it to the browser
- * $value = array('foo', 'bar', array(1, 2, 'baz'), array(3, array(4)));
- * $output = $json->encode($value);
- *
- * print($output);
- * // prints: ["foo","bar",[1,2,"baz"],[3,[4]]]
- *
- * // accept incoming POST data, assumed to be in JSON notation
- * $input = file_get_contents('php://input', 1000000);
- * $value = $json->decode($input);
- * </code>
- */
-class Services_JSON
-{
- /**
- * constructs a new JSON instance
- *
- * @param int $use object behavior flags; combine with boolean-OR
- *
- * possible values:
- * - SERVICES_JSON_LOOSE_TYPE: loose typing.
- * "{...}" syntax creates associative arrays
- * instead of objects in decode().
- * - SERVICES_JSON_SUPPRESS_ERRORS: error suppression.
- * Values which can't be encoded (e.g. resources)
- * appear as NULL instead of throwing errors.
- * By default, a deeply-nested resource will
- * bubble up with an error, so all return values
- * from encode() should be checked with isError()
- */
- function Services_JSON($use = 0)
- {
- $this->use = $use;
- }
-
- /**
- * convert a string from one UTF-16 char to one UTF-8 char
- *
- * Normally should be handled by mb_convert_encoding, but
- * provides a slower PHP-only method for installations
- * that lack the multibye string extension.
- *
- * @param string $utf16 UTF-16 character
- * @return string UTF-8 character
- * @access private
- */
- function utf162utf8($utf16)
- {
- // oh please oh please oh please oh please oh please
- if(function_exists('mb_convert_encoding')) {
- return mb_convert_encoding($utf16, 'UTF-8', 'UTF-16');
- }
-
- $bytes = (ord($utf16{0}) << 8) | ord($utf16{1});
-
- switch(true) {
- case ((0x7F & $bytes) == $bytes):
- // this case should never be reached, because we are in ASCII range
- // see: http://www.cl.cam.ac.uk/~mgk25/unicode.html#utf-8
- return chr(0x7F & $bytes);
-
- case (0x07FF & $bytes) == $bytes:
- // return a 2-byte UTF-8 character
- // see: http://www.cl.cam.ac.uk/~mgk25/unicode.html#utf-8
- return chr(0xC0 | (($bytes >> 6) & 0x1F))
- . chr(0x80 | ($bytes & 0x3F));
-
- case (0xFFFF & $bytes) == $bytes:
- // return a 3-byte UTF-8 character
- // see: http://www.cl.cam.ac.uk/~mgk25/unicode.html#utf-8
- return chr(0xE0 | (($bytes >> 12) & 0x0F))
- . chr(0x80 | (($bytes >> 6) & 0x3F))
- . chr(0x80 | ($bytes & 0x3F));
- }
-
- // ignoring UTF-32 for now, sorry
- return '';
- }
-
- /**
- * convert a string from one UTF-8 char to one UTF-16 char
- *
- * Normally should be handled by mb_convert_encoding, but
- * provides a slower PHP-only method for installations
- * that lack the multibye string extension.
- *
- * @param string $utf8 UTF-8 character
- * @return string UTF-16 character
- * @access private
- */
- function utf82utf16($utf8)
- {
- // oh please oh please oh please oh please oh please
- if(function_exists('mb_convert_encoding')) {
- return mb_convert_encoding($utf8, 'UTF-16', 'UTF-8');
- }
-
- switch(strlen($utf8)) {
- case 1:
- // this case should never be reached, because we are in ASCII range
- // see: http://www.cl.cam.ac.uk/~mgk25/unicode.html#utf-8
- return $utf8;
-
- case 2:
- // return a UTF-16 character from a 2-byte UTF-8 char
- // see: http://www.cl.cam.ac.uk/~mgk25/unicode.html#utf-8
- return chr(0x07 & (ord($utf8{0}) >> 2))
- . chr((0xC0 & (ord($utf8{0}) << 6))
- | (0x3F & ord($utf8{1})));
-
- case 3:
- // return a UTF-16 character from a 3-byte UTF-8 char
- // see: http://www.cl.cam.ac.uk/~mgk25/unicode.html#utf-8
- return chr((0xF0 & (ord($utf8{0}) << 4))
- | (0x0F & (ord($utf8{1}) >> 2)))
- . chr((0xC0 & (ord($utf8{1}) << 6))
- | (0x7F & ord($utf8{2})));
- }
-
- // ignoring UTF-32 for now, sorry
- return '';
- }
-
- /**
- * encodes an arbitrary variable into JSON format
- *
- * @param mixed $var any number, boolean, string, array, or object to be encoded.
- * see argument 1 to Services_JSON() above for array-parsing behavior.
- * if var is a strng, note that encode() always expects it
- * to be in ASCII or UTF-8 format!
- *
- * @return mixed JSON string representation of input var or an error if a problem occurs
- * @access public
- */
- function encode($var)
- {
- switch (gettype($var)) {
- case 'boolean':
- return $var ? 'true' : 'false';
-
- case 'NULL':
- return 'null';
-
- case 'integer':
- return (int) $var;
-
- case 'double':
- case 'float':
- return (float) $var;
-
- case 'string':
- // STRINGS ARE EXPECTED TO BE IN ASCII OR UTF-8 FORMAT
- $ascii = '';
- $strlen_var = strlen($var);
-
- /*
- * Iterate over every character in the string,
- * escaping with a slash or encoding to UTF-8 where necessary
- */
- for ($c = 0; $c < $strlen_var; ++$c) {
-
- $ord_var_c = ord($var{$c});
-
- switch (true) {
- case $ord_var_c == 0x08:
- $ascii .= '\b';
- break;
- case $ord_var_c == 0x09:
- $ascii .= '\t';
- break;
- case $ord_var_c == 0x0A:
- $ascii .= '\n';
- break;
- case $ord_var_c == 0x0C:
- $ascii .= '\f';
- break;
- case $ord_var_c == 0x0D:
- $ascii .= '\r';
- break;
-
- case $ord_var_c == 0x22:
- case $ord_var_c == 0x2F:
- case $ord_var_c == 0x5C:
- // double quote, slash, slosh
- $ascii .= '\\'.$var{$c};
- break;
-
- case (($ord_var_c >= 0x20) && ($ord_var_c <= 0x7F)):
- // characters U-00000000 - U-0000007F (same as ASCII)
- $ascii .= $var{$c};
- break;
-
- case (($ord_var_c & 0xE0) == 0xC0):
- // characters U-00000080 - U-000007FF, mask 110XXXXX
- // see http://www.cl.cam.ac.uk/~mgk25/unicode.html#utf-8
- $char = pack('C*', $ord_var_c, ord($var{$c + 1}));
- $c += 1;
- $utf16 = $this->utf82utf16($char);
- $ascii .= sprintf('\u%04s', bin2hex($utf16));
- break;
-
- case (($ord_var_c & 0xF0) == 0xE0):
- // characters U-00000800 - U-0000FFFF, mask 1110XXXX
- // see http://www.cl.cam.ac.uk/~mgk25/unicode.html#utf-8
- $char = pack('C*', $ord_var_c,
- ord($var{$c + 1}),
- ord($var{$c + 2}));
- $c += 2;
- $utf16 = $this->utf82utf16($char);
- $ascii .= sprintf('\u%04s', bin2hex($utf16));
- break;
-
- case (($ord_var_c & 0xF8) == 0xF0):
- // characters U-00010000 - U-001FFFFF, mask 11110XXX
- // see http://www.cl.cam.ac.uk/~mgk25/unicode.html#utf-8
- $char = pack('C*', $ord_var_c,
- ord($var{$c + 1}),
- ord($var{$c + 2}),
- ord($var{$c + 3}));
- $c += 3;
- $utf16 = $this->utf82utf16($char);
- $ascii .= sprintf('\u%04s', bin2hex($utf16));
- break;
-
- case (($ord_var_c & 0xFC) == 0xF8):
- // characters U-00200000 - U-03FFFFFF, mask 111110XX
- // see http://www.cl.cam.ac.uk/~mgk25/unicode.html#utf-8
- $char = pack('C*', $ord_var_c,
- ord($var{$c + 1}),
- ord($var{$c + 2}),
- ord($var{$c + 3}),
- ord($var{$c + 4}));
- $c += 4;
- $utf16 = $this->utf82utf16($char);
- $ascii .= sprintf('\u%04s', bin2hex($utf16));
- break;
-
- case (($ord_var_c & 0xFE) == 0xFC):
- // characters U-04000000 - U-7FFFFFFF, mask 1111110X
- // see http://www.cl.cam.ac.uk/~mgk25/unicode.html#utf-8
- $char = pack('C*', $ord_var_c,
- ord($var{$c + 1}),
- ord($var{$c + 2}),
- ord($var{$c + 3}),
- ord($var{$c + 4}),
- ord($var{$c + 5}));
- $c += 5;
- $utf16 = $this->utf82utf16($char);
- $ascii .= sprintf('\u%04s', bin2hex($utf16));
- break;
- }
- }
-
- return '"'.$ascii.'"';
-
- case 'array':
- /*
- * As per JSON spec if any array key is not an integer
- * we must treat the the whole array as an object. We
- * also try to catch a sparsely populated associative
- * array with numeric keys here because some JS engines
- * will create an array with empty indexes up to
- * max_index which can cause memory issues and because
- * the keys, which may be relevant, will be remapped
- * otherwise.
- *
- * As per the ECMA and JSON specification an object may
- * have any string as a property. Unfortunately due to
- * a hole in the ECMA specification if the key is a
- * ECMA reserved word or starts with a digit the
- * parameter is only accessible using ECMAScript's
- * bracket notation.
- */
-
- // treat as a JSON object
- if (is_array($var) && count($var) && (array_keys($var) !== range(0, sizeof($var) - 1))) {
- $properties = array_map(array($this, 'name_value'),
- array_keys($var),
- array_values($var));
-
- foreach($properties as $property) {
- if(Services_JSON::isError($property)) {
- return $property;
- }
- }
-
- return '{' . join(',', $properties) . '}';
- }
-
- // treat it like a regular array
- $elements = array_map(array($this, 'encode'), $var);
-
- foreach($elements as $element) {
- if(Services_JSON::isError($element)) {
- return $element;
- }
- }
-
- return '[' . join(',', $elements) . ']';
-
- case 'object':
- $vars = get_object_vars($var);
-
- $properties = array_map(array($this, 'name_value'),
- array_keys($vars),
- array_values($vars));
-
- foreach($properties as $property) {
- if(Services_JSON::isError($property)) {
- return $property;
- }
- }
-
- return '{' . join(',', $properties) . '}';
-
- default:
- return ($this->use & SERVICES_JSON_SUPPRESS_ERRORS)
- ? 'null'
- : new Services_JSON_Error(gettype($var)." can not be encoded as JSON string");
- }
- }
-
- /**
- * array-walking function for use in generating JSON-formatted name-value pairs
- *
- * @param string $name name of key to use
- * @param mixed $value reference to an array element to be encoded
- *
- * @return string JSON-formatted name-value pair, like '"name":value'
- * @access private
- */
- function name_value($name, $value)
- {
- $encoded_value = $this->encode($value);
-
- if(Services_JSON::isError($encoded_value)) {
- return $encoded_value;
- }
-
- return $this->encode(strval($name)) . ':' . $encoded_value;
- }
-
- /**
- * reduce a string by removing leading and trailing comments and whitespace
- *
- * @param $str string string value to strip of comments and whitespace
- *
- * @return string string value stripped of comments and whitespace
- * @access private
- */
- function reduce_string($str)
- {
- $str = preg_replace(array(
-
- // eliminate single line comments in '// ...' form
- '#^\s*//(.+)$#m',
-
- // eliminate multi-line comments in '/* ... */' form, at start of string
- '#^\s*/\*(.+)\*/#Us',
-
- // eliminate multi-line comments in '/* ... */' form, at end of string
- '#/\*(.+)\*/\s*$#Us'
-
- ), '', $str);
-
- // eliminate extraneous space
- return trim($str);
- }
-
- /**
- * decodes a JSON string into appropriate variable
- *
- * @param string $str JSON-formatted string
- *
- * @return mixed number, boolean, string, array, or object
- * corresponding to given JSON input string.
- * See argument 1 to Services_JSON() above for object-output behavior.
- * Note that decode() always returns strings
- * in ASCII or UTF-8 format!
- * @access public
- */
- function decode($str)
- {
- $str = $this->reduce_string($str);
-
- switch (strtolower($str)) {
- case 'true':
- return true;
-
- case 'false':
- return false;
-
- case 'null':
- return null;
-
- default:
- $m = array();
-
- if (is_numeric($str)) {
- // Lookie-loo, it's a number
-
- // This would work on its own, but I'm trying to be
- // good about returning integers where appropriate:
- // return (float)$str;
-
- // Return float or int, as appropriate
- return ((float)$str == (integer)$str)
- ? (integer)$str
- : (float)$str;
-
- } elseif (preg_match('/^("|\').*(\1)$/s', $str, $m) && $m[1] == $m[2]) {
- // STRINGS RETURNED IN UTF-8 FORMAT
- $delim = substr($str, 0, 1);
- $chrs = substr($str, 1, -1);
- $utf8 = '';
- $strlen_chrs = strlen($chrs);
-
- for ($c = 0; $c < $strlen_chrs; ++$c) {
-
- $substr_chrs_c_2 = substr($chrs, $c, 2);
- $ord_chrs_c = ord($chrs{$c});
-
- switch (true) {
- case $substr_chrs_c_2 == '\b':
- $utf8 .= chr(0x08);
- ++$c;
- break;
- case $substr_chrs_c_2 == '\t':
- $utf8 .= chr(0x09);
- ++$c;
- break;
- case $substr_chrs_c_2 == '\n':
- $utf8 .= chr(0x0A);
- ++$c;
- break;
- case $substr_chrs_c_2 == '\f':
- $utf8 .= chr(0x0C);
- ++$c;
- break;
- case $substr_chrs_c_2 == '\r':
- $utf8 .= chr(0x0D);
- ++$c;
- break;
-
- case $substr_chrs_c_2 == '\\"':
- case $substr_chrs_c_2 == '\\\'':
- case $substr_chrs_c_2 == '\\\\':
- case $substr_chrs_c_2 == '\\/':
- if (($delim == '"' && $substr_chrs_c_2 != '\\\'') ||
- ($delim == "'" && $substr_chrs_c_2 != '\\"')) {
- $utf8 .= $chrs{++$c};
- }
- break;
-
- case preg_match('/\\\u[0-9A-F]{4}/i', substr($chrs, $c, 6)):
- // single, escaped unicode character
- $utf16 = chr(hexdec(substr($chrs, ($c + 2), 2)))
- . chr(hexdec(substr($chrs, ($c + 4), 2)));
- $utf8 .= $this->utf162utf8($utf16);
- $c += 5;
- break;
-
- case ($ord_chrs_c >= 0x20) && ($ord_chrs_c <= 0x7F):
- $utf8 .= $chrs{$c};
- break;
-
- case ($ord_chrs_c & 0xE0) == 0xC0:
- // characters U-00000080 - U-000007FF, mask 110XXXXX
- //see http://www.cl.cam.ac.uk/~mgk25/unicode.html#utf-8
- $utf8 .= substr($chrs, $c, 2);
- ++$c;
- break;
-
- case ($ord_chrs_c & 0xF0) == 0xE0:
- // characters U-00000800 - U-0000FFFF, mask 1110XXXX
- // see http://www.cl.cam.ac.uk/~mgk25/unicode.html#utf-8
- $utf8 .= substr($chrs, $c, 3);
- $c += 2;
- break;
-
- case ($ord_chrs_c & 0xF8) == 0xF0:
- // characters U-00010000 - U-001FFFFF, mask 11110XXX
- // see http://www.cl.cam.ac.uk/~mgk25/unicode.html#utf-8
- $utf8 .= substr($chrs, $c, 4);
- $c += 3;
- break;
-
- case ($ord_chrs_c & 0xFC) == 0xF8:
- // characters U-00200000 - U-03FFFFFF, mask 111110XX
- // see http://www.cl.cam.ac.uk/~mgk25/unicode.html#utf-8
- $utf8 .= substr($chrs, $c, 5);
- $c += 4;
- break;
-
- case ($ord_chrs_c & 0xFE) == 0xFC:
- // characters U-04000000 - U-7FFFFFFF, mask 1111110X
- // see http://www.cl.cam.ac.uk/~mgk25/unicode.html#utf-8
- $utf8 .= substr($chrs, $c, 6);
- $c += 5;
- break;
-
- }
-
- }
-
- return $utf8;
-
- } elseif (preg_match('/^\[.*\]$/s', $str) || preg_match('/^\{.*\}$/s', $str)) {
- // array, or object notation
-
- if ($str{0} == '[') {
- $stk = array(SERVICES_JSON_IN_ARR);
- $arr = array();
- } else {
- if ($this->use & SERVICES_JSON_LOOSE_TYPE) {
- $stk = array(SERVICES_JSON_IN_OBJ);
- $obj = array();
- } else {
- $stk = array(SERVICES_JSON_IN_OBJ);
- $obj = new stdClass();
- }
- }
-
- array_push($stk, array('what' => SERVICES_JSON_SLICE,
- 'where' => 0,
- 'delim' => false));
-
- $chrs = substr($str, 1, -1);
- $chrs = $this->reduce_string($chrs);
-
- if ($chrs == '') {
- if (reset($stk) == SERVICES_JSON_IN_ARR) {
- return $arr;
-
- } else {
- return $obj;
-
- }
- }
-
- //print("\nparsing {$chrs}\n");
-
- $strlen_chrs = strlen($chrs);
-
- for ($c = 0; $c <= $strlen_chrs; ++$c) {
-
- $top = end($stk);
- $substr_chrs_c_2 = substr($chrs, $c, 2);
-
- if (($c == $strlen_chrs) || (($chrs{$c} == ',') && ($top['what'] == SERVICES_JSON_SLICE))) {
- // found a comma that is not inside a string, array, etc.,
- // OR we've reached the end of the character list
- $slice = substr($chrs, $top['where'], ($c - $top['where']));
- array_push($stk, array('what' => SERVICES_JSON_SLICE, 'where' => ($c + 1), 'delim' => false));
- //print("Found split at {$c}: ".substr($chrs, $top['where'], (1 + $c - $top['where']))."\n");
-
- if (reset($stk) == SERVICES_JSON_IN_ARR) {
- // we are in an array, so just push an element onto the stack
- array_push($arr, $this->decode($slice));
-
- } elseif (reset($stk) == SERVICES_JSON_IN_OBJ) {
- // we are in an object, so figure
- // out the property name and set an
- // element in an associative array,
- // for now
- $parts = array();
-
- if (preg_match('/^\s*(["\'].*[^\\\]["\'])\s*:\s*(\S.*),?$/Uis', $slice, $parts)) {
- // "name":value pair
- $key = $this->decode($parts[1]);
- $val = $this->decode($parts[2]);
-
- if ($this->use & SERVICES_JSON_LOOSE_TYPE) {
- $obj[$key] = $val;
- } else {
- $obj->$key = $val;
- }
- } elseif (preg_match('/^\s*(\w+)\s*:\s*(\S.*),?$/Uis', $slice, $parts)) {
- // name:value pair, where name is unquoted
- $key = $parts[1];
- $val = $this->decode($parts[2]);
-
- if ($this->use & SERVICES_JSON_LOOSE_TYPE) {
- $obj[$key] = $val;
- } else {
- $obj->$key = $val;
- }
- }
-
- }
-
- } elseif ((($chrs{$c} == '"') || ($chrs{$c} == "'")) && ($top['what'] != SERVICES_JSON_IN_STR)) {
- // found a quote, and we are not inside a string
- array_push($stk, array('what' => SERVICES_JSON_IN_STR, 'where' => $c, 'delim' => $chrs{$c}));
- //print("Found start of string at {$c}\n");
-
- } elseif (($chrs{$c} == $top['delim']) &&
- ($top['what'] == SERVICES_JSON_IN_STR) &&
- ((strlen(substr($chrs, 0, $c)) - strlen(rtrim(substr($chrs, 0, $c), '\\'))) % 2 != 1)) {
- // found a quote, we're in a string, and it's not escaped
- // we know that it's not escaped becase there is _not_ an
- // odd number of backslashes at the end of the string so far
- array_pop($stk);
- //print("Found end of string at {$c}: ".substr($chrs, $top['where'], (1 + 1 + $c - $top['where']))."\n");
-
- } elseif (($chrs{$c} == '[') &&
- in_array($top['what'], array(SERVICES_JSON_SLICE, SERVICES_JSON_IN_ARR, SERVICES_JSON_IN_OBJ))) {
- // found a left-bracket, and we are in an array, object, or slice
- array_push($stk, array('what' => SERVICES_JSON_IN_ARR, 'where' => $c, 'delim' => false));
- //print("Found start of array at {$c}\n");
-
- } elseif (($chrs{$c} == ']') && ($top['what'] == SERVICES_JSON_IN_ARR)) {
- // found a right-bracket, and we're in an array
- array_pop($stk);
- //print("Found end of array at {$c}: ".substr($chrs, $top['where'], (1 + $c - $top['where']))."\n");
-
- } elseif (($chrs{$c} == '{') &&
- in_array($top['what'], array(SERVICES_JSON_SLICE, SERVICES_JSON_IN_ARR, SERVICES_JSON_IN_OBJ))) {
- // found a left-brace, and we are in an array, object, or slice
- array_push($stk, array('what' => SERVICES_JSON_IN_OBJ, 'where' => $c, 'delim' => false));
- //print("Found start of object at {$c}\n");
-
- } elseif (($chrs{$c} == '}') && ($top['what'] == SERVICES_JSON_IN_OBJ)) {
- // found a right-brace, and we're in an object
- array_pop($stk);
- //print("Found end of object at {$c}: ".substr($chrs, $top['where'], (1 + $c - $top['where']))."\n");
-
- } elseif (($substr_chrs_c_2 == '/*') &&
- in_array($top['what'], array(SERVICES_JSON_SLICE, SERVICES_JSON_IN_ARR, SERVICES_JSON_IN_OBJ))) {
- // found a comment start, and we are in an array, object, or slice
- array_push($stk, array('what' => SERVICES_JSON_IN_CMT, 'where' => $c, 'delim' => false));
- $c++;
- //print("Found start of comment at {$c}\n");
-
- } elseif (($substr_chrs_c_2 == '*/') && ($top['what'] == SERVICES_JSON_IN_CMT)) {
- // found a comment end, and we're in one now
- array_pop($stk);
- $c++;
-
- for ($i = $top['where']; $i <= $c; ++$i)
- $chrs = substr_replace($chrs, ' ', $i, 1);
-
- //print("Found end of comment at {$c}: ".substr($chrs, $top['where'], (1 + $c - $top['where']))."\n");
-
- }
-
- }
-
- if (reset($stk) == SERVICES_JSON_IN_ARR) {
- return $arr;
-
- } elseif (reset($stk) == SERVICES_JSON_IN_OBJ) {
- return $obj;
-
- }
-
- }
- }
- }
-
- /**
- * @todo Ultimately, this should just call PEAR::isError()
- */
- function isError($data, $code = null)
- {
- if (class_exists('pear')) {
- return PEAR::isError($data, $code);
- } elseif (is_object($data) && (get_class($data) == 'services_json_error' ||
- is_subclass_of($data, 'services_json_error'))) {
- return true;
- }
-
- return false;
- }
-}
-
-if (class_exists('PEAR_Error')) {
-
- class Services_JSON_Error extends PEAR_Error
- {
- function Services_JSON_Error($message = 'unknown error', $code = null,
- $mode = null, $options = null, $userinfo = null)
- {
- parent::PEAR_Error($message, $code, $mode, $options, $userinfo);
- }
- }
-
-} else {
-
- /**
- * @todo Ultimately, this class shall be descended from PEAR_Error
- */
- class Services_JSON_Error
- {
- function Services_JSON_Error($message = 'unknown error', $code = null,
- $mode = null, $options = null, $userinfo = null)
- {
-
- }
- }
-
-}
-
-?> \ No newline at end of file
diff --git a/plugins/video_zencoder/includes/zencoder.inc b/plugins/video_zencoder/includes/zencoder.inc
deleted file mode 100644
index fcf7e48..0000000
--- a/plugins/video_zencoder/includes/zencoder.inc
+++ /dev/null
@@ -1,280 +0,0 @@
-<?php
-//$Id$
-/*
- * @file
- * Class file to handle amazon s3 transfers.
- *
-*/
-
-// Include our class file.
-require_once('Zencoder.php');
-
-define('VIDEO_ZC_PENDING', 0);
-define('VIDEO_ZC_WORKING', 1);
-define('VIDEO_ZC_ACTIVE', 2);
-define('VIDEO_ZC_FAILED', 3);
-
-class video_zencoder_api {
-
- private $jobid;
- private $access_key;
- private $limit;
- private $bucket;
-
- public function __construct() {
- $this->access_key = variable_get('zencoder_api_key', '');
- $this->limit = variable_get('amazon_s3_limit',5);
- $this->bucket = variable_get('amazon_s3_bucket', '');
- }
-
-
- /**
- * create transcoding job on Zencoder.com
- */
- public function create($file) {
- // API Key
- $api_key = variable_get('zencoder_api_key', '');
- // File details
- $filename = $file->filename;
- // Get varialbes
- $lable = 'VIDEO_' . $file->fid;
- $base_url = $folder;
- $width = variable_get('zc_width', '');
- $height = variable_get('zc_height', '');
- $quality = variable_get('zc_quality', 3);
- $speed = variable_get('zc_speed', 3);
- $upscale = variable_get('zc_upscale', '');
- $stretch = variable_get('zc_stretch', '');
- $frame_rate = variable_get('zc_frame_rate', '');
- $max_frame_rate = variable_get('zc_max_frame_rate', '');
- $keyframe_interval = variable_get('zc_key_frame_interval', '');
- $video_bitrate = variable_get('zc_vid_bit_rate', '');
- $bitrate_cap = variable_get('zc_bit_rate_cap', '');
- $buffer_size = variable_get('zc_buffer_size', '');
- $h264_profile = variable_get('zc_h245_profile', 1);
- $h264_level = variable_get('zc_h245_level', 0);
- $skip_video = variable_get('zc_skip_video', '');
- $audio_codec = variable_get('zc_audio_codec', 'aac');
- $audio_bitrate = variable_get('zc_audio_bitrate', '');
- $audio_channels = variable_get('zc_audio_channels', 2);
- $audio_sample_rate = variable_get('zc_audio_sample_rate', '');
- $skip_audio = variable_get('zc_skip_audio', '');
- $thumb_no = variable_get('no_of_video_thumbs', 5);
- // TODO :
- $thumb_size = '160x120';
- $thumb_base = $baseurl;
- $thumb_prefix = $filename;
- $notify_url = variable_get('zc_notify_url', '');
- $notify_email = variable_get('zc_notify_email', 'heshanmw@gmail.com');
- $start_clip = variable_get('zc_start_clip', '');
- $clip_length = variable_get('zc_clip_length', '');
-
- $bucket = $this->bucket;
-
- // Job details
- $input_name = $bucket . '/' . $filename;
-// watchdog('zencoder', $input_name);
-
- $zc_output = array();
- if(!empty($lable))
- $zc_output['label'] = $lable;
- if(!empty($bucket))
- $zc_output['url'] = 's3://' . $bucket . '/' . $filename . '.flv';
- if(!empty($width))
- $zc_output['width'] = $width;
- if(!empty($height))
- $zc_output['height'] = $height;
- if($quality != 3)
- $zc_output['quality'] = $quality;
- if($speed != 3)
- $zc_output['speed'] = $speed;
- if(!empty($upscale))
- $zc_output['upscale'] = $upscale;
- if(!empty($frame_rate))
- $zc_output['frame_rate'] = $frame_rate;
- if(!empty($max_frame_rate))
- $zc_output['max_frame_rate'] = $max_frame_rate;
- if(!empty($keyframe_interval))
- $zc_output['keyframe_interval'] = $keyframe_interval;
- if(!empty($video_bitrate))
- $zc_output['video_bitrate'] = $video_bitrate;
- if(!empty($bitrate_cap))
- $zc_output['bitrate_cap'] = $bitrate_cap;
- if(!empty($buffer_size))
- $zc_output['buffer_size'] = $buffer_size;
- if(($h264_profile != 1))
- $zc_output['h264_profile'] = $h264_profile;
- if(($h264_level != 0))
- $zc_output['h264_level'] = $h264_level;
- if(!empty($skip_video))
- $zc_output['skip_video'] = $skip_video;
- if(($audio_codec != 'aac'))
- $zc_output['audio_codec'] = $audio_codec;
- if(!empty($audio_bitrate))
- $zc_output['audio_bitrate'] = $audio_bitrate;
- if(($audio_channels != 2))
- $zc_output['audio_channels'] = $audio_channels;
- if(!empty($audio_sample_rate))
- $zc_output['audio_sample_rate'] = $audio_sample_rate;
- if(!empty($skip_audio))
- $zc_output['skip_audio'] = $skip_audio;
- if(!empty($start_clip))
- $zc_output['start_clip'] = $start_clip;
- if(!empty($clip_length))
- $zc_output['clip_length'] = $clip_length;
-
-// thumbnails
- $thumbnails['number'] = $thumb_no;
- if(!empty($thumb_size))
- $thumbnails['thumb_size'] = $thumb_size;
- if(!empty($bucket))
- $thumbnails['base_url'] = 's3://' . $bucket;
- if(!empty($lable))
- $thumbnails['prefix'] = $lable;
- $zc_output['thumbnails'] = $thumbnails;
-
- // Notifications
- if(!empty($notify_url))
- $notifications[] = $notify_url;
- if(!empty($notify_email))
- $notifications[] = $notify_email;
- $zc_output['notifications'] = $notifications;
-
-
- $encoding_job_json = array(
- 'test' => 1,
-// 'download_connections' => -1,
- 'api_key' => $this->access_key,
- 'input' => 's3://' . $input_name . '',
- 'output' => $zc_output
- );
-
-
- watchdog('zencoder', json_encode($encoding_job_json));
-
- $encoding_job = new ZencoderJob(json_encode($encoding_job_json));
-
- // Check if it worked
- if ($encoding_job->created) {
-// watchdog('zencoder', $encoding_job->id);
- return $encoding_job;
- }
- else {
- foreach($encoding_job->errors as $error) {
- // echo $error."\n";
- watchdog('zencoder', 'Zencoder reports some errors. !error', array('!error' => $error), WATCHDOG_ERROR);
- }
- return false;
- }
-
- }
-
- /*
- * Inserts file object into the database.
- */
- public function insert($fid, $jobid = 0) {
- db_query("INSERT INTO {video_zencoder} (fid, jobid, status) VALUES (%d, %d, %d)", $fid, $jobid, VIDEO_ZC_PENDING);
- }
-
- /*
- * Updates the database after a successful transfer to amazon.
- */
- public function update($video) {
- $result = db_query("UPDATE {video_zencoder} SET jobid = %d, outputid = %d, bucket='%s', filename='%s', filepath='%s', filemime='%s', filesize='%s', status=%d, completed=%d WHERE vid=%d",
- $video->jobid, $video->outputid, $video->bucket, $video->filename, $video->filepath, $video->filemime, $video->filesize, VIDEO_ZC_ACTIVE, REQUEST_TIME, $video->vid);
- return $result;
- }
-
- public function working($vid) {
- db_query("UPDATE {video_zencoder} SET status=%d WHERE vid=%d", VIDEO_ZC_WORKING, $vid);
- }
-
- public function failed($vid) {
- db_query("UPDATE {video_zencoder} SET status=%d WHERE vid=%d", VIDEO_ZC_FAILED, $vid);
- }
- /*
- * Verifies the existence of a file id, returns the row or false if none found.
- */
- public function verify($fid) {
- $sql = db_query("SELECT * FROM {video_zencoder} WHERE fid=%d", $fid);
- $row = db_fetch_object($sql);
- return $row;
- }
-
- public function delete($fid) {
- // Lets get our file no matter the status and delete it.
- if($video = $this->verify($fid)) {
- // Lets delete our record from the database.
- db_query("DELETE FROM {video_zencoder} WHERE vid=%d", $video->vid);
- }
- }
- public function get_job_id() {
- return $this->jobid;
- }
- /*
- * Gets a video object from the database.
- */
- public function get($fid) {
- $sql = db_query("SELECT * FROM {video_zencoder} WHERE fid=%d AND status=%d", $fid, VIDEO_ZC_ACTIVE);
- $row = db_fetch_object($sql);
- return $row;
- }
-
- /*
- * Selects the pending queue to be transfered to amazon.
- */
- public function queue() {
- $video = false;
- $sql = db_query("SELECT vid, fid FROM {video_zencoder} WHERE status=%d LIMIT %d", VIDEO_ZC_PENDING, $this->limit);
- while($row = db_fetch_object($sql)) {
- // We need to check if this file id exists in our S3 table to avoid filenot found error.
- $sql_video = db_query("SELECT * FROM {video_s3} WHERE fid=%d", $row->fid);
- if($sql_video_row = db_fetch_object($sql_video)) {
- // This is a s3 file, lets verify it has been pushed and if so lets push Zencoder queue.
- module_load_include('inc', 'video', '/includes/conversion');
- if($sql_video_row->status == VIDEO_ZC_ACTIVE) {
- $video = $sql_video_row;
- }
- }
- else {
- // This is a regular video file, lets get our file object from the files table and push it to amazon.
- $sql_files = db_query("SELECT * FROM {files} WHERE fid=%d", $row->fid);
- if($sql_files_row = db_fetch_object($sql_files)) {
- $video = $sql_files_row;
- }
- }
- // If we have a video lets go ahead and send it.
- if($video) {
- // Get Output file info
- // API Key
- $api_key = variable_get('zencoder_api_key', '');
-
- // Update our status to working.
- $this->working($row->vid);
- $filepath = $video->filepath;
- $filename = basename($video->filepath);
- if ($encoding_job = $this->create($video)) {
- // Update our table.
- $video->bucket = $this->bucket;
- $video->filename = $filename . '.flv';
- $video->filemime = 'video/x-flv';
- $video->vid = $row->vid;
- $video->jobid = $encoding_job->id;
- $video->outputid = $encoding_job->outputs["VIDEO" . $video->fid]->id;
- $prefix = $this->ssl ? 'https://' : 'http://';
- $video->filepath = $prefix . $video->bucket .'.s3.amazonaws.com/'. $filename . '.flv';
- if($this->update($video)) {
- watchdog('zencoder', t('Successfully created trancoding job on file: !file into the bucket %bucket on Zencoder.', array('!file' => $filepath, '%bucket' => $this->bucket)), array(), WATCHDOG_INFO);
- }
- }
- else {
- watchdog('zencoder', 'Failed to queus our file to Zencoder.', array(), WATCHDOG_ERROR);
- $this->failed($row->vid);
- }
- }
- else {
- watchdog('zencoder', 'We did not find the file id: '.$row->fid.' or it is still queued for ffmpeg processing or S3 push.', array(), WATCHDOG_DEBUG);
- }
- }
- }
-} \ No newline at end of file
diff --git a/plugins/video_zencoder/video_zencoder.admin.inc b/plugins/video_zencoder/video_zencoder.admin.inc
deleted file mode 100644
index 7dcfa7f..0000000
--- a/plugins/video_zencoder/video_zencoder.admin.inc
+++ /dev/null
@@ -1,302 +0,0 @@
-<?php
-// $Id$
-/**
- * @file
- * Provides admin functions for the s3 amazon webservices.
- */
-function video_zencoder_admin_settings() {
- global $user;
-
- $form = array();
- $form['zencoder_info'] = array(
- '#type' => 'fieldset',
- '#title' => t('Zencoder API'),
- '#collapsible' => FALSE,
- '#collapsed' => FALSE,
- );
-// $form['amazon_info']['zencoder_username'] = array(
-// '#type' => 'textfield',
-// '#title' => t('Your email address'),
-// '#default_value' => variable_get('zencoder_username', $user->mail),
-// '#size' => 50,
-// '#description' => t('Make sure the email is accurate, since we will send all the password details and API key details to this.')
-// );
-// $form['amazon_info']['agree_terms_zencoder'] = array(
-// '#type' => 'checkbox',
-// '#title' => t('Agree Zencoder Terms and Conditions.'),
-// '#default_value' => variable_get('agree_terms_zencoder', TRUE),
-// '#description' => t('Read terms and conditions on !link.', array('!link' => l(t('Zencoder.com'), 'http://zencoder.com'))),
-// );
- $form['zencoder_info']['zencoder_api_key'] = array(
- '#type' => 'textfield',
- '#title' => t('Zencoder API Key'),
- '#default_value' => variable_get('zencoder_api_key', ''),
- '#size' => 50,
- '#description' => t('Zencoder API Key if you don\'t have API key click here to generate one.')
- );
-
- $form['zencoder'] = array(
- '#type' => 'fieldset',
- '#title' => t("Zencoder Settings"),
- '#collapsed' => false,
- '#description' => t('All output settings are optional. We choose sensible defaults for web and iPhone playback.')
- );
-
- // Basic Video Settings
- $form['zencoder']['basic_video'] = array(
- '#type' => 'fieldset',
- '#title' => t("Basic Video Settings"),
- '#collapsed' => true,
- '#collapsible' => true,
- '#description' => t('')
- );
-
- $form['zencoder']['basic_video']['zc_width'] = array(
- '#type' => 'textfield',
- '#title' => t('Video width'),
- '#default_value' => variable_get('zc_width', ''),
- '#description' => t('Width of the converted video, of the format 600x400. This is the maximum width of the output video specified as a positive integer. In order for video compression to work properly the width should be divisible by 4 (or even better 16).'),
- '#size' => 12,
- );
- $form['zencoder']['basic_video']['zc_height'] = array(
- '#type' => 'textfield',
- '#title' => t('Video height'),
- '#default_value' => variable_get('zc_height', ''),
- '#description' => t('Width of the converted video, of the format 600x400. This is the maximum height of the output video specified as a positive integer. In order for video compression to work properly the height should be divisible by 4 (or even better 16).'),
- '#size' => 12,
- );
- $quality = array(
- 1=>'1 - Poor Quality (Smaller file)',
- 2=>2,
- 3=>'3 - Default',
- 4=>4,
- 5=>'5 - High Quality (Larger file)'
- );
- $form['zencoder']['basic_video']['zc_quality'] = array(
- '#type' => 'select',
- '#title' => t('Quality'),
- '#options' => $quality,
- '#default_value' => variable_get('zc_quality', 3),
- '#description' => t('This is the desired output video quality. A higher quality setting will mean higher bitrates and higher file sizes. A quality setting of 5 will be nearly lossless and a setting of 1 will be quite compressed and may not look great. Higher quality encoding is also a bit slower than lower quality encoding. As a rule of thumb, lowering quality by a level will reduce file size by about 40%. A quality setting of 3-4 usually looks pretty good. Note that the actual bitrate will vary when using the quality setting, depending on the type of video. Even at the same quality setting, low-complexity video (like a screencast) will generally result in lower bitrates than high-complexity video (like a movie).'),
- );
- $speed = array(
- 1=>'1 - Slow (Better Compression)',
- 2=>2,
- 3=>'3 - Default',
- 4=>4,
- 5=>'5 - Fast (Worst Compression)'
- );
- $form['zencoder']['basic_video']['zc_speed'] = array(
- '#type' => 'select',
- '#title' => t('Speed'),
- '#options' => $speed,
- '#default_value' => variable_get('zc_speed', 3),
- '#description' => t('This is the desired speed of encoding. A lower speed setting will mean slower encode times, but lower file sizes and better quality video. A high speed setting will transcode quickly, but compression will be less efficient and result in larger files with lower quality output.'),
- );
-
- // Advaced Video Settings
- $form['zencoder']['adv_video'] = array(
- '#type' => 'fieldset',
- '#title' => t("Advanced Video Settings"),
- '#collapsed' => true,
- '#collapsible' => true,
- '#description' => t('')
- );
-
- $form['zencoder']['adv_video']['zc_upscale'] = array(
- '#type' => 'checkbox',
- '#title' => t('Upscale?'),
- '#description' => t("If a video is received that is smaller than your maximum frame size (width and height settings), this setting will determine if we will increase the size of the input video to the supplied width and height. For example, if width is set to 640 and the input file is 320x240, the upscale option will force the output video to expand to 640x480. If false, the output video will match the input's original size."),
- '#default_value' => variable_get('zc_upscale', ''),
- );
- $form['zencoder']['adv_video']['zc_stretch'] = array(
- '#type' => 'checkbox',
- '#title' => t('Stretch?'),
- '#description' => t("If true, the aspect ratio of the original file may be distorted to fit the aspect ratio of the supplied width and height. By default, aspect ratio will always be preserved."),
- '#default_value' => variable_get('zc_stretch', ''),
- );
- $form['zencoder']['adv_video']['zc_frame_rate'] = array(
- '#type' => 'textfield',
- '#title' => t('Frame Rate '),
- '#default_value' => variable_get('zc_frame_rate', ''),
- '#description' => t('The output frame rate to use specified as a decimal number (e.g. 15 or 24.98). Unless you need to target a specific frame rate, you might be better off using Maximum Frame Rate setting. By default, the original frame rate will be preserved.'),
- '#size' => 12,
- );
- $form['zencoder']['adv_video']['zc_max_frame_rate'] = array(
- '#type' => 'textfield',
- '#title' => t('Maximum Frame Rate'),
- '#default_value' => variable_get('zc_max_frame_rate', ''),
- '#description' => t('The maximum frame rate to allow specified as a decimal number (e.g. 15 or 24.98). If the original frame rate is lower than this value, it will not be increased. Otherwise, it will be lowered to the max frame rate. By default, the original frame rate will be preserved.'),
- '#size' => 12,
- );
- $form['zencoder']['adv_video']['zc_key_frame_interval'] = array(
- '#type' => 'textfield',
- '#title' => t('Keyframe Interval'),
- '#default_value' => variable_get('zc_key_frame_interval', ''),
- '#description' => t('By default, a keyframe will be created every 250 frames. Specifying a keyframe interval will allow you to create more or less keyframes in your video. Sometimes the number of keyframes can affect video scrubbing. A greater number of keyframes will increase the size of your output file. Keyframe interval should be specified as a positive integer. For example, a value of 100 will create a keyframe every 100 frames.'),
- '#size' => 12,
- );
- $form['zencoder']['adv_video']['zc_vid_bit_rate'] = array(
- '#type' => 'textfield',
- '#title' => t('Video Bitrate'),
- '#default_value' => variable_get('zc_vid_bit_rate', ''),
- '#description' => t('The target video bitrate specified as kilobits per second (Kbps, e.g. 300 or 500). If you set quality, you don\'t need to set bitrate, unless you want to target a specific bitrate.'),
- '#size' => 12,
- );
- $form['zencoder']['adv_video']['zc_bit_rate_cap'] = array(
- '#type' => 'textfield',
- '#title' => t('Bitrate Cap'),
- '#default_value' => variable_get('zc_bit_rate_cap', ''),
- '#description' => t('A bitrate cap specified as kilobits per second (Kbps, e.g. 300 or 500). Specifying a quality alone will vary the bitrate to match the content of the video potentially introducing high peak bitrates. This setting will prevent peaks in the video bitrate, resulting in a file that looks worse but plays more smoothly. We recommend only using this for streaming or for devices that require it.'),
- '#size' => 12,
- );
- $form['zencoder']['adv_video']['zc_buffer_size'] = array(
- '#type' => 'textfield',
- '#title' => t('Buffer Size'),
- '#default_value' => variable_get('zc_buffer_size', ''),
- '#description' => t('The buffer size specified as kilobits per second (Kbps, e.g. 300 or 500). This is another setting useful for playback on specific devices. Check your streaming server or device settings for tips, or set this to the same as the bitrate cap.'),
- '#size' => 12,
- );
- $profile = array(
- 'baseline' => 'Baseline - Default',
- 'main' => 'Main',
- 'high' => 'High - Best for web playback'
- );
- $form['zencoder']['adv_video']['zc_h245_profile'] = array(
- '#type' => 'select',
- '#title' => t('H.264 Profile'),
- '#options' => $profile,
- '#default_value' => variable_get('zc_h245_profile', 1),
- '#description' => t('The H.264 standard defines various sets of capabilities, which are referred to as profiles, targeting specific classes of applications. The currently supported profiles are baseline, main, and high. The baseline profile will produce video that looks worse, but requires less CPU on playback and is required for playback on some devices (e.g. iPhone or iPod). The high profile will look best, but can be CPU intensive to playback. By default, the baseline profile will be used to maximize compatibility.'),
- );
- $level = array(
- '' => '',
- '1' => '1',
- '1.1' => '1.1',
- '1.2' => '1.2',
- '1.3' => '1.3',
- '2' => '2',
- '2.1' => '2.1',
- '2.2' => '2.2',
- '3' => '3',
- '3.1' => '3.1',
- '3.2' => '3.2',
- '4' => '4',
- '4.1' => '4.1',
- '4.2' => '4.2',
- '5' => '5',
- '5.1' => '5.1'
- );
- $form['zencoder']['adv_video']['zc_h245_level'] = array(
- '#type' => 'select',
- '#title' => t('H.264 Level'),
- '#options' => $level,
- '#default_value' => variable_get('zc_h245_level', 0),
- '#description' => t('Similar to profiles, the H.264 standard defines various levels that will limit the size and complexity of the output file. We recommend leaving this blank unless your output device requires it. iPhone video can\'t exceed level 3, Blu-Ray is 4.1, and older iPods max out at 1.3. By default, level 3 will be used to ensure iPhone playback.'),
- );
- $form['zencoder']['adv_video']['zc_skip_video'] = array(
- '#type' => 'checkbox',
- '#title' => t('Skip Video'),
- '#description' => t("The video track will be omitted from the output. You can still specify a video format, however, no video track will be present in the resulting file."),
- '#default_value' => variable_get('zc_skip_video', ''),
- );
-
- // Advanced Audio Settings
- $form['zencoder']['adv_audio'] = array(
- '#type' => 'fieldset',
- '#title' => t("Advanced Audio Settings"),
- '#collapsed' => true,
- '#collapsible' => true,
- '#description' => t('')
- );
- $audio_codec = array(
- 'aac' => 'AAC - Default',
- 'mp3' => 'MP3'
- );
- $form['zencoder']['adv_audio']['zc_audio_codec'] = array(
- '#type' => 'select',
- '#title' => t('Audio Codec'),
- '#options' => $audio_codec,
- '#default_value' => variable_get('zc_audio_codec', 'aac'),
- '#description' => t('The audio codec used in the video file can affect the ability to play the video on certain devices. The default codec used is AAC and should only be changed if the playback device you are targeting requires something different.'),
- );
- $form['zencoder']['adv_audio']['zc_audio_bitrate'] = array(
- '#type' => 'textfield',
- '#title' => t('Audio Bitrate'),
- '#default_value' => variable_get('zc_audio_bitrate', ''),
- '#description' => t('The overall audio bitrate specified as kilobits per second (Kbps, e.g. 96 or 160). This value can\'t exceed 160 Kbps per channel. 96-160 is usually a good range for stereo output.'),
- '#size' => 12,
- );
- $audio_channel = array(
- 1 => 'Mono',
- 2 => 'Stereo - Default'
- );
- $form['zencoder']['adv_audio']['zc_audio_channels'] = array(
- '#type' => 'select',
- '#title' => t('Audio Channels'),
- '#options' => $audio_channel,
- '#default_value' => variable_get('zc_audio_channels', 2),
- '#description' => t('By default we will choose the lesser of the number of audio channels in the input file or 2 (stereo).'),
- );
- $form['zencoder']['adv_audio']['zc_audio_sample_rate'] = array(
- '#type' => 'textfield',
- '#title' => t('Audio Sample Rate'),
- '#default_value' => variable_get('zc_audio_sample_rate', ''),
- '#description' => t('The sample rate of the audio file specified in hertz (e.g. 44100 or 22050). A sample rate of 44100 is the best option for web playback. 22050 and 48000 are also valid options. Warning: the wrong setting may cause encoding problems. By default, 44100 will be used.'),
- '#size' => 12,
- );
- $form['zencoder']['adv_audio']['zc_skip_audio'] = array(
- '#type' => 'checkbox',
- '#title' => t('Skip Audio'),
- '#description' => t("The audio track will be omitted from the output. You must specify a video format and no audio track will be present in the resulting file."),
- '#default_value' => variable_get('zc_skip_audio', ''),
- );
-
- // Notification Settings
- $form['zencoder']['notification'] = array(
- '#type' => 'fieldset',
- '#title' => t("Notification Settings"),
- '#collapsed' => true,
- '#collapsible' => true,
- '#description' => t('')
- );
- $form['zencoder']['notification']['zc_notify_url'] = array(
- '#type' => 'textfield',
- '#title' => t('URL'),
- '#default_value' => variable_get('zc_notify_url', ''),
- '#description' => t('We will POST a JSON notification to the URL provided. We will consider the notification successful if we receive a 200 OK response.'),
- );
- $form['zencoder']['notification']['zc_notify_email'] = array(
- '#type' => 'textfield',
- '#title' => t('Email Address'),
- '#default_value' => variable_get('zc_notify_email', ''),
- '#description' => t('We will send a notification email to the URL provided. The notification will contain basic file status information.'),
- );
-
-
- // Other Settings
- $form['zencoder']['other'] = array(
- '#type' => 'fieldset',
- '#title' => t("Other Settings"),
- '#collapsed' => true,
- '#collapsible' => true,
- '#description' => t('')
- );
- $form['zencoder']['other']['zc_start_clip'] = array(
- '#type' => 'textfield',
- '#title' => t('Start Clip'),
- '#default_value' => variable_get('zc_start_clip', ''),
- '#description' => t('Creates a subclip from the input file, starting at either a timecode or a number of seconds. Format: 0:01:23.6 or 88.6 for 1 minute and 23.6 seconds.'),
- '#size' => 12,
- );
- $form['zencoder']['other']['zc_clip_length'] = array(
- '#type' => 'textfield',
- '#title' => t('Clip Length'),
- '#default_value' => variable_get('zc_clip_length', ''),
- '#description' => t('Creates a subclip from the input file of the specified length using either a timecode or a number of seconds. Format: 0:00:45.3 or 45.3 for 45.3 seconds.'),
- '#size' => 12,
- );
-
- return system_settings_form($form);
-}
-
diff --git a/plugins/video_zencoder/video_zencoder.info b/plugins/video_zencoder/video_zencoder.info
deleted file mode 100644
index 0d4c214..0000000
--- a/plugins/video_zencoder/video_zencoder.info
+++ /dev/null
@@ -1,10 +0,0 @@
-;$Id$
-name = Zencoder API on Video
-description = Zencoder is a webservice to transcode videos.
-package = "Video"
-dependencies[] = video
-dependencies[] = video_s3
-core = 7.x
-files[]=video_zencoder.modules
-files[]=video_zencoder.install
-files[]=video_zencoder.admin.inc \ No newline at end of file
diff --git a/plugins/video_zencoder/video_zencoder.install b/plugins/video_zencoder/video_zencoder.install
deleted file mode 100644
index 31c54a1..0000000
--- a/plugins/video_zencoder/video_zencoder.install
+++ /dev/null
@@ -1,116 +0,0 @@
-<?php
-// $Id$
-/**
- * @file
- * Provides installation functions for video_s3.module.
- */
-
-/**
- * Implementation of hook_schema().
- */
-function video_zencoder_schema() {
- $schema['video_zencoder'] = array(
- 'description' => t('Store video s3 cdn and convert with zencoder webservice'),
- 'fields' => array(
- 'vid' => array(
- 'description' => t('Auto Increment id'),
- 'type' => 'serial',
- 'unsigned' => TRUE,
- 'not null' => TRUE,
- ),
- 'fid' => array(
- 'description' => t('Original file id'),
- 'type' => 'int',
- 'unsigned' => TRUE,
- 'not null' => TRUE,
- 'default' => 0,
- ),
- 'nid' => array(
- 'description' => t('Node id'),
- 'type' => 'int',
- 'unsigned' => TRUE,
- 'not null' => TRUE,
- 'default' => 0,
- ),
- 'jobid' => array(
- 'description' => t('Job id'),
- 'type' => 'int',
- 'unsigned' => TRUE,
- 'not null' => TRUE,
- 'default' => 0,
- ),
- 'outputid' => array(
- 'description' => t('Job Output id'),
- 'type' => 'int',
- 'unsigned' => TRUE,
- 'not null' => TRUE,
- 'default' => 0,
- ),
- 'bucket' => array(
- 'type' => 'varchar',
- 'length' => '255',
- 'default' => '',
- 'description' => t('The bucket the video is stored in.'),
- ),
- 'filename' => array(
- 'type' => 'varchar',
- 'length' => '255',
- 'default' => '',
- 'description' => t('The filename of the video.'),
- ),
- 'filepath' => array(
- 'type' => 'varchar',
- 'length' => '255',
- 'default' => '',
- 'description' => t('The filepath of the video.'),
- ),
- 'filemime' => array(
- 'type' => 'varchar',
- 'length' => '255',
- 'default' => '',
- 'description' => t('The filemime of the video.'),
- ),
- 'filesize' => array(
- 'description' => t('Filesize of the video.'),
- 'type' => 'int',
- 'unsigned' => TRUE,
- 'not null' => TRUE,
- 'default' => 0,
- ),
- 'status' => array(
- 'description' => t('Status of the cdn transfer'),
- 'type' => 'int',
- 'unsigned' => TRUE,
- 'not null' => TRUE,
- 'default' => 0,
- ),
- 'completed' => array(
- 'description' => t('Time of successful completion to amazon.'),
- 'type' => 'int',
- 'not null' => TRUE,
- 'default' => 0,
- ),
- ),
- 'indexes' => array(
- 'status' => array('status'),
- 'file' => array('fid'),
- ),
- 'primary key' => array('vid'),
- );
- return $schema;
-}
-
-/**
- * Implementation of hook_install().
- */
-function video_zencoder_install() {
- drupal_install_schema('video_zencoder');
-}
-
-/**
- * Implementation of hook_uninstall().
- */
-function video_zencoder_uninstall() {
- drupal_uninstall_schema('video_zencoder');
- // TODO : Delete our variables.
-} \ No newline at end of file
diff --git a/plugins/video_zencoder/video_zencoder.module b/plugins/video_zencoder/video_zencoder.module
deleted file mode 100644
index 042b2c3..0000000
--- a/plugins/video_zencoder/video_zencoder.module
+++ /dev/null
@@ -1,104 +0,0 @@
-<?php
-// $Id$
-/**
- * @file
- * Provides wrapper functions for the s3 amazon webservices.
- */
-
-/*
- * Implementation of hook_perm().
- */
-function video_zencoder_perm() {
- return array('administer zencoder');
-}
-/*
- * Implmentation of hook_help().
- */
-function video_zencoder_help($path, $arg) {
- switch($path) {
- case 'admin/settings/video/amazon_s3':
- $output = t('Use Amazon Simple Storage Service (Amazon S3) to store your video files. This free\'s up bandwidth from your site, providing a faster experience for your users. Simply enable this module and enter your authentication details and your done!');
- return $output;
- }
-}
-
-/*
- * Implementation of hook_menu().
- */
-function video_zencoder_menu() {
- $items = array();
- $items['admin/settings/video/zencoder'] = array(
- 'title' => 'Zencoder',
- 'description' => 'Configure your Zencoder API settings.',
- 'page callback' => 'drupal_get_form',
- 'page arguments' => array('video_zencoder_admin_settings'),
- 'access arguments' => array('administer site configuration'),
- 'file' => 'video_zencoder.admin.inc',
- 'type' => MENU_LOCAL_TASK,
- 'weight' => 10,
- );
- return $items;
-}
-
-/*
- * Implementation of hook_cron().
- */
-function video_zencoder_cron() {
- module_load_include('inc', 'video_zencoder', '/includes/zencoder');
- $zc = new video_zencoder_api;
-// $s3->connect();
-// // Lets run our queue.
- $zc->queue();
-}
-
-/**
- * Implementation of hook_file_delete().
- */
-function video_zencoder_file_delete($file) {
- module_load_include('inc', 'video_zencoder', '/includes/zencoder');
- $zc = new video_zencoder_api;
- // Lets run delete.
- $zc->delete($file->fid);
-}
-
-/*
- * Implementation of hook_form_alter().
- */
-function video_zencoder_form_alter(&$form, &$form_state, $form_id) {
- if (isset($form['type']) && isset($form['#node']) && $form['type']['#value'] .'_node_form' == $form_id) {
- $form['buttons']['submit']['#submit'][] = 'video_zencoder_node_update_submit';
- }
-}
-
-/*
- * Submit hanlder to update our s3 table to include the node id.
- */
-function video_zencoder_node_update_submit($form, &$form_state) {
- //lets update our video rending table to include the node id created
- if (isset($form_state['nid']) && isset($form_state['values']['video_id']) && is_array($form_state['values']['video_id'])) {
- foreach($form_state['values']['video_id'] as $fid) {
- //lets update our table to include the nid
- db_query("UPDATE {video_zencoder} SET nid=%d WHERE fid=%d", $form_state['nid'], $fid);
- }
- }
-}
-
-/**
- * Implementing hook_video_submit
- * @param <type> $element
- * @param <type> $form_state
- */
-function video_zencoder_video_submit(&$element, &$form_state) {
- $file = $element['#value'];
- //we need to check if this fid has already been added to the database AND that there is in fact a fid
- if (is_array($file) && isset($file['fid']) && !empty($file['fid'])) {
- module_load_include('inc', 'video_zencoder', '/includes/zencoder');
- $zc = new video_zencoder_api;
- // Lets verify that we haven't added this video already. Multiple validation fails will cause this to be ran more than once
- if(!$video = $zc->verify($file['fid'])) {
- // Video has not been added to the queue yet so lets add it.
- $zc->insert($file['fid'], $jobid);
- drupal_set_message(t('Video submission queued for transfer to your Zencoder Transcoding server. Will be there shortly.'));
- }
- }
-} \ No newline at end of file
diff --git a/plugins/zencoder.inc b/plugins/zencoder.inc
deleted file mode 100644
index 989222b..0000000
--- a/plugins/zencoder.inc
+++ /dev/null
@@ -1,307 +0,0 @@
-<?php
-//$Id$
-
-/**
- * @file
- * Provide a api for video conversion and auto thumbnailing using ffmpeg.
- *
- * @author Heshan Wanigasooriya <heshan at heidisoft.com, heshanmw at gmail dot com>
- * TODO: add common settings from video module configurations and extend it from ffmpeg.inc
- * since we need to have executable path of ffmpeg to ffmpeg.inc we need to have it
- */
-
-/**
- * Define some constants
- */
-defined('VIDEO_RENDERING_PENDING')
- or define('VIDEO_RENDERING_PENDING', 1);
-defined('VIDEO_RENDERING_ACTIVE')
- or define('VIDEO_RENDERING_ACTIVE', 5);
-defined('VIDEO_RENDERING_COMPLETE')
- or define('VIDEO_RENDERING_COMPLETE', 10);
-defined('VIDEO_RENDERING_FAILED')
- or define('VIDEO_RENDERING_FAILED', 20);
-
-// nice value to append at the beginning of the command
-defined('VIDEO_RENDERING_NICE')
- or define('VIDEO_RENDERING_NICE', 'nice -n 19');
-
-// curl related data
-defined('HTTP_CONNECT_TIMEOUT')
- or define('HTTP_CONNECT_TIMEOUT', 600);
-defined('HTTP_LOW_SPEED_LIMIT')
- or define('HTTP_LOW_SPEED_LIMIT', 256);
-defined('HTTP_LOW_SPEED_TIMEOUT')
- or define('HTTP_LOW_SPEED_TIMEOUT', 600);
-
-
-// TODO : add cron API to video module
-function zencoder_cron() {
- global $base_url;
-
- if(variable_get('video_zencoder_helper_auto_cvr_cron', true)) {
- exec("php video_scheduler.php $base_url > /dev/null &");
- }
-}
-
-
-/**
- * Get some informations from the video file
- */
-function zencoder_get_video_info($vidfile) {
- static $zencoder_info;
- $fid = $vidfile['fid'];
- // $command_output = cache_get($fid);
- // if(empty($command_output)) {
- // escape file name for safety
- $file = escapeshellarg($vidfile['filepath']);
- // create the full command to execute
- $command = variable_get('video_transcoder_path', '/usr/bin/ffmpeg') . ' -i ' . $file;
-
- //execute the command
- ob_start();
- passthru($command." 2>&1", $command_return);
- $command_output = ob_get_contents();
- ob_end_clean();
-
- // cache the result for further calls
- // $zencoder_info[$vidfile['fid']] = $command_output;
- // cache_set($vidfile['fid'], $command_output);
- // }
-
- return $command_output;
-}
-
-
-/**
- * Return the video resolution
- */
-function zencoder_auto_resolution(&$node) {
-
- if(!variable_get('video_zencoder_helper_auto_resolution', false)) {
-
- // call ffmpeg -i
- $zencoder_output = zencoder_get_video_info($node);
-
- // get resolution
- $pattern = '/Video: .*, ([0-9]{2,4}x[0-9]{2,4})/';
- preg_match_all($pattern, $zencoder_output, $matches, PREG_PATTERN_ORDER);
- $resolution = $matches[1][0];
-
- return explode("x", $resolution);
- }
- return null;
-}
-
-
-/**
- * Return the playtime seconds of a video
- */
-function zencoder_auto_playtime($file) {
-
- if(!variable_get('video_zencoder_helper_auto_playtime', false)) {
-
- // call ffmpeg -i
- $zencoder_output = zencoder_get_video_info($file);
-
- // get playtime
- $pattern = '/Duration: ([0-9]{2}:[0-9]{2}:[0-9]{2}\.[0-9])/';
- preg_match_all($pattern, $zencoder_output, $matches, PREG_PATTERN_ORDER);
- $playtime = $matches[1][0];
-
- // ffmpeg return lenght as 00:00:31.1 Let's get playtime from that
- $hmsmm = explode(":", $playtime);
-
- $tmp = explode(".", $hmsmm[2]);
- $seconds = $tmp[0];
-
- $hours = $hmsmm[0];
- $minutes = $hmsmm[1];
-
- return $seconds + ($hours * 3600) + ($minutes * 60);
- }
-}
-
-/**
- * Generates a thumbnail from the video file
- * Implementing hook_auto_thumbnail on inc
- *
- * @param $vidfile
- * object with element information
- *
- * @return
- * a drupal file objects
- */
-function zencoder_auto_thumbnail($vidfile) {
- global $user;
- $uploaded_file = $vidfile;
- $fid = $uploaded_file["fid"];
-
- // are we debugging?
- // escape the filename for safety
- $videofile = escapeshellarg($uploaded_file['filepath']);
- $thumb_path = variable_get('video_thumb_path', 'video_thumbs');
- //files will save in files/video_thumbs/#fileId folder
- $tmp = file_directory_path(). '/' . $thumb_path . '/' . $fid;
- // Ensure the destination directory exists and is writable.
- $directories = explode('/', $tmp);
- // array_pop($directories); // Remove the file itself.
- // Get the file system directory.
- $file_system = file_directory_path();
- foreach ($directories as $directory) {
- $full_path = isset($full_path) ? $full_path . '/' . $directory : $directory;
- // Don't check directories outside the file system path.
- if (strpos($full_path, $file_system) === 0) {
- field_file_check_directory($full_path, FILE_CREATE_DIRECTORY);
- }
- }
- $count = variable_get('no_of_video_thumbs', 5);
- $duration = zencoder_auto_playtime($vidfile);
- $files = NULL;
- for($i = 1; $i <= $count; $i++) {
- // get ffmpeg configurations
- $seek = ($duration/$count) * $i;
- $thumbfile = $tmp . "/video-thumb-for-$fid-$i.png";
- //skip files already exists, this will save ffmpeg traffic
- if (!is_file($thumbfile)) {
- $tnail = variable_get('video_transcoder_path', '/usr/bin/ffmpeg');
- $options = preg_replace(array('/%videofile/', '/%thumbfile/', '/%seek/'), array($videofile, $thumbfile, $seek), variable_get('video_zencoder_thumbnailer_options', '-i %videofile -an -y -f mjpeg -ss %seek -vframes 1 %thumbfile'));
- // $options = preg_replace(array('/%videofile/', '/%tmp/', '/%id/', '/%interval/'), array($videofile, $tmp, $i, ($duration/$count)), variable_get('video_image_thumbnailer_options', '-ss %id*%interval -i %videofile -vframes 1 %thumbfile'));
- // ffmpeg -ss $i*$interval -i intro.mov -vframes 1 -s 320x240 thumb_$i.jpg
- //ffmpeg -i superstunt_8uiarzrh.mp4 -r 0.1 -ss 00:00:5 -f image2 img/images%02d.png
- ////ffmpeg -i superstunt_8uiarzrh.mp4 -r 0.05 -ss 00:00:5 -f image2 img/images%1d.jpg
- // executes the command
- $command = "$tnail $options";
- ob_start();
- passthru($command." 2>&1", $tnail_return);
- $tnail_output = ob_get_contents();
- ob_end_clean();
- if (!file_exists($thumbfile)) {
- $error_param = array(
- '%file' => $thumbfile,
- '%cmd' => $command,
- '%out' => $tnail_output,
- );
- $error_msg = t("error generating thumbnail for video: generated file %file does not exist.<br />Command Executed:<br />%cmd<br />Command Output:<br />%out", $error_param);
- // let's log this
- watchdog('video_ffmpeg',$error_msg, array(), WATCHDOG_ERROR);
- }
- }
- // Begin building file object.
- //TODO : use file_munge_filename()
- $file = new stdClass();
- $file->uid = $user->uid;
- $file->status = FILE_STATUS_TEMPORARY;
- $file->filename = trim("video-thumb-for-$fid-$i.png");
- $file->filepath = $thumbfile;
- $file->filemime = file_get_mimetype("video-thumb-for-$fid-$i.png");
- $file->filesize = filesize($thumbfile);
- $file->timestamp = REQUEST_TIME;
- $files[] = $file;
- }
- return $files;
-}
-
-/**
- * Implementing hook_chcek_exepath() on inc
- * To check the the path is executable or not
- * @param <type> path to check
- * @return bool TRUE/FALSE
- */
-function zencoder_check_exe_path($path=NULL) {
- if (!$path) {
- $path = variable_get('video_transcoder_path', '/usr/bin/ffmpeg');
- }
- if (function_exists('is_executable')) {
- $test = 'is_executable';
- } else {
- $test = 'file_exists';
- }
- return $test($path);
-}
-
-/**
- * Implementing hook_auto_convert();
- * @param <type> $job
- */
-function zencoder_auto_convert(&$job) {
- $videofile = escapeshellarg($job->filepath); // escape file name for safety
- $convfile = tempnam(file_directory_temp(), 'video-rendering');
- $audiobitrate = variable_get('video_zencoder_helper_auto_cvr_audio_bitrate', 64);
- $videobitrate = variable_get('video_zencoder_helper_auto_cvr_video_bitrate', 200);
- $size = _video_render_get_size();
- $converter = variable_get('video_transcoder_path', '/usr/bin/ffmpeg');
-
- $options = preg_replace(array('/%videofile/', '/%convertfile/', '/%audiobitrate/', '/%size/', '/%videobitrate/'),
- array($videofile, $convfile, $audiobitrate, $size, $videobitrate),
- variable_get('video_zencoder_helper_auto_cvr_options',
- '-y -i %videofile -f flv -ar 22050 -ab %audiobitrate -s %size -b %videobitrate -qscale 1 %convertfile'));
-
- // set to the converted file output
- $job->convfile = $convfile;
-
- $command = VIDEO_RENDERING_NICE . " $converter $options";
-
- //print('executing ' . $command); die;
- watchdog('video_render', 'executing: ' . $command, array(), WATCHDOG_DEBUG);
-// watchdog('video_render', 'Starting : ' . REQUEST_TIME);
- //execute the command
- ob_start();
- passthru($command." 2>&1", $command_return);
- $command_output = ob_get_contents();
- ob_end_clean();
-// watchdog('video_render', 'Completed');
- //print $command_output;
-
- if (!file_exists($job->convfile) || !filesize($job->convfile)) {
- watchdog('video_render', 'video conversion failed. ffmpeg reported the following output: ' . $command_output, array(), WATCHDOG_ERROR);
- // _video_render_set_video_encoded_fid($job->nid, $job->vid, -1);
- // _video_render_job_change_status($job->nid, $job->vid, VIDEO_RENDERING_FAILED);
- }
- else {
- $file_name = basename($job->filename . ".flv");
- $file = new stdClass();
- $file->uid = $job->uid;
- $file->status = FILE_STATUS_PERMANENT;
- $file->filename = basename($file_name);
- $file->filepath = $job->convfile;
- $file->filemime = file_get_mimetype($file_name);
- $file->filesize = filesize($job->convfile);
- $file->timestamp = REQUEST_TIME;
-
- $job->converted = $file;
- }
-}
-
-
-/**
- * Calculate the converted video size basing on the width set on administration.
- * Aspect ration is maintained.
- */
-//function _video_render_get_size() {
-// return variable_get('video_zencoder_width', 640) . 'x' . variable_get('video_zencoder_height', 480);
-//}
-
-
-function _video_curl_post($url, $fields, &$output) {
-
- $options = array(
- CURLOPT_POST => TRUE,
- CURLOPT_POSTFIELDS => $fields,
- CURLOPT_CONNECTTIMEOUT => HTTP_CONNECT_TIMEOUT,
- CURLOPT_LOW_SPEED_LIMIT => HTTP_LOW_SPEED_LIMIT,
- CURLOPT_LOW_SPEED_TIME => HTTP_LOW_SPEED_TIMEOUT,
- CURLOPT_RETURNTRANSFER => TRUE
- );
-
- $ch = curl_init($url);
- curl_setopt_array($ch, $options);
- $output = curl_exec($ch);
- $http_code = curl_getinfo($ch, CURLINFO_HTTP_CODE);
- curl_close($ch);
-
- return $http_code;
-}
-
-/** S3 API functions **/
-/** ---------------- **/
diff --git a/theme/video-play-dcr.tpl.php b/theme/video-play-dcr.tpl.php
deleted file mode 100644
index 576e52c..0000000
--- a/theme/video-play-dcr.tpl.php
+++ /dev/null
@@ -1,17 +0,0 @@
-<?php
-//$Id$
-/*
- * @file
- * Theme file to handle director output.
- *
- * Variables passed.
- * $video is the video object.
- * $node is the node object.
- */
-?>
-<object classid="clsid:166B1BCA-3F9C-11CF-8075-444553540000" type="application/x-director" width="<?php print $video->player_width; ?>" height="<?php print $video->player_height; ?>" codebase="http://download.macromedia.com/pub/shockwave/cabs/director/sw.cab#version=10,0,0,0">
- <param name="src" value="<?php print $video->url; ?>" />
- <object class="video-object" type="application/x-director" data="<?php print $video->url; ?>" width="<?php print $video->player_width; ?>" height="<?php print $video->player_height; ?>" mode="zero">
- <?php print t('No video? Get the Director !plugin', array('!plugin' => l(t('Plugin'), 'http://www.macromedia.com/shockwave/download/'))); ?>
- </object>
-</object> \ No newline at end of file
diff --git a/theme/video-play-divx.tpl.php b/theme/video-play-divx.tpl.php
deleted file mode 100644
index e5e7f35..0000000
--- a/theme/video-play-divx.tpl.php
+++ /dev/null
@@ -1,20 +0,0 @@
-<?php
-//$Id$
-/*
- * @file
- * Theme file to handle divx output.
- *
- * Variables passed.
- * $video is the video object.
- * $node is the node object.
- *
- */
-?>
-<object classid="clsid:67DABFBF-D0AB-41fa-9C46-CC0F21721616" width="<?php print $video->player_width; ?>" height="<?php print $video->player_height; ?>" codebase="http://go.divx.com/plugin/DivXBrowserPlugin.cab">
- <param name="src" value="<?php print $video->url; ?>" />
- <param name="pluginspage" value="http://go.divx.com/plugin/download/" />
- <param name="mode" value="zero" />
- <object class="video-object" type="video/divx" data="<?php print $video->url; ?>" width="<?php print $video->player_width; ?>" height="<?php print $video->player_height; ?>" mode="zero">
- <?php print t('No video? Get the DivX Web Player !plugin', array('!plugin' => l(t('Plugin'), 'http://go.divx.com/plugin/download/'))); ?>
- </object>
-</object> \ No newline at end of file
diff --git a/theme/video-play-flash.tpl.php b/theme/video-play-flash.tpl.php
deleted file mode 100644
index a559976..0000000
--- a/theme/video-play-flash.tpl.php
+++ /dev/null
@@ -1,20 +0,0 @@
-<?php
-//$Id$
-/*
- * @file
- * Theme file to handle flash output.
- *
- * Variables passed.
- * $video is the video object.
- * $node is the node object.
- *
- */
-?>
-<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" width="<?php print $video->player_width; ?>" height="<?php print $video->player_height; ?>" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,40,0">
- <param name="movie" value="<?php print $video->url; ?>" />
- <param name="autoplay" value="<?php print $video->autoplay; ?>" />
- <param name="wmode" value="transparent" />
- <object class="video-object" type="application/x-shockwave-flash" data="<?php print $video->url; ?>" width="<?php print $video->player_width; ?>" height="<?php print $video->player_height; ?>">
- <?php print t('No video? Get the Adobe Flash !plugin', array('!plugin' => l(t('Plugin'), 'http://get.adobe.com/flashplayer/'))); ?>
- </object>
-</object> \ No newline at end of file
diff --git a/theme/video-play-flv.tpl.php b/theme/video-play-flv.tpl.php
deleted file mode 100644
index 661ad04..0000000
--- a/theme/video-play-flv.tpl.php
+++ /dev/null
@@ -1,14 +0,0 @@
-<?php
-//$Id$
-/*
- * @file
- * Theme file to handle flv output.
- *
- * Variables passed.
- * $video is the video object.
- * $node is the node object.
- * $themed_output is the rendered html.
- *
- */
-print $themed_output;
-?> \ No newline at end of file
diff --git a/theme/video-play-quicktime.tpl.php b/theme/video-play-quicktime.tpl.php
deleted file mode 100644
index 7e4fb29..0000000
--- a/theme/video-play-quicktime.tpl.php
+++ /dev/null
@@ -1,32 +0,0 @@
-<?php
-//$Id$
-/*
- * @file
- * Theme file to handle quicktime output.
- *
- * Variables passed.
- * $video is the video object.
- * $node is the node object.
- *
- *
- * <script type="text/javascript" src="/sites/all/libraries/quicktime/AC_QuickTime.js"></script>
- * <script type="text/javascript">
- * QT_WriteOBJECT('<?php print $video->url; ?>' , '<?php print $video->width; ?>', '<?php print $video->height; ?>' , '');
- * </script>
- */
-?>
-<object classid="clsid:02BF25D5-8C17-4B23-BC80-D3488ABDDC6B" codebase="http://www.apple.com/qtactivex/qtplugin.cab#version=7,3,0,0" width="<?php print $video->player_width; ?>" height="<?php print $video->player_height; ?>">
- <param name="src" value="<?php print $video->url; ?>" />
- <param name="controller" value="true" />
- <param name="scale" value="tofit" />
- <param name="autoplay" value="<?php print $video->autoplay ? 'true' : 'false'; ?>" />
- <param name="pluginurl" value="http://www.apple.com/quicktime/download/" />
- <embed src="<?php print $video->url; ?>"
- type="video/quicktime"
- pluginspage="http://www.apple.com/quicktime/download/"
- width="<?php print $video->player_width; ?>"
- height="<?php print $video->player_height; ?>"
- autostart="<?php print $video->autoplay ? 'true' : 'false'; ?>"
- controller="true" >
- </embed>
-</object> \ No newline at end of file
diff --git a/theme/video-play-realmedia.tpl.php b/theme/video-play-realmedia.tpl.php
deleted file mode 100644
index 8048c5c..0000000
--- a/theme/video-play-realmedia.tpl.php
+++ /dev/null
@@ -1,22 +0,0 @@
-<?php
-//$Id$
-/*
- * @file
- * Theme file to handle realmedia output.
- *
- * Variables passed.
- * $video is the video object.
- * $node is the node object.
- *
- */
-?>
-<object classid="clsid:CFCDAA03-8BE4-11cf-B84B-0020AFBBCCFA" width="<?php print $video->player_width; ?>" height="<?php print $video->player_height; ?>">
- <param name="src" value="<?php print $video->url; ?>" />
- <param name="autostart" value="<?php print $video->autoplay; ?>" />
- <param name="controls" value="imagewindow" />
- <param name="console" value="video" />
- <param name="loop" value="false" />
- <object class="video-object" type="audio/x-pn-realaudio-plugin" data="<?php print $video->url; ?>" width="<?php print $video->player_width; ?>" height="<?php print $video->player_height; ?>">
- <?php print t('No video? Get the Real Media !plugin', array('!plugin' => l(t('Plugin'), 'http://www.real.com/realplayer'))); ?>
- </object>
-</object> \ No newline at end of file
diff --git a/theme/video-play-theora.tpl.php b/theme/video-play-theora.tpl.php
deleted file mode 100644
index 1b759ee..0000000
--- a/theme/video-play-theora.tpl.php
+++ /dev/null
@@ -1,23 +0,0 @@
-<?php
-//$Id$
-/*
- * @file
- * Theme file to handle ogg theora output.
- *
- * Variables passed.
- * $video is the video object.
- * $node is the node object.
- *
- */
-?>
-<applet=code="com.fluendo.player.Cortado.class" archive="<?php print $video->theora_player; ?>" width="<?php print $video->player_width; ?>" height="<?php print $video->player_height; ?>">
- <param name="url" value="<?php print $video->url; ?>" />
- <param name="local" value="false" />
- <param name="mode" value="zero" />
- <param name="keepaspect" value="true" />
- <param name="video" value="true" />
- <param name="audio" value="true" />
- <param name="seekable" value="true" />
- <param name="bufferSize" value="200" />
- <?php print t('No video? Get the Latest Cortado !plugin', array('!plugin' => l(t('Plugin'), 'http://www.theora.org/cortado/'))); ?>
-</applet> \ No newline at end of file
diff --git a/theme/video-play-windowsmedia.tpl.php b/theme/video-play-windowsmedia.tpl.php
deleted file mode 100644
index c7a1026..0000000
--- a/theme/video-play-windowsmedia.tpl.php
+++ /dev/null
@@ -1,21 +0,0 @@
-<?php
-//$Id$
-/*
- * @file
- * Theme file to handle windows media output.
- *
- * Variables passed.
- * $video is the video object.
- * $node is the node object.
- *
- */
-?>
-
-<object type="video/x-ms-wmv" data="<?php print $video->url; ?>" width="<?php print $video->player_width; ?>" height="<?php print $video->player_height; ?>">
- <param name="src" value="<?php print $video->url; ?>" valuetype="ref" type="<?php print $video->url; ?>">
- <param name="animationatStart" value="true">
- <param name="transparentatStart" value="true">
- <param name="autostart" value="<?php print $video->autoplay; ?>">
- <param name="controller" value="1">
- <?php print t('No video? Get the Windows Media !plugin', array('!plugin' => l(t('Plugin'), 'http://www.microsoft.com/windows/windowsmedia/player/download/'))); ?>
-</object> \ No newline at end of file
diff --git a/transcoders/video_ffmpeg.inc b/transcoders/video_ffmpeg.inc
deleted file mode 100644
index 713693a..0000000
--- a/transcoders/video_ffmpeg.inc
+++ /dev/null
@@ -1,312 +0,0 @@
-<?php
-//$Id$
-/*
- * @file
- * Transcoder class file to handle ffmpeg settings and conversions.
- *
- */
-
-
-class video_ffmpeg implements transcoder_interface {
- // Naming for our radio options. Makes it easy to extend our transcoders.
- private $name = 'FFmpeg';
- private $value = 'video_ffmpeg';
-
- protected $params = array();
- protected $audio_bitrate = 64;
- protected $video_bitrate = 200;
- protected $video_width = 640;
- protected $video_height = 480;
- protected $command = '-y -i !videofile -f flv -ar 22050 -ab !audiobitrate -s !size -b !videobitrate -qscale 1 !convertfile';
- protected $thumb_command = '-i !videofile -an -y -f mjpeg -ss !seek -vframes 1 !thumbfile';
- protected $ffmpeg = '/usr/bin/ffmpeg';
- protected $nice;
- protected $video_ext = 'flv';
-
- public function __construct() {
- $this->params['audiobitrate'] = variable_get('video_ffmpeg_helper_auto_cvr_audio_bitrate', $this->audio_bitrate);
- $this->params['videobitrate'] = variable_get('video_ffmpeg_helper_auto_cvr_video_bitrate', $this->video_bitrate);
- //@todo: move this to the actual widget and save in video_files table.
- $this->params['size'] = variable_get('video_ffmpeg_width', $this->video_width) . 'x' . variable_get('video_ffmpeg_height', $this->video_height);
- $this->params['command'] = variable_get('video_ffmpeg_helper_auto_cvr_options', $this->command);
- $this->params['cmd_path'] = variable_get('video_transcoder_path', $this->ffmpeg);
- $this->params['thumb_command'] = variable_get('video_ffmpeg_thumbnailer_options', $this->thumb_command);
- $this->nice = variable_get('video_ffmpeg_nice_enable', TRUE) ? 'nice -n 19' : '';
- $this->params['videoext'] = variable_get('video_ffmpeg_ext', $this->video_ext);
- }
-
- public function run_command($options) {
- $command = $this->nice .' '. $this->params['cmd_path'].' '.$options.' 2>&1';
- watchdog('video_ffmpeg', 'Executing command: '. $command, array(), WATCHDOG_DEBUG);
- ob_start();
- passthru($command, $command_return);
- $output = ob_get_contents();
- ob_end_clean();
- return $output;
- }
-
- public function generate_thumbnails($video) {
- global $user;
- // Setup our thmbnail path.
- $video_thumb_path = variable_get('video_thumb_path', 'video_thumbs');
- $final_thumb_path = file_directory_path(). '/' . $video_thumb_path . '/' . $video['fid'];
-
- // Ensure the destination directory exists and is writable.
- $directories = explode('/', $final_thumb_path);
- // Get the file system directory.
- $file_system = file_directory_path();
- foreach ($directories as $directory) {
- $full_path = isset($full_path) ? $full_path . '/' . $directory : $directory;
- // Don't check directories outside the file system path.
- if (strpos($full_path, $file_system) === 0) {
- field_file_check_directory($full_path, FILE_CREATE_DIRECTORY);
- }
- }
-
- // Total thumbs to generate
- $total_thumbs = variable_get('no_of_video_thumbs', 5);
- $videofile = escapeshellarg($video['filepath']);
- //get the playtime from the current transcoder
- $duration = $this->get_playtime($video['filepath']);
-
- $files = NULL;
- for($i = 1; $i <= $total_thumbs; $i++) {
- $seek = ($duration/$total_thumbs) * $i -1; //adding minus one to prevent seek times equaling the last second of the video
- $filename = "/video-thumb-for-$fid-$i.jpg";
- $thumbfile = $final_thumb_path . $filename;
- //skip files already exists, this will save ffmpeg traffic
- if (!is_file($thumbfile)) {
- //setup the command to be passed to the transcoder.
- $options = t($this->params['thumb_command'], array('!videofile' => $videofile, '!seek' => $seek, '!thumbfile' => $thumbfile));
- // Generate the thumbnail from the video.
- $command_output = $this->run_command($options);
- if (!file_exists($thumbfile)) {
- $error_param = array('%file' => $thumbfile, '%cmd' => $options, '%out' => $command_output);
- $error_msg = t("Error generating thumbnail for video: generated file %file does not exist.<br />Command Executed:<br />%cmd<br />Command Output:<br />%out", $error_param);
- // Log the error message.
- watchdog('video_transcoder',$error_msg, array(), WATCHDOG_ERROR);
- continue;
- }
- }
- // Begin building the file object.
- // @TODO : use file_munge_filename()
- $file = new stdClass();
- $file->uid = $user->uid;
- $file->status = FILE_STATUS_TEMPORARY;
- $file->filename = trim($filename);
- $file->filepath = $thumbfile;
- $file->filemime = file_get_mimetype($filename);
- $file->filesize = filesize($thumbfile);
- $file->timestamp = REQUEST_TIME;
- $files[] = $file;
- }
- return $files;
- }
-
- public function convert_video($video, $converted, $dimensions) {
- // Setup our default command to be run.
- $command = t($this->params['command'], array(
- '!videofile' => $video->filepath,
- '!audiobitrate' => $this->params['audiobitrate'],
- '!size' => $dimensions,
- '!videobitrate' => $this->params['videobitrate'],
- '!convertfile' => $converted
- ));
- // Process our video
- return $this->run_command($command);
- }
-
- public function video_converted_extension() {
- return $this->params['videoext'];
- }
-
- /**
- * Get some information from the video file
- */
- public function get_video_info($video) {
- static $command_ouput;
- if(!empty($command_output)) return $command_output;
-
- $file = escapeshellarg($video);
- // Execute the command
- $options = ' -i ' . $file;
- $command_output = $this->run_command($options);
- return $command_output;
- }
-
- /**
- * Return the playtime seconds of a video
- */
- public function get_playtime($video) {
- $ffmpeg_output = $this->get_video_info($video);
- // Get playtime
- $pattern = '/Duration: ([0-9]{2}:[0-9]{2}:[0-9]{2}\.[0-9])/';
- preg_match_all($pattern, $ffmpeg_output, $matches, PREG_PATTERN_ORDER);
- $playtime = $matches[1][0];
- // ffmpeg return length as 00:00:31.1 Let's get playtime from that
- $hmsmm = explode(":", $playtime);
- $tmp = explode(".", $hmsmm[2]);
- $seconds = $tmp[0];
- $hours = $hmsmm[0];
- $minutes = $hmsmm[1];
- return $seconds + ($hours * 3600) + ($minutes * 60);
- }
-
- /*
- * Return the dimensions of a video
- */
- public function get_dimensions($video) {
- $ffmpeg_output = $this->get_video_info($video);
- $res = array('width' => 0,'height' => 0);
- // Get dimensions
- $regex = ereg ('[0-9]?[0-9][0-9][0-9]x[0-9][0-9][0-9][0-9]?', $ffmpeg_output, $regs );
- if(isset($regs[0])) {
- $dimensions = explode("x", $regs[0]);
- $res['width'] = $dimensions[0] ? $dimensions[0] : NULL;
- $res['height'] = $dimensions[1] ? $dimensions[1] : NULL;
-
- }
- return $res;
- }
-
- /**
- * Interface Implementations
- * @see sites/all/modules/video/includes/transcoder_interface#get_name()
- */
- public function get_name() {
- return $this->name;
- }
-
- /**
- * Interface Implementations
- * @see sites/all/modules/video/includes/transcoder_interface#get_value()
- */
- public function get_value() {
- return $this->value;
- }
-
- /**
- * Interface Implementations
- * @see sites/all/modules/video/includes/transcoder_interface#get_help()
- */
- public function get_help() {
- return l(t('FFMPEG Online Manual'), 'http://www.ffmpeg.org/');
- }
-
- /**
- * Interface Implementations
- * @see sites/all/modules/video/includes/transcoder_interface#admin_settings()
- */
- public function admin_settings() {
- $form = array();
- $form['video_transcoder_path'] = array(
- '#type' => 'textfield',
- '#title' => t('Path to Video Transcoder'),
- '#description' => t('Absolute path to ffmpeg.'),
- '#default_value' => variable_get('video_transcoder_path', '/usr/bin/ffmpeg'),
- );
- $form['no_of_video_thumbs'] = array(
- '#type' => 'textfield',
- '#title' => t('Number of thumbnails'),
- '#description' => t('Number of thumbnails to display from video.'),
- '#default_value' => variable_get('no_of_video_thumbs', 5),
- );
- $form['video_ffmpeg_nice_enable'] = array(
- '#type' => 'checkbox',
- '#title' => t('Enable the use of nice when calling the ffmpeg command.'),
- '#default_value' => variable_get('video_ffmpeg_nice_enable', TRUE),
- '#description' => t('The nice command Invokes a command with an altered scheduling priority. This option may not be available on windows machines, so disable it.')
- );
- // Thumbnail Videos We need to put this stuff last.
- $form['autothumb'] = array(
- '#type' => 'fieldset',
- '#title' => t('Video Thumbnails'),
- '#collapsible' => TRUE,
- '#collapsed' => TRUE,
- );
- $form['autothumb']['video_thumb_path'] = array(
- '#type' => 'textfield',
- '#title' => t('Path to save thumbnails'),
- '#description' => t('Path to save video thumbnails extracted from the videos.'),
- '#default_value' => variable_get('video_thumb_path', 'video_thumbs'),
- );
- $form['autothumb']['advanced'] = array(
- '#type' => 'fieldset',
- '#title' => t('Advanced Settings'),
- '#collapsible' => TRUE,
- '#collapsed' => TRUE
- );
- $form['autothumb']['advanced']['video_ffmpeg_thumbnailer_options'] = array(
- '#type' => 'textarea',
- '#title' => t('Video thumbnailer options'),
- '#description' => t('Provide the options for the thumbnailer. Available argument values are: ').'<ol><li>'.t('!videofile (the video file to thumbnail)').'<li>'.t('!thumbfile (a newly created temporary file to overwrite with the thumbnail)</ol>'),
- '#default_value' => variable_get('video_ffmpeg_thumbnailer_options', '-i !videofile -an -y -f mjpeg -ss !seek -vframes 1 !thumbfile'),
- );
-
- // Video conversion settings.
- $form['autoconv'] = array(
- '#type' => 'fieldset',
- '#title' => t('Video Conversion'),
- '#collapsible' => TRUE,
- '#collapsed' => TRUE,
- '#prefix' => '<div id="video_ffmpeg">',
- '#suffix' => '</div>'
- );
- $form['autoconv']['video_ffmpeg_ext'] = array(
- '#type' => 'textfield',
- '#title' => t('Video Extension'),
- '#size' => 10,
- '#maxlength' => 10,
- '#default_value' => variable_get('video_ffmpeg_ext', 'flv'),
- '#description' => t('The video extensions without the period you want the converted file to contain.')
- );
- $form['autoconv']['video_ffmpeg_width'] = array(
- '#type' => 'textfield',
- '#title' => t('Video Width'),
- '#size' => 10,
- '#maxlength' => 10,
- '#default_value' => variable_get('video_ffmpeg_width', 640),
- );
- $form['autoconv']['video_ffmpeg_height'] = array(
- '#type' => 'textfield',
- '#title' => t('Video height'),
- '#size' => 10,
- '#maxlength' => 10,
- '#default_value' => variable_get('video_ffmpeg_height', 480),
- );
- $form['autoconv']['video_ffmpeg_helper_auto_cvr_video_bitrate'] = array(
- '#type' => 'textfield',
- '#title' => t('Video bitrate'),
- '#description' => t('The video bitrate in bit/s of the converted video.'),
- '#size' => 10,
- '#maxlength' => 10,
- '#default_value' => variable_get('video_ffmpeg_helper_auto_cvr_video_bitrate', 200000),
- );
- $form['autoconv']['video_ffmpeg_helper_auto_cvr_audio_bitrate'] = array(
- '#type' => 'textfield',
- '#title' => t('Audio bitrate'),
- '#description' => t('The audio bitrate in bit/s of the converted video.'),
- '#size' => 10,
- '#maxlength' => 10,
- '#default_value' => variable_get('video_ffmpeg_helper_auto_cvr_audio_bitrate', 64000),
- );
- $form['autoconv']['advanced'] = array(
- '#type' => 'fieldset',
- '#title' => t('Advanced Settings'),
- '#collapsible' => TRUE,
- '#collapsed' => TRUE
- );
- $form['autoconv']['advanced']['video_ffmpeg_helper_auto_cvr_options'] = array(
- '#type' => 'textarea',
- '#title' => t('Video converter options'),
- '#description' => t('Provide the ffmpeg options to configure the video conversion. Available argument values are: ').'<ul>'.
- '<li>'.t('!videofile (the video file to convert)').
- '<li>'.t('!convertfile (a newly created file to store the converted file)').
- '<li>'.t('!size (video resolution of the converted file)').
- '</ul>'.t('For further informations refer to the !ffmpegdoc', array('!ffmpegdoc' => l(t('Official FFMpeg documentation.'), 'http://ffmpeg.mplayerhq.hu/ffmpeg-doc.html', array('fragment' => TRUE)))),
- '#default_value' => variable_get('video_ffmpeg_helper_auto_cvr_options', '-y -i !videofile -f flv -ar 22050 -ab !audiobitrate -s !size -b !videobitrate -qscale 1 !convertfile'),
- );
- return $form;
- }
-}
-?>
diff --git a/transcoders/video_ffmpeg_wrapper.inc b/transcoders/video_ffmpeg_wrapper.inc
deleted file mode 100644
index 2661fd9..0000000
--- a/transcoders/video_ffmpeg_wrapper.inc
+++ /dev/null
@@ -1,243 +0,0 @@
-<?php
-//$Id$
-/*
- * @file
- * Transcoder class file to handle ffmpeg_wrapper settings and conversions.
- *
- */
-
-
-class video_ffmpeg_wrapper implements transcoder_interface {
- private $name = 'FFmpeg Wrapper';
- private $value = 'video_ffmpeg_wrapper';
- private $video_ext = 'flv';
-
- protected $thumb_command = '-i !videofile -an -y -f mjpeg -ss !seek -vframes 1 !thumbfile';
-
- public function __construct() {
- $this->params['thumb_command'] = variable_get('video_ffmpeg_thumbnailer_options', $this->thumb_command);
- }
-
- public function run_command($options) {
- watchdog('ffmpeg_wrapper', 'Sending options: '. $options, array(), WATCHDOG_DEBUG);
- $output = ffmpeg_wrapper_run_command($options);
- if(is_object($output) && ISSET($output->errors)) {
- return implode("\n", $output->errors);
- }
- return $output;
- }
-
- public function generate_thumbnails($video) {
- global $user;
- // Setup our thmbnail path.
- $video_thumb_path = variable_get('video_thumb_path', 'video_thumbs');
- $final_thumb_path = file_directory_path(). '/' . $video_thumb_path . '/' . $video['fid'];
-
- // Ensure the destination directory exists and is writable.
- $directories = explode('/', $final_thumb_path);
- // Get the file system directory.
- $file_system = file_directory_path();
- foreach ($directories as $directory) {
- $full_path = isset($full_path) ? $full_path . '/' . $directory : $directory;
- // Don't check directories outside the file system path.
- if (strpos($full_path, $file_system) === 0) {
- field_file_check_directory($full_path, FILE_CREATE_DIRECTORY);
- }
- }
-
- // Total thumbs to generate
- $total_thumbs = variable_get('no_of_video_thumbs', 5);
- $videofile = escapeshellarg($video['filepath']);
- //get the playtime from the current transcoder
- $duration = $this->get_playtime($video);
-
- $files = NULL;
- for($i = 1; $i <= $total_thumbs; $i++) {
- $seek = ($duration/$total_thumbs) * $i - 1;
- $filename = "/video-thumb-for-$fid-$i.jpg";
- $thumbfile = $final_thumb_path . $filename;
- //skip files already exists, this will save ffmpeg traffic
- if (!is_file($thumbfile)) {
- //setup the command to be passed to the transcoder.
- $options = t($this->params['thumb_command'], array('!videofile' => $videofile, '!seek' => $seek, '!thumbfile' => $thumbfile));
- // Generate the thumbnail from the video.
- $command_output = $this->run_command($options);
- if (!file_exists($thumbfile)) {
- $error_param = array('%file' => $thumbfile, '%cmd' => $command, '%out' => $command_output);
- $error_msg = t("Error generating thumbnail for video: generated file %file does not exist.<br />Command Executed:<br />%cmd<br />Command Output:<br />%out", $error_param);
- // Log the error message.
- watchdog('video_transcoder',$error_msg, array(), WATCHDOG_ERROR);
- continue;
- }
- }
- // Begin building the file object.
- // @TODO : use file_munge_filename()
- $file = new stdClass();
- $file->uid = $user->uid;
- $file->status = FILE_STATUS_TEMPORARY;
- $file->filename = trim($filename);
- $file->filepath = $thumbfile;
- $file->filemime = file_get_mimetype($filename);
- $file->filesize = filesize($thumbfile);
- $file->timestamp = REQUEST_TIME;
- $files[] = $file;
- }
- return $files;
- }
-
- public function video_converted_extension() {
- global $conf;
- if(isset($conf['ffmpeg_output_type']) && !empty($conf['ffmpeg_output_type'])) {
- return $conf['ffmpeg_output_type'];
- }
- return $this->video_ext;
- }
-
- public function convert_video($video, $converted, $dimensions) {
- $ffmpeg_object = new stdClass();
- // check configuration are pass of then use global $conf
- if (empty($params)) {
- global $conf;
- $params = $conf;
- }
-
- // first error check, make sure that we can decode this kind of file
- if (!ffmpeg_wrapper_can_decode($video->filepath)) {
- $message = 'FFmpeg Wrapper can not decode this file: !file';
- $variables = array('!file' => l($video->filepath, file_create_url($video->filepath)));
- watchdog('video_render', $message, $variables, WATCHDOG_ERROR);
- return false;
- }
-
- // did the admin define a specific FFmpeg comand to run?
- // we only run what the admin specified
- if ($params['ffmpeg_video_custom']) {
- $options[] = str_replace(array('%in_file', '%out_file'), array($video->filepath, $converted), $params['ffmpeg_video_custom_command']);
- }
- // build a standard configuration
- else {
- // build the ffmpeg command structure out
- $options = array();
- // input file
- $options[] = "-i '". $video->filepath ."'";
- // build the watermark config
- if ($params['ffmpeg_video_wm']) $options[] = "-vhook '". ffmpeg_wrapper_path_to_vhook('watermark.so') ." -f ". $params['ffmpeg_video_wm_file'] ."'";
- // build the audio config
- if ($params['ffmpeg_audio_advanced']) {
- // use a specifc codec?
- if ($params['ffmpeg_audio_acodec']) $options[] = '-acodec '. $params['ffmpeg_audio_acodec'];
- // use a specific sample rate?
- if ($params['ffmpeg_audio_ar']) $options[] = '-ar '. $params['ffmpeg_audio_ar'];
- // use a specific bit rate?
- if ($params['ffmpeg_audio_ab']) $options[] = '-ab '. $params['ffmpeg_audio_ab'];
- }
-
- //custom sizing per video
- $options[] = '-s '. $dimensions;
-
- // build the video config
- if ($params['ffmpeg_video_advanced']) {
- // is codec set?
- if ($params['ffmpeg_video_vcodec']) $options[] = '-vcodec '. $params['ffmpeg_video_vcodec'];
- // is the bit rate set?
- if ($params['ffmpeg_video_br']) $options[] = '-b '. $params['ffmpeg_video_br'];
- // is frame rate set?
- if ($params['ffmpeg_video_fps']) $options[] = '-r '. $params['ffmpeg_video_fps'];
- }
- // implement truncating
- if ($params['ffmpeg_time_advanced']) $options[] = '-t '. $params['ffmpeg_time'];
- // add the output file
- $options[] = "'". $converted ."'";
- }
- $ffmpeg_object->command = implode(" ", $options);
-
- // run our command and return the output.
- return $this->run_command($ffmpeg_object->command);
- }
-
- /**
- * Return the playtime seconds of a video
- */
- public function get_playtime($video) {
- $ffmpeg_output = ffmpeg_wrapper_get_file_data($video['filepath']);
- return $ffmpeg_output['duration'];
- }
-
- /**
- * Return the dimensions of a video
- */
- public function get_dimensions($video) {
- $ffmpeg_output = ffmpeg_wrapper_get_file_data($video);
- $res = array('width' => 0,'height' => 0);
- if($ffmpeg_output['video']['s']) {
- $dimensions = explode("x", $ffmpeg_output['video']['s']);
- $res['width'] = $dimensions[0] ? $dimensions[0] : NULL;
- $res['height'] = $dimensions[1] ? $dimensions[1] : NULL;
- }
- return $res;
- }
-
- /**
- * Interface Implementations
- * @see sites/all/modules/video/includes/transcoder_interface#get_name()
- */
- public function get_name() {
- return $this->name;
- }
-
- /**
- * Interface Implementations
- * @see sites/all/modules/video/includes/transcoder_interface#get_value()
- */
- public function get_value() {
- return $this->value;
- }
-
- /**
- * Interface Implementations
- * @see sites/all/modules/video/includes/transcoder_interface#get_help()
- */
- public function get_help() {
- $help = l(t('FFMPEG Wrapper'), 'http://drupal.org/project/ffmpeg_wrapper');
- // If the module isn't loaded, show an error next to the link.
- if(!module_exists('ffmpeg_wrapper')) {
- $help .= ' <span class="error">'.t('You currently do not have this installed.').'</span>';
- }
- return $help;
- }
-
- /**
- * Interface Implementations
- * @see sites/all/modules/video/includes/transcoder_interface#admin_settings()
- */
- public function admin_settings() {
- global $conf;
- $form = array();
- if (!module_exists('ffmpeg_wrapper')) {
- $markup = t('You must download and install the !ffmpeg_wrapper to use the FFmpeg Wrapper as a transcoder.', array('!ffmpeg_wrapper' => l(t('FFmpeg Wrapper Module'), 'http://www.drupal.org/project/ffmpeg_wrapper')));
- $form['video_wrapper_info'] = array(
- '#type' => 'markup',
- '#value' => $markup,
- '#prefix' => '<div id="'. $this->value .'">',
- '#suffix' => '</div>',
- );
- }
- else {
- $form['video_ffmpeg_wrapper_start'] = array(
- '#type' => 'markup',
- '#value' => '<div id="video_ffmpeg_wrapper">',
- );
- if(module_exists('ffmpeg_wrapper_ui')) {
- $ffmpeg_admin_form = ffmpeg_wrapper_ui_configuration_form($conf);
- } else if (module_exists('ffmpeg_wrapper')) {
- $ffmpeg_admin_form = ffmpeg_wrapper_configuration_form($conf);
- }
- $form = array_merge($form, $ffmpeg_admin_form['ffmpeg_wrapper']);
- $form['video_ffmpeg_wrapper_end'] = array(
- '#type' => 'markup',
- '#value' => '</div>',
- );
- }
- return $form;
- }
-} \ No newline at end of file
diff --git a/translations/de.po b/translations/de.po
deleted file mode 100644
index b6ae698..0000000
--- a/translations/de.po
+++ /dev/null
@@ -1,560 +0,0 @@
-# $Id$
-#
-# German translation of Drupal (general)
-# Copyright YEAR NAME <EMAIL@ADDRESS>
-# Generated from files:
-# video_render.php,v 1.1.2.7 2010/01/08 00:25:24 heshanmw
-# video_scheduler.php,v 1.1.2.5 2009/12/25 08:35:25 heshanmw
-# video.admin.inc,v 1.1.2.11 2010/01/08 00:05:37 heshanmw
-# video.module,v 1.69.4.17.2.7 2009/12/23 18:01:58 heshanmw
-# video.info,v 1.3.4.1.4.1 2009/12/13 12:59:22 heshanmw
-# uploadfield.module,v 1.1.2.23 2010/01/09 15:18:55 heshanmw
-# uploadfield.info,v 1.1.2.2 2009/12/23 11:16:59 heshanmw
-# video.install,v 1.4.4.1.4.6 2009/12/24 12:35:03 heshanmw
-# apiclient.inc,v 1.2.4.4 2009/11/13 14:39:03 heshanmw
-# common.inc,v 1.2.4.10.2.9 2009/12/27 06:46:26 heshanmw
-# ffmpeg.inc,v 1.1.2.12 2010/01/08 00:35:04 heshanmw
-# uploadfield_convert.inc,v 1.1.2.12 2009/12/24 16:16:22 heshanmw
-# uploadfield_file.inc,v 1.1.2.5 2009/12/23 13:46:09 heshanmw
-# uploadfield_formatter.inc,v 1.1.2.11 2009/12/24 16:34:39 heshanmw
-# uploadfield_thumb.inc,v 1.1.2.4 2009/12/24 16:16:22 heshanmw
-# uploadfield_widget.inc,v 1.1.2.32 2010/01/17 02:46:46 heshanmw
-#
-msgid ""
-msgstr ""
-"Project-Id-Version: Drupal Video 3.6\n"
-"POT-Creation-Date: 2010-02-14 16:02+0100\n"
-"PO-Revision-Date: 2010-02-14 18:48+0100\n"
-"Last-Translator: rastatt <rastatt@drupal.org>\n"
-"Language-Team: Frank Tartler <frank.tartler@googlemail.com>\n"
-"MIME-Version: 1.0\n"
-"Content-Type: text/plain; charset=UTF-8\n"
-"Content-Transfer-Encoding: 8bit\n"
-"Plural-Forms: nplurals=2; plural=(n!=1);\n"
-"X-Poedit-Language: German\n"
-"X-Poedit-Country: GERMANY\n"
-"X-Poedit-SourceCharset: utf-8\n"
-
-#: video_render.php:56;82;91;113;127
-#: video_scheduler.php:132;141;165;179
-msgid "video_render"
-msgstr ""
-
-#: video_render.php:56
-msgid "Incorrect parameters to the video_render.php script."
-msgstr "Fehlerhafte Parameter für as video_render.php-Skript."
-
-#: video_render.php:82
-#: video_scheduler.php:132
-msgid "video_render.php has been called with an invalid job resource. exiting."
-msgstr "video_render.php wurde mit einer ungültigen Job-Ressource aufgerufen; wird beendet."
-
-#: video_render.php:91
-#: video_scheduler.php:141
-msgid "converted file is an empty file."
-msgstr "Die konvertierte Datei ist eine leere Datei."
-
-#: video_render.php:113
-#: video_scheduler.php:165
-msgid "successfully converted %orig to %dest"
-msgstr "%orig erfolgreich in %dest konvertiert"
-
-#: video_render.php:127
-#: video_scheduler.php:179
-msgid "error moving video %vid_file with nid = %nid to %dir the final directory. Check folder permissions.<br />The script was run by %uname .<br />The folder owner is %fowner .<br />The folder permissions are %perms ."
-msgstr "Fehler beim Verschieben des Videos %vid_file (nid = %nid) ins finale Verzeichnis %dir. Die Ordner-Berechtigungen sollten geprüft werden.<br />. Das Skript wurde durch %uname ausgeführt.<br />Der Eigentümer des Ordners ist %fowner.<br />Die Ordner-Berechtigungen sind %perms."
-
-#: video_scheduler.php:80
-msgid "video_scheduler"
-msgstr ""
-
-#: video_scheduler.php:80
-msgid "no video conversion jobs to schedule."
-msgstr "Es stehen keine Jobs zur Video-Konverierung an."
-
-#: video.admin.inc:22
-msgid "General Behavior"
-msgstr "Allgemeines Verhalten"
-
-#: video.admin.inc:53
-msgid "Automatically start video on page load"
-msgstr "Video autmomatisch beim Laden der Seite starten"
-
-#: video.admin.inc:55
-msgid "Start the video when the page and video loads"
-msgstr "Video starten wenn die Seite und das Video geladen wird"
-
-#: video.admin.inc:60
-msgid "Automatically start video buffering"
-msgstr "Video automatisch beim Laden der Seite puffern"
-
-#: video.admin.inc:62
-msgid "Start buffering video when the page and video loads"
-msgstr "Das Puffern des Videos starten wenn die Seite und das Video geladen wird"
-
-#: video.admin.inc:67
-msgid "Video Extra Players"
-msgstr "Video-Extra-Player"
-
-#: video.admin.inc:73
-msgid "Path to OGG Cortado Player"
-msgstr "Pfad zum OGG-Cortado-Player"
-
-#: video.admin.inc:75
-msgid "Copy your cortado.jar file to Drupal root and keep the setting un-changed."
-msgstr "Die Datei cortado.jar in das Drupal-Stammverzeichnis kopieren, Einstellungen unverändert lassen."
-
-#: video.admin.inc:80
-msgid "Play HQ MP4 files in Flash Player"
-msgstr "HQ-MP4-Dateien im Flash-Player abspielen"
-
-#: video.admin.inc:82
-msgid "Play HQ MP4 files in Flash player."
-msgstr "HQ-MP4-Dateien im Flash-Player abspielen."
-
-#: video.admin.inc:99
-msgid "Video Additions"
-msgstr "Video-Zusätze"
-
-#: video.admin.inc:106
-msgid "Video transcoder"
-msgstr "Video-Transcoder"
-
-#: video.admin.inc:109
-msgid "Video transcoder will help you to video conversion and automatic thumbnail generaion. You must install !ffmpeg_wrapper module to enable ffmpeg_wrapper support"
-msgstr "Der Video-Transcoder hilft bei der Video-Konvertierung und beim automatischen Erzeugen von Miniaturansichten. Das !ffmpeg_wrapper-Modul muss für die ffmpeg_wrapper-Unterstützung installiert werden"
-
-#: video.admin.inc:113
-msgid "Path to Video Transcoder"
-msgstr "Pfad zum Video-Transcoder"
-
-#: video.admin.inc:114
-msgid "Path to executable, you can skip this if your usign ffmpeg_wrapper module support."
-msgstr "Pfad zur ausführbaren Datei, dies kann übersprungen werden, wenn Unterstützung für das ffmpeg_wrapper-Modul verwendet wird."
-
-#: video.admin.inc:122
-msgid "Automatic video thumbnailing"
-msgstr "Automatisches Erzeugen von Miniaturansichten für Videos"
-
-#: video.admin.inc:128
-msgid "Path to Video Thumbnails"
-msgstr "Pfad zu den Video-Miniaturansichten"
-
-#: video.admin.inc:129
-msgid "Path to save video thumbanils extracted from video"
-msgstr "Pfad in dem aus dem Video extrahierte Video-Miniaturansichten gespeichert werden sollen"
-
-#: video.admin.inc:134
-msgid "No of thumbnails"
-msgstr "Anzahl Miniaturansichten"
-
-#: video.admin.inc:135
-msgid "No of thumbnails extracting from video"
-msgstr "Anzahl der aus dem Video zu exxtrahierenden Miniaturansichten"
-
-#: video.admin.inc:140;191
-msgid "Advanced settings"
-msgstr "Erweiterte Einstellungen"
-
-#: video.admin.inc:146
-msgid "Video thumbnailer options"
-msgstr "Optionen für Video-Miniaturansichten"
-
-#: video.admin.inc:147
-msgid "Provide the options for the thumbnailer. Available argument values are: "
-msgstr "Bitte die Optionen für das Erstellen von Miniaturansichten angeben. Verfügbare Argument-Werte sind:"
-
-#: video.admin.inc:147
-msgid "%videofile (the video file to thumbnail)"
-msgstr "%videofile (das Video für das Miniaturansichten erstellt werden sollen)"
-
-#: video.admin.inc:147
-msgid "%thumbfile (a newly created temporary file to overwrite with the thumbnail)"
-msgstr "%thumbfile (eine neu erstellte temporäre Datei, die mit der Miniaturansicht überschrieben werden soll)"
-
-#: video.admin.inc:147
-msgid "Only the first two are mandatory. For example, older versions of ffmpeg should use something like: !old While newer versions should use something like: !new"
-msgstr "Nur die ersten beiden sind zwingend. Ältere Versionen von ffmpeg sollten z.B. etwas wie !old verwenden. Dagegen sollten neuere Versionen etwas wie !new verwenden."
-
-#: video.admin.inc:155
-msgid "Automatic video conversion"
-msgstr "Automatische Video-Konvertierung"
-
-#: video.admin.inc:161
-msgid "Destination video Width"
-msgstr "Breite des Ziel-Videos"
-
-#: video.admin.inc:168
-msgid "Destination video height"
-msgstr "Höhe des Ziel-Videos"
-
-#: video.admin.inc:175
-msgid "Video bitrate"
-msgstr "Video-Bitrate"
-
-#: video.admin.inc:176
-msgid "The video bitrate in bit/s of the converted video."
-msgstr "Die Video-Bitrate in bit/s des konvertierten Videos."
-
-#: video.admin.inc:183
-msgid "Audio bitrate"
-msgstr "Audio-Bitrate"
-
-#: video.admin.inc:184
-msgid "The audio bitrate in bit/s of the converted video."
-msgstr "Die Audio-Bitrate in bit/s des konvertierten Videos."
-
-#: video.admin.inc:197
-msgid "Video converter options"
-msgstr "Video-Konverter-Optionen"
-
-#: video.admin.inc:198
-msgid "Provide the ffmpeg options to configure the video conversion. Available argument values are: "
-msgstr "Zu konfigurierende ffmpeg-Optionen für die Video-Konvertierung. Verfügbare Argumente sind:"
-
-#: video.admin.inc:199
-msgid "%videofile (the video file to convert)"
-msgstr "%videofile (die zu konvertierenden Videodatei)"
-
-#: video.admin.inc:200
-msgid "%convertfile (a newly created file to store the converted file)"
-msgstr "%convertfile (eine neu erstellte Datei in der das konvertierte Video geespeichert wird)"
-
-#: video.admin.inc:201
-msgid "%size (video resolution of the converted file)"
-msgstr "%size (Video-Auflösung der konvertierten Datei)"
-
-#: video.admin.inc:203
-msgid "For further informations refer to the !ffmpegdoc"
-msgstr "Die !ffmpegdoc enthält weitere Informationen."
-
-#: video.admin.inc:203
-msgid "Official FFMpeg documentation."
-msgstr "offizielle FFMpeg-Dokumentation"
-
-#: video.admin.inc:220
-msgid "You do not have installed the !ffmpeg_wrapper module to enable using its plugin, please install it."
-msgstr "Das ffmpeg_wrapper-Modul ist nicht installiert, daher kann dieses Plugin nicht aktiviert werden. Bitte installieren!"
-
-#: video.module:16
-msgid "v_perm"
-msgstr ""
-
-#: video.module:25
-#: video.info:0;0
-#: types/uploadfield/uploadfield.module:201
-#: types/uploadfield/uploadfield.info:0
-msgid "Video"
-msgstr ""
-
-#: video.module:26
-msgid "Configure different aspects of the video module and its plugins"
-msgstr "Verschiedene Aspekte des Video-Moduls und seiner Plugins konfigurieren"
-
-#: video.install:17
-msgid "Store video transcoding queue"
-msgstr "Warteschlange für Video-Transkodierung speichern"
-
-#: video.install:20
-msgid "original file id"
-msgstr "Original-Datei-ID"
-
-#: video.install:27
-msgid "Process ID"
-msgstr "Prozess-ID"
-
-#: video.install:34
-msgid "status of the transcoding"
-msgstr "Status der Transkodierung"
-
-#: video.install:41
-msgid "Started transcodings"
-msgstr "Transkodierungen gestartet"
-
-#: video.install:47
-msgid "Transcoding completed"
-msgstr "Transkodierung abgeschlossen"
-
-#: video.install:53
-msgid "Informations related to the videos"
-msgstr "Informationen in Bezug auf die Videos"
-
-#: video.info:0
-msgid "Allows video nodes."
-msgstr "Video-Beiträge erlauben"
-
-#: includes/apiclient.inc:44;81
-msgid "YouTube Uploads not currently available"
-msgstr "YouTube-Uploads sind momentan nicht verfügbar"
-
-#: includes/apiclient.inc:62;67
-msgid "YouTube uploads currently unavailable"
-msgstr "YouTube-Uploads momentan nicht verfügbar"
-
-#: includes/apiclient.inc:33;40;63;68;80
-msgid "video_upload"
-msgstr ""
-
-#: includes/apiclient.inc:33
-msgid "No YouTube username set"
-msgstr "Kein YouTube-Benutzername angegeben"
-
-#: includes/apiclient.inc:40
-msgid "No YouTube password set"
-msgstr "Kein YouTube-Passwort angegeben"
-
-#: includes/apiclient.inc:63
-msgid "Authentication error for YouTube Account"
-msgstr "Authentifizierungsfehler mit den YouTube-Benutzerdaten"
-
-#: includes/apiclient.inc:68
-msgid "Authentication error for YouTube Account: %error"
-msgstr "Authentifizierungsfehler mit den YouTube-Benutzerdaten: %errror"
-
-#: includes/apiclient.inc:80
-msgid "No developer key set"
-msgstr "Kein Entwickler-Schlüssel angegeben"
-
-#: includes/apiclient.inc:104;133
-msgid "youtube_video"
-msgstr ""
-
-#: includes/apiclient.inc:104
-msgid "Authentication error while creating a YouTube connection object: %error"
-msgstr "Authentifizierungsfehler beim Erstellen des YouTube-Verbindungsobjekts: %error"
-
-#: includes/apiclient.inc:133
-msgid "Authentication error while receiving YouTube connection object: %error"
-msgstr "Authentifierungsfehler beim Empfang des YouTube-Verbindungsobjekts: %error"
-
-#: includes/apiclient.inc:161
-msgid "youtbe_video"
-msgstr ""
-
-#: includes/apiclient.inc:161
-msgid "Couldn't find the Zend client libraries."
-msgstr "Die Zend-Client-Bibliotheken konnten nicht gefunden werden."
-
-#: includes/common.inc:156;199;285;337;385
-msgid "Your browser is not able to display this multimedia content."
-msgstr "Dieser Browser kann diesen Multimedia-Inhalt nicht anzeigen."
-
-#: includes/common.inc:0
-msgid "1 year"
-msgid_plural "@count years"
-msgstr[0] "1 Jahr"
-msgstr[1] "@count Jahre"
-
-#: includes/common.inc:0
-msgid "1 week"
-msgid_plural "@count weeks"
-msgstr[0] "1 Woche"
-msgstr[1] "@count Wochen"
-
-#: includes/common.inc:0
-msgid "1 day"
-msgid_plural "@count days"
-msgstr[0] "1 Tag"
-msgstr[1] "@count Tage"
-
-#: includes/common.inc:0
-msgid "1 hour"
-msgid_plural "@count hours"
-msgstr[0] "1 Stunde"
-msgstr[1] "@count Stunden"
-
-#: includes/common.inc:0
-msgid "1 min"
-msgid_plural "@count min"
-msgstr[0] "1 Minute"
-msgstr[1] "@count Minuten"
-
-#: includes/common.inc:0
-msgid "1 sec"
-msgid_plural "@count sec"
-msgstr[0] "1 Sekunde"
-msgstr[1] "@count Sekunden"
-
-#: plugins/ffmpeg.inc:177
-#: plugins/ffmpeg_wrapper.inc:179
-msgid "error generating thumbnail for video: generated file %file does not exist.<br />Command Executed:<br />%cmd<br />Command Output:<br />%out"
-msgstr "Fehler beim Erzeugen der Video-Miniaturansicht: erzeugte Datei %file existiert nicht.<br />Ausgeführter Befehl:<br />%cmd<br />Befehlsausgabe:<br />%out"
-
-#: types/uploadfield/uploadfield_convert.inc:52;63
-msgid "Video submission queued for processing. Please wait: our servers are preparing your video for web displaying."
-msgstr "Das gespeicherte Video wurde zur Verarbeitung in die Warteschlange gestellt. Bitte warten: unsere Server bereiten das Video für die Anzeige im Web vor."
-
-#: types/uploadfield/uploadfield_file.inc:121
-msgid "An image thumbnail was not able to be created."
-msgstr "Eine Bild-Miniaturansicht konnte nicht erstellt werden."
-
-#: types/uploadfield/uploadfield_formatter.inc:150
-msgid "This video is currently being processed. Please wait."
-msgstr "Dieses Video wird momentan verarbeitet. Bitte warten."
-
-#: types/uploadfield/uploadfield_formatter.inc:158
-msgid "The video conversion process has failed. You might want to submit a simpler video format like <em>mpeg</em> or <em>divx avi</em>.<br />If the problem persists please contact website administrators."
-msgstr "Der Video-Konvertierungsprozess ist fehlgeschlagen. Es sollte ein einfacheres Videoformat wie <em>mpeg</em> oder <em>DivX avi</em> angegeben werden.<br />Wenn das problem weiterhin besteht, sollten die Website-Administratoren kontaktiert werden."
-
-#: types/uploadfield/uploadfield_thumb.inc:25
-msgid "Transcoder not configured properly"
-msgstr "Transcoder nicht korrekt konfiguriert"
-
-#: types/uploadfield/uploadfield_thumb.inc:40
-msgid "Video Thumbnails"
-msgstr "Video-Miniaturansichten"
-
-#: types/uploadfield/uploadfield_widget.inc:22
-msgid "Video Player Settings"
-msgstr "Video-Player-Einstellungen"
-
-#: types/uploadfield/uploadfield_widget.inc:30
-msgid "Default Video Resolution"
-msgstr "Standardmäßige Video-Auflösung"
-
-#: types/uploadfield/uploadfield_widget.inc:34
-#, fuzzy
-msgid "Default player resolution WIDTHXHEIGHT in px. eg : 16:9 for widescreen or 4:3 for general screen"
-msgstr "Standardmäßige Video-Auflösung Breite:Höhe in Pixeln, z.B. 16:9 für Breitformat oder 4:3 für gewöhnliches Format."
-
-#: types/uploadfield/uploadfield_widget.inc:39
-msgid "Default Video Player Width"
-msgstr "Standardmäßige Breite des Video-Players"
-
-#: types/uploadfield/uploadfield_widget.inc:43
-msgid "Default player WIDTHXHEIGHT in px. eg : 640 for 640X480 player size if resolution it 4:3"
-msgstr "Standardmäßge BreiteXHöhe des Players in Pixeln, z.B. 640 für die Player-Größe 640x480, wenn die Auflösung 4:3 ist."
-
-#: types/uploadfield/uploadfield_widget.inc:50
-msgid "Video Thumbnail Settings"
-msgstr "Einstellungen für Video-Miniaturansichten"
-
-#: types/uploadfield/uploadfield_widget.inc:69
-msgid "Upload video thumbnail"
-msgstr "Video-Miniaturansicht hochladen"
-
-#: types/uploadfield/uploadfield_widget.inc:69
-msgid "Replace video thumbnail with"
-msgstr "Video-Miniaturansicht ersetzen durch"
-
-#: types/uploadfield/uploadfield_widget.inc:70
-msgid "Choose a image that will be used as default video thumbnail."
-msgstr "Auswahl eines Bildes, das als standardmäßige Video-Miniaturansict verwendet wird"
-
-#: types/uploadfield/uploadfield_widget.inc:83
-msgid "Video Advanced Settings"
-msgstr "Erweiterte Video-Einstellungen"
-
-#: types/uploadfield/uploadfield_widget.inc:90
-msgid "Enable auto conversion video"
-msgstr "Automatische Video-Konvertierung aktivieren"
-
-#: types/uploadfield/uploadfield_widget.inc:91
-msgid "Use ffmpeg(Default) to automaticcally convert videos to web compatible types eg. FLV, Please make sure to configure convertor settings."
-msgstr "Ffmpeg (Standard) kann verwendet werden, um Videos automatisch in Web-kompatible Formate, z.B. FLV, zu konvertieren. Es muss sichergestellt werden, dass die Konverter-Einstellungen konfiguriert sind."
-
-#: types/uploadfield/uploadfield_widget.inc:96
-msgid "Enable auto thumbnail video"
-msgstr "Automatisches Erstellen von Video-Miniaturansichten aktivieren"
-
-#: types/uploadfield/uploadfield_widget.inc:97
-msgid "Use ffmpeg(Default) to automaticcally thumbnails, Please make sure to configure convertor settings."
-msgstr "Ffmpeg (Standard) kann verwendet werden um automatisch Miniaturansichten zu erstellen. Es muss sichergestellt werden, dass die Konverter-Einstellungen konfiguriert sind."
-
-#: types/uploadfield/uploadfield_widget.inc:115
-msgid "The default image could not be uploaded. The destination %destination does not exist or is not writable by the server."
-msgstr "Das Standardbild konnte nicht hochgeladen werden. Das Ziel %destination existiert nicht oder kann nicht durch den Server geschrieben werden."
-
-#: types/uploadfield/uploadfield_widget.inc:160
-msgid "Only web-standard videos are supported through the video widget. If needing to upload other types of files, change the widget to use a standard file upload."
-msgstr "Nur standardmäßige Web-Videos werden durchc das Video-Widget unterstützt. Wenn andere Dateitypen hochgeladen werden müssen, muss das Widget in ein standardmäßigen Datei-Upload geändert werden."
-
-#: types/uploadfield/uploadfield_widget.inc:166
-msgid "Please specify default width in integers only (e.g. 640)."
-msgstr "Bitte die standardmäßige Breite als ganze Zahl angeben (z.B. 640)"
-
-#: types/uploadfield/uploadfield_widget.inc:173
-msgid "Please specify a resolution in the format WIDTH:HEIGHT (e.g. 16:9)."
-msgstr "Bitte die Auflösung im Format WIDTH:HEIGHT angeben( z.B. 16:9)."
-
-#: types/uploadfield/uploadfield_widget.inc:228
-msgid "Width for Player"
-msgstr "Player-Breite"
-
-#: types/uploadfield/uploadfield_widget.inc:230
-msgid "Set player width(in pix) here, make sure your video have good resolution to fix on larger values."
-msgstr "Player-Breite (in Pixeln) hier einstellen, es sollte auch sichergestellt werden, dass bei größeren Werten die Videos eine gute Auflösung haben."
-
-#: types/uploadfield/uploadfield_widget.inc:246
-msgid "Bypass auto conversion"
-msgstr "Automatische Konvertierung umgehen"
-
-#: types/uploadfield/uploadfield_widget.inc:248
-msgid "This will bypass your auto conversion of videos."
-msgstr "Dies umgeht die automatische Konvertierung von Videos."
-
-#: types/uploadfield/uploadfield_widget.inc:264
-msgid "Override Video Thumbnail with Default"
-msgstr "Video-Miniaturansicht mit Standard überschreiben"
-
-#: types/uploadfield/uploadfield_widget.inc:266
-msgid "If you want to use default image instead of using actual thumbnail of video then check."
-msgstr "Ankreuzen, wenn das Standardbild anstelle der aktuellen Video-Miniaturansichten verwendet werden soll."
-
-#: types/uploadfield/uploadfield_widget.inc:278
-msgid "Save"
-msgstr "Speichern"
-
-#: types/uploadfield/uploadfield_widget.inc:290
-msgid "Preview"
-msgstr "Vorschau"
-
-#: types/uploadfield/uploadfield_widget.inc:293
-msgid "Delete"
-msgstr "Löschen"
-
-#: types/uploadfield/uploadfield.module:23
-msgid "The uploadfield module has been disabled. The <a href=\"http://drupal.org/project/filefield\">FileField module</a> needs to be installed for it to work properly."
-msgstr "Das Uploadfield-Modul wurde deaktiviert. Dass <a href=\"http://drupal.org/project/filefield\">FileField-Modul</a> muss installiert werden, damit es korrekt funktioniert."
-
-#: types/uploadfield/uploadfield.module:205
-msgid "An edit widget for video files, including video thumbnails and transcoding to flash."
-msgstr "Ein Bearbeiten-Widget für Video-Dateien inklusive Video-Miniaturansichten und Transkodieren nach Flash."
-
-#: types/uploadfield/uploadfield.module:296
-msgid "video"
-msgstr ""
-
-#: types/uploadfield/uploadfield.module:298
-msgid "Displays video files with player embeded."
-msgstr "Zeigt Videos mit dem eingebetteten Player an."
-
-#: types/uploadfield/uploadfield.module:301
-msgid "video thumbnail linked to video"
-msgstr "Video-Miniaturansicht, verbunden mit dem Video"
-
-#: types/uploadfield/uploadfield.module:303
-msgid "Displays video thumb files then the video."
-msgstr "Zeigt Video-Miniaturansichten an, dann das Video"
-
-#: types/uploadfield/uploadfield.module:315
-msgid "@preset of video thumbnail linked to video"
-msgstr "Voreinstellung @preset der Video-Miniaturansicht, verbunden mit dem Video"
-
-#: types/uploadfield/uploadfield.module:445
-msgid "Upload support"
-msgstr "Unterstützung für das Hochladen"
-
-#: types/uploadfield/uploadfield.module:446
-msgid "You can upload a video file from your computer to this website."
-msgstr "Von diesem Computer kann ein Video zur Website hochgeladen werden."
-
-#: types/uploadfield/uploadfield.info:0
-#, fuzzy
-msgid "Video Upload"
-msgstr "Hochladen von Videos"
-
-#: types/uploadfield/uploadfield.info:0
-msgid "handle video upload for video module using filefield and CCK."
-msgstr "Hochladen von Videos durch das Video-Modul mittels filefield und CCK abwickeln."
-
diff --git a/translations/video.pot b/translations/video.pot
deleted file mode 100644
index 112e194..0000000
--- a/translations/video.pot
+++ /dev/null
@@ -1,548 +0,0 @@
-# $Id$
-#
-# LANGUAGE translation of Drupal (general)
-# Copyright YEAR NAME <EMAIL@ADDRESS>
-# Generated from files:
-# video_render.php,v 1.1.2.7 2010/01/08 00:25:24 heshanmw
-# video_scheduler.php,v 1.1.2.8 2010/02/14 02:33:33 heshanmw
-# video.admin.inc,v 1.1.2.15 2010/02/14 03:28:53 heshanmw
-# video.module,v 1.69.4.17.2.7 2009/12/23 18:01:58 heshanmw
-# video.info,v 1.3.4.1.4.1 2009/12/13 12:59:22 heshanmw
-# uploadfield.module,v 1.1.2.24 2010/02/14 10:42:49 heshanmw
-# uploadfield.info,v 1.1.2.2 2009/12/23 11:16:59 heshanmw
-# video.install,v 1.4.4.1.4.6 2009/12/24 12:35:03 heshanmw
-# apiclient.inc,v 1.2.4.4 2009/11/13 14:39:03 heshanmw
-# common.inc,v 1.2.4.10.2.11 2010/02/14 03:02:06 heshanmw
-# ffmpeg.inc,v 1.1.2.14 2010/02/13 11:31:28 heshanmw
-# ffmpeg_wrapper.inc,v 1.1.2.1 2010/02/13 11:31:28 heshanmw
-# uploadfield_convert.inc,v 1.1.2.12 2009/12/24 16:16:22 heshanmw
-# uploadfield_file.inc,v 1.1.2.5 2009/12/23 13:46:09 heshanmw
-# uploadfield_formatter.inc,v 1.1.2.14 2010/02/14 10:42:49 heshanmw
-# uploadfield_thumb.inc,v 1.1.2.4 2009/12/24 16:16:22 heshanmw
-# uploadfield_widget.inc,v 1.1.2.33 2010/02/14 02:32:55 heshanmw
-#
-#, fuzzy
-msgid ""
-msgstr ""
-"Project-Id-Version: PROJECT VERSION\n"
-"POT-Creation-Date: 2010-02-14 16:02+0100\n"
-"PO-Revision-Date: YYYY-mm-DD HH:MM+ZZZZ\n"
-"Last-Translator: NAME <EMAIL@ADDRESS>\n"
-"Language-Team: LANGUAGE <EMAIL@ADDRESS>\n"
-"MIME-Version: 1.0\n"
-"Content-Type: text/plain; charset=utf-8\n"
-"Content-Transfer-Encoding: 8bit\n"
-"Plural-Forms: nplurals=INTEGER; plural=EXPRESSION;\n"
-
-#: video_render.php:56;82;91;113;127 video_scheduler.php:132;141;165;179
-msgid "video_render"
-msgstr ""
-
-#: video_render.php:56
-msgid "Incorrect parameters to the video_render.php script."
-msgstr ""
-
-#: video_render.php:82 video_scheduler.php:132
-msgid "video_render.php has been called with an invalid job resource. exiting."
-msgstr ""
-
-#: video_render.php:91 video_scheduler.php:141
-msgid "converted file is an empty file."
-msgstr ""
-
-#: video_render.php:113 video_scheduler.php:165
-msgid "successfully converted %orig to %dest"
-msgstr ""
-
-#: video_render.php:127 video_scheduler.php:179
-msgid "error moving video %vid_file with nid = %nid to %dir the final directory. Check folder permissions.<br />The script was run by %uname .<br />The folder owner is %fowner .<br />The folder permissions are %perms ."
-msgstr ""
-
-#: video_scheduler.php:80
-msgid "video_scheduler"
-msgstr ""
-
-#: video_scheduler.php:80
-msgid "no video conversion jobs to schedule."
-msgstr ""
-
-#: video.admin.inc:22
-msgid "General Behavior"
-msgstr ""
-
-#: video.admin.inc:53
-msgid "Automatically start video on page load"
-msgstr ""
-
-#: video.admin.inc:55
-msgid "Start the video when the page and video loads"
-msgstr ""
-
-#: video.admin.inc:60
-msgid "Automatically start video buffering"
-msgstr ""
-
-#: video.admin.inc:62
-msgid "Start buffering video when the page and video loads"
-msgstr ""
-
-#: video.admin.inc:67
-msgid "Video Extra Players"
-msgstr ""
-
-#: video.admin.inc:73
-msgid "Path to OGG Cortado Player"
-msgstr ""
-
-#: video.admin.inc:75
-msgid "Copy your cortado.jar file to Drupal root and keep the setting un-changed."
-msgstr ""
-
-#: video.admin.inc:80
-msgid "Play HQ MP4 files in Flash Player"
-msgstr ""
-
-#: video.admin.inc:82
-msgid "Play HQ MP4 files in Flash player."
-msgstr ""
-
-#: video.admin.inc:99
-msgid "Video Additions"
-msgstr ""
-
-#: video.admin.inc:106
-msgid "Video transcoder"
-msgstr ""
-
-#: video.admin.inc:109
-msgid "Video transcoder will help you to video conversion and automatic thumbnail generaion. You must install !ffmpeg_wrapper module to enable ffmpeg_wrapper support"
-msgstr ""
-
-#: video.admin.inc:113
-msgid "Path to Video Transcoder"
-msgstr ""
-
-#: video.admin.inc:114
-msgid "Path to executable, you can skip this if your usign ffmpeg_wrapper module support."
-msgstr ""
-
-#: video.admin.inc:122
-msgid "Automatic video thumbnailing"
-msgstr ""
-
-#: video.admin.inc:128
-msgid "Path to Video Thumbnails"
-msgstr ""
-
-#: video.admin.inc:129
-msgid "Path to save video thumbanils extracted from video"
-msgstr ""
-
-#: video.admin.inc:134
-msgid "No of thumbnails"
-msgstr ""
-
-#: video.admin.inc:135
-msgid "No of thumbnails extracting from video"
-msgstr ""
-
-#: video.admin.inc:140;191
-msgid "Advanced settings"
-msgstr ""
-
-#: video.admin.inc:146
-msgid "Video thumbnailer options"
-msgstr ""
-
-#: video.admin.inc:147
-msgid "Provide the options for the thumbnailer. Available argument values are: "
-msgstr ""
-
-#: video.admin.inc:147
-msgid "%videofile (the video file to thumbnail)"
-msgstr ""
-
-#: video.admin.inc:147
-msgid "%thumbfile (a newly created temporary file to overwrite with the thumbnail)"
-msgstr ""
-
-#: video.admin.inc:147
-msgid "Only the first two are mandatory. For example, older versions of ffmpeg should use something like: !old While newer versions should use something like: !new"
-msgstr ""
-
-#: video.admin.inc:155
-msgid "Automatic video conversion"
-msgstr ""
-
-#: video.admin.inc:161
-msgid "Destination video Width"
-msgstr ""
-
-#: video.admin.inc:168
-msgid "Destination video height"
-msgstr ""
-
-#: video.admin.inc:175
-msgid "Video bitrate"
-msgstr ""
-
-#: video.admin.inc:176
-msgid "The video bitrate in bit/s of the converted video."
-msgstr ""
-
-#: video.admin.inc:183
-msgid "Audio bitrate"
-msgstr ""
-
-#: video.admin.inc:184
-msgid "The audio bitrate in bit/s of the converted video."
-msgstr ""
-
-#: video.admin.inc:197
-msgid "Video converter options"
-msgstr ""
-
-#: video.admin.inc:198
-msgid "Provide the ffmpeg options to configure the video conversion. Available argument values are: "
-msgstr ""
-
-#: video.admin.inc:199
-msgid "%videofile (the video file to convert)"
-msgstr ""
-
-#: video.admin.inc:200
-msgid "%convertfile (a newly created file to store the converted file)"
-msgstr ""
-
-#: video.admin.inc:201
-msgid "%size (video resolution of the converted file)"
-msgstr ""
-
-#: video.admin.inc:203
-msgid "For further informations refer to the !ffmpegdoc"
-msgstr ""
-
-#: video.admin.inc:203
-msgid "Official FFMpeg documentation."
-msgstr ""
-
-#: video.admin.inc:220
-msgid "You do not have installed the !ffmpeg_wrapper module to enable using its plugin, please install it."
-msgstr ""
-
-#: video.module:16
-msgid "v_perm"
-msgstr ""
-
-#: video.module:25 video.info:0;0 types/uploadfield/uploadfield.module:201 types/uploadfield/uploadfield.info:0
-msgid "Video"
-msgstr ""
-
-#: video.module:26
-msgid "Configure different aspects of the video module and its plugins"
-msgstr ""
-
-#: video.install:17
-msgid "Store video transcoding queue"
-msgstr ""
-
-#: video.install:20
-msgid "original file id"
-msgstr ""
-
-#: video.install:27
-msgid "Process ID"
-msgstr ""
-
-#: video.install:34
-msgid "status of the transcoding"
-msgstr ""
-
-#: video.install:41
-msgid "Started transcodings"
-msgstr ""
-
-#: video.install:47
-msgid "Transcoding completed"
-msgstr ""
-
-#: video.install:53
-msgid "Informations related to the videos"
-msgstr ""
-
-#: video.info:0
-msgid "Allows video nodes."
-msgstr ""
-
-#: includes/apiclient.inc:44;81
-msgid "YouTube Uploads not currently available"
-msgstr ""
-
-#: includes/apiclient.inc:62;67
-msgid "YouTube uploads currently unavailable"
-msgstr ""
-
-#: includes/apiclient.inc:33;40;63;68;80
-msgid "video_upload"
-msgstr ""
-
-#: includes/apiclient.inc:33
-msgid "No YouTube username set"
-msgstr ""
-
-#: includes/apiclient.inc:40
-msgid "No YouTube password set"
-msgstr ""
-
-#: includes/apiclient.inc:63
-msgid "Authentication error for YouTube Account"
-msgstr ""
-
-#: includes/apiclient.inc:68
-msgid "Authentication error for YouTube Account: %error"
-msgstr ""
-
-#: includes/apiclient.inc:80
-msgid "No developer key set"
-msgstr ""
-
-#: includes/apiclient.inc:104;133
-msgid "youtube_video"
-msgstr ""
-
-#: includes/apiclient.inc:104
-msgid "Authentication error while creating a YouTube connection object: %error"
-msgstr ""
-
-#: includes/apiclient.inc:133
-msgid "Authentication error while receiving YouTube connection object: %error"
-msgstr ""
-
-#: includes/apiclient.inc:161
-msgid "youtbe_video"
-msgstr ""
-
-#: includes/apiclient.inc:161
-msgid "Couldn't find the Zend client libraries."
-msgstr ""
-
-#: includes/common.inc:156;199;285;337;385
-msgid "Your browser is not able to display this multimedia content."
-msgstr ""
-
-#: includes/common.inc:0
-msgid "1 year"
-msgid_plural "@count years"
-msgstr[0] ""
-msgstr[1] ""
-
-#: includes/common.inc:0
-msgid "1 week"
-msgid_plural "@count weeks"
-msgstr[0] ""
-msgstr[1] ""
-
-#: includes/common.inc:0
-msgid "1 day"
-msgid_plural "@count days"
-msgstr[0] ""
-msgstr[1] ""
-
-#: includes/common.inc:0
-msgid "1 hour"
-msgid_plural "@count hours"
-msgstr[0] ""
-msgstr[1] ""
-
-#: includes/common.inc:0
-msgid "1 min"
-msgid_plural "@count min"
-msgstr[0] ""
-msgstr[1] ""
-
-#: includes/common.inc:0
-msgid "1 sec"
-msgid_plural "@count sec"
-msgstr[0] ""
-msgstr[1] ""
-
-#: plugins/ffmpeg.inc:177 plugins/ffmpeg_wrapper.inc:179
-msgid "error generating thumbnail for video: generated file %file does not exist.<br />Command Executed:<br />%cmd<br />Command Output:<br />%out"
-msgstr ""
-
-#: types/uploadfield/uploadfield_convert.inc:52;63
-msgid "Video submission queued for processing. Please wait: our servers are preparing your video for web displaying."
-msgstr ""
-
-#: types/uploadfield/uploadfield_file.inc:121
-msgid "An image thumbnail was not able to be created."
-msgstr ""
-
-#: types/uploadfield/uploadfield_formatter.inc:150
-msgid "This video is currently being processed. Please wait."
-msgstr ""
-
-#: types/uploadfield/uploadfield_formatter.inc:158
-msgid "The video conversion process has failed. You might want to submit a simpler video format like <em>mpeg</em> or <em>divx avi</em>.<br />If the problem persists please contact website administrators."
-msgstr ""
-
-#: types/uploadfield/uploadfield_thumb.inc:25
-msgid "Transcoder not configured properly"
-msgstr ""
-
-#: types/uploadfield/uploadfield_thumb.inc:40
-msgid "Video Thumbnails"
-msgstr ""
-
-#: types/uploadfield/uploadfield_widget.inc:22
-msgid "Video Player Settings"
-msgstr ""
-
-#: types/uploadfield/uploadfield_widget.inc:30
-msgid "Default Video Resolution"
-msgstr ""
-
-#: types/uploadfield/uploadfield_widget.inc:34
-msgid "Default player resolution WIDTHXHEIGHT in px. eg : 16:9 for widescreen or 4:3 for general screen"
-msgstr ""
-
-#: types/uploadfield/uploadfield_widget.inc:39
-msgid "Default Video Player Width"
-msgstr ""
-
-#: types/uploadfield/uploadfield_widget.inc:43
-msgid "Default player WIDTHXHEIGHT in px. eg : 640 for 640X480 player size if resolution it 4:3"
-msgstr ""
-
-#: types/uploadfield/uploadfield_widget.inc:50
-msgid "Video Thumbnail Settings"
-msgstr ""
-
-#: types/uploadfield/uploadfield_widget.inc:69
-msgid "Upload video thumbnail"
-msgstr ""
-
-#: types/uploadfield/uploadfield_widget.inc:69
-msgid "Replace video thumbnail with"
-msgstr ""
-
-#: types/uploadfield/uploadfield_widget.inc:70
-msgid "Choose a image that will be used as default video thumbnail."
-msgstr ""
-
-#: types/uploadfield/uploadfield_widget.inc:83
-msgid "Video Advanced Settings"
-msgstr ""
-
-#: types/uploadfield/uploadfield_widget.inc:90
-msgid "Enable auto conversion video"
-msgstr ""
-
-#: types/uploadfield/uploadfield_widget.inc:91
-msgid "Use ffmpeg(Default) to automaticcally convert videos to web compatible types eg. FLV, Please make sure to configure convertor settings."
-msgstr ""
-
-#: types/uploadfield/uploadfield_widget.inc:96
-msgid "Enable auto thumbnail video"
-msgstr ""
-
-#: types/uploadfield/uploadfield_widget.inc:97
-msgid "Use ffmpeg(Default) to automaticcally thumbnails, Please make sure to configure convertor settings."
-msgstr ""
-
-#: types/uploadfield/uploadfield_widget.inc:115
-msgid "The default image could not be uploaded. The destination %destination does not exist or is not writable by the server."
-msgstr ""
-
-#: types/uploadfield/uploadfield_widget.inc:160
-msgid "Only web-standard videos are supported through the video widget. If needing to upload other types of files, change the widget to use a standard file upload."
-msgstr ""
-
-#: types/uploadfield/uploadfield_widget.inc:166
-msgid "Please specify default width in integers only (e.g. 640)."
-msgstr ""
-
-#: types/uploadfield/uploadfield_widget.inc:173
-msgid "Please specify a resolution in the format WIDTH:HEIGHT (e.g. 16:9)."
-msgstr ""
-
-#: types/uploadfield/uploadfield_widget.inc:228
-msgid "Width for Player"
-msgstr ""
-
-#: types/uploadfield/uploadfield_widget.inc:230
-msgid "Set player width(in pix) here, make sure your video have good resolution to fix on larger values."
-msgstr ""
-
-#: types/uploadfield/uploadfield_widget.inc:246
-msgid "Bypass auto conversion"
-msgstr ""
-
-#: types/uploadfield/uploadfield_widget.inc:248
-msgid "This will bypass your auto conversion of videos."
-msgstr ""
-
-#: types/uploadfield/uploadfield_widget.inc:264
-msgid "Override Video Thumbnail with Default"
-msgstr ""
-
-#: types/uploadfield/uploadfield_widget.inc:266
-msgid "If you want to use default image instead of using actual thumbnail of video then check."
-msgstr ""
-
-#: types/uploadfield/uploadfield_widget.inc:278
-msgid "Save"
-msgstr ""
-
-#: types/uploadfield/uploadfield_widget.inc:290
-msgid "Preview"
-msgstr ""
-
-#: types/uploadfield/uploadfield_widget.inc:293
-msgid "Delete"
-msgstr ""
-
-#: types/uploadfield/uploadfield.module:23
-msgid "The uploadfield module has been disabled. The <a href=\"http://drupal.org/project/filefield\">FileField module</a> needs to be installed for it to work properly."
-msgstr ""
-
-#: types/uploadfield/uploadfield.module:205
-msgid "An edit widget for video files, including video thumbnails and transcoding to flash."
-msgstr ""
-
-#: types/uploadfield/uploadfield.module:296
-msgid "video"
-msgstr ""
-
-#: types/uploadfield/uploadfield.module:298
-msgid "Displays video files with player embeded."
-msgstr ""
-
-#: types/uploadfield/uploadfield.module:301
-msgid "video thumbnail linked to video"
-msgstr ""
-
-#: types/uploadfield/uploadfield.module:303
-msgid "Displays video thumb files then the video."
-msgstr ""
-
-#: types/uploadfield/uploadfield.module:315
-msgid "@preset of video thumbnail linked to video"
-msgstr ""
-
-#: types/uploadfield/uploadfield.module:445
-msgid "Upload support"
-msgstr ""
-
-#: types/uploadfield/uploadfield.module:446
-msgid "You can upload a video file from your computer to this website."
-msgstr ""
-
-#: types/uploadfield/uploadfield.info:0
-msgid "Video Upload"
-msgstr ""
-
-#: types/uploadfield/uploadfield.info:0
-msgid "handle video upload for video module using filefield and CCK."
-msgstr ""
-
diff --git a/types/uploadfield/uploadfield.css b/types/uploadfield/uploadfield.css
deleted file mode 100644
index dc5b21a..0000000
--- a/types/uploadfield/uploadfield.css
+++ /dev/null
@@ -1,114 +0,0 @@
-/* $Id$ */
-
-.filefield-element .filefield-file-info, .video_thumbnail {
- min-width: 100px;
- min-height: 100px;
-}
-
-.filefield-element .imagefield-preview {
- min-width: 100px;
- min-height: 100px;
-}
-
-.filefield-element .imagefield-text {
- max-width: 40em; /* Reflect the maxlength of the ALT attribute (80 characters). */
-}
-
-.filefield-element .uploadfield-text {
- max-width: 40em;
-}
-
-.video_thumbnail {
- min-width: 100px;
- min-height: 100px;
-}
-
-.uploadfield {
-
-}
-
-.uploadfield-nodelink {
-
-}
-
-.uploadfield-video-thumb {
-
-}
-
-.uploadfield-video-thumb img{
- width : 250px;
-/* min-width: 100px; */
- min-height: 210px;
-
-}
-
-.uploadfield-video-thumb span{
- /* This is the overlay image for use as a play button. */
- background: url(../../images/play.png) no-repeat;
-
- /* This is the size of our button. DOES NOT WORK WITH DEFAULT THUMB SIZE! */
- width: 50px;
- height: 112px;
- position : absolute;
- margin : 65px 100px;
-}
-
-.uploadfield-video-thumb span:hover {
- background-position: -50px 0px;
-}
-
-.video-width-text {
- width:10px;
-}
-
-.video-thumb-selection{
-
-}
-
-.video-thumb-selection .form-item {
-
-}
-
-.video-thumbnails{
-/* display : block;*/
-}
-.video-thumbnails .form-item{
- float:left;
- margin-right:10px;
- max-width:30%;
- padding-right:10px;
-}
-
-.video-bypass-auto-conversion{
-
-}
-.video-default-thumbnail{
-
-}
-
-.video-data{
-
-}
-
-.video_image_teaser {
- float: left;
- padding: 0.5em;
-}
-
-br.video_image_clear {
- clear: both;
-}
-
-.video_image_view {
- /* inser here rules for node page image */
-}
-
-.video-ffmpeg-helper-inprogress {
- border: 1px solid red;
- padding: .5em;
-}
-
-/* override filefield entry */
-.widget-edit{
- max-width:70%;
-} \ No newline at end of file
diff --git a/types/uploadfield/uploadfield.info b/types/uploadfield/uploadfield.info
deleted file mode 100644
index a609098..0000000
--- a/types/uploadfield/uploadfield.info
+++ /dev/null
@@ -1,18 +0,0 @@
-; $Id$
-name = Video Upload
-description = handle video upload for video module using filefield and CCK.
-core = 7.x
-files[]= uploadfield.module
-files[]= uploadfield.install
-files[]= uploadfield.theme.inc
-files[]= uploadfield_convert.inc
-files[]= uploadfield_file.inc
-files[]= uploadfield_formatter.inc
-files[]= uploadfield_thumb.inc
-files[]= uploadfield_transcode.inc
-files[]= uploadfield_widget.inc
-dependencies[] = content
-dependencies[] = filefield
-dependencies[] = video
-package = "Video"
-
diff --git a/types/uploadfield/uploadfield.install b/types/uploadfield/uploadfield.install
deleted file mode 100644
index a2e1b65..0000000
--- a/types/uploadfield/uploadfield.install
+++ /dev/null
@@ -1,25 +0,0 @@
-<?php
-// $Id$
-
-/**
- * Implementation of hook_install().
- */
-function uploadfield_install() {
- drupal_load('module', 'content');
- content_notify('install', 'uploadfield');
-}
-
-function uploadfield_uninstall() {
- drupal_load('module', 'content');
- content_notify('uninstall', 'uploadfield');
-}
-
-function uploadfield_enable() {
- drupal_load('module', 'content');
- content_notify('enable', 'uploadfield');
-}
-
-function uploadfield_disable() {
- drupal_load('module', 'content');
- content_notify('disable', 'uploadfield');
-} \ No newline at end of file
diff --git a/types/uploadfield/uploadfield.module b/types/uploadfield/uploadfield.module
deleted file mode 100644
index a76f112..0000000
--- a/types/uploadfield/uploadfield.module
+++ /dev/null
@@ -1,540 +0,0 @@
-<?php
-// $Id$
-
-/**
- * @file
- * uploadfield core hooks and menu callbacks.
- */
-
-include_once dirname(__FILE__) . '/uploadfield_file.inc';
-include_once dirname(__FILE__) . '/uploadfield_widget.inc';
-
-/**
- * Implementation of hook_init().
- *
- * Load required includes.
- */
-function uploadfield_init() {
-// add CSS file
- drupal_add_css(drupal_get_path('module', 'video') .'/types/uploadfield/uploadfield.css');
- // If FileField is not available, immediately disable uploadfield.
- if (!module_exists('filefield')) {
- module_disable(array('uploadfield'));
- drupal_set_message(t('The uploadfield module has been disabled. The <a href="http://drupal.org/project/filefield">FileField module</a> needs to be installed for it to work properly.'));
- return;
- }
-}
-
-/**
- * Implementation of hook_theme().
- */
-function uploadfield_theme() {
- $theme = array();
- $theme = array(
- // Theme an image uploaded to uploadfield with alt and title.
- // TODO: Switch to core theme image if possible.
- 'uploadfield_image' => array(
- 'arguments' => array('file' => NULL,
- 'alt' => '',
- 'title' => '',
- 'attributes' => NULL,
- 'getsize' => TRUE),
- ),
- // Theme an uploadfield field item. It calls imagefied_image with the proper
- // item properties as arguments.
- 'uploadfield_item' => array(
- 'arguments' => array('item' => NULL),
- ),
- // uploadfield_widget form element type theme function.
- 'uploadfield_widget' => array(
- 'arguments' => array('element' => NULL),
- 'file' => 'uploadfield_widget.inc',
- ),
- // Use to generate a preview (admin view) of an uploadfield item for use in
- // field item forms and filefield widgets. Invoked by filefield_widget_process.
- 'uploadfield_widget_preview' => array(
- 'arguments' => array('item' => NULL),
- ),
- // Theme function for the field item elements. allows you to place children
- // within the context of the parent.
- 'uploadfield_widget_item' => array(
- 'arguments' => array('element' => NULL),
- ),
- // Generates and img tag to the admin thumbnail of an uploadfield upload.
- 'uploadfield_admin_thumbnail' => array(
- 'arguments' => array('item' => NULL),
- ),
- // Generates and img tag to the video thumbnails.
- 'uploadfield_widget_video_thumb' => array(
- 'arguments' => array('item' => NULL),
- ),
-
- // uploadfield formatter theme functions.
- 'uploadfield_formatter_video_plain' => array(
- 'arguments' => array('element' => NULL),
- 'file' => 'uploadfield_formatter.inc',
- ),
- 'uploadfield_formatter_video_nodelink' => array(
- 'arguments' => array('element' => NULL),
- 'file' => 'uploadfield_formatter.inc',
- ),
- 'uploadfield_formatter_video_imagelink' => array(
- 'arguments' => array('element' => NULL),
- 'file' => 'uploadfield_formatter.inc',
- ),
-
- //from includes/common.inc
- 'video_format_play' => array(
- 'arguments' => array( 'output' => NULL,
- 'url' => NULL,
- 'title' => NULL,
- 'link_text' => NULL
- ),
- ),
- 'video_play_dcr' => array(
- 'arguments' => array('node' => NULL),
- ),
- 'video_play_divx' => array(
- 'arguments' => array('node' => NULL),
- ),
- 'video_play_flash' => array(
- 'arguments' => array('node' => NULL),
- ),
- 'video_play_ogg_theora' => array(
- 'arguments' => array('node' => NULL),
- ),
- 'video_play_quicktime' => array(
- 'arguments' => array('node' => NULL),
- ),
- 'video_play_realmedia' => array(
- 'arguments' => array('node' => NULL),
- ),
- 'video_play_swf' => array(
- 'arguments' => array('node' => NULL),
- ),
- 'video_play_windowsmedia' => array(
- 'arguments' => array('node' => NULL),
- ),
- 'video_encoding_failed' => array(
- 'arguments' => array(),
- ),
- 'video_inprogress' => array(
- 'arguments' => array(),
- ),
- );
- if(module_exists('imagecache')) {
- // imagecache presets
- foreach (imagecache_presets() as $preset) {
- $theme['uploadfield_formatter_'. $preset['presetname'] .'_videolinked'] = array(
- 'arguments' => array('element' => NULL),
- 'function' => 'theme_uploadfield_formatter_videolinked',
- 'file' => 'uploadfield_formatter.inc'
- );
- }
- }
-
- return $theme;
-}
-
-/**
- * Implementation of hook_elements().
- */
-function uploadfield_elements() {
- $elements = array();
-
- // An uploadfield is really just a FileField with extra processing.
- $filefield_elements = module_invoke('filefield', 'elements');
- $elements['uploadfield_widget'] = $filefield_elements['filefield_widget'];
- $elements['uploadfield_widget']['#process'][] = 'uploadfield_widget_process';
- $elements['uploadfield_widget']['#element_validate'][] = 'uploadfield_widget_validate';
-
- // uploadfield needs a separate value callback to save its alt and title texts.
- $elements['uploadfield_widget']['#value_callback'] = 'uploadfield_widget_value';
-
- return $elements;
-}
-
-/**
- * Implementation of hook_file_download.
- */
-function uploadfield_file_download($filepath) {
-// watchdog('video', 'file path is ' . $filepath);
-// echo $filepath;
-// Return headers for admin thumbnails if private files are enabled.
-// if (strpos($filepath, 'video_thumbs') !== FALSE) {
-// $original_path = str_replace('video_thumbs/', '', $filepath);
-// $original_full_path = file_create_path($original_path);
-// $thumb_full_path = file_create_path($filepath);
-//
-// // Allow access to temporary thumbnails, since they're not yet associated
-// // with a node. If not temporary, check access on the original file.
-// $status = db_result(db_query("SELECT status FROM {files} WHERE filepath = '%s'", $original_full_path));
-// $access = ($status == 0 || module_invoke_all('file_download', $original_path));
-// if ($access && $info = getimagesize($thumb_full_path)) {
-// return array(
-// 'Content-Type: ' . $info['mime'],
-// 'Content-Length: ' . filesize($thumb_full_path)
-// );
-// }
-// }
-
- // Return headers for default images.
-// if (strpos($filepath, 'uploadfield_default_images') !== FALSE) {
- if (strpos($filepath, 'video_thumbs') !== FALSE) {
- $full_path = file_create_path($filepath);
- if ($info = getimagesize($full_path)) {
- return array(
- 'Content-Type: ' . $info['mime'],
- 'Content-Length: ' . filesize($full_path)
- );
- }
- }
-}
-
-/**
- * Implementation of CCK's hook_widget_info().
- */
-function uploadfield_widget_info() {
- $module_path = drupal_get_path('module', 'uploadfield');
- return array(
- 'uploadfield_widget' => array(
- 'label' => t('Video'),
- 'field types' => array('filefield'),
- 'multiple values' => CONTENT_HANDLE_CORE,
- 'callbacks' => array('default value' => CONTENT_CALLBACK_CUSTOM),
- 'description' => t('An edit widget for video files, including video thumbnails and transcoding to flash.'),
- ),
- );
-}
-
-/**
- * Implementation of CCK's hook_widget_settings().
- */
-function uploadfield_widget_settings($op, $widget) {
- switch ($op) {
- case 'form':
- return uploadfield_widget_settings_form($widget);
- case 'validate':
- return uploadfield_widget_settings_validate($widget);
- case 'save':
- return uploadfield_widget_settings_save($widget);
- }
-}
-
-/**
- * Implementation of CCK's hook_widget().
- *
- * Assign default properties to item and delegate to FileField.
- */
-function uploadfield_widget(&$form, &$form_state, $field, $items, $delta = 0) {
-// Add default values to items.
-// TODO: use CCK's default value callback.
- if (empty($items[$delta])) {
- $items[$delta] = array('alt' => '', 'title' => '');
- }
-
- // Start with the FileField widget as a basic start.
- // Note that FileField needs to modify $form by reference.
- $element = filefield_widget($form, $form_state, $field, $items, $delta);
-
- // Add uploadfield specific validators.
- // $element['#upload_validators'] = array_merge($element['#upload_validators'], uploadfield_widget_upload_validators($field));
-
- return $element;
-}
-
-/**
- * Get the additional upload validators for an image field.
- *
- * @param $field
- * The CCK field array.
- * @return
- * An array suitable for passing to file_save_upload() or the file field
- * element's '#upload_validators' property.
- */
-function uploadfield_widget_upload_validators($field) {
- $validators = array();
-
- // Ensure that only web images are supported.
- $web_extensions = array(
- 'mov', 'mp4', '3gp', '3g2', 'mpg', 'mpeg', // quicktime
- 'divx', //divx
- 'rm', // realplayer
- 'flv', 'f4v', //flash player
- 'swf', // swf player
- 'dir', 'dcr', // dcr player
- 'asf', 'wmv', 'avi', 'mpg', 'mpeg', // windows media
- 'ogg' // ogg theora
- );
- $extensions = array_filter(explode(' ', $field['widget']['file_extensions']));
- if (empty($extensions)) {
- $extensions = $web_extensions;
- }
- $validators['filefield_validate_extensions'][0] = implode(' ', array_intersect($extensions, $web_extensions));
-
- // Add the image validator as a basic safety check.
- // $validators['filefield_validate_is_image'] = array();
-
- // Add validators for resolutions.
- // if (!empty($field['widget']['max_resolution']) || !empty($field['widget']['min_resolution'])) {
- // $validators['filefield_validate_image_resolution'] = array(
- // $field['widget']['max_resolution'],
- // $field['widget']['min_resolution'],
- // );
- // }
-
- return $validators;
-}
-
-/**
- * Implementation of CCK's hook_field_formatter_info().
- */
-function uploadfield_field_formatter_info() {
- $module_path = drupal_get_path('module', 'uploadfield');
- $formatters = array(
- 'video_plain' => array(
- 'label' => t('video'),
- 'field types' => array('filefield'),
- 'description' => t('Displays video files with player embedded.'),
- ),
- 'video_nodelink' => array(
- 'label' => t('video thumbnail linked to video'),
- 'field types' => array('filefield'),
- 'description' => t('Displays video thumb files then the video.'),
- ),
- // 'video_imagelink' => array(
- // 'label' => t('Video Thumbnail linked to video file download'),
- // 'field types' => array('filefield'),
- // 'description' => t('Displays video files in their original size.'),
- // ),
- );
-
-if(module_exists('imagecache')) {
- foreach (imagecache_presets() as $preset) {
- $formatters[$preset['presetname'] .'_videolinked'] = array(
- 'label' => t('Preset @preset of video thumbnail linked to video', array('@preset' => $preset['presetname'])),
- 'field types' => array('filefield'),
- );
- }
-}
- return $formatters;
-}
-
-/**
- * Implementation of CCK's hook_default_value().
- */
-function uploadfield_default_value(&$form, &$form_state, $field, $delta) {
- return filefield_default_value($form, $form_state, $field, $delta);
-}
-
-/**
- * Implementation of hook_form_[form_id]_alter().
- *
- * Modify the add new field form to make "Image" the default formatter.
- */
-function uploadfield_form_content_field_overview_form_alter(&$form, &$form_state) {
- $form['#submit'][] = 'uploadfield_form_content_field_overview_submit';
-}
-
-/**
- * Submit handler to set a new field's formatter to "video_plain".
- */
-function uploadfield_form_content_field_overview_submit(&$form, &$form_state) {
- if (isset($form_state['fields_added']['_add_new_field']) && isset($form['#type_name'])) {
- $new_field = $form_state['fields_added']['_add_new_field'];
- $node_type = $form['#type_name'];
- $field = content_fields($new_field, $node_type);
- if ($field['widget']['module'] == 'uploadfield') {
- foreach ($field['display_settings'] as $display_type => $display_settings) {
- if ($field['display_settings'][$display_type]['format'] == 'default') {
- $field['display_settings'][$display_type]['format'] = 'video_plain';
- }
- }
- content_field_instance_update($field);
- }
- }
-}
-
-/**
- * @defgroup "Theme Callbacks"
- * @{
- * @see uploadfield_theme().
- */
-function theme_uploadfield_image($file, $alt = '', $title = '', $attributes = NULL, $getsize = TRUE) {
- $file = (array)$file;
- // return $file['filepath'];
- if (!is_file($file['filepath'])) {
- return '<!-- File not found: '. $file['filepath'] .' -->';
- }
-
- if ($getsize) {
- // Use cached width and height if available.
- if (!empty($file['data']['width']) && !empty($file['data']['height'])) {
- $attributes['width'] = $file['data']['width'];
- $attributes['height'] = $file['data']['height'];
- }
- // Otherwise pull the width and height from the file.
- elseif (list($width, $height, $type, $image_attributes) = @getimagesize($file['filepath'])) {
- $attributes['width'] = $width;
- $attributes['height'] = $height;
- }
- }
-
- if (!empty($title)) {
- $attributes['title'] = $title;
- }
-
- // Alt text should be added even if it is an empty string.
- $attributes['alt'] = $alt;
-
- // Add a timestamp to the URL to ensure it is immediately updated after editing.
- $query_string = '';
- if (isset($file['timestamp'])) {
- $query_character = (variable_get('file_downloads', FILE_DOWNLOADS_PUBLIC) == FILE_DOWNLOADS_PRIVATE && variable_get('clean_url', '0') == '0') ? '&' : '?';
- $query_string = $query_character . $file['timestamp'];
- }
-
- $url = file_create_url($file['filepath']) . $query_string;
- $attributes['src'] = $url;
- $attributes = drupal_attributes($attributes);
- return '<span></span><img '. $attributes .' />';
-}
-
-function theme_uploadfield_item($item) {
- return theme('uploadfield_image', $item, $item['alt'], $item['title']);
-}
-
-function theme_uploadfield_widget_preview($item = NULL) {
- return '<div class="uploadfield-preview">' . theme('uploadfield_admin_thumbnail', $item) . '</div>';
-}
-
-function theme_uploadfield_widget_item($element) {
- return theme('filefield_widget_item', $element);
-}
-
-function theme_uploadfield_admin_thumbnail($item = NULL) {
- if (is_null($item) || empty($item['filepath'])) {
- return '<!-- link to default admin thumb -->';
- }
- $thumb_path = uploadfield_file_admin_thumb_path($item);
- return '<img src="'. file_create_url($thumb_path) .'" title="' . check_plain($item['filename']) . '" />';
-}
-
-function theme_uploadfield_widget_video_thumb($item = NULL) {
- return '<div class="uploadfield-video-thumb">' . theme('uploadfield_image', $item, '', '', '', FALSE) . '</div>';
-}
-/**
- * @} End defgroup "Theme Callbacks".
- */
-
-/**
- * Implementing video module API
- * hook_v_perm()
- */
-
-function uploadfield_v_perm() {
- return array('use default thumbnail', 'bypass conversion video');
-}
-
-/**
- * Implementation of hook_v_help
- */
-function video_upload_v_help() {
-
- $help = array();
- $help['upload']['data'] = '<b>' . t('Upload support') . '</b>';
- $help['upload']['children'] = array(t('You can upload a video file from your computer to this website.'));
-
- return $help;
-}
-
-
-/**
- * Implements the hook_v_auto_resolution
- */
-function uploadfield_v_auto_resolution($vidfile) {
-//TODO : add dynamic converter selector
- module_load_include('inc', 'video', '/plugins/ffmpeg');
- if(module_hook('ffmpeg', 'auto_playtime')) {
- return ffmpeg_auto_playtime($vidfile);
- }
- return false;
-}
-
-
-/**
- * Implements the hook_v_auto_resolution
- */
-function uploadfield_v_auto_playtime($vidfile) {
-//TODO : add dynamic converter selector
- module_load_include('inc', 'video', '/plugins/ffmpeg');
- if(module_hook('ffmpeg', 'auto_playtime')) {
- return ffmpeg_auto_playtime($vidfile);
- }
- return false;
-}
-
-/**
- * Implementation of hook_v_video()
- */
-function uploadfield_v_video($op, &$element) {
- global $user;
- switch ($op) {
- case 'insert':
- case 'update':
- // TODO : need to add validation on just submit scenario
- $field = content_fields($element['#field_name'], $element['#type_name']);
- // auto thumbnailing
- if($field['widget']['autothumbnail']) {
- $update = NULL;
- $vidfile = $element['#value'];
- $vid = $vidfile['fid'];
- $vid_path = $vidfile['data']['video_thumb'];
- $vid_dir = explode('/', $vid_path);
- $vid_name = $vid_dir[count($vid_dir) - 1];
-
- $file = new stdClass();
- $file->uid = $user->uid;
- $file->status = FILE_STATUS_PERMANENT;
- $file->filename = $vid_name;
- $file->filepath = $vid_path;
- $file->filemime = file_get_mimetype($vid_name);
- $file->filesize = filesize($vid_path);
- $file->timestamp = REQUEST_TIME;
-
- if($op == 'update') {
- $old_fid = $element['#default_value']['data']['video_thumb_fid'];
- $update = 'fid';
- $file->fid = $old_fid;
- }
- drupal_write_record ('files', $file, $update);
- // get fid if and only if insert
- if($op == 'insert')
- $file->fid = db_last_insert_id('files', 'fid');
- // add file id to the data
- $element['data']['video_thumb_fid'] = array (
- '#type'=> 'value',
- '#value' => $file->fid
- );
- }
-
- // auto covnersion
- if($field['widget']['autoconversion']) {
- video_auto_transcode_add_to_queue($element, $op);
- }
- break;
- case 'delete':
- //delete thumbnails
- break;
- case 'thumbs':
- include_once dirname(__FILE__) . '/uploadfield_thumb.inc';
- //create thumbs and display
- video_auto_thumb_process($element);
- break;
- case 'convert':
- include_once dirname(__FILE__) . '/uploadfield_convert.inc';
- //create FLV file
-// video_auto_transcode_process($element);
- break;
- }
-} \ No newline at end of file
diff --git a/types/uploadfield/uploadfield.theme.inc b/types/uploadfield/uploadfield.theme.inc
deleted file mode 100644
index 5a81efd..0000000
--- a/types/uploadfield/uploadfield.theme.inc
+++ /dev/null
@@ -1,18 +0,0 @@
-<?php
-//$Id$
-/**
- *
- * @file
- * Theme functions for the videoftp module.
- */
-
-/**
- * FormAPI theme function. Theme the output of an video upload field.
- */
-function theme_uploadfield_widget($element) {
- return theme('form_element', $element, $element['#children']);
-}
-
-function theme_uploadfield_widget_item($element) {
- return theme('filefield_widget_item', $element);
-} \ No newline at end of file
diff --git a/types/uploadfield/uploadfield_convert.inc b/types/uploadfield/uploadfield_convert.inc
deleted file mode 100644
index fbd13ac..0000000
--- a/types/uploadfield/uploadfield_convert.inc
+++ /dev/null
@@ -1,102 +0,0 @@
-<?php
-//$Id$
-
-/**
- * @file
- * Enable conversion control on video module.
- *
- * @author Heshan Wanigasooriya <heshan at heidisoft dot com, heshanmw at gmail dot com>
- */
-
-
-/**
- * Define some constants
- */
-define('VIDEO_RENDERING_PENDING', 1);
-define('VIDEO_RENDERING_ACTIVE', 5);
-define('VIDEO_RENDERING_COMPLETE', 10);
-define('VIDEO_RENDERING_FAILED', 20);
-
-function video_auto_transcode_process(&$element) {
-// $file = $element['#value'];
-// $element['data']['old_vid'] = array(
-// '#type' => 'value',
-// '#value' => $file['fid']
-// );
-// $element['data']['vid_transcode_status'] = array(
-// '#type' => 'value',
-// '#value' => VIDEO_RENDERING_PENDING
-// );
-}
-
-/**
- * Add a video conversion rendering process to the queue
- */
-function video_auto_transcode_add_to_queue(&$element, $op) {
- $file = $element['#value'];
-
- //load cck instace settings
-// $field = content_fields($element['#field_name'], $element['#type_name']);
-// $resolution = array_filter(explode(':', $field['widget']['default_resolution']));
-// $element['#item']['data']['height'] = $element['#item']['data']['width'] * ($resolution[1]/$resolution[0]);
-
-// $serialized_data = array('resolution' =>$field['widget']['default_resolution'], 'width' => $element['#item']['data']['width']);
-
- $fid = $file['fid'];
-
- switch($op) {
- case 'insert':
- db_query('INSERT INTO {video_rendering} (fid, pid, status, started, completed)
- VALUES (%d, %d, %d, %d, %d)',
- $fid, 0, VIDEO_RENDERING_PENDING, 0, 0);
- drupal_set_message(t('Video submission queued for processing. Please wait: our servers are preparing your video for web displaying.'));
- break;
-
- case 'update':
- $old_fid = $element['#default_value']['fid'];
- $serialized_data ['old_file'] = $old_fid;
- if($old_fid != $fid) {
- db_query('DELETE FROM {video_rendering} WHERE fid = %d', $old_fid);
- db_query('INSERT INTO {video_rendering} (fid, pid, status, started, completed, serialized_data)
- VALUES (%d, %d, %d, %d, %d, \'%s\')',
- $fid, 0, VIDEO_RENDERING_PENDING, 0, 0, serialize($serialized_data));
- drupal_set_message(t('Video submission queued for processing. Please wait: our servers are preparing your video for web displaying.'));
- }
- break;
- }
-}
-
-function _video_get_content_types() {
- $widget_info = uploadfield_widget_info();
- $content_types = array();
- foreach ($widget_info as $key => $value) {
- $query = "SELECT type_name FROM {content_node_field_instance} WHERE widget_type='%s'";
- $result = db_query($query, $key);
- while ($row = db_fetch_object($result)) {
- $content_types[] = $row->type_name;
- }
- }
- return $content_types;
-}
-
-function _video_get_field_by_content_type($content_type) {
- $type = content_types($content_type);
-
- $fields = $type['fields'];
- $field_name = '';
- foreach ($fields as $field) {
- if ($field['type'] == 'filefield') {
- $db_info = content_database_info($field);
- $db_info = array_merge($db_info, $field);
- return $db_info;
- }
- }
-}
-
-function _video_get_nid_by_video_token($content_type, $fid) {
- $field_info = _video_get_field_by_content_type($content_type);
- $query = "SELECT nid FROM {%s} WHERE %s = '%s'";
- $result = db_query($query, $field_info['table'], $field_info['field_name'] .'_fid', $fid);
- $nid = db_fetch_object($result);
- return $nid;
-} \ No newline at end of file
diff --git a/types/uploadfield/uploadfield_file.inc b/types/uploadfield/uploadfield_file.inc
deleted file mode 100644
index cff6c7f..0000000
--- a/types/uploadfield/uploadfield_file.inc
+++ /dev/null
@@ -1,123 +0,0 @@
-<?php
-// $Id$
-
-/**
- * @file
- * hook_file and uploadfield file functions.
- */
-
-/**
- * Implementation of hook_file_insert().
- */
-function uploadfield_file_insert($file) {
-// Currently empty. Thumbnails are now generated on preview.
-}
-
-/**
- * Implementation of hook_file_delete().
- *
- * Delete the admin thumbnail when the original is deleted.
- */
-function uploadfield_file_delete($file) {
-// delete thumb from files
-// file_set_status($file->data['video_thumb_fid'], FILE_STATUS_TEMPORARY);
- db_query('DELETE FROM {files} WHERE fid = %d', $file->data['video_thumb_fid']);
-
- // delete thums directory
- $thumbs_path = variable_get('video_thumb_path', 'video_thumbs');
- //files will save in files/video_thumbs/#fileId folder
- $tmp = file_directory_path(). '/' . $thumbs_path . '/' . $file->fid . '/';
- // rmdir($tmp);
- _file_delete_tree($tmp);
-// if(@rmdir($tmp)) {
-// }
-}
-
-
-// delete dir and its content
-function _file_delete_tree($current_dir) {
- if($dir = @opendir($current_dir)) {
- while (($f = readdir($dir)) !== false) {
- if($f > '0' and filetype($current_dir.$f) == "file") {
- file_delete($current_dir.$f);
- } elseif($f > '0' and filetype($current_dir.$f) == "dir") {
- _file_delete_tree($current_dir.$f."\\");
- }
- }
- closedir($dir);
- rmdir($current_dir);
- }
-}
-
-/**
- * Simple utility function to check if a file is an image.
- */
-function uploadfield_file_is_image($file) {
- return TRUE;
- //TODO : add file validations
- $file = (object)$file;
- return in_array($file->filemime, array('image/jpg', 'image/pjpeg', 'image/jpeg', 'image/png', 'image/gif'));
-}
-
-/**
- * Given a file, return the path the image thumbnail used while editing.
- */
-function uploadfield_file_admin_thumb_path($file, $create_thumb = TRUE) {
- $file = (object)$file;
- $short_path = preg_replace('/^' . preg_quote(file_directory_path(), '/') . '/', '', $file->filepath);
- $filepath = file_directory_path() . '/video_thumb' . $short_path;
-
- if ($create_thumb) {
- uploadfield_create_admin_thumb($file->filepath, $filepath);
- }
-
- return $filepath;
-}
-
-/**
- * Create a thumbnail to be shown while editing an image.
- */
-function uploadfield_create_admin_thumb($source, $destination) {
- if (!is_file($source)) {
- return FALSE;
- }
-
- $info = image_get_info($source);
- $size = explode('x', variable_get('uploadfield_thumb_size', '100x100'));
-
- // Check if the destination image needs to be regenerated to match a new size.
- if (is_file($destination)) {
- $thumb_info = image_get_info($destination);
- if ($thumb_info['width'] != $size[0] && $thumb_info['height'] != $size[1] && ($info['width'] > $size[0] || $info['height'] > $size[1])) {
- unlink($destination);
- }
- else {
- return;
- }
- }
-
- // Ensure the destination directory exists and is writable.
- $directories = explode('/', $destination);
- array_pop($directories); // Remove the file itself.
- // Get the file system directory.
- $file_system = file_directory_path();
- foreach ($directories as $directory) {
- $full_path = isset($full_path) ? $full_path . '/' . $directory : $directory;
- // Don't check directories outside the file system path.
- if (strpos($full_path, $file_system) === 0) {
- field_file_check_directory($full_path, FILE_CREATE_DIRECTORY);
- }
- }
-
- // Create the thumbnail.
- if ($info['width'] <= $size[0] && $info['height'] <= $size[1]) {
- file_copy($source, $destination);
- }
- elseif (image_get_toolkit() && @image_scale($source, $destination, $size[0], $size[1])) {
- // Set permissions. This is done for us when using file_copy().
- @chmod($destination, 0664);
- }
- else {
- drupal_set_message(t('An image thumbnail was not able to be created.'), 'error');
- }
-}
diff --git a/types/uploadfield/uploadfield_formatter.inc b/types/uploadfield/uploadfield_formatter.inc
deleted file mode 100644
index c4c62ac..0000000
--- a/types/uploadfield/uploadfield_formatter.inc
+++ /dev/null
@@ -1,173 +0,0 @@
-<?php
-// $Id$
-
-/**
- * @file
- * uploadfield formatter hooks and callbacks.
- */
-
-//include common player file
-
-/**
- * Define some constants
- */
-defined('VIDEO_RENDERING_PENDING')
- or define('VIDEO_RENDERING_PENDING', 1);
-defined('VIDEO_RENDERING_ACTIVE')
- or define('VIDEO_RENDERING_ACTIVE', 5);
-defined('VIDEO_RENDERING_COMPLETE')
- or define('VIDEO_RENDERING_COMPLETE', 10);
-defined('VIDEO_RENDERING_FAILED')
- or define('VIDEO_RENDERING_FAILED', 20);
-/**
- *
- * @param <type> $element
- * @return <type>
- */
-function theme_uploadfield_formatter_video_plain($element) {
-// print_r($field = content_fields($element['#field_name'], $element['#type_name']););
-// Inside a view $element may contain null data. In that case, just return.
- module_load_include('inc', 'video', '/includes/common');
-
- if (empty($element['#item']['fid'])) {
- return '';
- }
-//print_r($element['#item']['fid']);
- $result = db_query('SELECT vr.status FROM {video_rendering} vr INNER JOIN {files}
- f ON vr.fid = f.fid WHERE vr.fid = f.fid AND f.status = %d AND f.fid = %d',
- FILE_STATUS_PERMANENT, $element['#item']['fid']);
- $status = db_fetch_object($result);
-// print_r($status);
- if($status->status == VIDEO_RENDERING_ACTIVE || $status->status == VIDEO_RENDERING_PENDING) {
- return theme('video_inprogress');
- }
- else if ($status->status == VIDEO_RENDERING_FAILED) {
- return theme('video_encoding_failed');
- }
- else {
- return _video_common_get_player($element);
- }
-// $field = content_fields($element['#field_name']);
-// $item = $element['#item'];
-//
-// $item['data']['alt'] = isset($item['data']['alt']) ? $item['data']['alt'] : '';
-// $item['data']['title'] = isset($item['data']['title']) ? $item['data']['title'] : NULL;
-//
-// $class = 'uploadfield uploadfield-'. $field['field_name'];
-// return theme('uploadfield_image', $item, $item['data']['alt'], $item['data']['title'], array('class' => $class));
-}
-
-
-/**
- *
- * @param <type> $element
- * @return <type>
- */
-
-function theme_uploadfield_formatter_video_nodelink($element) {
- $field = content_fields($element['#field_name'], $element['#type_name']);
- // Inside a view $element may contain null data. In that case, just return.
- if (empty($element['#item']['fid'])) {
- return '';
- }
- // print_r($field);
- // exit;
- $node = $element['#node'];
- // $imagetag = theme('uploadfield_formatter_video_plain', $element);
- $use_default_img = $element['#item']['data']['use_default_video_thumb'];
- if($use_default_img) {
- $imagetag = theme('uploadfield_widget_video_thumb', $field['widget']['default_video_thumb']);
- }
- else if($element['#item']['data']['video_thumb']) {
- // print_r($field['widget']['default_video_thumb']);
- $thumb = array('filepath' => $element['#item']['data']['video_thumb']);
- $imagetag = theme('uploadfield_widget_video_thumb', $thumb);
- }
- $class = 'popups uploadfield uploadfield-nodelink uploadfield-'. $element['#field_name'];
- return l($imagetag, 'node/'. $node->nid, array('attributes' => array('class' => $class), 'html' => TRUE));
-
-}
-
-/**
- * use image cache profiles for video thumb display
- * @param object $element
- * @return HTML image file
- */
-
-function theme_uploadfield_formatter_videolinked($element) {
- // Inside a view $element may contain NULL data. In that case, just return.
- if (empty($element['#item']['fid'])) {
- return '';
- }
-
- // Extract the preset name from the formatter name.
- $presetname = substr($element['#formatter'], 0, strrpos($element['#formatter'], '_'));
- $style = 'linked';
-
- $item = $element['#item'];
- $item['data']['alt'] = isset($item['data']['alt']) ? $item['data']['alt'] : '';
- $item['data']['title'] = isset($item['data']['title']) ? $item['data']['title'] : NULL;
-
- $node = $element['#node'];
- // $imagetag = theme('uploadfield_formatter_video_plain', $element);
- $use_default_img = $element['#item']['data']['use_default_video_thumb'];
- if($use_default_img) {
- $thumb_path = $field['widget']['default_video_thumb'];
-// $imagetag = theme('uploadfield_widget_video_thumb', $field['widget']['default_video_thumb']);
- }
- else if($element['#item']['data']['video_thumb']) {
- // print_r($field['widget']['default_video_thumb']);
-// $thumb = array('filepath' => $element['#item']['data']['video_thumb']);
- $thumb_path = $element['#item']['data']['video_thumb'];
-// $imagetag = theme('uploadfield_widget_video_thumb', $thumb);
- }
-// die($presetname);
- $imagetag = theme('imagecache', $presetname, $thumb_path, $node->title, $node->title);
- $path = empty($item['nid']) ? '' : 'node/'. $item['nid'];
- $class = "imagecache imagecache-$presetname imagecache-$style imagecache-{$element['#formatter']}";
- return l($imagetag, $path, array('attributes' => array('class' => $class), 'html' => TRUE));
-}
-
-/**
- *
- * @param <type> $element
- * @return <type>
- */
-function theme_uploadfield_formatter_video_imagelink($element) {
- $field = content_fields($element['#field_name'], $element['#type_name']);
- // Inside a view $element may contain null data. In that case, just return.
- if (empty($element['#item']['fid'])) {
- return '';
- }
-
- $node = $element['#node'];
- // $imagetag = theme('uploadfield_formatter_video_plain', $element);
- $imagetag = theme('uploadfield_widget_video_thumb', $field['widget']['default_video_thumb']);
- $class = 'popups uploadfield uploadfield-nodelink uploadfield-'. $element['#field_name'];
- return l($imagetag, 'node/'. $node->nid, array('attributes' => array('class' => $class), 'html' => TRUE));
-}
-
-/**
- * Displays a "encoding in progress message"
- */
-function theme_video_inprogress() {
- return '<div class="video-ffmpeg-helper-inprogress">'. t('This video is currently being processed. Please wait.') . '</div>';
-}
-
-
-/**
- * Display an "encoding failed" message"
- */
-function theme_video_encoding_failed() {
- return '<div class="video-ffmpeg-helper-encoding-failed">'. t('The video conversion process has failed. You might want to submit a simpler video format like <em>mpeg</em> or <em>divx avi</em>.<br />If the problem persists please contact website administrators.') . '</div>';
-}
-
-
-/**
- * Implementation of hook_theme().
- */
-function video_ffmpeg_helper_theme() {
- return array(
-
- );
-} \ No newline at end of file
diff --git a/types/uploadfield/uploadfield_thumb.inc b/types/uploadfield/uploadfield_thumb.inc
deleted file mode 100644
index 74aeb80..0000000
--- a/types/uploadfield/uploadfield_thumb.inc
+++ /dev/null
@@ -1,47 +0,0 @@
-<?php
-//$Id$
-
-/**
- * @file
- * Enable image support for video module.
- *
- * @author Heshan Wanigasooriya <heshan at heidisoft dot com, heshanmw at gmail dot com>
- */
-
-function video_auto_thumb_process (&$element) {
-//developed for ffmpeg support
- $file = $element['#value'];
-// $field = content_fields($element['#field_name'], $element['#type_name']);
- if (isset($element['preview']) && $file['fid'] != 0) {
- // TODO : change this to use any transcode to generate thumbnails
- $transcoder = variable_get('vid_convertor', 'ffmpeg');
- module_load_include('inc', 'video', '/plugins/' . $transcoder);
- $function = variable_get('vid_convertor', 'ffmpeg') . '_auto_thumbnail';
- if (function_exists($function)) {
- // $thumbs = ffmpeg_auto_thumbnail($file);
- $thumbs = $function($file);
- }
- else {
- drupal_set_message(t('Transcoder not configured properly'), 'error');
- }
- $default_thumb = '';
- $rnd_img = rand(1, variable_get('no_of_video_thumbs', 5));
- $default_thumb = $thumbs[$rnd_img]->filepath;
-
- if(is_array($thumbs)) {
- foreach($thumbs as $fid => $img) {
- $thumbss[$img->filepath] = theme('uploadfield_image', $img, '', '', array('width' => '50'), FALSE);
- }
- }
- }
-
- $element['data']['video_thumb'] = array(
- '#type' => 'radios',
- '#title' => t('Video Thumbnails'),
- '#options' => $thumbss,
- '#default_value' => !empty($file['data']['video_thumb']) ? $file['data']['video_thumb'] : $default_thumb,
- // '#description' => t('Pleaes choose a thumbnail from above'),
- '#weight' => 10,
- '#attributes' => array('class' => 'video-thumbnails'),
- );
- } \ No newline at end of file
diff --git a/types/uploadfield/uploadfield_transcode.inc b/types/uploadfield/uploadfield_transcode.inc
deleted file mode 100644
index 39db634..0000000
--- a/types/uploadfield/uploadfield_transcode.inc
+++ /dev/null
@@ -1,13 +0,0 @@
-<?php
-//$Id$
-
-/**
- * @file
- * Enable conversion control on video module.
- *
- * @author Heshan Wanigasooriya <heshan at heidisoft dot com, heshanmw at gmail dot com>
- */
-
-function video_auto_transcode_process (&$element) {
-
- } \ No newline at end of file
diff --git a/types/uploadfield/uploadfield_widget.inc b/types/uploadfield/uploadfield_widget.inc
deleted file mode 100644
index fafdb5e..0000000
--- a/types/uploadfield/uploadfield_widget.inc
+++ /dev/null
@@ -1,308 +0,0 @@
-<?php
-// $Id$
-
-/**
- * @file
- * uploadfield widget hooks and callbacks.
- */
-
-/**
- * Implementation of CCK's hook_widget_settings($op = 'form').
- */
-function uploadfield_widget_settings_form($widget) {
- $form = module_invoke('filefield', 'widget_settings', 'form', $widget);
-
- if ($form['file_extensions']['#default_value'] == 'txt') {
- $form['file_extensions']['#default_value'] = 'mp4 mpeg avi mpg wmv flv';
- }
-
- // Default video player settings.
- $form['player'] = array(
- '#type' => 'fieldset',
- '#title' => t('Video Player Settings'),
- '#collapsible' => TRUE,
- '#collapsed' => TRUE,
- '#weight' => 9
- );
-
- $form['player']['default_resolution'] = array(
- '#type' => 'textfield',
- '#title' => t('Default Video Resolution'),
- '#default_value' => !empty($widget['default_resolution']) ? $widget['default_resolution'] : '16:9',
- '#size' => 15,
- '#maxlength' => 5,
- '#description' => t('Default player resolution WIDTH:HEIGHT in px. eg : 16:9 for widescreen or 4:3 for general screen'),
- );
-
- $form['player']['default_width'] = array(
- '#type' => 'textfield',
- '#title' => t('Default Video Player Width'),
- '#default_value' => !empty($widget['default_width']) ? $widget['default_width'] : 640,
- '#size' => 15,
- '#maxlength' => 5,
- '#description' => t('Default player WIDTH:HEIGHT in px. eg : 640 for 640X480 player size if resolution it 4:3'),
- );
-
-
- // Default image settings.
- $form['default'] = array(
- '#type' => 'fieldset',
- '#title' => t('Video Thumbnail Settings'),
- '#element_validate' => array('_uploadfield_widget_settings_default_validate'),
- '#collapsible' => TRUE,
- '#collapsed' => FALSE,
- '#weight' => 10
- );
-
- // Present a video image of the current default image.
- if (!empty($widget['default_video_thumb'])) {
- $form['default']['default_video_thumbnail'] = array(
- '#type' => 'markup',
- '#value' => theme('uploadfield_image', $widget['default_video_thumb'], '', '', array('width' => '150'), FALSE),
- '#prefix' => '<div class="video_thumbnail">',
- '#suffix' => '</div>'
- );
- }
-
- $form['default']['default_video_thumb_upload'] = array(
- '#type' => 'file',
- '#title' => empty($widget['default_video_thumb']) ? t('Upload video thumbnail') : t('Replace video thumbnail with'),
- '#description' => t('Choose a image that will be used as default video thumbnail.'),
- );
-
- // We set this value on 'validate' so we can get CCK to add it
- // as a standard field setting.
- $form['default_video_thumb'] = array(
- '#type' => 'value',
- '#value' => $widget['default_video_thumb'],
- );
-
- // Default image settings.
- $form['plugings'] = array(
- '#type' => 'fieldset',
- '#title' => t('Video Advanced Settings'),
- '#collapsible' => TRUE,
- '#collapsed' => FALSE,
- '#weight' => 10
- );
- $form['plugings']['autoconversion'] = array(
- '#type' => 'checkbox',
- '#title' => t('Enable auto conversion video'),
- '#description' => t('Use ffmpeg(Default) to automatically convert videos to web compatible types eg. FLV, Please make sure to configure convertor settings.'),
- '#default_value' => $widget['autoconversion'],
- );
- $form['plugings']['autothumbnail'] = array(
- '#type' => 'checkbox',
- '#title' => t('Enable auto thumbnail video'),
- '#description' => t('Use ffmpeg(Default) to automatically thumbnails, Please make sure to configure convertor settings.'),
- '#default_value' => $widget['autothumbnail'],
- );
-
-
- return $form;
-}
-
-/**
- * Element specific validation for uploadfield default value.
- *
- * Validated in a separate function from uploadfield_field() to get access
- * to the $form_state variable.
- */
-function _uploadfield_widget_settings_default_validate($element, &$form_state) {
-// Verify the destination exists
- $destination = file_directory_path() .'/video_thumb';
- if (!field_file_check_directory($destination, FILE_CREATE_DIRECTORY)) {
- form_set_error('default_video_thumb', t('The default image could not be uploaded. The destination %destination does not exist or is not writable by the server.', array('%destination' => dirname($destination))));
- return;
- }
-
- $validators = array (
- 'file_validate_is_image' => array(),
- );
-
- // We save the upload here because we can't know the correct path until the file is saved.
- if (!$file = file_save_upload('default_video_thumb_upload', $validators, $destination)) {
- // No upload to save we hope... or file_save_upload() reported an error on its own.
- return;
- }
-
- // Remove old image (if any) & clean up database.
- $old_default = $form_state['values']['default_video_thumb'];
- if (!empty($old_default['fid'])) {
- if (file_delete(file_create_path($old_default['filepath']))) {
- db_query('DELETE FROM {files} WHERE fid=%d', $old_default['fid']);
- }
- }
-
- // Make the file permanent and store it in the form.
- file_set_status($file, FILE_STATUS_PERMANENT);
- $file->timestamp = REQUEST_TIME;
- $form_state['values']['default_video_thumb'] = (array)$file;
-}
-
-/**
- * Implementation of CCK's hook_widget_settings($op = 'validate').
- */
-function uploadfield_widget_settings_validate($widget) {
-// Check that only web images are specified in the callback.
- $extensions = array_filter(explode(' ', $widget['file_extensions']));
- $web_extensions = array(
- 'mov', 'mp4', '3gp', '3g2', 'mpg', 'mpeg', // quicktime
- 'divx', //divx
- 'rm', // realplayer
- 'flv', 'f4v', //flash player
- 'swf', // swf player
- 'dir', 'dcr', // dcr player
- 'asf', 'wmv', 'avi', 'mpg', 'mpeg', // windows media
- 'ogg' // ogg theora
- );
- if (count(array_diff($extensions, $web_extensions))) {
- form_set_error('file_extensions', t('Only web-standard videos are supported through the video widget. If needing to upload other types of files, change the widget to use a standard file upload.'));
- }
-
- // Check that set video resolutions are valid.
- foreach (array('default_width') as $numerics) {
- if (!empty($widget[$numerics]) && !preg_match('/^[0-9]+$/', $widget[$numerics])) {
- form_set_error($numerics, t('Please specify default width in integers only (e.g. 640).'));
- }
- }
-
- // Check that set resolutions are valid.
- foreach (array('default_resolution') as $resolution) {
- if (!empty($widget[$resolution]) && !preg_match('/^[0-9]+:[0-9]+$/', $widget[$resolution])) {
- form_set_error($resolution, t('Please specify a resolution in the format WIDTH:HEIGHT (e.g. 16:9).'));
- }
- }
-// Check for convertor is installed
-}
-
-/**
- * Implementation of CCK's hook_widget_settings($op = 'save').
- */
-function uploadfield_widget_settings_save($widget) {
- $filefield_settings = module_invoke('filefield', 'widget_settings', 'save', $widget);
- return array_merge($filefield_settings, array('default_video_thumb', 'default_width', 'default_resolution', 'autoconversion', 'autothumbnail'));
-}
-
-/**
- * Element #value_callback function.
- */
-function uploadfield_widget_value($element, $edit = FALSE) {
- $item = filefield_widget_value($element, $edit);
- // print_r($edit);
- // exit;
- // if ($edit) {
- // $item['alt'] = isset($edit['alt']) ? $edit['alt'] : '';
- // $item['title'] = isset($edit['title']) ? $edit['title'] : '';
- // $item['video_thumb_fid'] = isset($edit['default_video_thumb']['fid']) ? $edit['default_video_thumb']['fid'] : 'novalue';
- // }
- // else {
- // $item['alt'] = '';
- // $item['title'] = '';
- // $item['default_video_thumb'] = '';
- // }
- return $item;
-}
-
-/**
- * Element #process callback function.
- */
-function uploadfield_widget_process($element, $edit, &$form_state, $form) {
-// TODO : get play duration/ image thumbnails
- $file = $element['#value'];
- $field = content_fields($element['#field_name'], $element['#type_name']);
- $element['#theme'] = 'uploadfield_widget_item';
-
- if (isset($element['preview']) && $file['fid'] != 0) {
- //TODO : implement preview video play
- $tml_thumb = !empty($file['data']['video_thumb']) ? array('filepath' => $file['data']['video_thumb']) : $field['widget']['default_video_thumb'];
- $element['preview']['#suffix'] = '<div class="video_thumbnail">' .
- theme('uploadfield_image', $tml_thumb, '', '', array('width' => '150'), FALSE) .
- '</div>';
- }
-
- // Check if using the default width and replace tokens.
- $default_width = user_access('override player width');
- $element['data']['width'] = array(
- '#type' => $default_width ? 'textfield' : 'value',
- '#title' => t('Width for Player'),
- '#default_value' => empty($file['data']['width']) ? $field['widget']['default_width'] : $file['data']['width'],
- '#description' => t('Set player width(in pix) here, make sure your video have good resolution to fit on larger values.'),
- '#size' => 15,
- '#maxlength' => 5,
- '#attributes' => array('class' => 'video-width-text'),
- );
- if(!$default_width){
- $element['data']['width']['#value'] = empty($file['data']['width']) ? $field['widget']['default_width'] : $file['data']['width'];
- }
-
- // only in preview mode and then create thumbnails
- if($field['widget']['autoconversion']) {
- video_module_invoke('convert', $element);
- //bypass auto conversion
- if (user_access('bypass conversion video')) {
- $element['data']['bypass_autoconversion'] = array(
- '#type' => 'checkbox',
- '#title' => t('Bypass auto conversion'),
- '#default_value' => !empty($file['data']['bypass_autoconversion']) ? $file['data']['bypass_autoconversion'] : FALSE,
- '#description' => t('This will bypass your auto conversion of videos.'),
- '#attributes' => array('class' => 'video-bypass-auto-conversion'),
- );
- }
- }
-
- //Create video thubs and save in a directory then we can get thumbnails from it using folder read
-
- // only in preview mode and then create thumbnails
- if($field['widget']['autothumbnail']) {
- video_module_invoke('thumbs', $element);
- }
- // default image default_image
- if (user_access('use default thumbnail') && !empty($field['widget']['default_video_thumb'])) {
- $element['data']['use_default_video_thumb'] = array(
- '#type' => 'checkbox',
- '#title' => t('Override Video Thumbnail with Default'),
- '#default_value' => !empty($file['data']['use_default_video_thumb']) ? $file['data']['use_default_video_thumb'] : FALSE,
- '#description' => t('If you want to use default image instead of using actual thumbnail of video then check.'),
- '#weight' => 9,
- '#attributes' => array('class' => 'video-default-thumbnail'),
- );
- }
-
-
- // creating Update/Insert/Delete API
- // TODO : use if any better solution than this with filefield
- // hook_v_video()
- if($form_state['submitted'] == 1) {
- switch($form_state['values']['op']) {
- case t('Save'):
- // print_r($form);
- // exit;
- // update
- if(!empty($form_state['values']['nid'])) {
- video_module_invoke('update', $element);
- }
- // insert
- else {
- video_module_invoke('insert', $element);
- }
- break;
- case t('Preview'):
- // module_invoke_all('v_preview');
- break;
- case t('Delete'):
- video_module_invoke('delete', $element);
- break;
- }
- }
-
- return $element;
-}
-
-/**
- * FormAPI theme function. Theme the output of an video upload field.
- */
-function theme_uploadfield_widget($element) {
- drupal_add_css(drupal_get_path('module', 'uploadfield') .'/uploadfield.css');
- return theme('form_element', $element, $element['#children']);
-}
diff --git a/types/videoftp/videoftp.info b/types/videoftp/videoftp.info
deleted file mode 100644
index 5832bc6..0000000
--- a/types/videoftp/videoftp.info
+++ /dev/null
@@ -1,12 +0,0 @@
-; $Id$
-name = Video FTP
-description = Allows you to attach videos uploaded through FTP to nodes.
-core = 7.x
-files[]=videoftp.module
-files[]=videoftp.install
-files[]=videoftp.theme.inc
-files[]=videoftp_widget.inc
-dependencies[] = content
-dependencies[] = filefield
-dependencies[] = video
-package = "Video" \ No newline at end of file
diff --git a/types/videoftp/videoftp.install b/types/videoftp/videoftp.install
deleted file mode 100644
index 8349abc..0000000
--- a/types/videoftp/videoftp.install
+++ /dev/null
@@ -1,25 +0,0 @@
-<?php
-// $Id$
-
-/**
- * Implementation of hook_install().
- */
-function videoftp_install() {
- drupal_load('module', 'content');
- content_notify('install', 'videoftp');
-}
-
-function videoftp_uninstall() {
- drupal_load('module', 'content');
- content_notify('uninstall', 'videoftp');
-}
-
-function videoftp_enable() {
- drupal_load('module', 'content');
- content_notify('enable', 'videoftp');
-}
-
-function videoftp_disable() {
- drupal_load('module', 'content');
- content_notify('disable', 'videoftp');
-} \ No newline at end of file
diff --git a/types/videoftp/videoftp.module b/types/videoftp/videoftp.module
deleted file mode 100644
index c07741e..0000000
--- a/types/videoftp/videoftp.module
+++ /dev/null
@@ -1,200 +0,0 @@
-<?php
-// $Id$
-
-/**
- * @file
- * video ftp core hooks and menu callbacks.
- */
-
-module_load_include('inc', 'videoftp', 'videoftp_widget');
-
-/*
- * Implementation of hook_menu().
- */
-function videoftp_menu() {
- $items = array();
- $items['videoftp/ahah/%/%/%'] = array(
- 'page callback' => 'videoftp_js',
- 'page arguments' => array(2, 3, 4),
- //'access callback' => 'videoftp_edit_access',
- 'access arguments' => array(3),
- 'type' => MENU_CALLBACK,
- );
- $items['videoftp/progress'] = array(
- 'page callback' => 'videoftp_progress',
- 'access arguments' => array('access content'),
- 'type' => MENU_CALLBACK,
- );
- return $items;
-}
-
-/**
- * Implementation of hook_theme().
- */
-function videoftp_theme() {
- $theme = array();
- $theme['videoftp_widget'] = array(
- 'arguments' => array('element' => NULL),
- 'file' => 'videoftp.theme.inc',
- );
- $theme['videoftp_widget_item'] = array(
- 'arguments' => array('element' => NULL),
- 'file' => 'videoftp.theme.inc',
- );
- $theme['videoftp_widget_file'] = array(
- 'arguments' => array('element' => NULL),
- 'file' => 'videoftp.theme.inc',
- );
- return $theme;
-}
-
-/**
- * Implementation of CCK's hook_widget_info().
- */
-function videoftp_widget_info() {
- return array(
- 'videoftp_widget' => array(
- 'label' => t('Video FTP'),
- 'field types' => array('filefield'),
- 'multiple values' => CONTENT_HANDLE_CORE,
- 'callbacks' => array('default value' => CONTENT_CALLBACK_CUSTOM),
- 'description' => t('Widget allows you to select video files uploaded through FTP to be attached to the node.'),
- ),
- );
-}
-
-/**
- * Implementation of hook_elements().
- */
-function videoftp_elements() {
- return array(
- 'videoftp_widget' => array(
- '#input' => TRUE,
- '#columns' => array('fid', 'list', 'data', 'filepath'),
- '#process' => array('videoftp_widget_process'),
- '#value_callback' => 'videoftp_widget_value',
- ),
- );
-}
-
-/**
- * Implementation of CCK's hook_widget_settings().
- */
-function videoftp_widget_settings($op, $widget) {
- //load up our include file for the widget
- module_load_include('inc', 'videoftp', 'videoftp_widget');
- switch ($op) {
- case 'form':
- return videoftp_widget_settings_form($widget);
- case 'validate':
- return videoftp_widget_settings_validate($widget);
- case 'save':
- return videoftp_widget_settings_save($widget);
- }
-}
-
-/**
- * Implementation of hook_widget().
- */
-function videoftp_widget(&$form, &$form_state, $field, $items, $delta = NULL) {
- $item = array('fid' => 0, 'list' => $field['list_default'], 'data' => array('description' => '', 'video_thumb' => ''));
- if (isset($items[$delta])) {
- $item = array_merge($item, $items[$delta]);
- }
- $element = array(
- '#title' => $field['widget']['label'],
- '#type' => $field['widget']['type'],
- '#default_value' => $item,
- );
- return $element;
-}
-
-/**
- * Menu callback; Shared AHAH callback for ftp file attachment and deletions.
- *
- * This rebuilds the form element for a particular field item. As long as the
- * form processing is properly encapsulated in the widget element the form
- * should rebuild correctly using FAPI without the need for additional callbacks
- * or processing.
- */
-function videoftp_js($type_name, $field_name, $delta) {
- module_load_include('inc', 'videoftp', 'videoftp_widget');
- $field = content_fields($field_name, $type_name);
-
- if (empty($field) || empty($_POST['form_build_id'])) {
- // Invalid request.
- drupal_set_message(t('An unrecoverable error occurred.'), 'error');
- print drupal_to_js(array('data' => theme('status_messages')));
- exit;
- }
-
- // Build the new form.
- $form_state = array('submitted' => FALSE);
- $form_build_id = $_POST['form_build_id'];
- $form = form_get_cache($form_build_id, $form_state);
-
- if (!$form) {
- // Invalid form_build_id.
- drupal_set_message(t('An unrecoverable error occurred. This form was missing from the server cache. Try reloading the page and submitting again.'), 'error');
- print drupal_to_js(array('data' => theme('status_messages')));
- exit;
- }
-
- // Build the form. This calls the file field's #value_callback function and
- // saves the uploaded file. Since this form is already marked as cached
- // (the #cache property is TRUE), the cache is updated automatically and we
- // don't need to call form_set_cache().
- $args = $form['#parameters'];
- $form_id = array_shift($args);
- $form['#post'] = $_POST;
- $form = form_builder($form_id, $form, $form_state);
-
- // Update the cached form with the new element at the right place in the form.
- if (module_exists('fieldgroup') && ($group_name = _fieldgroup_field_get_group($type_name, $field_name))) {
- if (isset($form['#multigroups']) && isset($form['#multigroups'][$group_name][$field_name])) {
- $form_element = $form[$group_name][$delta][$field_name];
- }
- else {
- $form_element = $form[$group_name][$field_name][$delta];
- }
- }
- else {
- $form_element = $form[$field_name][$delta];
- }
-
- if (isset($form_element['_weight'])) {
- unset($form_element['_weight']);
- }
- $output = drupal_render($form_element);
- // AHAH is not being nice to us and doesn't know the "other" button (that is,
- // either "Attach" or "Delete") yet. Which in turn causes it not to attach
- // AHAH behaviours after replacing the element. So we need to tell it first.
-
- // Loop through the JS settings and find the settings needed for our buttons.
- $javascript = drupal_add_js(NULL, NULL);
- $videoftp_ahah_settings = array();
- if (isset($javascript['setting'])) {
- foreach ($javascript['setting'] as $settings) {
- if (isset($settings['ahah'])) {
- foreach ($settings['ahah'] as $id => $ahah_settings) {
- if (strpos($id, 'videoftp-attach') || strpos($id, 'videoftp-remove')) {
- $videoftp_ahah_settings[$id] = $ahah_settings;
- }
- }
- }
- }
- }
-
- // Add the AHAH settings needed for our new buttons.
- if (!empty($videoftp_ahah_settings)) {
- $output .= '<script type="text/javascript">jQuery.extend(Drupal.settings.ahah, '. drupal_to_js($videoftp_ahah_settings) .');</script>';
- }
-
- $output = theme('status_messages') . $output;
-
- // For some reason, file uploads don't like drupal_json() with its manual
- // setting of the text/javascript HTTP header. So use this one instead.
- $GLOBALS['devel_shutdown'] = FALSE;
- print drupal_to_js(array('status' => TRUE, 'data' => $output));
- exit;
-} \ No newline at end of file
diff --git a/types/videoftp/videoftp.theme.inc b/types/videoftp/videoftp.theme.inc
deleted file mode 100644
index 42203cb..0000000
--- a/types/videoftp/videoftp.theme.inc
+++ /dev/null
@@ -1,57 +0,0 @@
-<?php
-//$Id$
-/**
- *
- * @file
- * Theme functions for the videoftp module.
- */
-
-/**
- * FormAPI theme function. Theme the output of an video ftp field.
- */
-function theme_videoftp_widget($element) {
- return theme('form_element', $element, $element['#children']);
-}
-
-function theme_videoftp_widget_item($element) {
- // Put the upload button directly after the upload field.
- $element['ftpselect']['#field_suffix'] = drupal_render($element['videoftp_attach']);
- $element['ftpselect']['#theme'] = 'videoftp_widget_file';
- $output = '<div class="filefield-element clear-block">';
-
- if ($element['fid']['#value'] != 0) {
- $output .= '<div class="widget-preview">';
- $output .= drupal_render($element['preview']);
- $output .= '</div>';
- }
-
- $output .= '<div class="widget-edit">';
- $output .= drupal_render($element);
- $output .= '</div>';
- $output .= '</div>';
-
- return $output;
-}
-
-/**
- * Custom theme function for VideoFTP upload elements.
- *
- * This function allows us to put the "Attach" button immediately after the
- * select field by respecting the #field_suffix property.
- */
-function theme_videoftp_widget_file($element) {
- $output .= '<div class="filefield-upload clear-block">';
- if (isset($element['#field_prefix'])) {
- $output .= $element['#field_prefix'];
- }
- $size = $element['#size'] ? ' size="'. $element['#size'] .'"' : '';
- _form_set_class($element, array('form-select'));
- $multiple = $element['#multiple'];
- $output .= '<select name="'. $element['#name'] .''. ($multiple ? '[]' : '') .'"'. ($multiple ? ' multiple="multiple" ' : '') . drupal_attributes($element['#attributes']) .' id="'. $element['#id'] .'" '. $size .'>'. form_select_options($element) ."</select>\n";
- if (isset($element['#field_suffix'])) {
- $output .= $element['#field_suffix'];
- }
- $output .= '</div>';
-
- return theme('form_element', $element, $output);
-} \ No newline at end of file
diff --git a/types/videoftp/videoftp_widget.inc b/types/videoftp/videoftp_widget.inc
deleted file mode 100644
index 893be77..0000000
--- a/types/videoftp/videoftp_widget.inc
+++ /dev/null
@@ -1,313 +0,0 @@
-<?php
-// $Id:
-
-/**
- * @file
- * videoftp widget hooks and callbacks.
- */
-
-/**
- * Implementation of CCK's hook_widget_settings($op = 'form').
- */
-function videoftp_widget_settings_form($widget) {
- $form = array();
- $form['file_extensions'] = array(
- '#type' => 'textfield',
- '#title' => t('Permitted upload file extensions.'),
- '#default_value' => !empty($widget['file_extensions']) ? $widget['file_extensions'] : 'mp4 mpeg avi mpg wmv flv mov',
- '#size' => 64,
- '#description' => t('Extensions a user can attach to this field. Separate extensions with a space and do not include the leading dot. Leaving this blank will allow attachment of a file with any extension.'),
- '#weight' => 1
- );
- $form['path_settings'] = array(
- '#type' => 'fieldset',
- '#title' => t('Path settings'),
- '#collapsible' => TRUE,
- '#collapsed' => TRUE,
- '#weight' => 2,
- );
- $form['path_settings']['file_path'] = array(
- '#type' => 'textfield',
- '#size' => 64,
- '#title' => t('File path'),
- '#default_value' => ltrim(ltrim($widget['file_path'], "videos"), "/"),
- '#description' => t('Optional subdirectory within the "<em>files/videos/</em>" directory where files will be moved and stored. Do not include preceding or trailing slashes.'),
- '#element_validate' => array('video_widget_settings_file_path_validate', '_filefield_widget_settings_file_path_validate'),
- );
- $form['path_settings']['ftp_path'] = array(
- '#type' => 'textfield',
- '#title' => t('FTP Filepath'),
- '#default_value' => !empty($widget['ftp_path']) ? $widget['ftp_path'] : 'ftpvideos',
- '#description' => t('The subdirectory within the "<em>files/</em>" directory where you have upload the videos for attachment. Once the video is attached it will be moved from this directory to the main files directory.'),
- '#required' => TRUE,
- '#weight' => 3,
- );
- //default settings
- $default = video_default_widget_settings($widget);
- $form = $form + $default;
- return $form;
-}
-
-/**
- * Implementation of CCK's hook_widget_settings($op = 'validate').
- *
- * //@todo Integrate this into a universal function to share with uploadfield_widget
- */
-function videoftp_widget_settings_validate($widget) {
- // Check that only web images are specified in the callback.
- if(!video_web_extensions($widget['file_extensions'])) {
- form_set_error('file_extensions', t('Only web-standard videos are supported through the videoftp widget. If needing to upload other types of files, change the widget to use a standard file upload.'));
- }
- // Check for our ftp filepath and try to create it, if not it will throw an error.
- $ftp_path = file_directory_path().'/'.$widget['ftp_path'];
- file_check_directory($ftp_path, true, 'ftp_path');
-}
-
-/**
- * Implementation of CCK's hook_widget_settings($op = 'save').
- */
-function videoftp_widget_settings_save($widget) {
- return array('file_extensions', 'file_path', 'ftp_path', 'autothumbnail','autoconversion', 'default_dimensions', 'default_player_dimensions', 'default_video_thumb');
-}
-
-/**
- * The #value_callback for the videoftp_widget type element.
- */
-function videoftp_widget_value($element, $edit = FALSE) {
- if (!$edit) {
- // Creating so we load up our empty values.
- $file = field_file_load($element['#default_value']['fid']);
- $item = $element['#default_value'];
- }
- else {
- // Reset our item array for our data.
- $item = array_merge($element['#default_value'], $edit);
- $field = content_fields($element['#field_name'], $element['#type_name']);
-
- // Uploads take priority over value of fid text field.
- if ($fid = videoftp_save_upload($element)) {
- $item['fid'] = $fid;
- $item['data'] = array(); //reset our thumbnail
- }
- // Check for #videoftp_value_callback values.
- // Because FAPI does not allow multiple #value_callback values like it does
- // for #element_validate and #process, this fills the missing functionality
- // to allow VideoFtp to be extended purely through FAPI.
- elseif (isset($element['#videoftp_value_callback'])) {
- foreach ($element['#videoftp_value_callback'] as $callback) {
- $callback($element, $item);
- }
- }
-
- // Load file if the FID has changed so that it can be saved by CCK.
- $file = field_file_load($item['fid']);
-
- // If the file entry doesn't exist, don't save anything.
- if (empty($file)) {
- $item = array();
- }
-
- // Checkboxes loose their value when empty.
- // If the list field is present make sure its unchecked value is saved.
- if (!empty($field['list_field']) && empty($edit['list'])) {
- $item['list'] = 0;
- }
- }
- // Merge file and item data so it is available to all widgets.
- $item = array_merge($item, $file);
- return $item;
-}
-
-/**
- * Process an individual element.
- */
-function videoftp_widget_process($element, $edit, &$form_state, $form) {
- $item = $element['#value'];
- $field_name = $element['#field_name'];
- $delta = $element['#delta'];
- $field = content_fields($element['#field_name'], $element['#type_name']);
- $element['#theme'] = 'videoftp_widget_item';
-
- if (isset($element['preview']) && $element['#value']['fid'] != 0) {
- $element['preview']['#value'] = theme('videoftp_widget_preview', $element['#value']);
- }
-
- // Title is not necessary for each individual field.
- if ($field['multiple'] > 0) {
- unset($element['#title']);
- }
-
- // Set up the buttons first since we need to check if they were clicked.
- $element['videoftp_attach'] = array(
- '#type' => 'submit',
- '#value' => t('Attach'),
- '#submit' => array('node_form_submit_build_node'),
- '#ahah' => array( // with JavaScript
- 'path' => 'videoftp/ahah/'. $element['#type_name'] .'/'. $element['#field_name'] .'/'. $element['#delta'],
- 'wrapper' => $element['#id'] .'-ahah-wrapper',
- 'method' => 'replace',
- 'effect' => 'fade',
- ),
- '#field_name' => $element['#field_name'],
- '#delta' => $element['#delta'],
- '#type_name' => $element['#type_name'],
- '#upload_validators' => $element['#upload_validators'],
- '#weight' => 100,
- '#post' => $element['#post'],
- );
- $element['videoftp_remove'] = array(
- // With default CCK edit forms, $element['#parents'] is array($element['#field_name'], $element['#delta']).
- // However, if some module (for example, flexifield) places our widget deeper in the tree, we want to
- // use that information in constructing the button name.
- '#name' => implode('_', $element['#parents']) .'_videoftp_remove',
- '#type' => 'submit',
- '#value' => t('Remove'),
- '#submit' => array('node_form_submit_build_node'),
- '#ahah' => array( // with JavaScript
- 'path' => 'videoftp/ahah/'. $element['#type_name'] .'/'. $element['#field_name'] .'/'. $element['#delta'],
- 'wrapper' => $element['#id'] .'-ahah-wrapper',
- 'method' => 'replace',
- 'effect' => 'fade',
- ),
- '#field_name' => $element['#field_name'],
- '#delta' => $element['#delta'],
- '#weight' => 101,
- '#post' => $element['#post'],
- );
-
- // Because the output of this field changes depending on the button clicked,
- // we need to ask FAPI immediately if the remove button was clicked.
- // It's not good that we call this private function, but
- // $form_state['clicked_button'] is only available after this #process
- // callback is finished.
- if (_form_button_was_clicked($element['videoftp_remove'])) {
- // Delete the file if it is currently unused. Note that field_file_delete()
- // does a reference check in addition to our basic status check.
- if (isset($edit['fid'])) {
- $removed_file = field_file_load($edit['fid']);
- if ($removed_file['status'] == 0) {
- field_file_delete($removed_file);
- }
- }
- $item = array('fid' => 0, 'list' => $field['list_default'], 'data' => array('description' => '', 'video_thumb' => ''));
- }
-
- // Set access on the buttons and select.
- $element['videoftp_attach']['#access'] = empty($item['fid']);
- $element['videoftp_remove']['#access'] = !empty($item['fid']);
-
- $options = videoftp_options($field);
- $element['ftpselect'] = array(
- '#type' => 'select',
- '#required' => isset($element['#required']) ? $element['#required'] : $field['required'],
- '#options' => $options,
- '#access' => empty($item['fid']),
- );
-
- // Set the FID.
- $element['fid'] = array(
- '#type' => 'hidden',
- '#value' => $item['fid'],
- );
-
- if ($item['fid'] != 0) {
- $element['preview'] = array(
- '#type' => 'markup',
- '#value' => theme('video_widget_preview', $item),
- );
- }
-
- // placeholder.. will be serialized into the data column. this is a place for widgets
- // to put additional data.
- $element['data'] = array(
- '#tree' => 'true',
- '#access' => !empty($item['fid']),
- );
-
- // Create our thumbnails
- if($field['widget']['autothumbnail']) {
- video_thumb_process($element);
- }
-
- // Add our extra fields if in preview mode
- if(!empty($item['fid'])) {
- video_widget_element_settings($element);
- }
-
- // Set #element_validate in a way that it will not wipe out other
- // validation functions already set by other modules.
- if (empty($element['#element_validate'])) {
- $element['#element_validate'] = array();
- }
- array_unshift($element['#element_validate'], 'videoftp_widget_validate');
-
- // Make sure field info will be available to the validator which
- // does not get the values in $form.
- $form_state['#field_info'][$field['field_name']] = $field;
-
- $element['#attributes']['id'] = $element['#id'] .'-ahah-wrapper';
- $element['#prefix'] = '<div '. drupal_attributes($element['#attributes']) .'>';
- $element['#suffix'] = '</div>';
-
- // Lets use the clicked_button #submit[0] value here instead and see how that works out for now...
- if($form_state['submitted'] == 1) {
- video_widget_process($element, $form_state);
- }
- return $element;
-}
-
-function videoftp_save_upload($element) {
- global $user;
- $upload_name = $element['#field_name'] .'_'. $element['#delta'];
- $delta = $element['#delta'];
- $field = content_fields($element['#field_name'], $element['#type_name']);
- $video = $element['#post'][$field['field_name']][$delta]['ftpselect'];
- $ftp_path = file_directory_path().'/'.$field['widget']['ftp_path'];
-
- if (empty($video) || !file_exists($ftp_path.'/'.$video)) {
- return 0;
- }
-
- $dest = filefield_widget_file_path($field);
- if (!field_file_check_directory($dest, FILE_CREATE_DIRECTORY)) {
- watchdog('filefield', 'The upload directory %directory for the file field %field (content type %type) could not be created or is not accessible. A newly uploaded file could not be saved in this directory as a consequence, and the upload was canceled.', array('%directory' => $dest, '%field' => $element['#field_name'], '%type' => $element['#type_name']));
- form_set_error($upload_name, t('The file could not be uploaded.'));
- return 0;
- }
-
- // Begin building the file object.
- $file = new stdClass();
- $file->uid = $user->uid;
- $file->filename = file_munge_filename(trim(basename($video), '.'), $field['widget']['file_extensions']);
- $file->filepath = $ftp_path.'/'.$video;
- $file->filemime = file_get_mimetype($file->filename);
- $file->filesize = filesize($file->filepath);
- $file->status = FILE_STATUS_TEMPORARY;
- $file->timestamp = REQUEST_TIME;
-
- //lets move our file from the ftp folder to the files directory
- if(file_move($file, $dest)) {
- // Insert new record to the database.
- drupal_write_record('files', $file);
- }
- _field_file_cache($file); // cache the file in order to minimize load queries
- return $file->fid;
-}
-
-function videoftp_options($field) {
- $options = array();
- $options[] = t('Select Video');
- // Lets setup our ftp_path.
- $ftp_path = file_directory_path().'/'.$field['widget']['ftp_path'];
- // We are going to scan the directory and pull out the available video types by extension.
- $extensions = explode(" ",$field['widget']['file_extensions']);
- $video_files = scandir($ftp_path);
- foreach ($video_files as $file) {
- $ext = pathinfo($file);
- if (in_array($ext['extension'], $extensions)) {
- //add the file to the options array for selection
- $options["$file"] = $file;
- }
- }
- return $options;
-} \ No newline at end of file
diff --git a/video.admin.inc b/video.admin.inc
deleted file mode 100644
index 1d246af..0000000
--- a/video.admin.inc
+++ /dev/null
@@ -1,306 +0,0 @@
-<?php
-// $Id$
-
-/**
- * @file
- * Provides the administration settings for the Flowplayer Drupal module.
- */
-
-/**
- * Settings Form
- *
- * @return
- * string of form content or error message
- */
-function video_admin_settings() {
- global $base_url;
-
- $form = array();
-
- $form['menu'] = array(
- '#type' => 'fieldset',
- '#title' => t('General Behavior'),
- '#collapsible' => TRUE,
- '#collapsed' => FALSE
- );
-
- // $form['menu']['video_displaydownloadmenutab'] = array(
- // '#type' => 'checkbox',
- // '#title' => t('Display download menu tab'),
- // '#default_value' => variable_get('video_displaydownloadmenutab', 1),
- // '#description' => t('Toggle display of menu tab to download video from the node page.')
- // );
- // $form['menu']['video_displaydownloadlink'] = array(
- // '#type' => 'checkbox',
- // '#title' => t('Display download link'),
- // '#default_value' => variable_get('video_displaydownloadlink', 1),
- // '#description' => t('Toggle display of "download" link (below the node content in most themes).')
- // );
- // $form['menu']['video_displayplaytime'] = array(
- // '#type' => 'checkbox',
- // '#title' => t('Display playtime'),
- // '#default_value' => variable_get('video_displayplaytime', 1),
- // '#description' => t('Toggle the display of the playtime for a video.')
- // );
- // $form['menu']['video_displayfilesize'] = array(
- // '#type' => 'checkbox',
- // '#title' => t('Display filesize'),
- // '#default_value' => variable_get('video_displayfilesize', 1),
- // '#description' => t('Toggle the display of the filesize for a video.')
- // );
- $form['menu']['video_autoplay'] = array(
- '#type' => 'checkbox',
- '#title' => t('Automatically start video on page load'),
- '#default_value' => variable_get('video_autoplay', TRUE),
- '#description' => t('Start the video when the page and video loads')
- );
-
- $form['menu']['video_autobuffering'] = array(
- '#type' => 'checkbox',
- '#title' => t('Automatically start video buffering'),
- '#default_value' => variable_get('video_autobuffering', TRUE),
- '#description' => t('Start buffering video when the page and video loads')
- );
-
- $form['player'] = array(
- '#type' => 'fieldset',
- '#title' => t('Video Extra Players'),
- '#collapsible' => TRUE,
- '#collapsed' => FALSE
- );
- $form['player']['video_cortado'] = array(
- '#type' => 'textfield',
- '#title' => t('Path to OGG Cortado Player'),
- '#default_value' => variable_get('video_cortado', $base_url . '/cortado.jar'),
- '#description' => t('Copy your cortado.jar file to Drupal root and keep the setting un-changed.')
- );
-
- $form['player']['mp4_play_in_flowplayer'] = array(
- '#type' => 'checkbox',
- '#title' => t('Play HQ MP4 files in Flash Player'),
- '#default_value' => variable_get('mp4_play_in_flowplayer', FALSE),
- '#description' => t('Play HQ MP4 files in Flash player.')
- );
-
-
- //
- $gateways = _video_transcoder_types();
- // print_r($gateways);
- // $gateway_options = array();
- // foreach( $gateways as $gateway) {
- // $obj = new stdClass();
- // $obj->option = array($gateway => _smsgateway_invoke( 'name', $gateway));
- // $gateway_options[] = $obj;
- // }
-
-
- $form['tranccoder'] = array(
- '#type' => 'fieldset',
- '#title' => t('Video Transcoder'),
- '#collapsible' => FALSE,
- '#collapsed' => FALSE
- );
-
- // TODO : write a common function to pick as help
- $help_transcoders = array();
- $help_transcoders[] = l('FFMPEG Default module', 'http://drupal.org/node/722506');
- $help_transcoders[] = l('FFMPEG Wrapper module', 'http://drupal.org/project/ffmpeg_wrapper');
- $help_transcoders[] = l('ZENCODER Online Transcoder', 'http://zencoder.tv/');
-
- $form['tranccoder']['vid_convertor'] = array(
- '#type' => 'radios',
- '#title' => t('Video transcoder'),
- '#default_value' => variable_get('vid_convertor', 'ffmpeg'),
- '#options' => $gateways,
- '#description' => t('Video transcoder will help you to video conversion
- and automatic thumbnail generaion. You must install !ffmpeg_wrapper
- module to enable ffmpeg_wrapper support. !list',
- array('!ffmpeg_wrapper' => l('ffmpeg_wrapper module', 'http://drupal.org/project/ffmpeg_wrapper'),
- '!list' => theme('item_list', $help_transcoders)))
- );
- $form['tranccoder']['video_transcoder_path'] = array(
- '#type' => 'textfield',
- '#title' => t('Path to Video Transcoder'),
- '#description' => t('Path to executable, you can skip this if your usign ffmpeg_wrapper module support.'),
- '#default_value' => variable_get('video_transcoder_path', '/usr/bin/ffmpeg'),
- );
- $form['tranccoder']['no_of_video_thumbs'] = array(
- '#type' => 'textfield',
- '#title' => t('No of video thumbnails'),
- '#description' => t('No of thumbnails extracting from video'),
- '#default_value' => variable_get('no_of_video_thumbs', 5),
- );
-
- // ffmpeg wapper settings
- $video_converter = variable_get('vid_convertor', 'ffmpeg');
- if($video_converter == 'ffmpeg') {
-
- $form['conv'] = array(
- '#type' => 'fieldset',
- '#title' => t('FFmpeg video conversion settings.'),
- '#collapsible' => FALSE,
- '#collapsed' => FALSE
- );
-
- //auto thumb videos
- $form['conv']['autothumb'] = array(
- '#type' => 'fieldset',
- '#title' => t('Automatic video thumbnailing'),
- '#collapsible' => TRUE,
- '#collapsed' => TRUE
- );
- $form['conv']['autothumb']['video_thumb_path'] = array(
- '#type' => 'textfield',
- '#title' => t('Path to Video Thumbnails'),
- '#description' => t('Path to save video thumbnails extracted from video'),
- '#default_value' => variable_get('video_thumb_path', 'video_thumbs'),
- );
- $form['conv']['autothumb']['advanced'] = array(
- '#type' => 'fieldset',
- '#title' => t('Advanced settings'),
- '#collapsible' => TRUE,
- '#collapsed' => TRUE
- );
- $form['conv']['autothumb']['advanced']['video_ffmpeg_thumbnailer_options'] = array(
- '#type' => 'textfield',
- '#title' => t('Video thumbnailer options'),
- '#description' => t('Provide the options for the thumbnailer. Available argument values are: ').'<ol><li>'.t('%videofile (the video file to thumbnail)').'<li>'.t('%thumbfile (a newly created temporary file to overwrite with the thumbnail)').'</ol>'.t('Only the first two are mandatory. For example, older versions of ffmpeg should use something like: !old While newer versions should use something like: !new', array('!old' => "<div>-i %videofile -an -y -f mjpeg -ss %seek -vframes 1 %thumbfile</div>", '!new' => '<div>-i %videofile -an -y -f mjpeg -ss %seek -vframes 1 %thumbfile</div>')),
- '#default_value' => variable_get('video_ffmpeg_thumbnailer_options', '-i %videofile -an -y -f mjpeg -ss %seek -vframes 1 %thumbfile'),
- );
-
-
- // automatic video conversion settings
- $form['conv']['autoconv'] = array(
- '#type' => 'fieldset',
- '#title' => t('Automatic video conversion'),
- '#collapsible' => TRUE,
- '#collapsed' => TRUE
- );
- $form['conv']['autoconv']['video_ffmpeg_width'] = array(
- '#type' => 'textfield',
- '#title' => t('Destination video Width'),
- '#size' => 10,
- '#maxlength' => 10,
- '#default_value' => variable_get('video_ffmpeg_width', 640),
- );
- $form['conv']['autoconv']['video_ffmpeg_height'] = array(
- '#type' => 'textfield',
- '#title' => t('Destination video height'),
- '#size' => 10,
- '#maxlength' => 10,
- '#default_value' => variable_get('video_ffmpeg_height', 480),
- );
- $form['conv']['autoconv']['video_ffmpeg_helper_auto_cvr_video_bitrate'] = array(
- '#type' => 'textfield',
- '#title' => t('Video bitrate'),
- '#description' => t('The video bitrate in bit/s of the converted video.'),
- '#size' => 10,
- '#maxlength' => 10,
- '#default_value' => variable_get('video_ffmpeg_helper_auto_cvr_video_bitrate', 200000),
- );
- $form['conv']['autoconv']['video_ffmpeg_helper_auto_cvr_audio_bitrate'] = array(
- '#type' => 'textfield',
- '#title' => t('Audio bitrate'),
- '#description' => t('The audio bitrate in bit/s of the converted video.'),
- '#size' => 10,
- '#maxlength' => 10,
- '#default_value' => variable_get('video_ffmpeg_helper_auto_cvr_audio_bitrate', 64000),
- );
- $form['conv']['autoconv']['advanced'] = array(
- '#type' => 'fieldset',
- '#title' => t('Advanced settings'),
- '#collapsible' => TRUE,
- '#collapsed' => TRUE
- );
- $form['conv']['autoconv']['advanced']['video_ffmpeg_helper_auto_cvr_options'] = array(
- '#type' => 'textfield',
- '#title' => t('Video converter options'),
- '#description' => t('Provide the ffmpeg options to configure the video conversion. Available argument values are: ').'<ul>'.
- '<li>'.t('%videofile (the video file to convert)').
- '<li>'.t('%convertfile (a newly created file to store the converted file)').
- '<li>'.t('%size (video resolution of the converted file)').
- '</ul>'.
- t('For further informations refer to the !ffmpegdoc', array('!ffmpegdoc' => l(t('Official FFMpeg documentation.'), 'http://ffmpeg.mplayerhq.hu/ffmpeg-doc.html', array('fragment' => TRUE)))),
- '#default_value' => variable_get('video_ffmpeg_helper_auto_cvr_options', '-y -i %videofile -f flv -ar 22050 -ab %audiobitrate -s %size -b %videobitrate -qscale 1 %convertfile'),
- );
-
- }
- else if($video_converter == 'ffmpeg_wrapper') {
- global $conf;
- if(module_exists('ffmpeg_wrapper'))
- $form['ffmpeg'] = ffmpeg_wrapper_configuration_form($conf);
- }
- else if($video_converter == 'zencoder') {
- $form['zencoder'] = array(
- '#type' => 'fieldset',
- '#title' => t("ZENCODER configuration"),
- '#description' => t('Settings for the zencoder module.',
- array('!link' => l(t('S3 test'), 'admin/build/s3_ap1/test'))),
- '#element_validate' => array('video_admin_settings_validate'),
- );
-
- $form['zencoder']['zencoder_api_key'] = array(
- '#type' => 'textfield',
- '#title' => t('Zencoder Key'),
- '#default_value' => variable_get('zencoder_api_key', ""),
- '#description' => t("Zencoder key."),
- );
-
- $form['zencoder']['zencoder_api_skey'] = array(
- '#type' => 'textfield',
- '#title' => t('Zencoder Secret Key'),
- '#default_value' => variable_get('zencoder_api_skey', ""),
- '#description' => t("Zencoder secret key."),
- );
- }
-
- return system_settings_form($form);
-}
-
-/**
- * Form API callback to validate the upload settings form.
- *
- * Keeps the use from showing the play tab or the play link
- * if they have chosen to display the video in the node body.
- *
- *
- */
-function video_admin_settings_validate($form, &$form_state) {
-// check ffmpeg_wrapper installed or not
- if ($form_state['values']['vid_convertor'] == 'ffmpeg_wrapper' && !module_exists('ffmpeg_wrapper')) {
- form_set_error('vid_convertor', t('You do not have installed the !ffmpeg_wrapper module to enable using its plugin, please install it.' , array('!ffmpeg_wrapper' => l('ffmpeg_wrapper', 'http://drupal.org/project/ffmpeg_wrapper'))));
- }
-}
-
-/**
- * Ensure that specified convertor is included.
- */
-function _video_transcoder( $gateway) {
- $path = drupal_get_path('module', 'video') . '/plugins';
- $files = file_scan_directory($path, '^'. $gateway .'\.inc$');
- foreach ($files as $filename => $file) {
- include_once($filename);
- }
-}
-
-/**
- *
- * @staticvar <type> $transcoders
- * @return <type> get installed types of video
- */
-function _video_transcoder_types() {
- static $transcoders;
-
- if (!isset($transcoders)) {
- $transcoders = array();
- $path = drupal_get_path('module', 'video') .'/plugins';
- $files = file_scan_directory($path, '^.*\.inc$');
- foreach ($files as $filename => $file) {
- include_once($filename);
- $transcoders[$file->name] = $file->name;
- }
- }
- return $transcoders;
-}
-
-?>
diff --git a/video.info b/video.info
deleted file mode 100644
index f903eea..0000000
--- a/video.info
+++ /dev/null
@@ -1,12 +0,0 @@
-;$Id$
-
-name = Video
-description = Allows Creation of Video Fields.
-package = "Video"
-core = 7.x
-files[]=video.module
-files[]=video.install
-files[]=video.admin.inc
-files[]=video.theme.inc
-files[]=video_formatter.inc
-
diff --git a/video.install b/video.install
deleted file mode 100644
index 7e66988..0000000
--- a/video.install
+++ /dev/null
@@ -1,127 +0,0 @@
-<?php
-// $Id$
-
-/**
- * @file
- * Provides installation functions for video.module.
- *
- * @author Heshan Wanigasooriya <heshan at heidisoft dot com>
- * <heshanmw at gmail dot com>
- * @todo
- */
-
-/**
- * Implementation of hook_schema().
- */
-function video_schema() {
- $schema['video_files'] = array(
- 'description' => t('Store video transcoding queue'),
- 'fields' => array(
- 'vid' => array(
- 'description' => t('Video id'),
- 'type' => 'serial',
- 'unsigned' => TRUE,
- 'not null' => TRUE,
- ),
- 'fid' => array(
- 'description' => t('Original file id'),
- 'type' => 'int',
- 'unsigned' => TRUE,
- 'not null' => TRUE,
- 'default' => 0,
- ),
- 'nid' => array(
- 'description' => t('Node id'),
- 'type' => 'int',
- 'unsigned' => TRUE,
- 'not null' => TRUE,
- 'default' => 0,
- ),
- 'filename' => array(
- 'type' => 'varchar',
- 'length' => '255',
- 'default' => '',
- 'description' => t('The filename of the video.'),
- ),
- 'filepath' => array(
- 'type' => 'varchar',
- 'length' => '255',
- 'default' => '',
- 'description' => t('The filepath of the video.'),
- ),
- 'filemime' => array(
- 'type' => 'varchar',
- 'length' => '255',
- 'default' => '',
- 'description' => t('The filemime of the video.'),
- ),
- 'filesize' => array(
- 'description' => t('Filesize of the video.'),
- 'type' => 'int',
- 'unsigned' => TRUE,
- 'not null' => TRUE,
- 'default' => 0,
- ),
- 'dimensions' => array(
- 'type' => 'varchar',
- 'length' => '255',
- 'default' => '',
- 'description' => t('The dimensions of the video.'),
- ),
- 'status' => array(
- 'description' => t('Status of the transcoding'),
- 'type' => 'int',
- 'unsigned' => TRUE,
- 'not null' => TRUE,
- 'default' => 0,
- ),
- 'started' => array(
- 'description' => t('Started transcodings'),
- 'type' => 'int',
- 'not null' => TRUE,
- 'default' => 0,
- ),
- 'completed' => array(
- 'description' => t('Transcoding completed'),
- 'type' => 'int',
- 'not null' => TRUE,
- 'default' => 0,
- ),
- ),
- 'indexes' => array(
- 'status' => array('status'),
- 'file' => array('fid'),
- ),
- 'primary key' => array('vid'),
- );
- return $schema;
-}
-
-/**
- * Implementation of hook_uninstall().
- */
-function video_uninstall() {
- //@todo Need to drop all variables used in this module here.
-}
-
-/**
- * Update 6405
- * dropping video_rendering table and creating video_files
- * @return <type>
- */
-function video_update_6405() {
- $ret = array();
- $ret[] = update_sql("DROP TABLE IF EXISTS {video_rendering}");
- $ret[] = update_sql("DROP TABLE IF EXISTS {video_files}");
- $table = video_schema();
- db_create_table($ret, 'video_files', $table['video_files']);
- return $ret;
-}
-
-function video_update_6406() {
- drupal_set_message('The system has reset your thumbnail and ffmpeg command settings to their original state. If you made adjustments to these commands, you will have to reset them up.');
- //lets reset our ffmpeg system command variables.
- variable_set('video_ffmpeg_thumbnailer_options', '-i !videofile -an -y -f mjpeg -ss !seek -vframes 1 !thumbfile');
- variable_set('video_ffmpeg_helper_auto_cvr_options', '-y -i !videofile -f flv -ar 22050 -ab !audiobitrate -s !size -b !videobitrate -qscale 1 !convertfile');
- return array();
-}
diff --git a/video.module b/video.module
deleted file mode 100644
index 52f1f8f..0000000
--- a/video.module
+++ /dev/null
@@ -1,865 +0,0 @@
-<?php
-
-//$Id$
-
-/**
- *
- * @file video.module
- *
- */
-/*
- * Implementation of hook_init().
- */
-function video_init() {
- drupal_add_css(drupal_get_path('module', 'video') . '/css/video.css');
- drupal_add_js(drupal_get_path('module', 'video') . '/js/video.js');
-}
-
-/**
- * Invokes hook_video_*action*() in every module.
- * Eg :
- * hook_video_submit()
- * hook_video_insert()
- * hook_video_preview()
- * hook_video_delete()
- * hook_video_load()
- * hook_video_form() - to show values once upload is completed eg. Resolution, and Convert on Save etc
- *
- * We cannot use module_invoke() for this, because the arguments need to
- * be passed by reference.
- */
-function video_module_invoke($action, &$array, &$video = NULL, $other = NULL) {
- foreach (module_list () as $module) {
- $function = $module . '_video_' . $action;
- if (function_exists($function)) {
- $function($array, $video, $other);
- }
- }
-}
-
-/**
- * Implementation of hook_perm().
- */
-function video_permission() {
- return array(
- 'bypass conversion video' => array('title' => t('Bypass conversion video')),
- 'convert on submission' => array('title' => t('Convert on submission')),
- 'override player dimensions' => array('title' => t('Override player dimensions')),
- 'use default thumb' => array('title' => t('Use default thumb'))
- );
-}
-
-/**
- * Implementation of hook_menu().
- */
-function video_menu() {
- $items = array();
-
- $items['admin/settings/video'] = array(
- 'title' => 'Video',
- 'description' => 'Configure different aspects of the video module and its plugins',
- 'page callback' => 'drupal_get_form',
- 'page arguments' => array('video_general_admin_settings'),
- 'file' => 'video.admin.inc',
- 'access arguments' => array('administer site configuration'),
- 'type' => MENU_NORMAL_ITEM,
- );
-
- $items['admin/settings/video/general'] = array(
- 'title' => 'General',
- 'type' => MENU_DEFAULT_LOCAL_TASK,
- 'weight' => 0,
- );
-
- $items['admin/settings/video/players'] = array(
- 'title' => 'Players',
- 'description' => 'Configure your player settings for each video extension.',
- 'page callback' => 'drupal_get_form',
- 'page arguments' => array('video_players_admin_settings'),
- 'access arguments' => array('administer site configuration'),
- 'file' => 'video.admin.inc',
- 'type' => MENU_LOCAL_TASK,
- 'weight' => 1,
- );
-
- $items['admin/settings/video/transcoders'] = array(
- 'title' => 'Transcoders',
- 'description' => 'Configure your transcoder to convert your videos or extra thumbnails.',
- 'page callback' => 'drupal_get_form',
- 'page arguments' => array('video_transcoder_admin_settings'),
- 'access arguments' => array('administer site configuration'),
- 'file' => 'video.admin.inc',
- 'type' => MENU_LOCAL_TASK,
- 'weight' => 2,
- );
-
- $items['admin/settings/video/metadata'] = array(
- 'title' => 'Metadata',
- 'description' => 'Configure your metadata settings.',
- 'page callback' => 'drupal_get_form',
- 'page arguments' => array('video_metadata_admin_settings'),
- 'access arguments' => array('administer site configuration'),
- 'file' => 'video.admin.inc',
- 'type' => MENU_LOCAL_TASK,
- 'weight' => 3,
- );
-
- $items['admin/settings/video/cron'] = array(
- 'title' => 'Cron Settings',
- 'description' => 'Configure your cron settings.',
- 'page callback' => 'drupal_get_form',
- 'page arguments' => array('video_cron_admin_settings'),
- 'access arguments' => array('administer site configuration'),
- 'file' => 'video.admin.inc',
- 'type' => MENU_LOCAL_TASK,
- 'weight' => 4,
- );
-
- return $items;
-}
-
-/**
- * Implementation of hook_theme().
- */
-function video_theme() {
- $theme = array();
- $theme['video_thumbnails'] = array(
- 'variables' => array('file' => NULL, 'alt' => '', 'title' => '', 'attributes' => NULL, 'getsize' => TRUE),
- 'file' => 'video.theme.inc',
- );
- $theme['video_widget_preview'] = array(
- 'variables' => array('item' => TRUE),
- 'file' => 'video.theme.inc',
- );
- $theme['video_image'] = array(
- 'variables' => array('file' => NULL, 'alt' => '', 'title' => '', 'attributes' => NULL, 'getsize' => TRUE, 'imagecache' => NULL),
- 'file' => 'video.theme.inc',
- );
- $theme['video_widget_video_thumb'] = array(
- 'variables' => array('item' => TRUE),
- 'file' => 'video.theme.inc',
- );
- $theme['video_formatter_video_plain'] = array(
- 'variables' => array('element' => NULL),
- 'file' => 'video_formatter.inc',
- );
- $theme['video_formatter_video_nodelink'] = array(
- 'variables' => array('element' => NULL, 'imagecache' => NULL),
- 'file' => 'video_formatter.inc',
- );
- //$theme['video_formatter_video_colorbox'] = array(
- // 'arguments' => array('element' => NULL, 'imagecache' => NULL),
- // 'file' => 'video_formatter.inc',
- //);
- $theme['video_formatter_video_media_js'] = array(
- 'variables' => array('element' => NULL),
- 'file' => 'video_formatter.inc',
- );
- $theme['video_encoding_failed'] = array(
- 'arguments' => array(),
- 'file' => 'video_formatter.inc',
- );
- $theme['video_inprogress'] = array(
- 'variables' => array(),
- 'file' => 'video_formatter.inc',
- );
-
- $path = drupal_get_path('module', 'video') . '/theme';
- //Lets setup our themes for our players
- $players = video_video_players();
- foreach ($players as $tpl => $value) {
- $theme[$tpl] = array(
- 'variables' => array('video' => NULL, 'node' => NULL, 'themed_output' => NULL),
- 'file' => 'video_formatter.inc',
- 'template' => str_replace('_', '-', $tpl),
- 'path' => $path,
- );
- }
- //We need to add an flv theme buffer to allow users to override in their own module to add in extra parameters before
- //calling our flv template file.
- $theme['video_flv'] = array(
- 'variables' => array('video' => NULL, 'node' => NULL),
- 'file' => 'video_formatter.inc'
- );
-
- //setup our imagecache presets
- if (module_exists('imagecache')) {
- //we need formatters for each of our thumbnails.
- //@todo create a function to check for our colorbox module and only add theme elements that could be used.
- $thumb_types = array('video_nodelink'); //array('video_colorbox', 'video_nodelink');
- foreach ($thumb_types as $types) {
- foreach (imagecache_presets () as $preset) {
- $theme['video_formatter_' . $preset['presetname'] . '__' . $types] = array(
- 'variables' => array('element' => NULL),
- 'function' => 'theme_video_formatter_imagecache',
- 'file' => 'video_formatter.inc'
- );
- }
- }
- }
- return $theme;
-}
-
-/**
- * Implementation of hook_field_formatter_info().
- */
-function video_field_formatter_info() {
- $formatters = array(
- 'video_plain' => array(
- 'label' => t('Video'),
- 'field types' => array('file'),
- 'description' => t('Displays video files with player embedded.'),
- ),
- 'video_nodelink' => array(
- 'label' => t('Video Thumbnail linked to node'),
- 'field types' => array('file'),
- 'description' => t('Displays the video thumbnail and links to the node.'),
- ),
- //'video_colorbox' => array(
- // 'label' => t('Video Thumbnail to Colorbox'),
- // 'field types' => array('filefield'),
- // 'description' => t('Displays the video thumbnail and adds colorbox support.'),
- //),
- 'video_media_js' => array(
- 'label' => t('Video inject with jMedia'),
- 'field types' => array('file'),
- 'description' => t('Displays the video by using jmedia javascript.'),
- ),
- );
- //setup our imagecache presets
- if (module_exists('imagecache')) {
- //we need formatters for each of our thumbnails.
- $thumb_types = array('video_nodelink'); //array('video_colorbox', 'video_nodelink');
- foreach ($thumb_types as $types) {
- foreach (imagecache_presets () as $preset) {
- $formatters[$preset['presetname'] . '__' . $types] = array(
- 'label' => t('@preset @label', array('@preset' => $preset['presetname'], '@label' => $formatters[$types]['label'])),
- 'field types' => array('file'),
- );
- }
- }
- }
- return $formatters;
-}
-
-/*
- * Implmentation of hook_cron().
- */
-
-function video_cron() {
- if (variable_get('video_cron', FALSE)) {
- module_load_include('inc', 'video', '/includes/conversion');
- $video_conversion = new video_conversion;
- $video_conversion->run_queue();
- }
-}
-
-function video_form_alter(&$form, &$form_state, $form_id) {
- if (isset($form['type']) && isset($form['#node']) && $form['type']['#value'] . '_node_form' == $form_id) {
- $form['buttons']['submit']['#submit'][] = 'video_node_update_submit';
- }
-}
-
-function video_node_update_submit($form, &$form_state) {
- //lets update our video rending table to include the node id created
- if (isset($form_state['nid']) && isset($form_state['values']['video_id']) && is_array($form_state['values']['video_id'])) {
- foreach ($form_state['values']['video_id'] as $fid) {
- //lets update our table to include the nid
- db_query("UPDATE {video_files} SET nid=%d WHERE fid=%d", $form_state['nid'], $fid);
- // Lets other module to know to update
- video_module_invoke('update', $form, $form_state);
- }
- }
-}
-
-/*
- * Utility function that will add a preview of thumbnails for you to select when uploading videos.
- */
-
-function video_thumb_process(&$element) {
- // Developed for ffmpeg support
- $file = $element['#value'];
- $delta = $file['fid'];
- if (isset($element['preview']) && $file['fid'] != 0) {
- module_load_include('inc', 'video', '/includes/transcoder');
- $transcoder = new video_transcoder;
- if ($thumbs = $transcoder->generate_thumbnails($file)) {
- $default_thumb = '';
- $rnd_img = rand(0, variable_get('no_of_video_thumbs', 5) - 1);
- $default_thumb = $thumbs[$rnd_img]->filepath;
-
- if (is_array($thumbs)) {
- foreach ($thumbs as $fid => $img) {
- $thumbss[$img->filepath] = theme('video_thumbnails', $img, '', '', array('width' => '50'), FALSE);
- }
- }
- }
-
- $element['data']['video_thumb'] = array(
- '#type' => 'radios',
- '#title' => t('Video Thumbnails'),
- '#options' => $thumbss,
- '#default_value' => !empty($file['data']['video_thumb']) ? $file['data']['video_thumb'] : $default_thumb,
- '#weight' => 10,
- '#attributes' => array('class' => 'video-thumbnails', 'onchange' => 'videoftp_thumbnail_change()', 'rel' => 'video_large_thumbnail-' . $delta),
- );
-
- // Setup our large thumbnail that is on the left.
- // @todo Add smaller video preview instead of thumbnail?
- if (isset($file['data']['video_thumb']) && !empty($file['data']['video_thumb'])) {
- $large_thumb = array('filepath' => $file['data']['video_thumb']);
- }
- elseif (!empty($field['widget']['default_video_thumb'])) {
- $large_thumb = $field['widget']['default_video_thumb'];
- }
- else {
- $large_thumb = array('filepath' => $default_thumb);
- }
- // @todo Integrate the thumbnails with imagecache.
- $element['preview']['#suffix'] = '<div class="video_large_thumbnail-' . $delta . '">' . theme('video_thumbnails', $large_thumb, '', '', array('width' => '150'), FALSE) . '</div>';
- }
-}
-
-/**
- * Adds a video to the video rendering table.
- *
- * If auto converting, it will convert your video to flv right now. We are passing the element by reference
- * just in case we ever want to add more to the element during this process.
- *
- * @param $element
- * Form element to get the video file from.
- */
-function video_convert_process(&$element) {
- $file = $element['#value'];
- // Add default dimensions from our default_value if needed
- if (!isset($file['data']['dimensions'])) {
- $file['data']['dimensions'] = $element['data']['dimensions']['#value'];
- }
- $convert = false;
- //we need to check if this fid has already been added to the database AND that there is in fact a fid
- if (is_array($file) && isset($file['fid']) && !empty($file['fid']) && !$file['data']['bypass_autoconversion']) {
- $fid = $file['fid'];
- //setup our conversion class and check for the fid existence.
- module_load_include('inc', 'video', '/includes/conversion');
- $video_conversion = new video_conversion;
- // Lets verify that we haven't added this video already. Multiple validation fails will cause this to be ran more than once
- if (!$video = $video_conversion->load_video($fid)) {
- // Video has not been added to the queue yet so lets add it.
- db_query("INSERT INTO {video_files} (fid, status, dimensions) VALUES (%d, %d, '%s')", $fid, VIDEO_RENDERING_PENDING, $file['data']['dimensions']);
- $convert = true;
- //lets queue our node status to unpublished.
- $element['#unpublish'] = true;
- }
- else if ($video->video_status != VIDEO_RENDERING_COMPLETE) {
- // lets queue our node status to unpublished.
- $element['#unpublish'] = true;
- }
-
- // Our video should be in the database pending, lets see if we need to convert it now.
- // Check if we are going from unselected to selected or if this is a new video and we have checked the checkbox
- if (((!isset($element['#default_value']['data']['convert_video_on_save']) || !$element['#default_value']['data']['convert_video_on_save']) && $file['data']['convert_video_on_save']) || ($convert && $file['data']['convert_video_on_save'])) {
- $return = $video_conversion->process($fid);
- if ($return === FALSE) {
- drupal_set_message(t('Something went wrong with your video conversion. Please check your recent log entries for further debugging.'), 'error');
- }
- else if ($return === TRUE) {
- //we are always unpublished until we are converted.
- unset($element['#unpublish']);
- drupal_set_message(t('Successfully converted your video.'));
- }
- }
- else if ($convert) {
- drupal_set_message(t('Video submission queued for processing. Please wait: our servers are preparing your video for display.'));
- }
- }
-}
-
-/**
- * Implementation of hook_file_delete().
- */
-function video_file_delete($file) {
- //lets get all our videos and unlink them
- $sql = db_query("SELECT filepath FROM {video_files} WHERE fid=%d", $file->fid);
- //we loop here as future development will include multiple video types (HTML 5)
- while ($row = db_fetch_object($sql)) {
- if (file_exists($row->filepath))
- unlink($row->filepath);
- }
- //now delete our rows.
- db_query('DELETE FROM {video_files} WHERE fid = %d', $file->fid);
- //now lets delete our video thumbnails and folder.
- $video_thumb_path = variable_get('video_thumb_path', 'video_thumbs');
- $thumb_folder = file_directory_path() . '/' . $video_thumb_path . '/' . $file->fid;
- // Recursively delete our folder and files
- rmdirr($thumb_folder);
- // Let other modules to know about the file delete
- video_module_invoke('delete', $file);
-}
-
-/**
- * Compares passed extensions with normal video web extensions.
- */
-function video_web_extensions($ext) {
- $extensions = array_filter(explode(' ', $ext));
- $web_extensions = array(
- 'mov', 'mp4', '3gp', '3g2', 'mpg', 'mpeg', // quicktime
- 'divx', //divx
- 'rm', // realplayer
- 'flv', 'f4v', //flash player
- 'swf', // swf player
- 'dir', 'dcr', // dcr player
- 'asf', 'wmv', 'avi', 'mpg', 'mpeg', // windows media
- 'ogg',
- 'ogv', // ogg/ogv theora
- );
- if (count(array_diff($extensions, $web_extensions))) {
- return FALSE;
- }
- return TRUE;
-}
-
-/**
- * Implementation of hook_views_api().
- */
-function video_views_api() {
- return array(
- 'api' => 2.0,
- 'path' => drupal_get_path('module', 'video') . '/views',
- );
-}
-
-/**
- * Process elements loads on settings
- * @param <type> $element
- */
-function video_widget_element_settings(&$element) {
- $file = $element['#value'];
- $delta = $element['#delta'];
- $field = content_fields($element['#field_name'], $element['#type_name']);
- // Check if using the default width and replace tokens.
- $default_dimensions = user_access('override player dimensions');
- $description = t('Set your video dimensions. This will create your player with these dimensions.');
- //setup our default dimensions.
- $dimensions = $field['widget']['default_dimensions'];
- $player_dimensions = $field['widget']['default_player_dimensions'];
- // Lets figure out our dimensions for our video and add astericks next to our options.
- $options = video_explode("\n", variable_get("video_metadata_dimensions", video_default_dimensions()));
- if ($field['widget']['autoconversion'] && isset($element['preview']) && $file['fid'] != 0 && $default_dimensions) {
- $video_info = _video_dimensions_options($options, $file['filepath']);
- $description = t('Set your video dimensions. This will create your player and transcode your video with these dimensions. Your video size is !size, if you choose a higher resolution, this could cause video distortion. You are shown dimensions that match your aspect ratio, if you choose dimensions that do not match your ratio, we will pad your video by adding black bars on either the top or bottom while maintaining your videos original aspect ratio.', array('!size' => $video_info['width'] . 'x' . $video_info['height']));
- //setup our default display of dimensions.
- //lets go through our options looking for a matching resolution
- foreach ($options as $key => $value) {
- if (stristr($value, t('(Matches Resolution)')) == TRUE) {
- $dimensions = $key;
- break;
- }
- }
- }
- // Override our dimensions to the user selected.
- if (isset($file['data']['dimensions']) && !empty($file['data']['dimensions'])) {
- $dimensions = $file['data']['dimensions'];
- }
-
- // Override our player dimensions to the user selected.
- if (isset($file['data']['player_dimensions']) && !empty($file['data']['player_dimensions'])) {
- $player_dimensions = $file['data']['player_dimensions'];
- }
-
- $element['data']['dimensions'] = array(
- '#type' => 'select',
- '#title' => t('Dimensions for Video Transcoding'),
- '#default_value' => $dimensions,
- '#description' => $description,
- '#options' => $options,
- );
- $element['data']['player_dimensions'] = array(
- '#type' => 'select',
- '#title' => t('Dimensions for Video Player'),
- '#default_value' => $player_dimensions,
- '#description' => t('WxH of your video player.'),
- '#options' => $options,
- );
- // If users cannot change the default dimensions, lets change this to a value.
- if (!$default_dimensions) {
- $element['data']['dimensions']['#type'] = 'value';
- $element['data']['dimensions']['#value'] = $dimensions;
- $element['data']['player_dimensions']['#type'] = 'value';
- $element['data']['player_dimensions']['#value'] = $player_dimensions;
- }
-
- // only in preview mode and then create thumbnails
- if ($field['widget']['autoconversion']) {
- if (user_access('bypass conversion video')) {
- $element['data']['bypass_autoconversion'] = array(
- '#type' => 'checkbox',
- '#title' => t('Bypass auto conversion'),
- '#default_value' => isset($file['data']['bypass_autoconversion']) ? $file['data']['bypass_autoconversion'] : variable_get('video_bypass_conversion', FALSE),
- '#description' => t('This will bypass your auto conversion of videos.'),
- '#attributes' => array('class' => 'video-bypass-auto-conversion'),
- );
- }
- $convert_on_submission = user_access('convert on submission');
- $element['data']['convert_video_on_save'] = array(
- '#type' => $convert_on_submission ? 'checkbox' : 'value',
- '#title' => t('Convert video on save'),
- '#default_value' => isset($file['data']['convert_video_on_save']) ? $file['data']['convert_video_on_save'] : variable_get('video_convert_on_save', FALSE),
- '#description' => t('This will convert your video to flv format when you save, instead of scheduling it for cron.'),
- '#attributes' => array('class' => 'video-convert-video-on-save'),
- );
- $use_default_thumb = user_access('use default thumb');
- if ($use_default_thumb) {
- $element['data']['use_default_video_thumb'] = array(
- '#type' => $use_default_thumb ? 'checkbox' : 'value',
- '#title' => t('Use the default thumbnail for this video?'),
- '#default_value' => isset($file['data']['use_default_video_thumb']) ? $file['data']['use_default_video_thumb'] : variable_get('video_use_default_thumb', FALSE),
- '#description' => t('This will set a flag for this video to use the default video thumbnail when outputed..'),
- '#attributes' => array('class' => 'video-use-default-video-thumb'),
- );
- }
- }
-}
-
-/**
- * Video_widgi_process for API handlers for any video types.
- * @param <type> $element
- * @param <type> $form_state
- */
-function video_widget_process($element, &$form_state) {
- $item = $element['#value'];
- switch ($form_state['clicked_button']['#submit'][0]) {
- case 'node_form_submit':
- // Auto convert our video file
- if ($field['widget']['autoconversion']) {
- video_convert_process($element);
- //lets set our node status to unpublished if our video is not converted.
- if ($element['#unpublish']) {
- //unpublish the node
- $form_state['values']['status'] = 0;
- }
- }
- // Call hook_video_submit API
- video_module_invoke('insert', $element, $form_state);
- //
- //queue up the file id to update the node id in the video rendering / cdn tables.
- $form_state['values']['video_id'][] = $item['fid'];
- break;
- case 'node_form_build_preview':
- // Call hook_video_preview API
- video_module_invoke('preview', &$element, &$form_state);
- break;
- case 'node_form_delete_submit':
- //moved to hook_file_delete in video module.
- break;
- }
-}
-
-/*
- * Function updates our options list to show matching aspect ratios and if we have a matching resolution.
- *
- * We will update the options array by reference and return the aspect ratio of the file.
- */
-
-function _video_dimensions_options(&$options, $video) {
- $aspect_ratio = _video_aspect_ratio($video);
- //loop through our options and find matching ratio's and also the exact width/height
- foreach ($options as $key => $value) {
- $wxh = explode('x', $value);
- //lets check our width and height first
- if ($aspect_ratio['width'] == $wxh[0] && $aspect_ratio['height'] == $wxh[1]) {
- $options[$key] = $value . ' ' . t('(Matches Resolution)');
- } else {
- //now lets check our ratio's
- $ratio = number_format($wxh[0] / $wxh[1], 4);
- if ($ratio == $aspect_ratio['ratio']) {
- $options[$key] = $value . ' ' . t('(Matches Ratio)');
- }
- }
- }
- return $aspect_ratio;
-}
-
-/*
- * Returns the width/height and aspect ratio of the video
- *
- * @todo: move this to the transcoder class instead?
- */
-
-function _video_aspect_ratio($video) {
- //lets get our video dimensions from the file
- module_load_include('inc', 'video', '/includes/transcoder');
- $transcoder = new video_transcoder;
- $wxh = $transcoder->get_dimensions($video);
- $width = $wxh['width'];
- $height = $wxh['height'];
-
- if (!$width || !$height) {
- //no width and height found just return.
- watchdog('video_conversion', 'We could not determine the height and width of the video: ' . $video, array(), WATCHDOG_DEBUG);
- drupal_set_message(t('The system counld not determine the width and height of your video: !video. If transcoding, the system could have problems.', array('!video' => $video)));
- return;
- }
-
- //now lets get aspect ratio and compare our options in the select dropdown then add an asterick if any to each option representing a matching aspect ratio.
- $ratio = number_format($width / $height, 4);
- $aspect_ratio = array(
- 'width' => $width,
- 'height' => $height,
- 'ratio' => $ratio,
- );
- return $aspect_ratio;
-}
-
-/*
- * Return our list of video extensions and their associated player.
- */
-
-function video_video_extensions() {
- $extensions = array(
- 'divx' => 'video_play_divx',
- 'mov' => 'video_play_quicktime',
- '3gp' => 'video_play_quicktime',
- '3g2' => 'video_play_quicktime',
- 'mp4' => 'video_play_quicktime',
- 'rm' => 'video_play_realmedia',
- 'f4v' => 'video_play_flv',
- 'flv' => 'video_play_flv',
- 'swf' => 'video_play_flash',
- 'dir' => 'video_play_dcr',
- 'dcr' => 'video_play_dcr',
- 'asf' => 'video_play_windowsmedia',
- 'wmv' => 'video_play_windowsmedia',
- 'avi' => 'video_play_windowsmedia',
- 'mpg' => 'video_play_windowsmedia',
- 'mpeg' => 'video_play_windowsmedia',
- 'ogg' => 'video_play_theora',
- 'ogv' => 'video_play_theora',
- );
- return $extensions;
-}
-
-/*
- * Return our supported video players.
- */
-
-function video_video_players() {
- $players = array(
- 'video_play_divx' => t('Divx Player'),
- 'video_play_quicktime' => t('Quicktime'),
- 'video_play_realmedia' => t('Real Media Player'),
- 'video_play_flv' => t('FLV Flash Players'),
- 'video_play_flash' => t('SWF Flash Player'),
- 'video_play_dcr' => t('Director/Shockwave'),
- 'video_play_windowsmedia' => t('Windows Media Player'),
- 'video_play_theora' => t('Theora Player'),
- );
- return $players;
-}
-
-/*
- * Return our possible flash players.
- */
-
-function video_video_flv_players() {
- $options = array();
- if (module_exists('swftools')) {
- $options['swftools'] = t('SWF Tools');
- }
- if (module_exists('flowplayer')) {
- $options['flowplayer'] = t('Flowplayer');
- }
- return $options;
-}
-
-/**
- * Get the object for the suitable player for the parameter resource
- */
-function video_get_player($element) {
- // Setup our node object to be passed along with the player.
- $node = $element['#node'];
- // Setup our video object
- module_load_include('inc', 'video', '/includes/video_helper');
- $video_helper = new video_helper;
- $video = $video_helper->video_object($element);
- // Lets spit out our theme based on the extension
- $defaults = video_video_extensions();
- $theme_function = variable_get('video_extension_' . $video->extension, $defaults[$video->extension]);
- // Lets do some special handling for our flv files to accomdate multiple players.
- if ($theme_function == 'video_play_flv') {
- return theme('video_flv', $video, $node);
- } else {
- return theme($theme_function, $video, $node);
- }
-}
-
-function video_default_widget_settings($widget) {
- $form = array();
- // Default video settings.
- $form['plugins'] = array(
- '#type' => 'fieldset',
- '#title' => t('Video Advanced Settings'),
- '#collapsible' => TRUE,
- '#collapsed' => FALSE,
- '#weight' => 10
- );
- $form['plugins']['default_dimensions'] = array(
- '#type' => 'select',
- '#title' => t('Default Video Resolution Dimensions'),
- '#default_value' => !empty($widget['default_dimensions']) ? $widget['default_dimensions'] : '',
- '#options' => video_explode("\n", variable_get("video_metadata_dimensions", video_default_dimensions())),
- '#description' => t('Default transcoding resolution WIDTHxHEIGHT, in px, that FFMPEG will use to transcode your video files.')
- );
- $form['plugins']['default_player_dimensions'] = array(
- '#type' => 'select',
- '#title' => t('Default Video Player Dimensions'),
- '#default_value' => !empty($widget['default_player_dimensions']) ? $widget['default_player_dimensions'] : '',
- '#options' => video_explode("\n", variable_get("video_metadata_dimensions", video_default_dimensions())),
- '#description' => t('Default player WIDTHxHEIGHT in px. This is your actual player dimensions that your video will be playing in.')
- );
- $form['plugins']['autoconversion'] = array(
- '#type' => 'checkbox',
- '#title' => t('Enable video conversion.'),
- '#description' => t('Use ffmpeg(Default) to automatically convert videos to web compatible types eg. FLV, Please make sure to configure your transcoder settings.'),
- '#default_value' => $widget['autoconversion'],
- );
- $form['plugins']['autothumbnail'] = array(
- '#type' => 'checkbox',
- '#title' => t('Enable thumbnail creation.'),
- '#description' => t('Use ffmpeg(Default) to create thumbnails, Please make sure to configure your transcoder settings.'),
- '#default_value' => $widget['autothumbnail'],
- );
- // Default thumbnail settings.
- $form['default'] = array(
- '#type' => 'fieldset',
- '#title' => t('Video Thumbnail Settings'),
- '#element_validate' => array('video_default_widget_settings_validate'),
- '#collapsible' => TRUE,
- '#collapsed' => FALSE,
- '#weight' => 11
- );
- // @TODO: Move this to the actual upload/attach when creating a node to allow the user to upload their own thumbnail for each video.
- // Present a video image of the current default image.
- if (!empty($widget['default_video_thumb'])) {
- $form['default']['default_video_thumbnail'] = array(
- '#type' => 'markup',
- '#value' => theme('video_image', $widget['default_video_thumb'], '', '', array('width' => '150'), FALSE),
- '#prefix' => '<div class="video_thumbnail">',
- '#suffix' => '</div>'
- );
- }
- $form['default']['default_video_thumb_upload'] = array(
- '#type' => 'file',
- '#title' => empty($widget['default_video_thumb']) ? t('Upload default video thumbnail') : t('Replace default video thumbnail with'),
- '#description' => t('Choose a image that will be used as video thumbnail when you don\'t have video thumbnails for videos.'),
- );
- // We set this value on 'validate' so we can get CCK to add it
- // as a standard field setting.
- $form['default_video_thumb'] = array(
- '#type' => 'value',
- '#value' => $widget['default_video_thumb'],
- );
- return $form;
-}
-
-/**
- * Element specific validation for video default value.
- *
- */
-function video_default_widget_settings_validate($element, &$form_state) {
- // Verify the destination exists
- $destination = file_directory_path() . '/video_thumbs';
- if (!field_file_check_directory($destination, FILE_CREATE_DIRECTORY)) {
- form_set_error('default_video_thumb', t('The default image could not be uploaded. The destination %destination does not exist or is not writable by the server.', array('%destination' => dirname($destination))));
- return;
- }
-
- $validators = array(
- 'file_validate_is_image' => array(),
- );
-
- // We save the upload here because we can't know the correct path until the file is saved.
- if (!$file = file_save_upload('default_video_thumb_upload', $validators, $destination)) {
- // No upload to save we hope... or file_save_upload() reported an error on its own.
- return;
- }
-
- // Remove old image (if any) & clean up database.
- $old_default = $form_state['values']['default_video_thumb'];
- if (!empty($old_default['fid'])) {
- if (file_delete(file_create_path($old_default['filepath']))) {
- db_query('DELETE FROM {files} WHERE fid=%d', $old_default['fid']);
- }
- }
-
- // Make the file permanent and store it in the form.
- file_set_status($file, FILE_STATUS_PERMANENT);
- $file->timestamp = REQUEST_TIME;
- $form_state['values']['default_video_thumb'] = (array) $file;
-}
-
-function video_widget_settings_file_path_validate($element, &$form_state) {
- //lets prepend our video folder to the path settings. first truncate videos/ off the end if it exists.
- $form_state['values']['file_path'] = 'videos/' . $form_state['values']['file_path'];
-}
-
-/*
- * #options helper function to set our key=value for the form api.
- */
-
-function video_explode($delimeter, $dimensions) {
- $options = array();
- $values = explode($delimeter, $dimensions);
- foreach ($values as $value) {
- //lets check we have a value and its in the right format
- if (!empty($value) && video_format_right($value)) {
- $options[trim($value)] = trim($value);
- }
- }
- return $options;
-}
-
-function video_format_right($value) {
- $format = explode("x", $value);
- if (!isset($format[0]) || !is_numeric(trim($format[0])))
- return false;
- if (!isset($format[1]) || !is_numeric(trim($format[1])))
- return false;
- return true;
-}
-
-/*
- * Default video dimensions.
- */
-
-function video_default_dimensions() {
- return "176x144\n352x288\n704x576\n1408x1152\n128x96\n160x120\n320x240\n640x480\n800x600\n1024x768\n1600x1200\n2048x1024\n1280x1024\n2560x2048\n5120x4096\n852x480\n1366x768\n1600x1024\n1920x1200\n2560x1600\n3200x2048\n3840x2400\n6400x4096\n7680x4800\n320x200\n640x350\n852x480\n1280x720\n1920x1080";
-}
-
-/*
- * Utility function to remove all files and directories recursively.
- */
-
-function rmdirr($dir) {
- if ($objs = glob($dir . "/*")) {
- foreach ($objs as $obj) {
- is_dir($obj) ? rmdirr($obj) : unlink($obj);
- }
- }
- @rmdir($dir);
-}
-
-/**
- * Implementation of hook_element_info()
- */
-function video_element_info() {
- $types = array();
-
- // Support HTML5 video tag for rendering videos
- $types['video'] = array(
- '#input' => TRUE,
- '#theme' => 'video',
- '#size' => 60,
- );
-
- return $types;
-} \ No newline at end of file
diff --git a/video.theme.inc b/video.theme.inc
deleted file mode 100644
index f76edc9..0000000
--- a/video.theme.inc
+++ /dev/null
@@ -1,111 +0,0 @@
-<?php
-//$Id$
-/**
- *
- * @file
- * Theme functions for the video module.
- *
- */
-
-function theme_video_thumbnails($variables) {
- $file = $variables['file'];
- $alt = $variables['alt'];
- $title = $variables['title'];
- $attributes = $variables['attributes'];
- $getsize = $variables['getsize'];
-
- $file = (array)$file;
- // return $file['filepath'];
- if (!is_file($file['filepath'])) {
- return '<!-- File not found: '. $file['filepath'] .' -->';
- }
-
- if ($getsize) {
- // Use cached width and height if available.
- if (!empty($file['data']['width']) && !empty($file['data']['height'])) {
- $attributes['width'] = $file['data']['width'];
- $attributes['height'] = $file['data']['height'];
- }
- // Otherwise pull the width and height from the file.
- elseif (list($width, $height, $type, $image_attributes) = @getimagesize($file['filepath'])) {
- $attributes['width'] = $width;
- $attributes['height'] = $height;
- }
- }
-
- if (!empty($title)) {
- $attributes['title'] = $title;
- }
-
- // Alt text should be added even if it is an empty string.
- $attributes['alt'] = $alt;
-
- // Add a timestamp to the URL to ensure it is immediately updated after editing.
- $query_string = '';
- if (isset($file['timestamp'])) {
- $query_character = (variable_get('file_downloads', FILE_DOWNLOADS_PUBLIC) == FILE_DOWNLOADS_PRIVATE && variable_get('clean_url', '0') == '0') ? '&' : '?';
- $query_string = $query_character . $file['timestamp'];
- }
-
- $url = file_create_url($file['filepath']) . $query_string;
- $attributes['src'] = $url;
- $attributes = drupal_attributes($attributes);
- return '<span></span><img '. $attributes .' />';
-}
-
-function theme_video_widget_preview($item) {
- return theme('filefield_widget_preview', $item);
-}
-
-function theme_video_widget_video_thumb($item = NULL) {
- return '<div class="video-thumb">' . theme('video_image', $item, '', '', '', FALSE) . '</div>';
-}
-
-/**
- * @defgroup "Theme Callbacks"
- * @{
- * @see uploadfield_theme().
- */
-function theme_video_image($file, $alt = '', $title = '', $attributes = NULL, $getsize = TRUE, $imagecache = FALSE) {
- $file = (array)$file;
- //if this is imagecache skip this as the file might not be created yet
- if (!$imagecache && !is_file($file['filepath'])) {
- return '<!-- File not found: '. str_replace("--", "-", $file['filepath']) .'" -->';
- }
-
- if ($getsize && $imagecache && ($image = image_get_info($file['filepath']))) {
- $attributes['width'] = $image['width'];
- $attributes['height'] = $image['height'];
- }
- elseif ($getsize) {
- // Use cached width and height if available.
- if (!empty($file['data']['width']) && !empty($file['data']['height'])) {
- $attributes['width'] = $file['data']['width'];
- $attributes['height'] = $file['data']['height'];
- }
- // Otherwise pull the width and height from the file.
- elseif (list($width, $height, $type, $image_attributes) = @getimagesize($file['filepath'])) {
- $attributes['width'] = $width;
- $attributes['height'] = $height;
- }
- }
-
- if (!empty($title)) {
- $attributes['title'] = $title;
- }
-
- // Alt text should be added even if it is an empty string.
- $attributes['alt'] = $alt;
-
- // Add a timestamp to the URL to ensure it is immediately updated after editing.
- $query_string = '';
- if (isset($file['timestamp'])) {
- $query_character = (variable_get('file_downloads', FILE_DOWNLOADS_PUBLIC) == FILE_DOWNLOADS_PRIVATE && variable_get('clean_url', '0') == '0') ? '&' : '?';
- $query_string = $query_character . $file['timestamp'];
- }
-
- $url = file_create_url($file['filepath']) . $query_string;
- $attributes['src'] = $url;
- $attributes = drupal_attributes($attributes);
- return '<img '. $attributes .' />';
-} \ No newline at end of file
diff --git a/video_formatter.inc b/video_formatter.inc
deleted file mode 100644
index 0707284..0000000
--- a/video_formatter.inc
+++ /dev/null
@@ -1,177 +0,0 @@
-<?php
-// $Id$
-
-/**
- * @file
- * Video formatter hooks and callbacks.
- */
-
-/*
- * Default video cck formatter. Makes sure the video being displayed exists, has been converted (if in que).
- * If not or the video is processed, then it will get the default player for the specific video type for output.
- */
-function theme_video_formatter_video_plain($element) {
- if (empty($element['#item']['fid'])) return '';
- // Get our field information to determine if we are checking conversion
- $field = content_fields($element['#field_name'], $element['#type_name']);
- // Only needs to be ran if they are converting videos
- if (isset($field['widget']['autoconversion']) && $field['widget']['autoconversion'] && !$element['#item']['data']['bypass_autoconversion']) {
- module_load_include('inc', 'video', '/includes/conversion');
- $conversion = new video_conversion;
- $video = $conversion->load_video($element['#item']['fid']);
- if($video->video_status == VIDEO_RENDERING_ACTIVE || $video->video_status == VIDEO_RENDERING_PENDING) {
- return theme('video_inprogress');
- }
- else if ($video->video_status == VIDEO_RENDERING_FAILED) {
- return theme('video_encoding_failed');
- }
- }
- return video_get_player($element);
-}
-
-/*
- * Renders the video thumbnail as a link to the node page.
- */
-function theme_video_formatter_video_nodelink($element, $imagecache = FALSE) {
- // Inside a view $element may contain null data. In that case, just return.
- if (empty($element['#item']['fid'])) return '';
- //setup our thumbnail object
- module_load_include('inc', 'video', '/includes/video_helper');
- $video_helper = new video_helper;
- $thumbnail = $video_helper->thumbnail_object($element);
- //get our themed image
- $image = theme('video_image', $thumbnail, $thumbnail->alt, $thumbnail->title, '', TRUE, $imagecache);
- $class = 'popups video video-nodelink video-'. $element['#field_name'];
- return l($image, 'node/'. $element['#node']->nid, array('attributes' => array('class' => $class), 'html' => TRUE));
-}
-
-/*
- * Renders the video thumbnail linked to the absolute filepath of the video. Colorbox is introduced to handle
- * the video in an overlay.
- *
- * @todo Very unstable, need better methods of integration. Seems hackish right now to find out what flv player is being
- * used. We are also using jmedia for all other filetypes.
- */
-function theme_video_formatter_video_colorbox($element, $imagecache = FALSE) {
- global $base_path;
- if (!module_exists('colorbox')) {
- drupal_set_message(t('You must download and enable !colorbox for this formatter.', array('!colorbox' => l(t('Colorbox'), 'http://www.drupal.org/project/colorbox'))), 'error');
- return theme('video_formatter_video_nodelink', $element);
- }
-
- // Inside a view $element may contain null data. In that case, just return.
- if (empty($element['#item']['fid'])) return '';
-
- //load up our media plugins
- drupal_add_js(drupal_get_path('module', 'video') .'/js/jquery.media.js');
- drupal_add_js(drupal_get_path('module', 'video') .'/js/jquery.metadata.js');
- drupal_add_js(drupal_get_path('module', 'video') .'/js/flowplayer-3.2.0.min.js');
-
- //setup our video object
- module_load_include('inc', 'video', '/includes/video_helper');
- $video_helper = new video_helper;
- $video = $video_helper->video_object($element);
-
- $action = swftools_get_action($video->filepath);
- $player = swftools_get_player($action);
- $path = explode("_", $player);
- $player_url = $base_path . swftools_get_player_path() .'/'. $path[0] .'/'. variable_get($player .'_file', '');
- if(stristr($player, 'flowplayer')) {
- $player = 'flowplayer';
- }
- //add our default settings to the Drupal.settings object
- $settings = array('video' => array(
- 'flvplayer' => $player_url,
- 'autoplay' => $video->autoplay,
- 'autobuffer' => $video->autobuffering,
- 'player' => $player,
- ));
- drupal_add_js($settings, 'setting');
- $image = theme('video_image', $video->thumbnail, $video->thumbnail->alt, $video->thumbnail->title, '', TRUE, $imagecache);
- $class = 'video-box video-'. $element['#field_name'] .'{width:\''.$video->player_width.'px\', height:\''.$video->player_height.'px\', player:\''.$player.'\'}';
- return l($image, $video->url, array('attributes' => array('class' => $class), 'html' => TRUE));
-}
-
-/*
- * We are using the jMedia library to output our video files.
- *
- * @todo Does not work with flv files as this requires an actual flv player. Need to figure out how to best integrate the player
- * into this function.
- *
- * We are outputing an anchor to the videofile. The jMedia functions will overtake this anchor and setup our object/embed tags.
- */
-function theme_video_formatter_video_media_js($element) {
- drupal_add_js(drupal_get_path('module', 'video') .'/js/jquery.media.js');
- drupal_add_js(drupal_get_path('module', 'video') .'/js/jquery.metadata.js');
- //setup our video object
- module_load_include('inc', 'video', '/includes/video_helper');
- $video_helper = new video_helper;
- $video = $video_helper->video_object($element);
- //lets output the link to be overtaken by jmedia
- $link = l($video->filename, $video->url, array('attributes' => array('class' => 'jmedia {width: '. $video->player_width .', height: '. $video->player_height .', autoplay: '. $video->autoplay .'}')));
- return $link;
-}
-
-/**
- * Displays a "encoding in progress message"
- */
-function theme_video_inprogress() {
- return '<div class="video-ffmpeg-helper-inprogress">'. t('This video is currently being processed. Please wait.') . '</div>';
-}
-
-/**
- * Display an "encoding failed" message"
- */
-function theme_video_encoding_failed() {
- return '<div class="video-ffmpeg-helper-encoding-failed">'. t('The video conversion process has failed. You might want to submit a simpler video format like <em>mpeg</em> or <em>divx avi</em>.<br />If the problem persists please contact website administrators.') . '</div>';
-}
-
-function theme_video_flv($video, $node) {
- if ($video->flash_player == 'swftools') {
- $options = array(
- 'params' => array(
- 'width' => $video->player_width,
- 'height' => $video->player_height,
- ),
- 'othervars' => array(
- //@todo: swftools bug, can't enable this until they fix their pathing for the images.
- //'image' => $video->thumbnail->swfthumb,
- ),
- );
- $themed_output = swf($video->url, $options);
- }
- elseif ($video->flash_player == 'flowplayer') {
- $options = array(
- 'clip' => array(
- 'url' => $video->url,
- 'autoPlay' => $video->autoplay,
- 'autoBuffering' => $video->autobuffering,
- ),
- );
- $themed_output = theme(
- 'flowplayer',
- $options,
- $video->formatter,
- array('style' => 'width:' . $video->player_width . 'px;height:' . $video->player_height . 'px;')
- );
- }
- else {
- $themed_output = t('No flash player has been setup. ' . l(t('Please select a player to play Flash videos.'), 'admin/settings/video/players'));
- }
- return theme('video_play_flv', $video, $node, $themed_output);
-}
-
-function theme_video_formatter_imagecache($element) {
- // Inside a view $element may contain NULL data. In that case, just return.
- if (empty($element['#item']['fid'])) {
- return '';
- }
-
- // Extract the preset name from the formatter name.
- list($namespace, $theme_function) = explode('__', $element['#formatter'], 2);
- if ($preset = imagecache_preset_by_name($namespace)) {
- $element['imagecache_preset'] = $namespace;
- }
- //return $theme_function;
- return theme('video_formatter_'. $theme_function, $element, TRUE);
-} \ No newline at end of file
diff --git a/video_scheduler.php b/video_scheduler.php
deleted file mode 100644
index a0cbc9c..0000000
--- a/video_scheduler.php
+++ /dev/null
@@ -1,225 +0,0 @@
-<?php
-//$Id$
-/**
- * @file
- * Implement video rendering scheduling.
- * If you are not using sites/default/settings.php as your settings file,
- * add an optional parameter for the drupal site url:
- * "php video_scheduler.php http://example.com/" or
- * "php video_scheduler.php http://example.org/drupal/"
- *
- * @author Heshan Wanigasooriya <heshan at heidisoft dot com, heshanmw at gmail dot com>
- *
- */
-
-/**
- * video_scheduler.php configuration
- */
-
-// number of conversion jobs active at the same time
-defined('VIDEO_RENDERING_FFMPEG_INSTANCES')
- or define('VIDEO_RENDERING_FFMPEG_INSTANCES', 5);
-
-/**
- * video_scheduler.php configuration ends.
- * DO NOT EDIT BELOW THIS LINE
- */
-
-/**
- * Define some constants
- */
-defined('VIDEO_RENDERING_PENDING')
- or define('VIDEO_RENDERING_PENDING', 1);
-defined('VIDEO_RENDERING_ACTIVE')
- or define('VIDEO_RENDERING_ACTIVE', 5);
-defined('VIDEO_RENDERING_COMPLETE')
- or define('VIDEO_RENDERING_COMPLETE', 10);
-defined('VIDEO_RENDERING_FAILED')
- or define('VIDEO_RENDERING_FAILED', 20);
-
-
-if (isset($_SERVER['argv'][1])) {
- $url = parse_url($_SERVER['argv'][1]);
- $_SERVER['SCRIPT_NAME'] = $url['path'];
- $_SERVER['HTTP_HOST'] = $url['host'];
-}
-
-include_once('./includes/bootstrap.inc');
-//module_load_include('/includes/bootstrap.inc', 'video_scheduler', 'includes/bootstrap');
-// disable error reporting for bootstrap process
-error_reporting(E_ERROR);
-// let's bootstrap: we will be able to use drupal apis
-drupal_bootstrap(DRUPAL_BOOTSTRAP_FULL);
-// enable full error reporting again
-error_reporting(E_ALL);
-
-//watchdog('video_scheduler', 'starting video conversion jobs.', array(), WATCHDOG_DEBUG);
-// allow execution only from the command line!
-if(empty($_SERVER['REQUEST_METHOD'])) {
- video_scheduler_main();
-}
-else {
- print ('This script is only executable from the command line.');
- die();
-}
-
-
-
-/**
- * Main for video_scheduler.php
- */
-function video_scheduler_main() {
-// echo 'ok';
- if($jobs = video_scheduler_select()) {
- foreach ($jobs as $job) {
- video_scheduler_start($job);
- }
- }
- else {
- watchdog('video_scheduler', 'no video conversion jobs to schedule.', array(), WATCHDOG_DEBUG);
- }
-}
-
-
-/**
- * Starts rendering for a job
- */
-function video_scheduler_start($job) {
-// $url = (isset($_SERVER['argv'][1])) ? escapeshellarg($_SERVER['argv'][1]) : '';
-// watchdog('video_scheduler', 'Execute video_render.php %url and %job', array('%url'=>$url, '%job'=>$job->fid), WATCHDOG_DEBUG);
-// exec("/usr/local/bin/php /home/freja/public_html/v5-dev/video_render.php $job->fid $url > /dev/null &");
- video_render_main($job->fid);
-}
-
-
-/**
- * Select VIDEO_RENDERING_FFMPEG_INSTANCES jobs from the queue
- *
- * @return an array containing jobs
- */
-function video_scheduler_select() {
-// load node and its file object
- module_load_include('inc', 'uploadfield', '/uploadfield_convert');
- $jobs = array();
- $i = 0;
- $result = db_query_range('SELECT f.fid, f.filepath, f.filesize, f.filename, f.filemime, f.status FROM {video_rendering} vr INNER JOIN {files}
- f ON vr.fid = f.fid WHERE vr.fid = f.fid AND vr.status = %d AND f.status = %d ORDER BY f.timestamp',
- VIDEO_RENDERING_PENDING, FILE_STATUS_PERMANENT, 0, VIDEO_RENDERING_FFMPEG_INSTANCES);
- while($job = db_fetch_object($result)) {
- $jobs[] = $job;
- }
- // print_r($jobs);
- // exit;
- return $jobs;
-}
-
-/**
- * Video Rendering Process
- *
- */
-function video_render_main($job_fid) {
-
-// get parameters passed from command line
- $fid = $job_fid;
- $job = NULL;
- // set the status to active
- _video_render_job_change_status($fid, VIDEO_RENDERING_ACTIVE);
- // load the job object
- $job = _video_render_load_job($fid);
-
- if(empty($job)) {
- watchdog('video_render', 'video_render.php has been called with an invalid job resource. exiting.', array(), WATCHDOG_ERROR);
- die;
- }
-
- // get file object
- _video_render_get_converted_file(&$job);
- $file = $job->converted;
-
- if(empty($file)) {
- watchdog('video_render', 'converted file is an empty file.', array(), WATCHDOG_ERROR);
- _video_render_job_change_status($fid, VIDEO_RENDERING_FAILED);
- die;
- }
-
-
- $tmpfile = $file->filepath;
-
- // the above no more works as token supports - use dirname
- $dest_dir = dirname($job->filepath) . '/';
-
- if (file_copy($file, $dest_dir)) {
- //update the file table entry and copy file content to new one
- $file->fid = $fid;
- //update file with new
- drupal_write_record ('files', $file, 'fid');
- //add new file entry
- drupal_write_record ('files', $job);
- // TODO : add data of rendering
- _video_render_job_change_status($fid, VIDEO_RENDERING_COMPLETE);
- // clear all cacahe data
- // cache_clear_all();
- // drupal_flush_all_caches();
- cache_clear_all("*", 'cache_content', true);
- watchdog('video_render', 'successfully converted %orig to %dest', array('%orig' => $job->filepath, '%dest' => $file->filepath), WATCHDOG_INFO);
- // delete the temp file
-// unlink($tmpfile);
- }
- else {
- _video_render_job_change_status($fid, VIDEO_RENDERING_FAILED);
- // get the username of the process owner
- $ownerarray = posix_getpwuid(posix_getuid());
- $owner=$ownerarray['name'];
- // get the username of the destination folder owner
- $fownerarray = posix_getpwuid(fileowner($dest_dir));
- $fowner=$fownerarray['name'];
- // get destination folder permissions
- $perms = substr(sprintf('%o', fileperms($dest_dir)), -4);
- watchdog('video_render', 'error moving video %vid_file with nid = %nid to %dir the final directory. Check folder permissions.<br />The script was run by %uname .<br />The folder owner is %fowner .<br />The folder permissions are %perms .', array('%vid_file' => $job->origfile, '%nid' => $job->nid, '%dir' => $dest_dir, '%uname' => $owner, '%fowner' => $fowner, '%perms' => $perms), WATCHDOG_ERROR);
- }
-}
-
-
-/**
- * Get a string cointaining the command to be executed including options
- */
-function _video_render_get_converted_file(&$job) {
- $transcoder = variable_get('vid_convertor', 'ffmpeg');
- module_load_include('inc', 'video', '/plugins/' . $transcoder);
- $function = variable_get('vid_convertor', 'ffmpeg') . '_auto_convert';
- if (function_exists($function)) {
- // $thumbs = ffmpeg_auto_thumbnail($file);
- // watchdog('video_render', 'calling to converter API %conv', array('%conv' => $transcoder));
- $function(&$job);
-// if(! $success) {
-// watchdog('video_render', 'error transcoding vide. existing.', array(), WATCHDOG_ERROR);
-// }
- }
- else {
- // drupal_set_message(t('Transcoder not configured properly'), 'error');
- print ('Transcoder not configured properly');
- }
-}
-
-
-/**
- * Load a job
- */
-function _video_render_load_job($fid) {
-// watchdog('video_render', 'Loading contents for file id %fid', array('%fid' => $fid));
- $result = db_query('SELECT f.filepath, f.filesize, f.filename, f.filemime, f.filesize, f.status, f.uid
- FROM {video_rendering} vr INNER JOIN {files} f
- ON vr.fid = f.fid WHERE vr.fid = f.fid AND f.status = %d AND f.fid = %d',
- FILE_STATUS_PERMANENT, $fid);
- return db_fetch_object($result);
-}
-
-
-/**
- * Change the status to $status of the job having nid=$nid and vid=$vid
- */
-function _video_render_job_change_status($fid, $status) {
- $result = db_query('UPDATE {video_rendering} SET status = %d WHERE fid = %d ', $status, $fid);
-}
-
-?>
diff --git a/views/video.views.inc b/views/video.views.inc
deleted file mode 100644
index 5f2c46f..0000000
--- a/views/video.views.inc
+++ /dev/null
@@ -1,77 +0,0 @@
-<?php
-// $Id$
-/**
- * @file
- * Provide views data for video.module.
- */
-
-module_load_include('inc', 'content', '/includes/views/content.views');
-/**
- * Implementation of hook_views_handlers().
- */
-function video_views_handlers() {
- return array(
- 'info' => array(
- 'path' => drupal_get_path('module', 'video') . '/views',
- ),
- 'handlers' => array(
- // field handlers
- 'video_views_handler_field_data' => array(
- 'parent' => 'content_handler_field',
- ),
- ),
- );
-}
-
-/**
- * Implementation of hook_views_data()
- */
-function video_views_data() {
- $data = array();
- $data['video']['table']['group'] = t('Video');
- $widgets = array('videoftp_widget','uploadfield_widget');
- foreach (content_fields() as $field) {
- if($field['module'] == 'filefield' && isset($field['widget']['type']) && in_array($field['widget']['type'], $widgets)) {
- $views_data = content_views_field_views_data($field);
- $table_alias = content_views_tablename($field);
- $db_info = content_database_info($field);
-
- $title = t('@label (!name) thumbnail', array('@label' => t($field['widget']['label']), '!name' => $field['field_name']));
- $types = array();
- foreach (content_types() as $type) {
- if (isset($type['fields'][$field['field_name']])) {
- // TODO : run check_plain here instead of on the imploded string below ?
- $types[] = $type['name'];
- }
- }
-
- $additional_fields = array();
- foreach ($db_info['columns'] as $column => $attributes) {
- // Select explicitly enabled field columns.
- if (!empty($attributes['views'])) {
- $db_columns[$column] = $attributes;
- }
- // Ensure all columns are retrieved.
- $additional_fields[$attributes['column']] = $attributes['column'];
- }
-
- $data[$table_alias][$field['field_name'].'_thumbnail'] = array(
- 'group' => t('Video'),
- 'title' => $title,
- 'help' => t($field_types[$field['type']]['label']) .' - '. t('Appears in: @types', array('@types' => implode(', ', $types))),
- );
- $data[$table_alias][$field['field_name'].'_thumbnail']['field'] = array(
- 'title' => $title,
- 'field' => $db_info['columns']['data']['column'],
- 'table' => $db_info['table'],
- 'handler' => 'video_views_handler_field_data',
- 'click sortable' => FALSE,
- 'content_field_name' => $field['field_name'],
- 'additional fields' => $additional_fields,
- 'access callback' => 'content_access',
- 'access arguments' => array('view', $field),
- );
- }
- }
- return $data;
-}
diff --git a/views/video_views_handler_field_data.inc b/views/video_views_handler_field_data.inc
deleted file mode 100644
index d082e46..0000000
--- a/views/video_views_handler_field_data.inc
+++ /dev/null
@@ -1,60 +0,0 @@
-<?php
-// $Id$
-
-/**
- * @file
- * video_handler_field_data.inc
- *
- * Provides a handler for displaying thumbnails within the serialized data column.
- */
-class video_views_handler_field_data extends content_handler_field {
-
- function render($values) {
- $values = drupal_clone($values); // Prevent affecting the original.
- $data = unserialize($values->{$this->field_alias});
- $filepath = $data['video_thumb'];
-
- // We're down to a single node here, so we can retrieve the actual field
- // definition for the node type being considered.
- $field = content_fields($this->content_field['field_name'], $values->{$this->aliases['type']});
- $options = $this->options;
- $db_info = content_database_info($field);
-
- // Build a pseudo-node from the retrieved values.
- $node = drupal_clone($values);
- $node->type = $values->{$this->aliases['type']};
- $node->nid = $values->{$this->aliases['nid']};
- $node->vid = $values->{$this->aliases['vid']};
- // Some formatters need to behave differently depending on the build_mode
- // (for instance: preview), so we provide one.
- $node->build_mode = NODE_BUILD_NORMAL;
-
- $item = array();
- foreach ($db_info['columns'] as $column => $attributes) {
- $item[$column] = $values->{$this->aliases[$attributes['column']]};
- }
-
- $item['#delta'] = $field['multiple'] ? $values->{$this->aliases['delta']} : 0;
- //added for thumbnails this should work.
- $file = pathinfo($filepath);
- $item['filepath'] = $filepath;
- $item['filename'] = $file['basename'];
- $item['filemime'] = file_get_mimetype($file['basename']);
- $item['filesize'] = filesize($filepath);
-
- // Render items.
- $formatter_name = $options['format'];
- if ($formatter = _content_get_formatter($formatter_name, $field['type'])) {
- if (content_handle('formatter', 'multiple values', $formatter) == CONTENT_HANDLE_CORE) {
- // Single-value formatter.
- $output = content_format($field, $item, $formatter_name, $node);
- }
- else {
- // Multiple values formatter - we actually have only one value to display.
- $output = content_format($field, array($item), $formatter_name, $node);
- }
- return $this->render_link($output, $values);
- }
- return '';
- }
-} \ No newline at end of file