Sealyu

--- 博客已迁移至: http://www.sealyu.com/blog

  BlogJava :: 首页 :: 新随笔 :: 联系 :: 聚合  :: 管理 ::
  618 随笔 :: 87 文章 :: 225 评论 :: 0 Trackbacks
Mon, 09/18/2006 - 3:03pm — ches

Updated for Drupal 5.1! See the bottom of the article.

I have a growing backlog of stories that I've been meaning to type up here, including several articles of interest for folks getting started with drupal, but I've just finished setting up the audio module, so I thought I'd share my experience while it's fresh on the mind.

You'll notice that you can now play the "two out of three" mp3 from my last post direct from the site without the need to download, and this is thanks to the audio module. Since it utilizes drupal's node model for content types, this module is able to harness much of the power and flexibility inherent in the CMS, including the taxonomy system and automatic RSS/podcast feed generation. It can also be readily extended through modules like the playlist toolkit for sites with sophisticated audio needs.

My intent here, though, is just to offer a quick step-by-step guide for a simpler application: a blog or some other site seeking to include audio files attached to other content types (pages and stories, for instance). Still, this should be helpful for anyone getting started with the audio module.

Installation and Configuration

  1. Let's obtain the audio module from the project page. I'm using version 4.7.0 for this guide. Untar the file in your site's modules directory.

    > tar xzvf audio-4.7.0.tar.gz

  2. Next we need to download the getid3 PHP libraries and unzip the downloaded file into the same directory as audio.module.

    > unzip getid3-1.7.7.zip -d <yoursitepath>/modules/audio/

    Version 1.7.7 of getid3 is recommended in the audio module's documentation.

  3. Open the site in your browser and go to administer >> modules. Enable the audio, audio_attach and audio_getid3 modules. I don't need to add audio files in bulk or use cover art, so I don't use audio_import or audio_images. Configuration for those modules is not covered here.
  4. I don't want audio entries in my navigation menu, so I disabled "audio" and "browse by" at administer >> menus. You can optionally enable audio-related blocks at, you guessed it, administer >> blocks.
  5. You'll need to set user privelages according to your needs: at administer >> access control I gave my blog user "create audio" and "edit own audio" permissions in addition to the defaults.
  6. In order to attach audio nodes to other content types, we need to enable this capability for each type at administer >> settings >> content types. I first configured audio, disabling Attach Images and Attachments since I have the image_attach and upload modules enabled. I also disabled comments and promotion to front page. Then, enable Attach audio files for the content types that suit your needs. I did so for story. You might do the same for page, CCK types or others.
  7. Finally, check your settings at administer >> settings >> audio. Typical PHP configurations will default to a 2MB upload limit -- you'll probably need to adjust your php.ini as suggested if you haven't already done so. Disable Downloadable by default if you want to make it more difficult for users to save copies of your music. Check that settings on the metadata tags tab are to your liking, and check the getid3 tab to assure that your installation is detected correctly.
  8. That's it! You should now be able to create a new node -- of a type set up in step six -- with the option to attach an audio file. This will create an audio node behind the scenes, which you can browse (and edit id3 tags for) at yoursite.com/audio. If you don't want this behavior, uncheck Published when attaching the audio file to your node.

Taking it Further

Of course, if audio plays a more prominent role at your site, there's much more that you can do with the audio module, incorporating taxonomy, changing the look of the player, and so on. Here are some links to get you started.

Update for Drupal 5.1

For the most part, updating my audio module for use as outlined above was intuitive, with one exception: the audio_attach module has just been contributed to CVS for 5.x by zirafa. He's also contributed a new audio_playlist module, but I haven't tried that out yet. To get audio_attach (and get my existing nodes with attached audio back to working order), I checked out the audio module from CVS with the following commands:

> cd <yoursitepath>/modules
> cvs -z6 -d:pserver:anonymous:anonymous@cvs.drupal.org:/cvs/drupal-contrib checkout -d audio contributions/modules/audio

I installed the modules as normal and ran update.php. At this point I received an SQL error as the script attempted to set multiple primary keys for the audio_attach table. I manually set nid, aid and weight as primary keys using phpMyAdmin, and I was back in business. I've found that my Flash players are not visible when using the handy admin_menu module, but that probably shouldn't effect many of your users.

I'll try to update all of these instructions soon. In the meantime, comment if you have questions!

posted on 2010-08-19 12:01 seal 阅读(318) 评论(0)  编辑  收藏 所属分类: PHP

只有注册用户登录后才能发表评论。


网站导航: