Ticket #2660: patch

File patch, 1.9 KB (added by Rich.West@…, 14 years ago)

Patch file

  • handler.pl

    old new  
    77# @author    $Author: xris $
    88#
    99
     10##
     11# Create the small .asx file based upon the information that we have for
     12# this particular piece of media.  .ASX files are pretty simplistic and are
     13# truly made for this purpose.
     14#
     15# The benefit is that the client has the ability to view/play the downloaded
     16# content as it is being downloaded, rather than waiting until the completion
     17# of the entire download.
     18#
     19# While it was geared towards Windows, it was discovered that Linux clients
     20# understand .asx files and can act upon them in the same way.
     21##
     22sub generate_asx
     23{
     24   my ($title, $subtitle, $filename) = @_;
     25   my ($file) = "";
     26
     27   $file = "<ASX version = \"3.0\">
     28<TITLE>$title</TITLE>
     29    <ENTRY>
     30    <TITLE>$title - $subtitle</TITLE>
     31    <AUTHOR>MythTV - MythWeb</AUTHOR>
     32    <COPYRIGHT>GPL</COPYRIGHT>
     33        <REF HREF =
     34\"http://" . $ENV{'HTTP_HOST'} . "/mythweb/" . $filename . "\" />
     35    </ENTRY>
     36</ASX>\n";
     37   return ($file)
     38}
     39
     40#
     41# Here we simply send the small asx file to the client and exit quietly.
     42#
     43sub send_asx
     44{
     45   my ($title, $subtitle, $filename) = @_;
     46   my ($file) = &generate_asx($title, $subtitle, $filename);
     47   print header(-type                => 'text/html',
     48                -Content_length      => length($file),
     49                -Content_disposition => " attachment; filename=\"$title.asx\"",
     50                );
     51   print $file;
     52   exit;
     53}
     54
     55
     56
    1057# Necessary constants for sysopen
    1158    use Fcntl;
    1259
     
    4592        exit;
    4693    }
    4794
     95&send_asx($title, $subtitle, $filename);
     96
     97#-#-#-##-#-#-##-#-#-##-#-#-##-#-#-##-#-#-##-#-#-##-#-#-##-#-#-##-#-#-#
     98#-#-#-##   We don't utilize any of the code past this point.  ##-#-#-#
     99#-#-#-##-#-#-##-#-#-##-#-#-##-#-#-##-#-#-##-#-#-##-#-#-##-#-#-##-#-#-#
     100
    48101# File size
    49102    my $size = -s $filename;
    50103