3 # Makes an index.html file containing
4 # links to every file in the directory
6 # Modified by Abel `00z' Camarillo <00z@the00z.org> 2008/6/22
8 ##########################################################
9 # User configuration variables #
10 ##########################################################
12 $header = qq/Complete listing.../;
13 # Location of this (HACK.. need to find a way around this)
14 #$location = "/home/arkane/scripts/ls2html.pl";
16 # font size used on headers (titles such as "files available")
18 # Files that are analyzed have these extensions
19 #@files = <*.ogg *.OGG *.mp3 *.MP3>;
21 # default html file written in each directory analyzed
23 # Array used for list of subdirectories
26 ##########################################################
28 ##########################################################
30 foreach $listing (<*>) {
32 push(@directories, $listing);
33 print("Heading into $listing\n");
34 system("cd $listing && exec $location ");
39 # Open HTML file for writing
40 open(FILE
, ">$html") || die "Can't open file: $!\n";
44 print("<html>\n<head>\n");
45 #print("<title>Files Listed</title>\n");
46 print("<TITLE>" . `pwd` . "</TITLE>\n");
47 print("</head>\n<body>");
49 print("<TR>\n<TD ALIGN=\"center\" BGCOLOR=\"#330099\">\n");
50 print("<FONT SIZE=\"6\" COLOR=\"white\"><B>", $header, "</B></FONT><BR>\n");
51 print("</TD>\n</TR>\n");
52 print("<TR>\n<TD VALIGN=\"top\" BGCOLOR=\"#FFFFFF\">\n");
53 print("<FONT SIZE=\"$headerfontsize\"><B>Subdirectories Available</B></FONT><BR><BR>\n");
54 print("</TD></TR>\n");
58 print("<TR VALIGN=\"top\" BGCOLOR=\"#FFFFFF\">\n");
59 # setup counter for iteration of tables for subdirectory listing
61 foreach $subdirectory (@directories) {
64 print("<A HREF=\"$subdirectory\">$subdirectory</A><BR>\n");
67 print("</TR>\n<TR>\n");
75 print("<TR>\n<TD VALIGN=\"top\" BGCOLOR=\"#330099\" WIDTH=\"100%\">\n");
76 print("<BR>\n</TD>\n</TR>\n");
77 print("<TR>\n<TD VALIGN=\"top\" BGCOLOR=\"#FFFFFF\" WIDTH=\"100%\">\n");
78 print("<FONT SIZE=\"$headerfontsize\"><B>Files Available</B></FONT>\n");
79 print("</TD>\n</TR>\n");
84 # Iterate through files listed, href'ing each
89 print("<TD VALIGN=\"top\" BGCOLOR=\"#FFFFFF\">\n");
90 # Keeps the index.html being written from showing up
92 print("<a href=\"$temp1\">$temp1</a>\n");
94 # Work information out of OGG files with ogginfo
95 # displaying it below the file listing
97 @ogginfo = `ogginfo \"$temp1\"`;
98 @oggtitle = grep /title=/, @ogginfo;
99 @oggtitle[0] =~ s/title=//ig;
100 @oggartistname = grep(/artist=/, @ogginfo);
101 @oggartistname[0] =~ s/artist=//ig;
102 @oggaveragebitrate = grep(/Average bitrate/, @ogginfo);
103 @oggaveragebitrate[0] =~ s/Average bitrate://ig;
104 @oggplaybacklength = grep(/Playback length/, @ogginfo);
105 @oggplaybacklength[0] =~ s/Playback length//ig;
106 print("<br><font size=\"3\">Title: @oggtitle \n");
107 print("Artist Name: @oggartistname<br>\n");
108 print("Average Bitrate: @oggaveragebitrate \n");
109 print("Playback Length: @oggplaybacklength\n");
112 if( $countagain == 2 ) {
113 print("</TR>\n<TR>\n");
124 print("<BR><BR><BR><FONT SIZE=\"2\"><i>\n");
125 print("Automatically created with ls2html Perl Script<BR>\n");
126 print("Copyright(c) 2002 Norman Lund (dan_lund\@hotmail.com)... and modified"
127 . " by Abel `00z' Camarillo <00z\@the00z.org><BR>\n");
128 print("Script is distributed under the GNU Public License (GPL)\n");
129 print("</FONT></i>\n");
130 print("</body>\n</html>\n");
135 print("<TABLE CELLPADDING=\"2\" CELLSPACING=\"2\" BORDER=\"1\" WIDTH=\"$mywidth%\">\n");