[chirp_devel] [PATCH 2 of 2] repeaterbook: Add Canadian provinces. #191

Tom Hayward
Tue May 29 11:56:12 PDT 2012


# HG changeset patch
# User Tom Hayward <tom at tomh.us>
# Date 1338317480 21600
# Node ID f0cf46aff98537eb5b1ef66833b8d0130849fc0b
# Parent  af31b1f3a1a6270a89ce6db40583d2605463e230
repeaterbook: Add Canadian provinces. #191

diff -r af31b1f3a1a6 -r f0cf46aff985 chirpui/fips.py
--- a/chirpui/fips.py	Tue May 29 12:51:16 2012 -0600
+++ b/chirpui/fips.py	Tue May 29 12:51:20 2012 -0600
@@ -69,6 +69,19 @@
     "Wisconsin"            : 55,
     "West Virginia"        : 54,
     "Wyoming"              : 56,
+    "Alberta"              : "CA01",
+    "British Columbia"     : "CA02",
+    "Manitoba"             : "CA03",
+    "New Brunswick"        : "CA04",
+    "Newfoundland and Labrador": "CA05",
+    "Northwest Territories": "CA13",
+    "Nova Scotia"          : "CA07",
+    "Nunavut"              : "CA14",
+    "Ontario"              : "CA08",
+    "Prince Edward Island" : "CA09",
+    "Quebec"               : "CA10",
+    "Saskatchewan"         : "CA11",
+    "Yukon"                : "CA12",
 }
 
 FIPS_COUNTIES = {
@@ -6558,7 +6571,20 @@
           'Vieques Municipio, PR': '147',
           'Villalba Municipio, PR': '149',
           'Yabucoa Municipio, PR': '151',
-          'Yauco Municipio, PR': '153'}
+          'Yauco Municipio, PR': '153'},
+  "CA01": { '--All--': '%', },
+  "CA02": { '--All--': '%', },
+  "CA03": { '--All--': '%', },
+  "CA04": { '--All--': '%', },
+  "CA05": { '--All--': '%', },
+  "CA13": { '--All--': '%', },
+  "CA07": { '--All--': '%', },
+  "CA14": { '--All--': '%', },
+  "CA08": { '--All--': '%', },
+  "CA09": { '--All--': '%', },
+  "CA10": { '--All--': '%', },
+  "CA11": { '--All--': '%', },
+  "CA12": { '--All--': '%', },
 }
 
 
diff -r af31b1f3a1a6 -r f0cf46aff985 chirpui/mainapp.py
--- a/chirpui/mainapp.py	Tue May 29 12:51:16 2012 -0600
+++ b/chirpui/mainapp.py	Tue May 29 12:51:20 2012 -0600
@@ -702,7 +702,10 @@
         default_county = "--All--"
         default_band = "--All--"
         try:
-            code = int(CONF.get("state", "repeaterbook"))
+            try:
+                code = int(CONF.get("state", "repeaterbook"))
+            except:
+                code = CONF.get("state", "repeaterbook")
             for k,v in fips.FIPS_STATES.items():
                 if code == v:
                     default_state = k
@@ -762,9 +765,12 @@
             return
 
         try:
-            code = int(CONF.get("state", "repeaterbook"))
+            code = "%02i" % int(CONF.get("state", "repeaterbook"))
         except:
-            code = 41 # Oregon default
+            try:
+                code = CONF.get("state", "repeaterbook")
+            except:
+                code = '41' # Oregon default
 
         try:
             county = CONF.get("county", "repeaterbook")
@@ -777,7 +783,7 @@
             band = 14 # 2m default
 
         query = "http://www.repeaterbook.com/repeaters/downloads/chirp.php?" + \
-            "func=default&state_id=%02i&band=%s&freq=%%&band6=%%&loc=%%" + \
+            "func=default&state_id=%s&band=%s&freq=%%&band6=%%&loc=%%" + \
             "&county_id=%s&status_id=%%&features=%%&coverage=%%&use=%%"
         query = query % (code, band and band or "%%", county and county or "%%")
 



More information about the chirp_devel mailing list