Skip to content

Commit

Permalink
Merge pull request #82 from masenf/cache-repeaters
Browse files Browse the repository at this point in the history
dzcb.pnwdigital: provide fallback for PNWDigital repeaters
  • Loading branch information
masenf committed Feb 15, 2022
2 parents b0083a5 + 6d4a7e7 commit a808baf
Showing 1 changed file with 13 additions and 2 deletions.
15 changes: 13 additions & 2 deletions src/dzcb/pnwdigital.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,14 +12,25 @@

logger = logging.getLogger(__name__)

PNWDIGITAL_REPEATERS = "http:https://www.pnwdigital.net/files/acb/PNW_Digital_Repeaters.zip"
PNWDIGITAL_REPEATERS = [
"http:https://www.pnwdigital.net/files/acb/PNW_Digital_Repeaters.zip",
"https://github.com/mycodeplug/dzcb/raw/b0083a5654f173a36671f90e8734982a01d16fad/codeplug/mirror/PNW_Digital_Repeaters_2022-01-30.zip"
]
REPEATER_FILENAME = "Digital-Repeaters__PNWDigital.csv"
TALKGROUPS_FILENAME = "Talkgroups__PNWDigital.csv"


def cache_repeaters(output_dir):
resp = requests.get(PNWDIGITAL_REPEATERS)
for dr_url in PNWDIGITAL_REPEATERS:
resp = requests.get(dr_url)
if resp.status_code < 300:
break
resp.raise_for_status()
logger.info(
"Retrieved PNWDigital repeaters from %s (%s)",
dr_url,
resp.status_code,
)
with tempfile.TemporaryFile() as tf:
tf.write(resp.content)
zf = ZipFile(tf, "r")
Expand Down

0 comments on commit a808baf

Please sign in to comment.