rendered paste body#!/usr/bin/perl
# Britsh TV
# THE REVIVAL!
use strict;
use warnings;
use LWP::Simple qw(!head);
# while(1) {
#something tells me this isn't right
#please don't laugh
undef(my($progid));
undef(my($chanid));
undef(my($station_raw));
undef(my($params));
system $^O eq 'MSWin32' ? 'cls' : 'clear';
# print "CHANNEL NUMBERS ARE BROKEN! TYPE IN 'tangytest' INSTEAD!\n";
print "1. BBC One 23. Discovery Channel\n";
print "2. BBC Two 24. National Geographic\n";
print "3. ITV 1 25. Animal Planet\n";
print "4. Channel 4 26. Travel Channel\n";
print "5. Five 27. 4Music\n";
print "6. BBC Three / CBBC 28. Chart Show\n";
print "7. BBC Four / CBeebies 29. Scuzz\n";
print "8. ITV 2 30. Flava\n";
print "9. ITV 3 31. Dance Nation\n";
print "10. ITV 4 32. TMF Dance\n";
print "11. CITV 33. The Vault\n";
print "12. E4 34. Eurosport\n";
print "13. More4 35. Eurosport 2\n";
print "14. Film4 36. BBC News\n";
print "15. True Movies 37. BBC World News\n";
print "16. Movies4Men 38. BBC Parliament\n";
print "17. HBO 39. Euronews\n";
print "18. Horror Channel 40. Sky News\n";
print "19. Zone Reality 41. Bloomberg\n";
print "20. Sci Fi 42. France 24\n";
print "21. Universal Channel 43. Al Jazeera\n";
print "22. CBS Reality 44. QVC\n\n";
print "Which channel would you like to watch? ";
my $chan = <>;
if (($chan eq 1) || ($chan eq "BBC1")) {
my $chanid = 2627;
my $progid = 19838;
}
if ($chan == 2) {
my $chanid = 2628;
my $progid = 19839;
}
if ($chan == 3) {
my $station_filmon = "42";
my $params = "--crop=16:10 --aspect-ratio=16:9";
}
if ($progid) {
my $content = get("http://www.verytangytv.com/playerFiles/checkAuth.php?macAddr=1031600&serialNo=9511&swVersion=n/a&unitType=Windows%2095%20or%20above&epgVersion=2.11.00&epgType=live&userName=1031600&userPin=9511&userId=undefined&epgVer=2.11.00&tvRandom=35946978");
die "Couldn't get the auth code!" unless defined $content;
# if($content1 =~ m/(<split>5<split>)(.*)("<split>")/){
# $auth = "$2";
# }
#print "$content\n\n";
# if ($content =~ m/(login ok)(.*)(0)/){
# $xml = "$2";
# }
my @array = split('<split>', $content);
my $auth = $array[6];
# die;
my $content2 = get("http://www.verytangytv.com/playerFiles/getSelection.php?type=ondemand&action=view&channelId=$chanid&programmeId=$progid&userPin=9511&langSet=0&subId=0&protocol=mms://&userId=13046&userMac=1031600&userSerial=9511&portal=5&userAuthToken=$auth&epgType=live&web&userId=13046&epgVer=2.11.00&tvRandom=66502370");
die "Couldn't get the URL!" unless defined $content2;
#print $content2;
#die;
# if($content2 =~ m/(<EPGLISTBREAK>)(.*)(<EPGLISTBREAK>)/){
# $station_raw = "$2";
# }
my @array2 = split('<EPGLISTBREAK>', $content2);
my $station_raw = $array2[1];
#print $station_raw;
#die;
}
my $windrive = $ENV{'HOMEDRIVE'};
if (-e "$windrive\\progra~1\\videolan\\vlc\\vlc.exe") {
my $vlcpath = "$windrive\\progra~1\\videolan\\vlc\\vlc.exe";
}
if (-e "$windrive\\progra~2\\videolan\\vlc\\vlc.exe") {
my $vlcpath = "$windrive\\progra~2\\videolan\\vlc\\vlc.exe";
}
if (-e "$windrive\\archiv~1\\videolan\\vlc\\vlc.exe") {
my $vlcpath = "$windrive\\archiv~1\\videolan\\vlc\\vlc.exe";
}
if (-e "$windrive\\archiv~2\\videolan\\vlc\\vlc.exe") {
my $vlcpath = "$windrive\\archiv~2\\videolan\\vlc\\vlc.exe";
}
if (-e '/usr/bin/vlc') {
my $vlcpath = "/usr/bin/vlc";
}
if (-e '/usr/local/bin/vlc') {
my $vlcpath = "/usr/local/bin/vlc";
}
if (-e '/Applications/VLC.app/Contents/MacOS/VLC') {
my $vlcpath = "/Applications/VLC.app/Contents/MacOS/VLC";
}
die "VLC not found" unless defined my($vlcpath);
die "No URL to play!" unless defined $station_raw;
my @output = `$vlcpath -v0 --quiet $params $station_raw`;
# }