Created
December 10, 2013 08:34
-
-
Save anonymous/7887403 to your computer and use it in GitHub Desktop.
URL rewriter to work around XBMC's mirror being down
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/perl | |
# Place this file somewhere that Squid can find it, and change access | |
# so that Squid can read and execute it. | |
# Include the following line in squid.conf, and un-comment it there: | |
#url_rewrite_program /etc/squid/rewrite.pl | |
# Restart Squid, and in your XBMC's Settings/Internet Settings give your | |
# squid server's name and port as the proxy to use. | |
# Change this line to your preferred mirror. It replaces mirrors.xbmc.org in the URL. | |
$mirror = "www.mirrorservice.org/sites/mirrors.xbmc.org"; | |
$| = 1; | |
while (<>) { | |
@line = split; | |
$_ = $line[0]; | |
if (m/^http:\/\/(mirrors\.xbmc\.org)\/(.*)/) { | |
print "http://" . $mirror . "/" . $2 . "\n"; | |
} else { | |
print $_ . "\n"; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment