You are here

video.install in Video 6.2

Provide installation functions for video.module .

@author Heshan Wanigasooriya <heshan at heidisoft dot com> <heshanmw at gmail dot com> @todo

File

video.install
View source
<?php

/**
 * @file
 * Provide 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'] = array(
    'description' => t('Store video files informations'),
    'fields' => array(
      'vid' => array(
        'description' => t('Prmary Key: {video}.vid of the video node'),
        'type' => 'int',
        'unsigned' => TRUE,
        'not null' => TRUE,
        'default' => 0,
      ),
      'nid' => array(
        'description' => t('Node id, index to the {node}.nid'),
        'type' => 'int',
        'unsigned' => TRUE,
        'not null' => TRUE,
        'default' => 0,
      ),
      'vtype' => array(
        'description' => t('The type of the video'),
        'type' => 'varchar',
        'length' => 32,
        'not null' => TRUE,
        'default' => '',
      ),
      'vidfile' => array(
        'description' => t('Video file name / path'),
        'type' => 'text',
        'not null' => FALSE,
        'default' => '',
      ),
      'videox' => array(
        'description' => t('resolution : x'),
        'type' => 'int',
        'size' => 'small',
        'unsigned' => TRUE,
        'not null' => TRUE,
        'default' => 0,
      ),
      'videoy' => array(
        'description' => t('resolution : y'),
        'type' => 'int',
        'size' => 'small',
        'unsigned' => TRUE,
        'not null' => TRUE,
        'default' => 0,
      ),
      'size' => array(
        'description' => t('size of the video file'),
        'type' => 'int',
        'size' => 'big',
        'unsigned' => TRUE,
        'not null' => FALSE,
      ),
      'download_counter' => array(
        'description' => t('No. of downloads of the video'),
        'type' => 'int',
        'unsigned' => TRUE,
        'not null' => TRUE,
        'default' => 0,
      ),
      'play_counter' => array(
        'description' => t('No. of play times per video'),
        'type' => 'int',
        'unsigned' => TRUE,
        'not null' => TRUE,
        'default' => 0,
      ),
      'video_bitrate' => array(
        'description' => t('Bit rate of the video'),
        'type' => 'int',
        'unsigned' => TRUE,
        'not null' => FALSE,
      ),
      'audio_bitrate' => array(
        'description' => t('Bit rate of the audio'),
        'type' => 'int',
        'unsigned' => TRUE,
        'not null' => FALSE,
      ),
      'audio_sampling_rate' => array(
        'description' => t('Sampling rate of the video'),
        'type' => 'int',
        'unsigned' => TRUE,
        'not null' => FALSE,
      ),
      'audio_channels' => array(
        'description' => t('Chenells of the audio'),
        'type' => 'text',
        'not null' => FALSE,
      ),
      'playtime_seconds' => array(
        'description' => t('Play time of the video'),
        'type' => 'int',
        'unsigned' => TRUE,
        'not null' => FALSE,
      ),
      'download_folder' => array(
        'description' => t('download folder'),
        'type' => 'varchar',
        'length' => 255,
        'not null' => FALSE,
      ),
      'disable_multidownload' => array(
        'description' => t('enable/disable multi download'),
        'type' => 'int',
        'size' => 'tiny',
        'unsigned' => TRUE,
        'not null' => TRUE,
        'default' => 0,
      ),
      'use_play_folder' => array(
        'description' => t('use play folder'),
        'type' => 'int',
        'size' => 'tiny',
        'unsigned' => TRUE,
        'not null' => TRUE,
        'default' => 0,
      ),
      'serialized_data' => array(
        'description' => t('Informations related to the videos'),
        'type' => 'text',
        'not null' => FALSE,
      ),
    ),
    'indexes' => array(
      'nid' => array(
        'nid',
      ),
    ),
    'primary key' => array(
      'vid',
    ),
  );
  return $schema;
}

/**
 * Implementation of hook_install().
 */
function video_install() {
  drupal_install_schema('video');

  // default values for some variables use for resolution stuff
  variable_set('video_resolution_1_name', '16:9 - Widescreen');
  variable_set('video_resolution_1_value', '400x226');
  variable_set('video_resolution_2_name', '4:3 - Television');
  variable_set('video_resolution_2_value', '400x300');
}

/**
 * Implementation of hook_uninstall().
 */
function video_uninstall() {
  drupal_uninstall_schema('video');
  variable_del('video_resolution_1_name');
  variable_del('video_resolution_1_value');
  variable_del('video_resolution_2_name');
  variable_del('video_resolution_2_value');
}

Functions

Namesort descending Description
video_install Implementation of hook_install().
video_schema Implementation of hook_schema().
video_uninstall Implementation of hook_uninstall().