? Copy (2) of audio.install
? Copy of audio.install_to_core
? ___audio.module___
? 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.info
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/audio/audio.info,v
retrieving revision 1.6
diff -u -r1.6 audio.info
--- audio.info	18 Jun 2007 22:53:31 -0000	1.6
+++ audio.info	30 Jul 2007 20:18:15 -0000
@@ -2,4 +2,4 @@
 name = Audio
 description = Allows you to upload and playback audio files.
 package = Audio
-dependencies = views views_rss
\ No newline at end of file
+dependencies = token views views_rss
\ No newline at end of file
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	30 Jul 2007 21:39:34 -0000
@@ -291,4 +291,46 @@
       break;
   }
   return $ret;
+}
+
+/**
+ * Use the token module for title and teasers.
+ */
+function audio_update_5201() {
+  $ret = array();
+
+  // Build an array of conversions. First the hard coded values...
+  $tokens = array(
+    '!filelength' => '[audio-file-length]',
+    '!fileformat' => '[audio-file-format]',
+    '!player' => '[audio-player]',
+    '!filename' => '[audio-filename]',
+  );
+  // ...then the tags.
+  foreach (audio_get_tags_allowed() as $tag) {
+    $tokens['!'. $tag] = '[audio-tag-'. strtr($tag, '_', '-') .']';
+  }
+
+  // Gather a list of all the different title formats and then replace them
+  // with the new token based equivalents.
+  $result = db_query('SELECT DISTINCT title_format FROM {audio}');
+  while ($o = db_fetch_object($result)) {
+    $new_value = strtr($o->title_format, $tokens);
+    db_query("UPDATE {audio} SET title_format = '%s' WHERE title_format = '%s'", $new_value, $o->title_format);
+  }
+
+  // Update the default title and teaser formats.
+  foreach (array('audio_default_title_format', 'audio_teaser_format') as $variable) {
+    if ($old_value = variable_get($variable, FALSE)) {
+      $new_value = strtr($old_value, $tokens);
+      variable_set($variable, $new_value);
+    }
+  }
+
+  // Let them know if they don't have token installed.
+  if (!module_exists('token')) {
+    drupal_set_message(t('The audio module requires that the <a href="http://drupal.org/project/token">token module</a> be installed. You should install it as soon as possible.'));
+  }
+
+  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.118
diff -u -r1.118 audio.module
--- audio.module	30 Jul 2007 19:45:38 -0000	1.118
+++ audio.module	30 Jul 2007 21:52:14 -0000
@@ -392,8 +392,11 @@
     form_set_error('audio_upload', t("A file must be provided. If you tried uploading a file, make sure it's less than the upload size limit."));
   }
 
-  // Build the title from metadata.
-  form_set_value($form['title'], audio_build_title($node));
+  // Build the title from metadata. If there's not title format use the default.
+  if (!isset($node->title_format)) {
+    $node->title_format = variable_get('audio_default_title_format', '[audio-tag-title] by [audio-tag-artist]');
+  }
+  form_set_value($form['title'], token_replace($node->title_format, 'node', $node));
 }
 
 /**
@@ -639,13 +642,22 @@
   $type = node_get_types('type', $node);
 
   if ($type->has_title) {
-    $form['title_format'] = array(
+    $form['title']['#weight'] = -5;
+    $form['title']['title_format'] = array(
       '#type' => 'textfield',
       '#title' => check_plain($type->title_label),
-      '#default_value' => isset($node->title_format) ? $node->title_format : variable_get('audio_default_title_format', '!title by !artist'),
-      '#description' => t("The title can use the file's metadata. Depending on what's filled out, you maybe able to use any of the following variables: " ) .'!filename !'. implode(' !', audio_get_tags_allowed()),
+      '#default_value' => isset($node->title_format) ? $node->title_format : variable_get('audio_default_title_format', '[audio-tag-title] by [audio-tag-artist]'),
+      '#description' => t("The title can use the file's metadata. You can use the tokens listed below to insert information into the title."),
       '#required' => TRUE,
-      '#weight' => -5,
+      
+    );
+    $form['title']['token_help'] = array(
+      '#title' => t('Token list'),
+      '#type' => 'fieldset',
+      '#collapsible' => TRUE,
+      '#collapsed' => TRUE,
+      '#description' => t('This is a list of the tokens that can be used in the title of audio nodes.'),
+      'help' => array('#value' => theme('token_help', 'node')),
     );
   }
 
@@ -835,31 +847,6 @@
 }
 
 /**
- * Build a title for the node.
- *
- * @param $node
- *   Node object with title_format and audio_tags values.
- * @return
- *   String with node's title.
- */
-function audio_build_title($node) {
-  // If there's not title format use the default.
-  if (!isset($node->title_format)) {
-    $node->title_format = variable_get('audio_default_title_format', '!title by !artist');
-  }
-
-  // Build a list of parameters.
-  $params = array(
-    '!filename' => $node->audio_file->filename,
-  );
-  foreach (audio_get_tags_allowed() as $tag) {
-    $params['!'. $tag] = isset($node->audio_tags[$tag]) ? $node->audio_tags[$tag] : '';
-  }
-
-  return t($node->title_format, $params);
-}
-
-/**
  * Implementation of hook_user().
  */
 function audio_user($op, &$edit, &$user, $category = NULL) {
@@ -917,15 +904,23 @@
     '#type' => 'textfield',
     '#title' => t('Default node title format'),
     '#maxlength' => 128,
-    '#default_value' => variable_get('audio_default_title_format', '!artist - !title'),
-    '#description' => t("The audio node's title can use the file's metadata as variables. This will be used as the default title for all new audio nodes. The following values can be used: ") .'!filename !'. implode(' !', audio_get_tags_allowed()),
+    '#default_value' => variable_get('audio_default_title_format', '[audio-tag-artist] - [audio-tag-title]'),
+    '#description' => t("The audio node's title can use the file's metadata as variables. This will be used as the default title for all new audio nodes. By using the tokens listed below, you can automatically create titles from things like a song's artist or title."),
   );
   $form['audio_teaser_format'] = array(
     '#type' => 'textfield',
     '#title' => t('Node teaser format'),
     '#maxlength' => 128,
-    '#default_value' => variable_get('audio_teaser_format', '!player<br />!filelength'),
-    '#description' => t("Specify a teaser format for all audio nodes. In addition to the tags allowed in the title, the following variables are also available: "). '!filelength !fileformat !player',
+    '#default_value' => variable_get('audio_teaser_format', '[audio-player]<br />[audio-file-length]'),
+    '#description' => t("Use this setting to customize the teasers for audio nodes. Using the tokens listed below you can select what information about the file will be displayed."),
+  );
+  $form['token_help'] = array(
+    '#title' => t('List of available tokens'),
+    '#type' => 'fieldset',
+    '#collapsible' => TRUE,
+    '#collapsed' => TRUE,
+    '#description' => t('This is a list of the tokens that can be used in the titles and teasers of audio nodes.'),
+    'help' => array('#value' => theme('token_help', 'node')),
   );
   $form['audio_allowed_extensions'] = array(
     '#type' => 'textfield',
@@ -1627,7 +1622,6 @@
   }
 
   // ...then save it.
-  $node->title = audio_build_title($node);
   $node = node_submit($node);
   node_save($node);
 
@@ -1692,10 +1686,15 @@
     // Tags.
     foreach (audio_get_tags_allowed() as $tag) {
       if (isset($node->audio_tags[$tag])) {
-        $tokens['audio-tag-'. $tag] = $node->audio_tags[$tag];
+        $tokens['audio-tag-'. strtr($tag, '_', '-')] = $node->audio_tags[$tag];
       }
     }
-    // File info.
+
+    // Formatted file info.
+    $tokens['audio-file-length'] = theme('audio_format_filelength', $node->audio_fileinfo);
+    $tokens['audio-file-format'] = theme('audio_format_fileformat', $node->audio_fileinfo);
+    
+    // Raw file info.
     $keys = array('sample_rate', 'channel_mode', 'bitrate', 'bitrate_mode', 'playtime');
     foreach ($keys as $key) {
       if (isset($node->audio_fileinfo[$key])) {
@@ -1711,11 +1710,13 @@
 
     // Play and download links.
     if (isset($node->url_play)) {
+      $tokens['audio-player'] = audio_get_node_player($node);
       $tokens['audio-url-play'] = $node->url_play;
     }
     if (isset($node->url_download)) {
       $tokens['audio-url-download'] = $node->url_download;
     }
+
     return $tokens;
   }
 }
@@ -1734,10 +1735,14 @@
   if ($type == 'node' || $type == 'all') {
     // Tags.
     foreach (audio_get_tags_allowed() as $tag) {
-      $tokens['node']['audio-tag-'. $tag] = t("Audio node @tag tag value.", array('@tag' => $tag));
+      $tokens['node']['audio-tag-'. strtr($tag, '_', '-')] = t("Audio node @tag tag value.", array('@tag' => $tag));
     }
 
-    // File info.
+    // Formatted file info.
+    $tokens['node']['audio-file-length']  = t("Audio node formatted file length information.");
+    $tokens['node']['audio-file-format']  = t("Audio node formatted file format information.");
+
+    // Raw file info.
     $tokens['node']['audio-sample-rate']  = t("Audio node sample rate, integer i.e. 44100.");
     $tokens['node']['audio-channel-mode'] = t("Audio node channels, i.e. mono, stereo.");
     $tokens['node']['audio-bitrate']      = t("Audio node bitrate, integer i.e. 19200.");
@@ -1749,6 +1754,7 @@
     $tokens['node']['audio-filesize']     = t("Audio node file size, in bytes.");
 
     // Play and download links.
+    $tokens['node']['audio-player']       = t("Audio node player.");
     $tokens['node']['audio-url-play']     = t("Audio node play URL.");
     $tokens['node']['audio-url-download'] = t("Audio node download URL.");
     return $tokens;
Index: audio_theme.inc
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/audio/audio_theme.inc,v
retrieving revision 1.6
diff -u -r1.6 audio_theme.inc
--- audio_theme.inc	30 Jul 2007 18:36:40 -0000	1.6
+++ audio_theme.inc	30 Jul 2007 21:20:59 -0000
@@ -5,19 +5,8 @@
  * Format the teaser for an audio node.
  */
 function theme_audio_teaser($node){
-  // make sure that all the allowed tags are included.
-  foreach (audio_get_tags_allowed() as $tag) {
-    $params['!'. $tag] = isset($node->audio_tags[$tag]) ? check_plain($node->audio_tags[$tag]) : '';
-  }
-  $params['!filelength'] = theme('audio_format_filelength', $node->audio_fileinfo);
-  $params['!fileformat'] = theme('audio_format_fileformat', $node->audio_fileinfo);
-  $params['!player'] = audio_get_node_player($node);
-  $params['!play_count'] = check_plain($node->audio_fileinfo['play_count']);
-  $params['!download_count'] = check_plain($node->audio_fileinfo['download_count']);
-
-  $format = variable_get('audio_teaser_format', '!player<br />!filelength');
-
-  return t($format, $params);
+  $format = variable_get('audio_teaser_format', '[audio-player]<br />[audio-file-length]');
+  return token_replace($format, 'node', $node);
 }
 
 /**
Index: contrib/attach/audio_attach.module
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/audio/contrib/attach/audio_attach.module,v
retrieving revision 1.5
diff -u -r1.5 audio_attach.module
--- contrib/attach/audio_attach.module	30 May 2007 19:46:09 -0000	1.5
+++ contrib/attach/audio_attach.module	30 Jul 2007 21:53:31 -0000
@@ -107,7 +107,7 @@
         $form['audio_attach']['audio_title'] = array(
           '#type' => 'textfield', 
           '#title' => t('Title'),
-          '#default_value' => variable_get('audio_default_title_format', '!title by !artist')
+          '#default_value' => variable_get('audio_default_title_format', '[audio-tag-title] by [audio-tag-artist]')
         );
         $form['audio_attach']['audio_publish'] = array(
           '#type' => 'checkbox', 
