aboutsummaryrefslogtreecommitdiff
path: root/video.install
blob: 153ce1bbf008c66211503a6dcbd128be4e97ae21 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
<?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,
      ),
      'status' => array(
        'description' => t('Status of the transcoding'),
        'type' => 'int',
        'unsigned' => TRUE,
        'not null' => TRUE,
        'default' => 0,
      ),
      'dimensions' => array(
        'type' => 'varchar',
        'length' => '255',
        'default' => '',
        'description' => t('The dimensions of the video.'),
      ),
      '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,
      ),
      'data' => array(
        'type' => 'text',
        'not null' => FALSE,
        'size' => 'big',
        'description' => 'A serialized array of converted files. Use of this field is discouraged and it will likely disappear in a future version of Drupal.',
      ),
    ),
    'indexes' => array(
      'status' => array('status'),
      'file' => array('fid'),
    ),
    'primary key' => array('vid'),
  );
  return $schema;
}

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

/**
 * Implementation of hook_uninstall().
 */
function video_uninstall() {
  drupal_uninstall_schema('video');
// Delete all variables which begin with the namespaced "video_*".
  $video_vars = array();
  $query = "SELECT name FROM {variable} WHERE name LIKE '%video_%'";
  $video_vars = db_query($query);
  while ($result = db_fetch_array($video_vars)) {
    if (strpos($result['name'], 'video') === 0) {
      variable_del($result['name']);
    }
  }
}

/**
 * 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;
}

/**
 * Update 6406
 * @return <type>
 */
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();
}

/**
 * Update 6407
 */
function video_update_6407() {
  $ret = array();
// drop un wanted fields in video files
  db_drop_field($ret, 'video_files', 'filesize');
  db_drop_field($ret, 'video_files', 'filename');
  db_drop_field($ret, 'video_files', 'filepath');
  db_drop_field($ret, 'video_files', 'filemime');
  db_add_column($ret, 'video_files', 'data', 'longtext', array('null' => TRUE));
  return $ret;
}