? Copy (2) of audio.install
? Copy of audio.install
? getid3/changelog.txt
? getid3/dependencies.txt
? getid3/getid3
? getid3/helperapps
? getid3/license.commercial.txt
? getid3/license.txt
? getid3/readme.txt
? getid3/structure.txt
? players/Thumbs.db
Index: audio.install
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/audio/audio.install,v
retrieving revision 1.14
diff -u -r1.14 audio.install
--- audio.install	27 Jul 2007 18:47:30 -0000	1.14
+++ audio.install	27 Jul 2007 21:40:05 -0000
@@ -17,6 +17,7 @@
           `download_count` int(10) unsigned NOT NULL default '0',
           `downloadable` tinyint(1) NOT NULL default '1',
           `fileformat` varchar(10) NOT NULL default '',
+          `filesize` int(10) unsigned NOT NULL default '0',
           `sample_rate` int(10) unsigned NOT NULL default '0',
           `channel_mode` varchar(10) NOT NULL default '',
           `bitrate` float unsigned NOT NULL default '0',
@@ -31,7 +32,6 @@
           `filename` varchar(255) NOT NULL default '',
           `filepath` varchar(255) NOT NULL default '',
           `filemime` varchar(255) NOT NULL default '',
-          `filesize` int(10) unsigned NOT NULL default '0',
           PRIMARY KEY  (`vid`)
         ) /*!40100 DEFAULT CHARACTER SET utf8 */;
       ");
@@ -61,6 +61,8 @@
                 CHECK (download_count >= 0),
             downloadable smallint NOT NULL default '1',
             fileformat varchar(10) NOT NULL default '',
+            filesize integer NOT NULL default '0'
+                CHECK (filesize >= 0),
             sample_rate integer NOT NULL default '0'
                 CHECK (sample_rate >= 0),
             channel_mode varchar(10) NOT NULL default '',
@@ -78,8 +80,6 @@
             filename varchar(255) NOT NULL default '',
             filepath varchar(255) NOT NULL default '',
             filemime varchar(255) NOT NULL default '',
-            filesize integer NOT NULL default '0'
-                CHECK (filesize >= 0),
             PRIMARY KEY  (vid)
         );
       ");
@@ -291,4 +291,20 @@
       break;
   }
   return $ret;
+}
+
+/**
+ * Move the filesize field from {audio_file} to {audio}.
+ */
+function audio_update_5201() {
+  $ret = array();
+  switch ($GLOBALS['db_type']) {
+    case 'mysql':
+    case 'mysqli':
+      $ret[] = update_sql("ALTER TABLE {audio} ADD COLUMN `filesize` INTEGER UNSIGNED NOT NULL default 0 AFTER `fileformat`");
+      $ret[] = update_sql("UPDATE {audio} a INNER JOIN {audio_file} af ON a.vid = af.vid SET a.filesize = af.filesize");
+      $ret[] = update_sql("ALTER TABLE {audio_file} DROP COLUMN `filesize`");
+      break;
+  }
+  return $ret;
 }
\ No newline at end of file
Index: audio.module
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/audio/audio.module,v
retrieving revision 1.115
diff -u -r1.115 audio.module
--- audio.module	27 Jul 2007 22:46:51 -0000	1.115
+++ audio.module	27 Jul 2007 22:47:25 -0000
@@ -331,8 +331,8 @@
             'key' => 'enclosure',
             'attributes' => array(
               'url' => $node->url_download,
-              'length' => $node->audio_file->filesize,
-              'type' => $node->audio_file->filemime,
+              'length' => $node->audio_fileinfo['filesize'],
+              'type' => $node->audio_file->filemime
             ));
           // Provide very basic iTunes support.
           $ret[] = array(
@@ -410,9 +410,8 @@
     unset($ret['audio_fileinfo']['title_format']);
 
     // Load the file.
-    $result = db_query('SELECT filename, filepath, filemime, filesize FROM {audio_file} f WHERE f.vid = %d', $node->vid);
+    $result = db_query('SELECT filename, filepath, filemime FROM {audio_file} f WHERE f.vid = %d', $node->vid);
     $ret['audio_file'] = $file = db_fetch_object($result);
-    $ret['audio_fileinfo']['filesize'] = $file->filesize;
 
     if (file_exists($file->filepath)) {
       // TODO: should these links be by vid?
@@ -451,10 +450,10 @@
 
   $f = $node->audio_file;
   $i = $node->audio_fileinfo;
-  db_query("INSERT INTO {audio_file} (vid, filename, filepath, filemime, filesize) VALUES (%d, '%s', '%s', '%s', %d)",
-    $node->vid, $f->filename, $f->filepath, $f->filemime, filesize($f->filepath));  
-  db_query("INSERT INTO {audio} (vid, nid, title_format, downloadable, fileformat, bitrate, bitrate_mode, sample_rate, channel_mode, playtime) VALUES (%d, %d, '%s', %d, '%s', %f, '%s', %d, '%s', '%s')",
-    $node->vid, $node->nid, $node->title_format, $i['downloadable'], $i['fileformat'], $i['bitrate'], $i['bitrate_mode'], $i['sample_rate'], $i['channel_mode'], $i['playtime']);
+  db_query("INSERT INTO {audio_file} (vid, filename, filepath, filemime) VALUES (%d, '%s', '%s', '%s')",
+    $node->vid, $f->filename, $f->filepath, $f->filemime);
+  db_query("INSERT INTO {audio} (vid, nid, title_format, downloadable, fileformat, filesize, bitrate, bitrate_mode, sample_rate, channel_mode, playtime) VALUES (%d, %d, '%s', %d, '%s', %d, %f, '%s', %d, '%s', '%s')",
+    $node->vid, $node->nid, $node->title_format, $i['downloadable'], $i['fileformat'], filesize($f->filepath), $i['bitrate'], $i['bitrate_mode'], $i['sample_rate'], $i['channel_mode'], $i['playtime']);
 
   _audio_save_tags_to_db($node);
   
@@ -479,13 +478,12 @@
   // Notify other modules.
   audio_invoke_audioapi('insert revision', $node);
 
-  $f = $node->audio_file;
-  db_query("INSERT INTO {audio_file} (vid, filename, filepath, filemime, filesize) VALUES (%d, '%s', '%s', '%s', %d)",
-    $node->vid, $f->filepath, $f->filepath, $f->filemime, filesize($f->filepath));
-
   $i = $node->audio_fileinfo;
-  db_query("INSERT INTO {audio} (vid, nid, title_format, downloadable, fileformat, bitrate, bitrate_mode, sample_rate, channel_mode, playtime) VALUES (%d, %d, '%s', %d, '%s', %f, '%s', %d, '%s', '%s')",
-    $node->vid, $node->nid, $node->title_format, $i['downloadable'], $i['fileformat'], $i['bitrate'], $i['bitrate_mode'], $i['sample_rate'], $i['channel_mode'], $i['playtime']);
+  $f = $node->audio_file;
+  db_query("INSERT INTO {audio} (vid, nid, title_format, downloadable, fileformat, filesize, bitrate, bitrate_mode, sample_rate, channel_mode, playtime) VALUES (%d, %d, '%s', %d, '%s', %d, %f, '%s', %d, '%s', '%s')",
+    $node->vid, $node->nid, $node->title_format, $i['downloadable'], $i['fileformat'], filesize($f->filepath), $i['bitrate'], $i['bitrate_mode'], $i['sample_rate'], $i['channel_mode'], $i['playtime']);
+  db_query("INSERT INTO {audio_file} (vid, filename, filepath, filemime) VALUES (%d, '%s', '%s', '%s')",
+    $node->vid, $f->filepath, $f->filepath, $f->filemime);
 
   _audio_save_tags_to_db($node);
 }
@@ -519,11 +517,11 @@
   db_query("DELETE FROM {audio} WHERE vid=%d", $node->vid);
   db_query("DELETE FROM {audio_file} WHERE vid=%d", $node->vid);
   $i = $node->audio_fileinfo;
-  db_query("INSERT INTO {audio} (vid, nid, title_format, play_count, download_count, downloadable, fileformat, bitrate, bitrate_mode, sample_rate, channel_mode, playtime) VALUES (%d, %d, '%s', %d, %d, %d, '%s', %f, '%s', %d, '%s', '%s')",
-    $node->vid, $node->nid, $node->title_format, $i['play_count'], $i['download_count'], $i['downloadable'], $i['fileformat'], $i['bitrate'], $i['bitrate_mode'], $i['sample_rate'], $i['channel_mode'], $i['playtime']);
   $f = $node->audio_file;
-  db_query("INSERT INTO {audio_file} (vid, filename, filepath, filemime, filesize) VALUES (%d, '%s', '%s', '%s', %d)",
-    $node->vid, $f->filename, $f->filepath, $f->filemime, filesize($f->filepath));
+  db_query("INSERT INTO {audio} (vid, nid, title_format, play_count, download_count, downloadable, fileformat, filesize, bitrate, bitrate_mode, sample_rate, channel_mode, playtime) VALUES (%d, %d, '%s', %d, %d, %d, '%s', %d, %f, '%s', %d, '%s', '%s')",
+    $node->vid, $node->nid, $node->title_format, $i['play_count'], $i['download_count'], $i['downloadable'], $i['fileformat'], filesize($f->filepath), $i['bitrate'], $i['bitrate_mode'], $i['sample_rate'], $i['channel_mode'], $i['playtime']);
+  db_query("INSERT INTO {audio_file} (vid, filename, filepath, filemime) VALUES (%d, '%s', '%s', '%s')",
+    $node->vid, $f->filename, $f->filepath, $f->filemime);
 
   _audio_save_tags_to_db($node);
 }
@@ -1448,7 +1446,7 @@
       }
       $headers = array(
         'Content-Type: '. mime_header_encode($node->audio_file->filemime),
-        'Content-Length: '. $node->audio_file->filesize,
+        'Content-Length: '. $node->audio_fileinfo['filesize'],
         'Content-Disposition: attachment; filename='. $filename,
       );
       audio_file_transfer($node->audio_file->filepath, $headers);
@@ -1483,7 +1481,7 @@
         'Expires: 0',
         'Cache-Control: must-revalidate, post-check=0, pre-check=0, private',
         'Content-Type: '. mime_header_encode($node->audio_file->filemime),
-        'Content-Length: '. $node->audio_file->filesize,
+        'Content-Length: '. $node->audio_fileinfo['filesize'],
         'Content-Disposition: inline;',
         'Content-Transfer-Encoding: binary',
       );
@@ -1605,7 +1603,7 @@
     'downloadable' => variable_get('audio_default_downloadable', 1),
     'play_count' => 0,
     'download_count' => 0,
-    'filesize' => $node->audio_file->filesize,
+    'filesize' => filesize($filepath),
   );
 
   // Allow other modules to modify the node (hopefully reading in tags).
@@ -1686,13 +1684,13 @@
       }
     }
     // File info.
-    $keys = array('sample_rate', 'channel_mode', 'bitrate', 'bitrate_mode', 'playtime');
+    $keys = array('filesize', 'sample_rate', 'channel_mode', 'bitrate', 'bitrate_mode', 'playtime');
     foreach ($keys as $key) {
       if (isset($node->audio_fileinfo[$key])) {
         $tokens['audio-'. strtr($key, '_', '-')] = $node->audio_fileinfo[$key];
       }
     }
-    $keys = array('filename', 'filepath', 'filemime', 'filesize');
+    $keys = array('filename', 'filepath', 'filemime');
     foreach ($keys as $key) {
       if (isset($node->audio_file->$key)) {
         $tokens['audio-'. strtr($key, '_', '-')] = $node->audio_file->$key;
Index: views_audio.inc
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/audio/views_audio.inc,v
retrieving revision 1.9
diff -u -r1.9 views_audio.inc
--- views_audio.inc	23 Jul 2007 03:27:03 -0000	1.9
+++ views_audio.inc	27 Jul 2007 22:48:24 -0000
@@ -52,6 +52,12 @@
         'sortable' => FALSE,
         'help' => t('This will display a download link if the node allows it.'),
       ),
+      'filesize' => array(
+        'name' => t('Audio: File size'),
+        'handler' => 'views_handler_field_filesize',
+        'sortable' => TRUE,
+        'help' => t("This will display the audio file's size."),
+      ),
     ),
     'filters' => array(
       'downloadable' => array(
@@ -86,12 +92,6 @@
       )
     ),
     'fields' => array(
-      'filesize' => array(
-        'name' => t('Audio: File size'),
-        'handler' => 'views_handler_field_filesize',
-        'sortable' => TRUE,
-        'help' => t("This will display the audio file's size."),
-      ),
     ),
   );
 
