#!/usr/bin/perl # # Makes an index.html file containing # links to every file in the directory # Location of this (HACK.. need to find a way around this) #$location = "/home/arkane/scripts/ls2html.pl"; $location = $0; # font size used on headers (titles such as "files available") $headerfontsize = 4; # Files that are analyzed have these extensions @files = <*.*>; # default html file written in each directory analyzed $html = "index.html"; # Array used for list of subdirectories @directories; foreach $listing (<*>) { if(-d $listing) { push(@directories, $listing); print("Heading into $listing\n"); system("cd $listing && exec $location "); } } # Open HTML file for writing open(FILE, ">$html") || die "Can't open file: $!\n"; select(FILE); # Start HTML file print("\n\n"); print("Simon Plouffe documents\n"); #print("" . `pwd` . "\n"); print("\n"); open_table("100"); print("\n\n"); print("Complete Listing
\n"); print("\n\n"); print("\n\n"); print("Subdirectories Available

\n"); print("\n"); print("\n"); print("\n"); open_table("100"); print("\n"); # setup counter for iteration of tables for subdirectory listing $count = 0; foreach $subdirectory (@directories) { $count++; print("\n"); print("$subdirectory
\n"); print("\n"); if($count == 3) { print("\n\n"); $count = 0; } } print("\n"); print("\n"); print("\n"); open_table("100"); print("\n\n"); print("
\n\n\n"); print("\n\n"); print("Files Available\n"); print("\n\n"); print("\n"); print("\n"); open_table("100"); print("\n"); # Iterate through files listed, href'ing each $countagain = 0; foreach (@files) { $temp1 = $_; $countagain++; print("\n"); # Keeps the index.html being written from showing up if(!/index.html/) { print("$temp1\n"); } # Work information out of OGG files with ogginfo # displaying it below the file listing if(/.ogg/i) { @ogginfo = `ogginfo \"$temp1\"`; @oggtitle = grep /title=/, @ogginfo; @oggtitle[0] =~ s/title=//ig; @oggartistname = grep(/artist=/, @ogginfo); @oggartistname[0] =~ s/artist=//ig; @oggaveragebitrate = grep(/Average bitrate/, @ogginfo); @oggaveragebitrate[0] =~ s/Average bitrate://ig; @oggplaybacklength = grep(/Playback length/, @ogginfo); @oggplaybacklength[0] =~ s/Playback length//ig; print("
Title: @oggtitle     \n"); print("Artist Name: @oggartistname
\n"); print("Average Bitrate: @oggaveragebitrate     \n"); print("Playback Length: @oggplaybacklength\n"); } print("\n"); if( $countagain == 2 ) { print("\n\n"); $countagain = 0; } } print("\n"); print("\n"); print(""); credits(); close(FILE); sub credits { print("


\n"); print("Automatically created with ls2html Perl Script
\n"); print(" ...and modified by Simon Plouffe\n"); print("Script is distributed under the GNU Public License (GPL)\n"); print("
\n"); print("\n\n"); } sub open_table { my($mywidth) = @_; print("\n"); print("\n"); }