From: Steven Black Date: Sat, 10 Dec 2016 01:59:43 +0000 (-0500) Subject: Change update.info files to update.json, update the python generators, and docs. X-Git-Url: http://git.99rst.org/?a=commitdiff_plain;h=a6fcff9f22432b208df5048c29eaa1be10e1e0d2;p=stevenblack-hosts.git Change update.info files to update.json, update the python generators, and docs. --- diff --git a/data/KADhosts/update.info b/data/KADhosts/update.info deleted file mode 100644 index 41b54a666..000000000 --- a/data/KADhosts/update.info +++ /dev/null @@ -1 +0,0 @@ -https://raw.githubusercontent.com/azet12/KADhosts/master/KADhosts.txt diff --git a/data/KADhosts/update.json b/data/KADhosts/update.json new file mode 100644 index 000000000..88790d2d9 --- /dev/null +++ b/data/KADhosts/update.json @@ -0,0 +1,3 @@ +{ + "url": "https://raw.githubusercontent.com/azet12/KADhosts/master/KADhosts.txt" +} diff --git a/data/SpotifyAds/update.info b/data/SpotifyAds/update.info deleted file mode 100644 index f5cae8ec1..000000000 --- a/data/SpotifyAds/update.info +++ /dev/null @@ -1 +0,0 @@ -https://raw.githubusercontent.com/FadeMind/hosts.extras/master/SpotifyAds/hosts \ No newline at end of file diff --git a/data/SpotifyAds/update.json b/data/SpotifyAds/update.json new file mode 100644 index 000000000..d4391c326 --- /dev/null +++ b/data/SpotifyAds/update.json @@ -0,0 +1,3 @@ +{ + "url": "https://raw.githubusercontent.com/FadeMind/hosts.extras/master/SpotifyAds/hosts" +} diff --git a/data/StevenBlack/update.info b/data/StevenBlack/update.info deleted file mode 100644 index 6d568b049..000000000 --- a/data/StevenBlack/update.info +++ /dev/null @@ -1 +0,0 @@ -https://raw.githubusercontent.com/StevenBlack/hosts/master/data/StevenBlack/hosts diff --git a/data/StevenBlack/update.json b/data/StevenBlack/update.json new file mode 100644 index 000000000..9b240a051 --- /dev/null +++ b/data/StevenBlack/update.json @@ -0,0 +1,3 @@ +{ + "url": "https://raw.githubusercontent.com/StevenBlack/hosts/master/data/StevenBlack/hosts" +} diff --git a/data/Telemetry/update.info b/data/Telemetry/update.info deleted file mode 100644 index 91f55536b..000000000 --- a/data/Telemetry/update.info +++ /dev/null @@ -1 +0,0 @@ -https://raw.githubusercontent.com/FadeMind/hosts.extras/master/Telemetry/hosts diff --git a/data/Telemetry/update.json b/data/Telemetry/update.json new file mode 100644 index 000000000..674dd8b93 --- /dev/null +++ b/data/Telemetry/update.json @@ -0,0 +1,3 @@ +{ + "url": "https://raw.githubusercontent.com/FadeMind/hosts.extras/master/Telemetry/hosts" +} diff --git a/data/UncheckyAds/update.info b/data/UncheckyAds/update.info deleted file mode 100644 index 0e8bd8f52..000000000 --- a/data/UncheckyAds/update.info +++ /dev/null @@ -1 +0,0 @@ -https://raw.githubusercontent.com/FadeMind/hosts.extras/master/UncheckyAds/hosts diff --git a/data/UncheckyAds/update.json b/data/UncheckyAds/update.json new file mode 100644 index 000000000..a5b776e2c --- /dev/null +++ b/data/UncheckyAds/update.json @@ -0,0 +1,3 @@ +{ + "url": "https://raw.githubusercontent.com/FadeMind/hosts.extras/master/UncheckyAds/hosts" +} diff --git a/data/adaway.org/update.info b/data/adaway.org/update.info deleted file mode 100644 index d1a4848c9..000000000 --- a/data/adaway.org/update.info +++ /dev/null @@ -1 +0,0 @@ -https://raw.githubusercontent.com/AdAway/adaway.github.io/master/hosts.txt diff --git a/data/adaway.org/update.json b/data/adaway.org/update.json new file mode 100644 index 000000000..4ee478a7d --- /dev/null +++ b/data/adaway.org/update.json @@ -0,0 +1,3 @@ +{ + "url": "https://raw.githubusercontent.com/AdAway/adaway.github.io/master/hosts.txt" +} diff --git a/data/add.2o7Net/update.info b/data/add.2o7Net/update.info deleted file mode 100644 index 82e94d254..000000000 --- a/data/add.2o7Net/update.info +++ /dev/null @@ -1 +0,0 @@ -https://raw.githubusercontent.com/FadeMind/hosts.extras/master/add.2o7Net/hosts diff --git a/data/add.2o7Net/update.json b/data/add.2o7Net/update.json new file mode 100644 index 000000000..c1c13f7db --- /dev/null +++ b/data/add.2o7Net/update.json @@ -0,0 +1,3 @@ +{ + "url": "https://raw.githubusercontent.com/FadeMind/hosts.extras/master/add.2o7Net/hosts" +} diff --git a/data/add.Dead/update.info b/data/add.Dead/update.info deleted file mode 100644 index 9c4fafc33..000000000 --- a/data/add.Dead/update.info +++ /dev/null @@ -1 +0,0 @@ -https://raw.githubusercontent.com/FadeMind/hosts.extras/master/add.Dead/hosts diff --git a/data/add.Dead/update.json b/data/add.Dead/update.json new file mode 100644 index 000000000..441f2a426 --- /dev/null +++ b/data/add.Dead/update.json @@ -0,0 +1,3 @@ +{ + "url": "https://raw.githubusercontent.com/FadeMind/hosts.extras/master/add.Dead/hosts" +} diff --git a/data/add.Risk/update.info b/data/add.Risk/update.info deleted file mode 100644 index a54db4b95..000000000 --- a/data/add.Risk/update.info +++ /dev/null @@ -1 +0,0 @@ -https://raw.githubusercontent.com/FadeMind/hosts.extras/master/add.Risk/hosts diff --git a/data/add.Risk/update.json b/data/add.Risk/update.json new file mode 100644 index 000000000..ac75bf4f7 --- /dev/null +++ b/data/add.Risk/update.json @@ -0,0 +1,3 @@ +{ + "url": "https://raw.githubusercontent.com/FadeMind/hosts.extras/master/add.Risk/hosts" +} diff --git a/data/add.Spam/update.info b/data/add.Spam/update.info deleted file mode 100644 index 0d2524742..000000000 --- a/data/add.Spam/update.info +++ /dev/null @@ -1 +0,0 @@ -https://raw.githubusercontent.com/FadeMind/hosts.extras/master/add.Spam/hosts diff --git a/data/add.Spam/update.json b/data/add.Spam/update.json new file mode 100644 index 000000000..2a738df36 --- /dev/null +++ b/data/add.Spam/update.json @@ -0,0 +1,3 @@ +{ + "url": "https://raw.githubusercontent.com/FadeMind/hosts.extras/master/add.Spam/hosts" +} diff --git a/data/malwaredomainlist.com/update.info b/data/malwaredomainlist.com/update.info deleted file mode 100644 index c612bfb17..000000000 --- a/data/malwaredomainlist.com/update.info +++ /dev/null @@ -1 +0,0 @@ -https://www.malwaredomainlist.com/hostslist/hosts.txt diff --git a/data/malwaredomainlist.com/update.json b/data/malwaredomainlist.com/update.json new file mode 100644 index 000000000..6556f837f --- /dev/null +++ b/data/malwaredomainlist.com/update.json @@ -0,0 +1,3 @@ +{ + "url": "https://www.malwaredomainlist.com/hostslist/hosts.txt" +} diff --git a/data/mvps.org/update.info b/data/mvps.org/update.info deleted file mode 100644 index 8e9f6a106..000000000 --- a/data/mvps.org/update.info +++ /dev/null @@ -1 +0,0 @@ -http://winhelp2002.mvps.org/hosts.txt diff --git a/data/mvps.org/update.json b/data/mvps.org/update.json new file mode 100644 index 000000000..578abdcae --- /dev/null +++ b/data/mvps.org/update.json @@ -0,0 +1,3 @@ +{ + "url": "http://winhelp2002.mvps.org/hosts.txt" +} diff --git a/data/someonewhocares.org/update.info b/data/someonewhocares.org/update.info deleted file mode 100644 index bb744a8ae..000000000 --- a/data/someonewhocares.org/update.info +++ /dev/null @@ -1 +0,0 @@ -http://someonewhocares.org/hosts/zero/hosts diff --git a/data/someonewhocares.org/update.json b/data/someonewhocares.org/update.json new file mode 100644 index 000000000..c8280fb6e --- /dev/null +++ b/data/someonewhocares.org/update.json @@ -0,0 +1,3 @@ +{ + "url": "http://someonewhocares.org/hosts/zero/hosts" +} diff --git a/data/tyzbit/update.info b/data/tyzbit/update.info deleted file mode 100644 index 766f885cd..000000000 --- a/data/tyzbit/update.info +++ /dev/null @@ -1 +0,0 @@ -https://raw.githubusercontent.com/tyzbit/hosts/master/data/tyzbit/hosts diff --git a/data/tyzbit/update.json b/data/tyzbit/update.json new file mode 100644 index 000000000..49450a54c --- /dev/null +++ b/data/tyzbit/update.json @@ -0,0 +1,3 @@ +{ + "url": "https://raw.githubusercontent.com/tyzbit/hosts/master/data/tyzbit/hosts" +} diff --git a/data/yoyo.org/update.info b/data/yoyo.org/update.info deleted file mode 100644 index 65a21d7f8..000000000 --- a/data/yoyo.org/update.info +++ /dev/null @@ -1 +0,0 @@ -https://pgl.yoyo.org/adservers/serverlist.php?hostformat=hosts&mimetype=plaintext&useip=0.0.0.0 diff --git a/data/yoyo.org/update.json b/data/yoyo.org/update.json new file mode 100644 index 000000000..29b57f8ab --- /dev/null +++ b/data/yoyo.org/update.json @@ -0,0 +1,3 @@ +{ + "url": "https://pgl.yoyo.org/adservers/serverlist.php?hostformat=hosts&mimetype=plaintext&useip=0.0.0.0" +} diff --git a/extensions/gambling/update.info b/extensions/gambling/update.info deleted file mode 100644 index dae01215d..000000000 --- a/extensions/gambling/update.info +++ /dev/null @@ -1 +0,0 @@ -https://raw.githubusercontent.com/Sinfonietta/hostfiles/master/gambling-hosts diff --git a/extensions/gambling/update.json b/extensions/gambling/update.json new file mode 100644 index 000000000..b9802edbc --- /dev/null +++ b/extensions/gambling/update.json @@ -0,0 +1,3 @@ +{ + "url": "https://raw.githubusercontent.com/Sinfonietta/hostfiles/master/gambling-hosts" +} diff --git a/extensions/porn/update.info b/extensions/porn/update.info deleted file mode 100644 index c2eab0028..000000000 --- a/extensions/porn/update.info +++ /dev/null @@ -1 +0,0 @@ -https://raw.githubusercontent.com/Sinfonietta/hostfiles/master/pornography-hosts \ No newline at end of file diff --git a/extensions/porn/update.json b/extensions/porn/update.json new file mode 100644 index 000000000..b13880270 --- /dev/null +++ b/extensions/porn/update.json @@ -0,0 +1,3 @@ +{ + "url": "https://raw.githubusercontent.com/Sinfonietta/hostfiles/master/pornography-hosts" +} diff --git a/extensions/social/update.info b/extensions/social/update.info deleted file mode 100644 index 02f045c40..000000000 --- a/extensions/social/update.info +++ /dev/null @@ -1 +0,0 @@ -https://raw.githubusercontent.com/Sinfonietta/hostfiles/master/social-hosts diff --git a/extensions/social/update.json b/extensions/social/update.json new file mode 100644 index 000000000..67cb51673 --- /dev/null +++ b/extensions/social/update.json @@ -0,0 +1,3 @@ +{ + "url": "https://raw.githubusercontent.com/Sinfonietta/hostfiles/master/social-hosts" +} diff --git a/updateHostsFile.py b/updateHostsFile.py index f4c7e70f5..975e71c14 100644 --- a/updateHostsFile.py +++ b/updateHostsFile.py @@ -87,7 +87,7 @@ defaults = { "datafilenames" : "hosts", "targetip" : "0.0.0.0", "ziphosts" : False, - "updateurlfilename" : "update.info", + "sourcedatafilename" : "update.json", "readmefilename" : "readme.md", "readmetemplate" : os.path.join(BASEDIR_PATH, "readme_template.md"), "readmedata" : {}, @@ -260,14 +260,14 @@ def updateAllSources(): print ("Skipping.") def getUpdateURLsFromFile(source): - pathToUpdateFile = os.path.join(settings["datapath"], source, settings["updateurlfilename"]) + pathToUpdateFile = os.path.join(settings["datapath"], source, settings["sourcedatafilename"]) if os.path.exists(pathToUpdateFile): updateFile = open(pathToUpdateFile, "r") - retURLs = updateFile.readlines() - # .strip() + updateData = json.load(updateFile) + retURLs = [updateData["url"]] updateFile.close() else: - retURL = None + retURLs = None printFailure("Warning: Can't find the update file for source " + source + "\n" + "Make sure that there's a file at " + pathToUpdateFile) return retURLs @@ -275,10 +275,11 @@ def getUpdateURLsFromFile(source): def getUpdateURLFromFile(source): - pathToUpdateFile = os.path.join(settings["datapath"], source, settings["updateurlfilename"]) + pathToUpdateFile = os.path.join(settings["datapath"], source, settings["sourcedatafilename"]) if os.path.exists(pathToUpdateFile): with open(pathToUpdateFile, "r") as updateFile: - return updateFile.readline().strip() + updateData = json.load(updateFile) + return [updateData["url"]] printFailure("Warning: Can't find the update file for source " + source + "\n" + "Make sure that there's a file at " + pathToUpdateFile) return None