Now adding target countries and languages to the info bubble.
This commit is contained in:
parent
7604a8e385
commit
b37fe98dcf
125
owrx/eibi.py
125
owrx/eibi.py
|
|
@ -90,9 +90,9 @@ class EIBI(object):
|
||||||
|
|
||||||
# Update schedule
|
# Update schedule
|
||||||
def updateSchedule(self):
|
def updateSchedule(self):
|
||||||
# Scrape EIBI database file
|
# Load EIBI database file from the web
|
||||||
file = self._getCachedScheduleFile()
|
file = self._getCachedScheduleFile()
|
||||||
schedule = self.scrape()
|
schedule = self.loadFromWeb()
|
||||||
# Save parsed data into a file
|
# Save parsed data into a file
|
||||||
if schedule:
|
if schedule:
|
||||||
self.saveSchedule(file, schedule)
|
self.saveSchedule(file, schedule)
|
||||||
|
|
@ -221,7 +221,7 @@ class EIBI(object):
|
||||||
# Done
|
# Done
|
||||||
return "".join(result)
|
return "".join(result)
|
||||||
|
|
||||||
def scrape(self, url: str = "http://www.eibispace.de/dx/sked-{0}.csv"):
|
def loadFromWeb(self, url: str = "http://www.eibispace.de/dx/sked-{0}.csv"):
|
||||||
# Figure out CSV file name based on the current date
|
# Figure out CSV file name based on the current date
|
||||||
# SUMMER: Apr - Oct - sked-aNN.csv
|
# SUMMER: Apr - Oct - sked-aNN.csv
|
||||||
# WINTER: Nov - Mar - sked-bNN.csv
|
# WINTER: Nov - Mar - sked-bNN.csv
|
||||||
|
|
@ -246,6 +246,7 @@ class EIBI(object):
|
||||||
days = m.group(4)
|
days = m.group(4)
|
||||||
name = m.group(6).lower()
|
name = m.group(6).lower()
|
||||||
lang = m.group(7)
|
lang = m.group(7)
|
||||||
|
trgt = m.group(8)
|
||||||
|
|
||||||
# Guess modulation, default to AM
|
# Guess modulation, default to AM
|
||||||
mode = (
|
mode = (
|
||||||
|
|
@ -267,6 +268,14 @@ class EIBI(object):
|
||||||
"usb" if freq < 7000000 else # Services
|
"usb" if freq < 7000000 else # Services
|
||||||
"am")
|
"am")
|
||||||
|
|
||||||
|
# Convert language code to language
|
||||||
|
if lang in EIBI_Languages:
|
||||||
|
lang = EIBI_Languages[lang]["name"]
|
||||||
|
|
||||||
|
# Convert target country code to target country
|
||||||
|
if trgt in EIBI_Countries:
|
||||||
|
trgt = EIBI_Countries[trgt]
|
||||||
|
|
||||||
# Append a new entry to the result
|
# Append a new entry to the result
|
||||||
result.append({
|
result.append({
|
||||||
"freq" : freq,
|
"freq" : freq,
|
||||||
|
|
@ -277,7 +286,7 @@ class EIBI(object):
|
||||||
"itu" : m.group(5),
|
"itu" : m.group(5),
|
||||||
"name" : m.group(6),
|
"name" : m.group(6),
|
||||||
"lang" : lang,
|
"lang" : lang,
|
||||||
"tgt" : m.group(8),
|
"tgt" : trgt,
|
||||||
"src" : m.group(9),
|
"src" : m.group(9),
|
||||||
"pers" : int(m.group(10)),
|
"pers" : int(m.group(10)),
|
||||||
"date1" : self.convertDate(m.group(11)),
|
"date1" : self.convertDate(m.group(11)),
|
||||||
|
|
@ -285,7 +294,7 @@ class EIBI(object):
|
||||||
})
|
})
|
||||||
|
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
logger.debug("scrape() exception: {0}".format(e))
|
logger.debug("loadFromWeb() exception: {0}".format(e))
|
||||||
|
|
||||||
# Done
|
# Done
|
||||||
return result
|
return result
|
||||||
|
|
@ -325,6 +334,66 @@ EIBI_SpecialDays = {
|
||||||
# Country Codes
|
# Country Codes
|
||||||
#
|
#
|
||||||
EIBI_Countries = {
|
EIBI_Countries = {
|
||||||
|
# Regions
|
||||||
|
"Af" : "Africa",
|
||||||
|
"Am" : "Americas",
|
||||||
|
"As" : "Asia",
|
||||||
|
"C..": "Central ..",
|
||||||
|
"CAf": "Central Africa",
|
||||||
|
"CAm": "Central America",
|
||||||
|
"CAs": "Central Asia",
|
||||||
|
"CEu": "Central Europe",
|
||||||
|
"Car": "Caribbean, Gulf of Mexico, Florida Waters",
|
||||||
|
"Cau": "Caucasus",
|
||||||
|
"CIS": "Commonwealth of Independent States (former Soviet Union)",
|
||||||
|
"CNA": "Central North America",
|
||||||
|
"E..": "East ..",
|
||||||
|
"EAf": "Eastern Africa",
|
||||||
|
"EAs": "Eastern Asia",
|
||||||
|
"EEu": "Eastern Europe",
|
||||||
|
"ENA": "Eastern North America",
|
||||||
|
"ENE": "East-Northeast",
|
||||||
|
"ESE": "East-Southeast",
|
||||||
|
"Eu" : "Europe, incl. North Africa / Middle East",
|
||||||
|
"FE" : "Far East",
|
||||||
|
"Glo": "World",
|
||||||
|
"In" : "Indian Subcontinent",
|
||||||
|
"LAm": "Latin America",
|
||||||
|
"ME" : "Middle East",
|
||||||
|
"N..": "North ..",
|
||||||
|
"NAf": "North Africa",
|
||||||
|
"NAm": "North America",
|
||||||
|
"NAs": "North Asia",
|
||||||
|
"NEu": "North Europe",
|
||||||
|
"NAO": "North Atlantic Ocean",
|
||||||
|
"NE" : "Northeast",
|
||||||
|
"NNE": "North-Northeast",
|
||||||
|
"NNW": "North-Northwest",
|
||||||
|
"NW" : "Northwest",
|
||||||
|
"Oc" : "Oceania (Australia, New Zealand, Pacific Ocean)",
|
||||||
|
"S..": "South ..",
|
||||||
|
"SAf": "South Africa",
|
||||||
|
"SAm": "South America",
|
||||||
|
"SAs": "South Asia",
|
||||||
|
"SEu": "South Europe",
|
||||||
|
"SAO": "South Atlantic Ocean",
|
||||||
|
"SE" : "Southeast",
|
||||||
|
"SEA": "South East Asia",
|
||||||
|
"SEE": "South East Europe",
|
||||||
|
"Sib": "Siberia",
|
||||||
|
"SSE": "South-Southeast",
|
||||||
|
"SSW": "South-Southwest",
|
||||||
|
"SW" : "Southwest",
|
||||||
|
"Tib": "Tibet",
|
||||||
|
"W..": "West ..",
|
||||||
|
"WAf": "Western Africa",
|
||||||
|
"WAs": "Western Asia",
|
||||||
|
"WEu": "Western Europe",
|
||||||
|
"WIO": "Western Indian Ocean",
|
||||||
|
"WNA": "Western North America",
|
||||||
|
"WNW": "West-Northwest",
|
||||||
|
"WSW": "West-Southwest",
|
||||||
|
# ITU codes start here
|
||||||
"ABW": "Aruba",
|
"ABW": "Aruba",
|
||||||
"AFG": "Afghanistan",
|
"AFG": "Afghanistan",
|
||||||
"AFS": "South Africa",
|
"AFS": "South Africa",
|
||||||
|
|
@ -369,17 +438,17 @@ EIBI_Countries = {
|
||||||
"BTN": "Bhutan",
|
"BTN": "Bhutan",
|
||||||
"BUL": "Bulgaria",
|
"BUL": "Bulgaria",
|
||||||
"BVT": "Bouvet",
|
"BVT": "Bouvet",
|
||||||
"CAB": "Cabinda *",
|
"CAB": "Cabinda",
|
||||||
"CAF": "Central African Republic",
|
"CAF": "Central African Republic",
|
||||||
"CAN": "Canada",
|
"CAN": "Canada",
|
||||||
"CBG": "Cambodia",
|
"CBG": "Cambodia",
|
||||||
"CEU": "Ceuta *",
|
"CEU": "Ceuta",
|
||||||
"CG7": "Guantanamo Bay",
|
"CG7": "Guantanamo Bay",
|
||||||
"CHL": "Chile",
|
"CHL": "Chile",
|
||||||
"CHN": "China (People's Republic)",
|
"CHN": "People's Republic of China",
|
||||||
"CHR": "Christmas Island (Indian Ocean)",
|
"CHR": "Christmas Island in Indian Ocean",
|
||||||
"CKH": "Cook Island",
|
"CKH": "Cook Island",
|
||||||
"CLA": "Clandestine stations *",
|
"CLA": "Clandestine stations",
|
||||||
"CLM": "Colombia",
|
"CLM": "Colombia",
|
||||||
"CLN": "Sri Lanka",
|
"CLN": "Sri Lanka",
|
||||||
"CME": "Cameroon",
|
"CME": "Cameroon",
|
||||||
|
|
@ -409,7 +478,7 @@ EIBI_Countries = {
|
||||||
"ERI": "Eritrea",
|
"ERI": "Eritrea",
|
||||||
"EST": "Estonia",
|
"EST": "Estonia",
|
||||||
"ETH": "Ethiopia",
|
"ETH": "Ethiopia",
|
||||||
"EUR": "Iles Europe & Bassas da India *",
|
"EUR": "Iles Europe & Bassas da India",
|
||||||
"F": "France",
|
"F": "France",
|
||||||
"FIN": "Finland",
|
"FIN": "Finland",
|
||||||
"FJI": "Fiji",
|
"FJI": "Fiji",
|
||||||
|
|
@ -425,7 +494,7 @@ EIBI_Countries = {
|
||||||
"GMB": "Gambia",
|
"GMB": "Gambia",
|
||||||
"GNB": "Guinea-Bissau",
|
"GNB": "Guinea-Bissau",
|
||||||
"GNE": "Equatorial Guinea",
|
"GNE": "Equatorial Guinea",
|
||||||
"GPG": "Galapagos *",
|
"GPG": "Galapagos",
|
||||||
"GRC": "Greece",
|
"GRC": "Greece",
|
||||||
"GRD": "Grenada",
|
"GRD": "Grenada",
|
||||||
"GRL": "Greenland",
|
"GRL": "Greenland",
|
||||||
|
|
@ -434,7 +503,7 @@ EIBI_Countries = {
|
||||||
"GUI": "Guinea",
|
"GUI": "Guinea",
|
||||||
"GUM": "Guam / Guahan",
|
"GUM": "Guam / Guahan",
|
||||||
"GUY": "Guyana",
|
"GUY": "Guyana",
|
||||||
"HKG": "Hong Kong, part of China",
|
"HKG": "Hong Kong",
|
||||||
"HMD": "Heard & McDonald Islands",
|
"HMD": "Heard & McDonald Islands",
|
||||||
"HND": "Honduras",
|
"HND": "Honduras",
|
||||||
"HNG": "Hungary",
|
"HNG": "Hungary",
|
||||||
|
|
@ -453,16 +522,16 @@ EIBI_Countries = {
|
||||||
"ISL": "Iceland",
|
"ISL": "Iceland",
|
||||||
"ISR": "Israel",
|
"ISR": "Israel",
|
||||||
"IW": "International Waters",
|
"IW": "International Waters",
|
||||||
"IWA": "Ogasawara (Bonin, Iwo Jima) *",
|
"IWA": "Ogasawara (Bonin, Iwo Jima)",
|
||||||
"J": "Japan",
|
"J": "Japan",
|
||||||
"JAR": "Jarvis Island",
|
"JAR": "Jarvis Island",
|
||||||
"JDN": "Juan de Nova *",
|
"JDN": "Juan de Nova",
|
||||||
"JMC": "Jamaica",
|
"JMC": "Jamaica",
|
||||||
"JMY": "Jan Mayen *",
|
"JMY": "Jan Mayen",
|
||||||
"JON": "Johnston Island",
|
"JON": "Johnston Island",
|
||||||
"JOR": "Jordan",
|
"JOR": "Jordan",
|
||||||
"JUF": "Juan Fernandez Island *",
|
"JUF": "Juan Fernandez Island",
|
||||||
"KAL": "Kaliningrad *",
|
"KAL": "Kaliningrad",
|
||||||
"KAZ": "Kazakstan / Kazakhstan",
|
"KAZ": "Kazakstan / Kazakhstan",
|
||||||
"KEN": "Kenya",
|
"KEN": "Kenya",
|
||||||
"KER": "Kerguelen",
|
"KER": "Kerguelen",
|
||||||
|
|
@ -491,7 +560,7 @@ EIBI_Countries = {
|
||||||
"MDG": "Madagascar",
|
"MDG": "Madagascar",
|
||||||
"MDR": "Madeira",
|
"MDR": "Madeira",
|
||||||
"MDW": "Midway Islands",
|
"MDW": "Midway Islands",
|
||||||
"MEL": "Melilla *",
|
"MEL": "Melilla",
|
||||||
"MEX": "Mexico",
|
"MEX": "Mexico",
|
||||||
"MHL": "Marshall Islands",
|
"MHL": "Marshall Islands",
|
||||||
"MKD": "Macedonia (F.Y.R.)",
|
"MKD": "Macedonia (F.Y.R.)",
|
||||||
|
|
@ -536,7 +605,7 @@ EIBI_Countries = {
|
||||||
"POR": "Portugal",
|
"POR": "Portugal",
|
||||||
"PRG": "Paraguay",
|
"PRG": "Paraguay",
|
||||||
"PRU": "Peru",
|
"PRU": "Peru",
|
||||||
"PRV": "Okino-Tori-Shima (Parece Vela) *",
|
"PRV": "Okino-Tori-Shima (Parece Vela)",
|
||||||
"PSE": "Palestine",
|
"PSE": "Palestine",
|
||||||
"PTC": "Pitcairn",
|
"PTC": "Pitcairn",
|
||||||
"PTR": "Puerto Rico",
|
"PTR": "Puerto Rico",
|
||||||
|
|
@ -547,11 +616,11 @@ EIBI_Countries = {
|
||||||
"RRW": "Rwanda",
|
"RRW": "Rwanda",
|
||||||
"RUS": "Russian Federation",
|
"RUS": "Russian Federation",
|
||||||
"S": "Sweden",
|
"S": "Sweden",
|
||||||
"SAP": "San Andres & Providencia *",
|
"SAP": "San Andres & Providencia",
|
||||||
"SDN": "Sudan",
|
"SDN": "Sudan",
|
||||||
"SEN": "Senegal",
|
"SEN": "Senegal",
|
||||||
"SEY": "Seychelles",
|
"SEY": "Seychelles",
|
||||||
"SGA": "South Georgia Islands *",
|
"SGA": "South Georgia Islands",
|
||||||
"SHN": "Saint Helena",
|
"SHN": "Saint Helena",
|
||||||
"SLM": "Solomon Islands",
|
"SLM": "Solomon Islands",
|
||||||
"SLV": "El Salvador",
|
"SLV": "El Salvador",
|
||||||
|
|
@ -559,17 +628,17 @@ EIBI_Countries = {
|
||||||
"SMO": "Samoa",
|
"SMO": "Samoa",
|
||||||
"SMR": "San Marino",
|
"SMR": "San Marino",
|
||||||
"SNG": "Singapore",
|
"SNG": "Singapore",
|
||||||
"SOK": "South Orkney Islands *",
|
"SOK": "South Orkney Islands",
|
||||||
"SOM": "Somalia",
|
"SOM": "Somalia",
|
||||||
"SPM": "Saint Pierre et Miquelon",
|
"SPM": "Saint Pierre et Miquelon",
|
||||||
"SRB": "Serbia",
|
"SRB": "Serbia",
|
||||||
"SRL": "Sierra Leone",
|
"SRL": "Sierra Leone",
|
||||||
"SSD": "South Sudan",
|
"SSD": "South Sudan",
|
||||||
"SSI": "South Sandwich Islands *",
|
"SSI": "South Sandwich Islands",
|
||||||
"STP": "Sao Tome & Principe",
|
"STP": "Sao Tome & Principe",
|
||||||
"SUI": "Switzerland",
|
"SUI": "Switzerland",
|
||||||
"SUR": "Suriname",
|
"SUR": "Suriname",
|
||||||
"SVB": "Svalbard *",
|
"SVB": "Svalbard",
|
||||||
"SVK": "Slovakia",
|
"SVK": "Slovakia",
|
||||||
"SVN": "Slovenia",
|
"SVN": "Slovenia",
|
||||||
"SWZ": "Swaziland",
|
"SWZ": "Swaziland",
|
||||||
|
|
@ -589,12 +658,12 @@ EIBI_Countries = {
|
||||||
"TUN": "Tunisia",
|
"TUN": "Tunisia",
|
||||||
"TUR": "Turkey",
|
"TUR": "Turkey",
|
||||||
"TUV": "Tuvalu",
|
"TUV": "Tuvalu",
|
||||||
"TWN": "Taiwan *",
|
"TWN": "Taiwan",
|
||||||
"TZA": "Tanzania",
|
"TZA": "Tanzania",
|
||||||
"UAE": "United Arab Emirates",
|
"UAE": "United Arab Emirates",
|
||||||
"UGA": "Uganda",
|
"UGA": "Uganda",
|
||||||
"UKR": "Ukraine",
|
"UKR": "Ukraine",
|
||||||
"UN": "United Nations *",
|
"UN": "United Nations",
|
||||||
"URG": "Uruguay",
|
"URG": "Uruguay",
|
||||||
"USA": "United States of America",
|
"USA": "United States of America",
|
||||||
"UZB": "Uzbekistan",
|
"UZB": "Uzbekistan",
|
||||||
|
|
@ -761,6 +830,8 @@ EIBI_Languages = {
|
||||||
"DY": { "name": "Dyula/Jula: Burkina Faso (1m), Ivory Coast (1.5m), Mali (50,000)", "code": "dyu" },
|
"DY": { "name": "Dyula/Jula: Burkina Faso (1m), Ivory Coast (1.5m), Mali (50,000)", "code": "dyu" },
|
||||||
"DZ": { "name": "Dzongkha: Bhutan (0.2m)", "code": "dzo" },
|
"DZ": { "name": "Dzongkha: Bhutan (0.2m)", "code": "dzo" },
|
||||||
"E": { "name": "English: UK (60m), USA (225m), India (200m), others", "code": "eng" },
|
"E": { "name": "English: UK (60m), USA (225m), India (200m), others", "code": "eng" },
|
||||||
|
"E,F": { "name": "English, French" },
|
||||||
|
"E,S": { "name": "English, Spanish" },
|
||||||
"EC": { "name": "Eastern Cham: Vietnam (70,000)", "code": "cjm" },
|
"EC": { "name": "Eastern Cham: Vietnam (70,000)", "code": "cjm" },
|
||||||
"EGY": { "name": "Egyptian Arabic: Egypt (52m)", "code": "arz" },
|
"EGY": { "name": "Egyptian Arabic: Egypt (52m)", "code": "arz" },
|
||||||
"EO": { "name": "Esperanto: Constructed language (2m)", "code": "epo" },
|
"EO": { "name": "Esperanto: Constructed language (2m)", "code": "epo" },
|
||||||
|
|
|
||||||
|
|
@ -266,15 +266,35 @@ class Markers(object):
|
||||||
|
|
||||||
# Load transmitter sites from EIBI database
|
# Load transmitter sites from EIBI database
|
||||||
for entry in EIBI.getSharedInstance().currentTransmitters().values():
|
for entry in EIBI.getSharedInstance().currentTransmitters().values():
|
||||||
|
# Extract target regions and languages, removing duplicates
|
||||||
|
schedule = entry["schedule"]
|
||||||
|
langs = {}
|
||||||
|
targets = {}
|
||||||
|
comment = ""
|
||||||
|
langstr = ""
|
||||||
|
for row in schedule:
|
||||||
|
lang = row["lang"]
|
||||||
|
target = row["tgt"]
|
||||||
|
if target not in targets:
|
||||||
|
targets[target] = True
|
||||||
|
comment += (", " if comment else " to ") + target
|
||||||
|
if lang not in langs:
|
||||||
|
langs[lang] = True
|
||||||
|
langstr += (", " if langstr else "") + re.sub(r":.*$", "", lang)
|
||||||
|
|
||||||
|
# Compose comment
|
||||||
|
comment = "Transmitting" + comment if comment else "Transmitter"
|
||||||
|
comment = comment + " (" + langstr + ")" if langstr else comment
|
||||||
|
|
||||||
rl = MarkerLocation({
|
rl = MarkerLocation({
|
||||||
"type" : "feature",
|
"type" : "feature",
|
||||||
"mode" : "Stations",
|
"mode" : "Stations",
|
||||||
"comment" : "Transmitter",
|
"comment" : comment,
|
||||||
"id" : entry["name"],
|
"id" : entry["name"],
|
||||||
"lat" : entry["lat"],
|
"lat" : entry["lat"],
|
||||||
"lon" : entry["lon"],
|
"lon" : entry["lon"],
|
||||||
"url" : url + urllib.parse.quote_plus(entry["name"]),
|
"url" : url + urllib.parse.quote_plus(entry["name"]),
|
||||||
"schedule": entry["schedule"]
|
"schedule": schedule
|
||||||
})
|
})
|
||||||
result[rl.getId()] = rl
|
result[rl.getId()] = rl
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue