? 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.13
diff -u -r1.13 audio.install
--- audio.install	15 Feb 2007 16:37:47 -0000	1.13
+++ audio.install	27 Jul 2007 18:10:00 -0000
@@ -276,3 +276,21 @@
   }
   return array();
 }
+
+/**
+ * Drop the audio_file.origname field.
+ *
+ * This is the first update for the 5.2 branch, using the update naming
+ * convention described in: http://drupal.org/node/114774#update-n
+ */
+function audio_update_5200() {
+  $ret = array();
+  switch ($GLOBALS['db_type']) {
+    case 'mysql':
+    case 'mysqli':
+      $ret[] = update_sql("UPDATE {audio_file} SET filename = origname");
+      $ret[] = update_sql("ALTER TABLE {audio_file} DROP COLUMN `origname`");
+      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.111
diff -u -r1.111 audio.module
--- audio.module	23 Jul 2007 03:27:03 -0000	1.111
+++ audio.module	27 Jul 2007 18:12:41 -0000
@@ -412,7 +412,7 @@
     unset($ret['audio_fileinfo']['title_format']);
 
     // load the file
-    $result = db_query('SELECT origname, filename, filepath, filemime, filesize FROM {audio_file} f WHERE f.vid = %d', $node->vid);
+    $result = db_query('SELECT filename, filepath, filemime, filesize FROM {audio_file} f WHERE f.vid = %d', $node->vid);
     $ret['audio_file'] = $file = db_fetch_object($result);
     $ret['audio_fileinfo']['filesize'] = $file->filesize;
 
@@ -423,7 +423,7 @@
         // iTunes and other podcasting programs check the url to determine the
         // file type. we'll add the original file name on to the end. see issues
         // #35398 and #68716 for more info.
-        $url = 'audio/download/'. $node->nid .'/'. $file->origname;
+        $url = 'audio/download/'. $node->nid .'/'. $file->filename;
         $ret['url_download'] = url($url , NULL, NULL, TRUE);
       }
     }
@@ -448,9 +448,6 @@
 function audio_insert(&$node) {
   $directory = audio_get_directory();
 
-  // the original filename is preserved in the name field so we can avoid name
-  // collisions but restore the original name when they download it.
-  $node->audio_file->origname = $node->audio_file->filename;
   // unset the new file flag so we don't run into problems if the same node
   // object is saved
   unset($node->audio_file->newfile);
@@ -464,8 +461,8 @@
 
   // add the file record
   $f = $node->audio_file;
-  db_query("INSERT INTO {audio_file} (vid, origname, filename, filepath, filemime, filesize) VALUES (%d, '%s', '%s', '%s', '%s', %d)",
-    $node->vid, $f->origname, basename($f->filepath), $f->filepath, $f->filemime, filesize($f->filepath));
+  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));
 
   // add the audio record
   $i = $node->audio_fileinfo;
@@ -485,17 +482,13 @@
 
   // new file uploaded?
   if (isset($node->audio_file->newfile)) {
-    // the original filename is preserved in the name field so we can avoid name
-    // collisions but restore the original name when they download it.
-    $node->audio_file->origname = $node->audio_file->filename;
-
     // move the new file to the audio directory...
     // TODO: better error checking that the move worked...
     file_move($node->audio_file, $directory, FILE_EXISTS_RENAME);
   }
   else {
     // copy the existing file (use the original name)
-    $newname = file_create_filename($node->audio_file->origname, $directory);
+    $newname = file_create_filename($node->audio_file->filename, $directory);
     // TODO: better error checking that the copy worked...
     file_copy($node->audio_file, $newname);
   }
@@ -505,8 +498,8 @@
 
   // add the file record
   $f = $node->audio_file;
-  db_query("INSERT INTO {audio_file} (vid, origname, filename, filepath, filemime, filesize) VALUES (%d, '%s', '%s', '%s', '%s', %d)",
-    $node->vid, $f->origname, basename($f->filepath), $f->filepath, $f->filemime, filesize($f->filepath));
+  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));
 
   // add the audio record
   $i = $node->audio_fileinfo;
@@ -553,8 +546,8 @@
   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, origname, filename, filepath, filemime, filesize) VALUES (%d, '%s', '%s', '%s', '%s', %d)",
-    $node->vid, $f->origname, basename($f->filepath), $f->filepath, $f->filemime, filesize($f->filepath));
+  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));
 
   // add the tags records
   _audio_save_tags_to_db($node);
@@ -634,7 +627,6 @@
       file_check_directory($temppath, TRUE);
 
       $node->audio_file = file_save_upload($file, $temppath .'/'. $file->filename, FILE_EXISTS_REPLACE);
-      $node->audio_file->origname = $file->filename;
       $node->audio_file->newfile = TRUE;
 
       $node->audio_tags = array();
@@ -881,8 +873,7 @@
   if (!isset($node->title_format)) {
     $node->title_format = variable_get('audio_default_title_format', '!title by !artist');
   }
-  // use the original filname as the filename
-  $params['!filename'] = $node->audio_file->origname;
+  $params['!filename'] = $node->audio_file->filename;
   // make sure that all the allowed tags are included.
   foreach (audio_get_tags_allowed() as $tag) {
     $params['!'. $tag] = isset($node->audio_tags[$tag]) ? $node->audio_tags[$tag] : '';
@@ -1445,7 +1436,7 @@
       // The mime_header_encode function does not (yet) support
       // quoted-string encoding of ASCII strings with special
       // characters.  See discussion at http://drupal.org/node/82614
-      $filename = $node->audio_file->origname;
+      $filename = $node->audio_file->filename;
       // If the string contains non-ASCII characters, process it through
       // the mime_header_encode function.
       if (preg_match('/[^\x20-\x7E]/', $filename)) {
@@ -1687,7 +1678,7 @@
         $tokens['audio-'. strtr($key, '_', '-')] = $node->audio_fileinfo[$key];
       }
     }
-    $keys = array('origname', 'filename', 'filepath', 'filemime', 'filesize');
+    $keys = array('filename', 'filepath', 'filemime', 'filesize');
     foreach ($keys as $key) {
       if (isset($node->audio_file->$key)) {
         $tokens['audio-'. strtr($key, '_', '-')] = $node->audio_file->$key;
@@ -1728,8 +1719,7 @@
     $tokens['node']['audio-bitrate']      = t("Audio node bitrate, integer i.e. 19200.");
     $tokens['node']['audio-bitrate-mode'] = t("Audio node bitrate encoding mode, i.e vbr, cbr.");
     $tokens['node']['audio-playtime']     = t("Audio node play time, minutes:seconds.");
-    $tokens['node']['audio-origname']     = t("Audio node original, uploaded file name.");
-    $tokens['node']['audio-filename']     = t("Audio node file name.");
+    $tokens['node']['audio-filename']     = t("Audio node original, uploaded file name.");
     $tokens['node']['audio-filepath']     = t("Audio node file path.");
     $tokens['node']['audio-filemime']     = t("Audio node MIME type.");
     $tokens['node']['audio-filesize']     = t("Audio node file size, in bytes.");
