| | 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 | ## |
| | 22 | sub 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 | # |
| | 43 | sub 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 | |