719 |
{ |
{ |
720 |
if ( $REFERRER =~ /^$ref/ ) |
if ( $REFERRER =~ /^$ref/ ) |
721 |
{ |
{ |
722 |
print "Referrer '$REFERRER' matches '$ref'\n"; |
$DEBUG && print "Referrer '$REFERRER' matches '$ref'\n"; |
723 |
} |
} |
724 |
else |
else |
725 |
{ |
{ |
1586 |
# |
# |
1587 |
if ( $down_enabled eq 0 ) |
if ( $down_enabled eq 0 ) |
1588 |
{ |
{ |
1589 |
print "Downsampling disabled for : $file\n"; |
$DEBUG && print "Downsampling disabled for : $file\n"; |
1590 |
&serveFile( $data, $file ); |
&serveFile( $data, $file ); |
1591 |
exit; |
exit; |
1592 |
} |
} |
1608 |
|
|
1609 |
if ( length( $default_quality ) ) |
if ( length( $default_quality ) ) |
1610 |
{ |
{ |
1611 |
print "Downsampling quality set to '$default_quality' per config\n"; |
$DEBUG && print "Downsampling quality set to '$default_quality' per config\n"; |
1612 |
} |
} |
1613 |
else |
else |
1614 |
{ |
{ |
1615 |
print "Downsample disabled, users quality level is unset, and no default quality.\n"; |
$DEBUG && print "Downsample disabled, users quality level is unset, and no default quality.\n"; |
1616 |
} |
} |
1617 |
} |
} |
1618 |
|
|
1639 |
my $cmd = &getConfig( $configKey, "" ); |
my $cmd = &getConfig( $configKey, "" ); |
1640 |
if ( not( length( $cmd ) ) ) |
if ( not( length( $cmd ) ) ) |
1641 |
{ |
{ |
1642 |
print "Downsample disabled we didnt find a command for filetype '$configKey'\n"; |
$DEBUG && print "Downsample disabled we didnt find a command for filetype '$configKey'\n"; |
1643 |
serveFile( $data, $file ); |
serveFile( $data, $file ); |
1644 |
exit; |
exit; |
1645 |
} |
} |
1658 |
# |
# |
1659 |
$cmd =~ s/\$FILENAME/$safeFile/g; |
$cmd =~ s/\$FILENAME/$safeFile/g; |
1660 |
|
|
1661 |
print "Downsampling - running: '$cmd' for '$file' at level '$quality'\n"; |
$DEBUG && print "Downsampling - running: '$cmd' for '$file' at level '$quality'\n"; |
1662 |
|
|
1663 |
# |
# |
1664 |
# Serve HTTP header for the downsampled file. |
# Serve HTTP header for the downsampled file. |
1666 |
my $mime = $mime_cache{ lc( &getSuffix( $file ) ) }; |
my $mime = $mime_cache{ lc( &getSuffix( $file ) ) }; |
1667 |
if ( ! defined ( $mime ) ) |
if ( ! defined ( $mime ) ) |
1668 |
{ |
{ |
1669 |
print "No mime type found for $file\n"; |
$DEBUG && print "No mime type found for $file\n"; |
1670 |
$mime = "text/html"; |
$mime = "text/html"; |
1671 |
} |
} |
1672 |
|
|
1731 |
# Seek if we're supposed to. |
# Seek if we're supposed to. |
1732 |
if ( length( $RANGE ) && ( $RANGE > 0 ) ) |
if ( length( $RANGE ) && ( $RANGE > 0 ) ) |
1733 |
{ |
{ |
1734 |
print "SKIPPING $RANGE bytes\n"; |
$DEBUG && print "SKIPPING $RANGE bytes\n"; |
1735 |
read(FILE, $buff, $RANGE); |
read(FILE, $buff, $RANGE); |
1736 |
$buff = ""; |
$buff = ""; |
1737 |
} |
} |
2092 |
} |
} |
2093 |
|
|
2094 |
push @DISPLAY, $dir . "/" . $file; |
push @DISPLAY, $dir . "/" . $file; |
2095 |
print "Kept $file\n"; |
$DEBUG && print "Kept $file\n"; |
2096 |
} |
} |
2097 |
|
|
2098 |
$totalFiles = $#DISPLAY + 1; |
$totalFiles = $#DISPLAY + 1; |
2392 |
my @ARRAY = ( ); |
my @ARRAY = ( ); |
2393 |
push @ARRAY, $file; |
push @ARRAY, $file; |
2394 |
|
|
|
print "$file ....\n"; |
|
2395 |
my %TAGS = $tagCache->formatMultipleSongTags( @ARRAY ); |
my %TAGS = $tagCache->formatMultipleSongTags( @ARRAY ); |
|
print $TAGS{$file} . "\n"; |
|
2396 |
return( $TAGS{ $file } ); |
return( $TAGS{ $file } ); |
2397 |
} |
} |
2398 |
# NOT REACHED |
# NOT REACHED |
2429 |
|
|
2430 |
if ( not -e $themeFile ) |
if ( not -e $themeFile ) |
2431 |
{ |
{ |
2432 |
print "The '$file' doesn't exist for the theme '$theme'\n"; |
$DEBUG && print "The '$file' doesn't exist for the theme '$theme'\n"; |
2433 |
exit; |
exit; |
2434 |
} |
} |
2435 |
|
|
2576 |
|
|
2577 |
$directory = $ROOT . "/" . $directory; |
$directory = $ROOT . "/" . $directory; |
2578 |
|
|
2579 |
print "Testing for directory: $directory\n"; |
$DEBUG && print "Testing for directory: $directory\n"; |
2580 |
|
|
2581 |
if ( -e $directory . "/.password" ) |
if ( -e $directory . "/.password" ) |
2582 |
{ |
{ |
2583 |
# |
# |
2584 |
print "Password file found\n"; |
$DEBUG && print "Password file found\n"; |
2585 |
if ( not length( $AUTHORIZATION ) ) |
if ( not length( $AUTHORIZATION ) ) |
2586 |
{ |
{ |
2587 |
# Send auth required header. |
# Send auth required header. |
2641 |
# |
# |
2642 |
# Record failed login attempts |
# Record failed login attempts |
2643 |
# |
# |
2644 |
print "Error : invalid login for user : $user\n"; |
$DEBUG && print "Error : invalid login for user : $user\n"; |
2645 |
|
|
2646 |
# |
# |
2647 |
# No match found |
# No match found |
2658 |
} |
} |
2659 |
else |
else |
2660 |
{ |
{ |
2661 |
print "No password file found.\n"; |
$DEBUG && print "No password file found.\n"; |
2662 |
} |
} |
2663 |
|
|
2664 |
# Redundent |
# Redundent |
2694 |
|
|
2695 |
if ( -e $plugin ) |
if ( -e $plugin ) |
2696 |
{ |
{ |
2697 |
print "Plugin '$plugin' exists. Reading it.\n"; |
$DEBUG && print "Plugin '$plugin' exists. Reading it.\n"; |
2698 |
|
|
2699 |
open( PLUGIN, "<$plugin" ) or warn "can't read: $!"; |
open( PLUGIN, "<$plugin" ) or warn "can't read: $!"; |
2700 |
my @PLUGIN = <PLUGIN>; |
my @PLUGIN = <PLUGIN>; |
2721 |
eval( $text ); |
eval( $text ); |
2722 |
if ( $@ ) |
if ( $@ ) |
2723 |
{ |
{ |
2724 |
print "Plugin load error $plugin : $@ "; |
$DEBUG && print "Plugin load error $plugin : $@ "; |
2725 |
} |
} |
2726 |
|
|
2727 |
# |
# |
2738 |
} |
} |
2739 |
else |
else |
2740 |
{ |
{ |
2741 |
print "Plugin '$plugin' not found\n"; |
$DEBUG && print "Plugin '$plugin' not found\n"; |
2742 |
} |
} |
2743 |
} |
} |
2744 |
|
|
2777 |
eval( $text ); |
eval( $text ); |
2778 |
if ( $@ ) |
if ( $@ ) |
2779 |
{ |
{ |
2780 |
print "Plugin load error $plugin : $@ "; |
$DEBUG && print "Plugin load error $plugin : $@ "; |
2781 |
} |
} |
2782 |
|
|
2783 |
# |
# |
2799 |
} |
} |
2800 |
else |
else |
2801 |
{ |
{ |
2802 |
print "Plugin '$plugin' not found\n"; |
$DEBUG && print "Plugin '$plugin' not found\n"; |
2803 |
} |
} |
2804 |
} |
} |
2805 |
|
|