Index: audio.module
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/audio/audio.module,v
retrieving revision 1.107
diff -u -r1.107 audio.module
--- audio.module	13 Jun 2007 22:38:50 -0000	1.107
+++ audio.module	20 Jul 2007 14:37:57 -0000
@@ -1651,3 +1651,85 @@
   }
 }
 
+
+
+/**
+ * Implementation of the token.module's hook_token_values().
+ *
+ * @param $type
+ *   The current context -- 'node', 'user', 'global', etc.
+ * @param $object
+ *   The specific node, user, etc. that should be used as the basis for the 
+ *   replacements.
+ * @return
+ *   Array of tokens.
+ */
+function audio_token_values($type, $object = NULL) {
+  $node = $object;
+  if ($type == 'node' && $node->type = 'audio') {
+    // Tags.
+    foreach (audio_get_tags_allowed() as $tag) {
+      if (isset($node->audio_tags[$tag])) {
+        $tokens['audio-tag-'. $tag] = $node->audio_tags[$tag];
+      }
+    }
+    // File info.
+    $keys = array('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('origname', 'filename', 'filepath', 'filemime', 'filesize');
+    foreach ($keys as $key) {
+      if (isset($node->audio_file->$key)) {
+        $tokens['audio-'. strtr($key, '_', '-')] = $node->audio_file->$key;
+      }
+    }
+
+    // Play and download links.
+    if (isset($node->url_play)) {
+      $tokens['audio-url-play'] = $node->url_play;
+    }
+    if (isset($node->url_download)) {
+      $tokens['audio-url-download'] = $node->url_download;
+    }
+    return $tokens;
+  }
+}
+
+/**
+ * Implementation of the token.module's hook_token_values().
+ *
+ * @param $type
+ *   Tndicates the context that token help is being generated for. Unlike 
+ *   hook_token_values however, you should show ALL tokens at the same time if 
+ *   $type is 'all'.
+ * @return
+ *   Array of token information.
+ */
+function audio_token_list($type = 'all') {
+  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));
+    }
+
+    // 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.");
+    $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-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.");
+
+    // Play and download links.
+    $tokens['node']['audio-url-play']     = t("Audio node play URL.");
+    $tokens['node']['audio-url-download'] = t("Audio node download URL.");
+    return $tokens;
+  }
+}
\ No newline at end of file
