August 2005
Beginner
464 pages
12h 36m
English
Use the speech synthesizer on the Macintosh to turn text RSS feeds into podcasts and import them into iTunes.
If you get addicted to podcasts, you will find yourself wishing that your regular feeds were podcasts. However, those feeds are in text. Short of getting someone to read them, how do you get them into audio? You can use a speech synthesizer that turns the text into speech.
It might not be the most pleasant way to listen to text, but if you are at the gym and you want to get the latest technology headlines, you can use a speech synthesizer to read the headlines into MP3 files for iTunes [Hack #4] .
Save this code as asmac.pl:
#!/usr/bin/perl -w
use LWP::Simple;
use FileHandle;
use Cwd;
use strict;
# The URL of the RSS feed
use constant URL => "http://www.mysite.com/myrss.xml";
# The artist name for the MP3s
use constant ARTIST => "Artist Name";
# The album name of the MP3s
use constant ALBUM => "Album Name";
# The output directory to put the MP3s into
use constant OUTPUT_DIR => "mp3s"; # Gets the feed and returns a hash of the RSS items, their titles # and the temporary filenames sub get_feed($) { my $out = {}; my $text = get URL; while( $text =~ /\<item(.*?)\<\/item\>/gs ) { my $item = $1; my ( $title ) = $item =~ /\<title\>(.*?)\<\/title\>/gs; my ( $desc ) = $item =~ /\<description\>(.*?)\<\/description\>/gs; $title =~ /[\n|\r]/g; $desc =~ s/[\n|\r]/ /g; $desc =~ s/$\<\!\[CDATA\[//; $desc =~ s/\]\]\>//; $desc =~ s/\<.*?\>//g; ...Read now
Unlock full access