![]() |
|
|
google unix.com
|
|||||||
| Forums | Register | Forum Rules | Links | Albums | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
| Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts and shell scripting languages here. |
More UNIX and Linux Forum Topics You Might Find Helpful
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Erwin Data Structures 2.1.79937 (Default branch) | iBot | Software Releases - RSS News | 0 | 04-22-2008 04:30 PM |
| Sux data structures 1.0.1 (Default branch) | iBot | Software Releases - RSS News | 0 | 04-14-2008 02:40 AM |
| Sux data structures 1.0 (Default branch) | iBot | Software Releases - RSS News | 0 | 04-07-2008 01:20 AM |
| Building a Hybrid Data Warehouse Model | iBot | Oracle Updates (RSS) | 0 | 04-06-2008 06:10 AM |
| Sux data structures 0.3 (Default branch) | iBot | Software Releases - RSS News | 0 | 02-21-2008 03:20 PM |
![]() |
|
|
LinkBack | Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
||||
|
building perl data structures on the fly
Objective: at the moment build a logical data structure to hold the GENRE, ARTIST-ALBUM,SONG TITILES. PURPOSE: to catalog my own MP3 collection. for view on the web. END RESULT: it will go on a CGI webpage and people can search by GENRE or artist name/album. I was thinking about useing a 3 dementional array. but then i was also thinking about an array with hash referances to an array. i am unsure. anyways, any help with building a logical data structure on the fly would be much appricated. Code:
SCRIPT:
#!/usr/bin/perl -w
$FFILE = "testlist.txt";
open SONG, $FFILE or die "NO GO ($!)";
foreach (<SONG>) {
chomp;
push(@holdit, $_) if $_ =~ /Directory of/ || $_ =~ /\.mp3/;
};
$count=0;
DIR: foreach (@holdit) {
$count++;
if (($_ =~ /\w*\s\w*\s\w:\\\w*\\\w*\\(\w*\s?\w*)\\(.*)/) && ($holdit[$count] !~ /Directory of/)){
print "\nGENRE:$1 TITLE: $2\n";
}
elsif ($_ =~ /mp3/) {
$SONG=substr($_,39);
print "SONG:$SONG\n";
}
}
Code:
SAMPLE OUTPUT: GENRE:Rock TITLE: Pink Floyd - Delicate Sound of Thunder\Disc 1 SONG:01 - Shine on You Crazy Diamond.mp3 SONG:02 - Learning to Fly.mp3 SONG:03 - Yet Another Movie.mp3 SONG:04 - Round and Around.mp3 SONG:05 - Sorrow.mp3 SONG:06 - The Dogs of War.mp3 SONG:07 - On the Turning Away.mp3 GENRE:Rock TITLE: Pink Floyd - Delicate Sound of Thunder\Disc 2 SONG:01 - One Of These Days.mp3 SONG:02 - Time.mp3 SONG:03 - Wish You Were Here.mp3 SONG:04 - Us And Them.mp3 SONG:05 - Money.mp3 SONG:06 - Another Brick In The Wall, Part Ii.mp3 SONG:07 - Comfortably Numb.mp3 SONG:08 - Run Like Hell.mp3 GENRE:MY GROUP TITLE: MY ARTIST - MY ALBUM SONG:02 - MY SONG.mp3 |
|
||||
|
Quote:
auswipe: thanks for the snipit. i will deffinetly be looking into it. |
![]() |
| Bookmarks |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|