add an optional blacklist file
authorTom Hoover <redacted>
Sat, 10 Dec 2016 17:26:50 +0000 (11:26 -0600)
committerTom Hoover <redacted>
Sat, 10 Dec 2016 20:17:56 +0000 (14:17 -0600)
The contents of this file (containing a listing of additional
domains in 'hosts' file format) are appended to the unified hosts
file during the update process.

.gitignore
blacklist [new file with mode: 0644]
readme.md
readme_template.md
updateHostsFile.py

index d7004daeb3ce5db07b11d8c44b4e9bd871613411..c21ae5225992203609ec0db1b73a6920e7e23ea3 100644 (file)
@@ -1,4 +1,5 @@
 myhosts
+blacklist
 whitelist
 readmeData.json
 hosts-*
diff --git a/blacklist b/blacklist
new file mode 100644 (file)
index 0000000..bead173
--- /dev/null
+++ b/blacklist
@@ -0,0 +1,8 @@
+# blacklist
+#
+# The contents of this file (containing a listing of additional domains in
+# 'hosts' file format) are appended to the unified hosts file during the
+# update process. For example, uncomment the following line to block
+# 'example.com':
+
+# 0.0.0.0 example.com
index 45593c776220b7659311e79aea9fe2640e435a13..0a91d6b0c77e230966ba5a1f0d2984d88946413f 100644 (file)
--- a/readme.md
+++ b/readme.md
@@ -93,6 +93,13 @@ Add one or more  *additional* sources, each in a subfolder of the `data/` folder
 Add one or more *optional* extensions, which originate from subfolders of the `extensions/` folder.  Again the url in
 `update.info` controls where this extension finds its updates.
 
+Create an *optional* `blacklist` file. The contents of this file (containing a listing of additional domains in
+`hosts` file format) are appended to the unified hosts file during the update process. A sample `blacklist` is
+included, and may be modified as you desire.
+
+  * NOTE: The `blacklist` is not tracked by git, so any changes you make won't be overridden when you `git pull`
+  this repo from `origin` in the future.
+
 ### How do I include my own custom domain mappings?
 
 If you have custom hosts records, place them in file `myhosts`.  The contents of this file are prepended to the
index 199f60d32bb00a2b4d4bacd303c44406590c7ef6..d1e99b01564a585681019bf0f18e2022a3864bee 100644 (file)
@@ -85,6 +85,13 @@ Add one or more  *additional* sources, each in a subfolder of the `data/` folder
 Add one or more *optional* extensions, which originate from subfolders of the `extensions/` folder.  Again the url in
 `update.info` controls where this extension finds its updates.
 
+Create an *optional* `blacklist` file. The contents of this file (containing a listing of additional domains in
+`hosts` file format) are appended to the unified hosts file during the update process. A sample `blacklist` is
+included, and may be modified as you desire.
+
+  * NOTE: The `blacklist` is not tracked by git, so any changes you make won't be overridden when you `git pull`
+  this repo from `origin` in the future.
+
 ### How do I include my own custom domain mappings?
 
 If you have custom hosts records, place them in file `myhosts`.  The contents of this file are prepended to the
index 975e71c1480188152370827a8dd645e1e7873c7c..eeb613e2a88782c28f8885be7f0daec3fbf0d582 100644 (file)
@@ -96,6 +96,7 @@ defaults = {
     "exclusionregexs" : [],
     "exclusions" : [],
     "commonexclusions" : ["hulu.com"],
+    "blacklistfile" : os.path.join(BASEDIR_PATH, "blacklist"),
     "whitelistfile" : os.path.join(BASEDIR_PATH, "whitelist")}
 
 def main():
@@ -300,6 +301,11 @@ def createInitialFile():
             #Done in a cross-python way
             writeData(mergeFile, curFile.read())
 
+    if os.path.isfile(settings["blacklistfile"]):
+        with open(settings["blacklistfile"], "r") as curFile:
+            #Done in a cross-python way
+            writeData(mergeFile, curFile.read())
+
     return mergeFile
 
 def removeDupsAndExcl(mergeFile):
git clone https://git.99rst.org/PROJECT