| 1 |
<?php
|
| 2 |
// $Id$
|
| 3 |
/**
|
| 4 |
* @file
|
| 5 |
* Provide installation functions for video.module .
|
| 6 |
*
|
| 7 |
* @author Heshan Wanigasooriya <heshan at heidisoft dot com>
|
| 8 |
* <heshanmw at gmail dot com>
|
| 9 |
* @todo
|
| 10 |
*/
|
| 11 |
|
| 12 |
/**
|
| 13 |
* Implementation of hook_schema().
|
| 14 |
*/
|
| 15 |
function video_schema() {
|
| 16 |
$schema['video'] = array(
|
| 17 |
'description' => t('Store video files informations'),
|
| 18 |
'fields' => array(
|
| 19 |
'vid' => array(
|
| 20 |
'description' => t('Prmary Key: {video}.vid of the video node'),
|
| 21 |
'type' => 'int',
|
| 22 |
'unsigned' => TRUE,
|
| 23 |
'not null' => TRUE,
|
| 24 |
'default' => 0,
|
| 25 |
),
|
| 26 |
'nid' => array(
|
| 27 |
'description' => t('Node id, index to the {node}.nid'),
|
| 28 |
'type' => 'int',
|
| 29 |
'unsigned' => TRUE,
|
| 30 |
'not null' => TRUE,
|
| 31 |
'default' => 0,
|
| 32 |
),
|
| 33 |
'vtype' => array(
|
| 34 |
'description' => t('The type of the video'),
|
| 35 |
'type' => 'varchar',
|
| 36 |
'length' => 32,
|
| 37 |
'not null' => TRUE,
|
| 38 |
'default' => '',
|
| 39 |
),
|
| 40 |
'vidfile' => array(
|
| 41 |
'description' => t('Video file name / path'),
|
| 42 |
'type' => 'text',
|
| 43 |
'not null' => FALSE,
|
| 44 |
'default' => '',
|
| 45 |
),
|
| 46 |
'videox' => array(
|
| 47 |
'description' => t('resolution : x'),
|
| 48 |
'type' => 'int',
|
| 49 |
'size' => 'small',
|
| 50 |
'unsigned' => TRUE,
|
| 51 |
'not null' => TRUE,
|
| 52 |
'default' => 0,
|
| 53 |
),
|
| 54 |
'videoy' => array(
|
| 55 |
'description' => t('resolution : y'),
|
| 56 |
'type' => 'int',
|
| 57 |
'size' => 'small',
|
| 58 |
'unsigned' => TRUE,
|
| 59 |
'not null' => TRUE,
|
| 60 |
'default' => 0,
|
| 61 |
),
|
| 62 |
'size' => array(
|
| 63 |
'description' => t('size of the video file'),
|
| 64 |
'type' => 'int',
|
| 65 |
'size' => 'big',
|
| 66 |
'unsigned' => TRUE,
|
| 67 |
'not null' => FALSE,
|
| 68 |
),
|
| 69 |
'download_counter' => array(
|
| 70 |
'description' => t('No. of downloads of the video'),
|
| 71 |
'type' => 'int',
|
| 72 |
'unsigned' => TRUE,
|
| 73 |
'not null' => TRUE,
|
| 74 |
'default' => 0,
|
| 75 |
),
|
| 76 |
'play_counter' => array(
|
| 77 |
'description' => t('No. of play times per video'),
|
| 78 |
'type' => 'int',
|
| 79 |
'unsigned' => TRUE,
|
| 80 |
'not null' => TRUE,
|
| 81 |
'default' => 0,
|
| 82 |
),
|
| 83 |
'video_bitrate' => array(
|
| 84 |
'description' => t('Bit rate of the video'),
|
| 85 |
'type' => 'int',
|
| 86 |
'unsigned' => TRUE,
|
| 87 |
'not null' => FALSE,
|
| 88 |
),
|
| 89 |
'audio_bitrate' => array(
|
| 90 |
'description' => t('Bit rate of the audio'),
|
| 91 |
'type' => 'int',
|
| 92 |
'unsigned' => TRUE,
|
| 93 |
'not null' => FALSE,
|
| 94 |
),
|
| 95 |
'audio_sampling_rate' => array(
|
| 96 |
'description' => t('Sampling rate of the video'),
|
| 97 |
'type' => 'int',
|
| 98 |
'unsigned' => TRUE,
|
| 99 |
'not null' => FALSE,
|
| 100 |
),
|
| 101 |
'audio_channels' => array(
|
| 102 |
'description' => t('Chenells of the audio'),
|
| 103 |
'type' => 'text',
|
| 104 |
'not null' => FALSE,
|
| 105 |
),
|
| 106 |
'playtime_seconds' => array(
|
| 107 |
'description' => t('Play time of the video'),
|
| 108 |
'type' => 'int',
|
| 109 |
'unsigned' => TRUE,
|
| 110 |
'not null' => FALSE,
|
| 111 |
),
|
| 112 |
'download_folder' => array(
|
| 113 |
'description' => t('download folder'),
|
| 114 |
'type' => 'varchar',
|
| 115 |
'length' => 255,
|
| 116 |
'not null' => FALSE,
|
| 117 |
),
|
| 118 |
'disable_multidownload' => array(
|
| 119 |
'description' => t('enable/disable multi download'),
|
| 120 |
'type' => 'int',
|
| 121 |
'size' => 'tiny',
|
| 122 |
'unsigned' => TRUE,
|
| 123 |
'not null' => TRUE,
|
| 124 |
'default' => 0,
|
| 125 |
),
|
| 126 |
'use_play_folder' => array(
|
| 127 |
'description' => t('use play folder'),
|
| 128 |
'type' => 'int',
|
| 129 |
'size' => 'tiny',
|
| 130 |
'unsigned' => TRUE,
|
| 131 |
'not null' => TRUE,
|
| 132 |
'default' => 0,
|
| 133 |
),
|
| 134 |
'serialized_data' => array(
|
| 135 |
'description' => t('Informations related to the videos'),
|
| 136 |
'type' => 'text',
|
| 137 |
'not null' => FALSE,
|
| 138 |
),
|
| 139 |
),
|
| 140 |
'indexes' => array(
|
| 141 |
'nid' => array('nid'),
|
| 142 |
),
|
| 143 |
'primary key' => array('vid'),
|
| 144 |
);
|
| 145 |
|
| 146 |
return $schema;
|
| 147 |
}
|
| 148 |
|
| 149 |
/**
|
| 150 |
* Implementation of hook_install().
|
| 151 |
*/
|
| 152 |
function video_install() {
|
| 153 |
drupal_install_schema('video');
|
| 154 |
|
| 155 |
// default values for some variables use for resolution stuff
|
| 156 |
variable_set('video_resolution_1_name', '16:9 - Widescreen');
|
| 157 |
variable_set('video_resolution_1_value', '400x226');
|
| 158 |
variable_set('video_resolution_2_name', '4:3 - Television');
|
| 159 |
variable_set('video_resolution_2_value', '400x300');
|
| 160 |
}
|
| 161 |
|
| 162 |
/**
|
| 163 |
* Implementation of hook_uninstall().
|
| 164 |
*/
|
| 165 |
function video_uninstall() {
|
| 166 |
drupal_uninstall_schema('video');
|
| 167 |
variable_del('video_resolution_1_name');
|
| 168 |
variable_del('video_resolution_1_value');
|
| 169 |
variable_del('video_resolution_2_name');
|
| 170 |
variable_del('video_resolution_2_value');
|
| 171 |
}
|