def __init__(self): # Fetch the service account key JSON file contents cred = credentials.Certificate(firebase_credentials) # Initialize the app with a custom auth variable, limiting the server's access firebase_admin.initialize_app( cred, { "databaseURL": firebaseio_url, "databaseAuthVariableOverride": { "uid": uid } }) self.localize = Localize()
class Operations(): def __init__(self): # Fetch the service account key JSON file contents cred = credentials.Certificate(firebase_credentials) # Initialize the app with a custom auth variable, limiting the server's access firebase_admin.initialize_app( cred, { "databaseURL": firebaseio_url, "databaseAuthVariableOverride": { "uid": uid } }) self.localize = Localize() def update_device_locale(self): try: ref_user = db.reference('/user') users = ref_user.get() if users is None: return for user_id in users: location_data = db.reference( "/user/{}/location".format(user_id)).get() device_data = db.reference("/device/{}".format(user_id)).get() if location_data is None: return if device_data is None: return self.localize.set_data(location_data) self.localize.set_user(device_data) locale = self.localize.locate()["locale"] db.reference("/device/{}/location".format(user_id)).set(locale) print() except Exception as e: print("ERROR:", e) def delete_device(self): ref = db.reference("/device") ref.delete() def delete_user(self): ref = db.reference("/user") ref.delete()
def __init__(self, *args, **kwargs): # set our Addon class self.Addon = kwargs["addon"] # set our window object self.WINDOW = kwargs["window"] # set our key variables self.geolocation = kwargs["geolocation"] self.location_id = kwargs["locationId"] # set localize functions self.Localize = Localize() # set title & logo self._set_addon_info()
def main(args): rospy.init_node('Cameras', anonymous=True) cams = Cameras() gate = Gate() buoy = Buoy() loc = Localize() rate = rospy.Rate(30) lastTime = time() * 1000 try: while True: if rospy.is_shutdown(): rospy.logerr("F**K") break if (cams.cam0Ready and (cams.cam1Ready or cams.cameraMap['down'] is None)): img_gate = np.copy(cams.getFrontFrame()) img_buoy = np.copy(img_gate) if ((img_gate == np.copy(None)).any() or img_gate is None): rospy.logwarn("none image recieved") continue bars = gate.findBars(img_gate) loc.updateGate([bars[1], bars[2], bars[3]]) buoys = buoy.mainImg(img_buoy) img_buoy = buoy.getResultImg() cams.buoyLinePrediction( img_buoy, loc.firstBuoyYaw.getPredictedState()[0]) cams.buoyLinePrediction( img_buoy, loc.secondBuoyYaw.getPredictedState()[0], green=False) loc.updateBuoy(buoys) try: cams.buoyPub.publish( cams.bridge.cv2_to_imgmsg(img_buoy, "bgr8")) cams.gatePub.publish( cams.bridge.cv2_to_imgmsg(img_gate, "bgr8")) except Exception as e: rospy.logerr("EXCEPTION IN CAMERAS: ") rospy.logerr(e) rospy.logwarn("LOOP TIME %d", time() * 1000 - lastTime) lastTime = time() * 1000 else: pass #print("NOT READY") except KeyboardInterrupt: rospy.logerr("Shutting down") cv2.destroyAllWindows() rospy.logerr("KILL")
def finish_install(self, setup): # Steps: our_total = 11 our_current = 4 # write host+hostname infos print " --> Writing hostname" our_current += 1 self.update_progress(total=our_total, current=our_current, message=_("Setting hostname")) hostnamefh = open("/target/etc/hostname", "w") hostnamefh.write("%s\n" % setup.hostname) hostnamefh.close() hostsfh = open("/target/etc/hosts", "w") hostsfh.write("127.0.0.1\tlocalhost\n") hostsfh.write("127.0.1.1\t%s\n" % setup.hostname) hostsfh.write("# The following lines are desirable for IPv6 capable hosts\n") hostsfh.write("::1 localhost ip6-localhost ip6-loopback\n") hostsfh.write("fe00::0 ip6-localnet\n") hostsfh.write("ff00::0 ip6-mcastprefix\n") hostsfh.write("ff02::1 ip6-allnodes\n") hostsfh.write("ff02::2 ip6-allrouters\n") hostsfh.write("ff02::3 ip6-allhosts\n") hostsfh.close() # set the locale print " --> Setting the locale" our_current += 1 self.update_progress(total=our_total, current=our_current, message=_("Setting locale")) shell_exec("echo \"%s.UTF-8 UTF-8\" >> /target/etc/locale.gen" % setup.language) chroot_exec("locale-gen") shell_exec("echo \"\" > /target/etc/default/locale") chroot_exec("update-locale LANG=\"%s.UTF-8\"" % setup.language) chroot_exec("update-locale LANG=%s.UTF-8" % setup.language) # set the timezone print " --> Setting the timezone" shell_exec("echo \"%s\" > /target/etc/timezone" % setup.timezone) shell_exec("cp /target/usr/share/zoneinfo/%s /target/etc/localtime" % setup.timezone) # localizing if setup.language != "en_US": if os.path.exists("/lib/live/mount/medium/pool"): print " --> Localizing packages" our_current += 1 self.update_progress(total=our_total, current=our_current, message=_("Localizing packages")) shell_exec("mkdir -p /target/debs") language_code = setup.language if "_" in setup.language: language_code = setup.language.split("_")[0] l10ns = getoutput("find /lib/live/mount/medium/pool | grep 'l10n-%s\\|hunspell-%s'" % (language_code, language_code)) for l10n in l10ns.split("\n"): shell_exec("cp %s /target/debs/" % l10n) chroot_exec("dpkg -i /debs/*") shell_exec("rm -rf /target/debs") if hasInternetConnection: # [XK] Localize when not LMDE loc = Localize(setup.language, our_total, our_current) loc.set_progress_hook(self.update_progress) loc.start() our_current = loc.our_current # [XK] Configure Plymouth our_current += 1 if os.path.exists('/target/bin/plymouth'): print " --> Configuring Plymouth" self.update_progress(pulse=True, total=our_total, current=our_current, message=_("Configuring Plymouth")) plymouth = PlymouthSave() plymouth.save(setup.plymouth_enable) # [XK] Install multimedia our_current += 1 if setup.multimedia_enable: if hasInternetConnection: print " --> Install multimedia" self.update_progress(pulse=True, total=our_total, current=our_current, message=_("Install multimedia")) packages = "libdvdcss2" if isAmd64: packages += " w64codecs" else: packages += " w32codecs" chroot_exec("apt-get install --assume-yes -o Dpkg::Options::=--force-confdef -o Dpkg::Options::=--force-confold --force-yes %s" % packages) # [XK] Configure sensors our_current += 1 if os.path.exists('/target/usr/sbin/sensors-detect'): print " --> Configuring sensors" self.update_progress(pulse=True, total=our_total, current=our_current, message=_("Configuring sensors")) chroot_exec('/usr/bin/yes YES | /usr/sbin/sensors-detect') # [XK] Remove VirtualBox when not installing to VirtualBox if not runningInVirtualBox(): print " --> Remove VirtualBox" self.update_progress(pulse=True, total=our_total, current=our_current, message=_("Removing VirtualBox")) chroot_exec("apt-get purge --assume-yes -o Dpkg::Options::=--force-confdef -o Dpkg::Options::=--force-confold --force-yes virtualbox*") # set the keyboard options.. print " --> Setting the keyboard" our_current += 1 self.update_progress(total=our_total, current=our_current, message=_("Setting keyboard options")) consolefh = open("/target/etc/default/console-setup", "r") newconsolefh = open("/target/etc/default/console-setup.new", "w") for line in consolefh: line = line.rstrip("\r\n") if(line.startswith("XKBMODEL=")): newconsolefh.write("XKBMODEL=\"%s\"\n" % setup.keyboard_model) elif(line.startswith("XKBLAYOUT=")): newconsolefh.write("XKBLAYOUT=\"%s\"\n" % setup.keyboard_layout) elif(line.startswith("XKBVARIANT=") and setup.keyboard_variant is not None): newconsolefh.write("XKBVARIANT=\"%s\"\n" % setup.keyboard_variant) else: newconsolefh.write("%s\n" % line) consolefh.close() newconsolefh.close() chroot_exec("rm /etc/default/console-setup") chroot_exec("mv /etc/default/console-setup.new /etc/default/console-setup") consolefh = open("/target/etc/default/keyboard", "r") newconsolefh = open("/target/etc/default/keyboard.new", "w") for line in consolefh: line = line.rstrip("\r\n") if(line.startswith("XKBMODEL=")): newconsolefh.write("XKBMODEL=\"%s\"\n" % setup.keyboard_model) elif(line.startswith("XKBLAYOUT=")): newconsolefh.write("XKBLAYOUT=\"%s\"\n" % setup.keyboard_layout) elif(line.startswith("XKBVARIANT=") and setup.keyboard_variant is not None): newconsolefh.write("XKBVARIANT=\"%s\"\n" % setup.keyboard_variant) else: newconsolefh.write("%s\n" % line) consolefh.close() newconsolefh.close() chroot_exec("rm /etc/default/keyboard") chroot_exec("mv /etc/default/keyboard.new /etc/default/keyboard") # write MBR (grub) print " --> Configuring Grub" our_current += 1 if(setup.grub_device is not None): self.update_progress(pulse=True, total=our_total, current=our_current, message=_("Installing bootloader")) print " --> Running grub-install" chroot_exec("grub-install --force %s" % setup.grub_device) self.do_configure_grub(our_total, our_current) grub_retries = 0 while (not self.do_check_grub(our_total, our_current)): self.do_configure_grub(our_total, our_current) grub_retries = grub_retries + 1 if grub_retries >= 5: self.error_message(message=_("WARNING: The grub bootloader was not configured properly! You need to configure it manually.")) break # recreate initramfs (needed in case of skip_mount also, to include things like mdadm/dm-crypt/etc in case its needed to boot a custom install) print " --> Configuring Initramfs" our_current += 1 # [XK] Running update-initramfs takes a long time: check if it is necessary initrd = "/boot/initrd.img-".format(getoutput("uname -r")) update = os.path.getmtime(initrd) < time.time() - 86400 if os.path.isfile(initrd) else True if update: self.update_progress(pulse=True, total=our_total, current=our_current, message=_("Configuring initramfs")) chroot_exec("/usr/sbin/update-initramfs -t -u -k all") kernelversion = getoutput("uname -r") chroot_exec("/usr/bin/sha1sum /boot/initrd.img-%s > /var/lib/initramfs-tools/%s" % (kernelversion,kernelversion)) # Clean APT print " --> Cleaning APT" our_current += 1 self.update_progress(pulse=True, total=our_total, current=our_current, message=_("Cleaning APT")) shell_exec("chroot /target/ /bin/sh -c \"dpkg --configure -a\"") chroot_exec("sed -i 's/^deb cdrom/#deb cdrom/' /etc/apt/sources.list") chroot_exec("apt-get -y --force-yes autoremove") # now unmount it print " --> Unmounting partitions" shell_exec("umount --force /target/dev/shm") shell_exec("umount --force /target/dev/pts") if setup.gptonefi: shell_exec("umount --force /target/boot/efi") shell_exec("umount --force /target/media/cdrom") shell_exec("umount --force /target/dev/") shell_exec("umount --force /target/sys/") shell_exec("umount --force /target/proc/") shell_exec("rm -f /target/etc/resolv.conf") shell_exec("mv /target/etc/resolv.conf.bk /target/etc/resolv.conf") if(not setup.skip_mount): for partition in setup.partitions: if(partition.mount_as is not None and partition.mount_as != "" and partition.mount_as != "/" and partition.mount_as != "swap"): self.do_unmount("/target" + partition.mount_as) self.do_unmount("/target") self.do_unmount("/source") self.update_progress(done=True, message=_("Installation finished")) print " --> All done"
class Properties: """ Class used to set window properties """ # $MSG[* Properties are set on the "Weather" window.]$END_MSG # $SUB_MSG[Use: "Window(Weather).Property(<property>)"]$END_SUB_MSG def __init__(self, *args, **kwargs): # set our Addon class self.Addon = kwargs["addon"] # set our window object self.WINDOW = kwargs["window"] # set our key variables self.geolocation = kwargs["geolocation"] self.location_id = kwargs["locationId"] # set localize functions self.Localize = Localize() # set title & logo self._set_addon_info() def _set_addon_info(self): # $BEGIN_GROUP[Addon Info] # Id of addon (useful for customized logo's) self.WINDOW.setProperty("Addon.Id", self.Addon.getAddonInfo("Id")) # Full path to addon's icon.png file self.WINDOW.setProperty("Addon.Logo", self.Addon.getAddonInfo("Icon")) # Name of addon self.WINDOW.setProperty("Addon.Name", self.Addon.getAddonInfo("Name")) # $END_GROUP # $BEGIN_GROUP[Weather Provider Info] # Weather provider's name self.WINDOW.setProperty("WeatherProvider", self.Addon.getAddonInfo("Name")) # Full path to weather provider's logo file self.WINDOW.setProperty("WeatherProviderIcon", self.Addon.getAddonInfo("Icon")) # $END_GROUP # $BEGIN_GROUP[XBMC Internal] # Loop thru and set each location for count in range(1, int(self.Addon.getSetting("Locations")) + 1): # Available town selections ({count} = 1 thru 5) self.WINDOW.setProperty("Location{count}".format(count=count), self.Addon.getSetting("Location{count}".format(count=count))) # Total number of towns set self.WINDOW.setProperty("Locations", str(int(self.Addon.getSetting("Locations")) + 1)) # $END_GROUP def set_status_properties(self, msg): # $BEGIN_GROUP[Status Messages] # Status message ('true'=successfully fetched weather, 'false'=currently fetching weather, 'error'=fetching weather failed) self.WINDOW.setProperty("Weather.IsFetched", msg) # $END_GROUP def set_geo_ip(self, id, ip): # TODO: maybe just remove this group # $BEGIN_GROUP[Addon Internal] # Current IP used for IP based GEO location to verify if location has changed self.WINDOW.setProperty("Location.IP", ip) # $END_GROUP self.location_id = id def set_properties(self, info): # $BEGIN_GROUP[Location Properties] # Last time weather.com updated current weather (e.g. 10/01/2010 10:00 AM EDT) self.WINDOW.setProperty("Updated", self.Localize.localize_unit(info["cc"][0], "datetime")) # Last time weather.com updated 5-day forecast (e.g. 10/01/2010 10:00 AM EDT) self.WINDOW.setProperty("Updated.5Day", self.Localize.localize_unit(info["days_updated"], "datetime")) # Town (e.g. New York, NY) self.WINDOW.setProperty("Location", "{geo}{location}".format(geo=["", "*"][self.geolocation], location=info["location"][1])) # Town's weather.com id (e.g. USNY0996) self.WINDOW.setProperty("Location.Id", self.location_id) """ # Town's setting index (starts at 1) self.WINDOW.setProperty("Location.Index", sys.argv[1]) """ # Town's latitude (*see settings - e.g. N 40°42'36") self.WINDOW.setProperty("Location.Latitude", self.Localize.localize_unit(info["location"][3], "latitude", format=self.Addon.getSetting("coordinate_format"))) # Town's longitude (*see settings - e.g. W 74°00'36") self.WINDOW.setProperty("Location.Longitude", self.Localize.localize_unit(info["location"][4], "longitude", format=self.Addon.getSetting("coordinate_format"))) # Town's latitude and longitude (*see settings - e.g. N 40°42'36" W 74°00'36") self.WINDOW.setProperty("Location.Coordinates", u"{latitude} {longitude}".format(latitude=self.Localize.localize_unit(info["location"][3], "latitude", format=self.Addon.getSetting("coordinate_format")), longitude=self.Localize.localize_unit(info["location"][4], "longitude", format=self.Addon.getSetting("coordinate_format")))) # Town's local time when weather was fetched (e.g. 7:39 AM) self.WINDOW.setProperty("Location.Time", self.Localize.localize_unit(info["location"][2], "time")) # Observation Station (e.g. New York, NY) self.WINDOW.setProperty("Station", info["cc"][1]) # $END_GROUP # $BEGIN_GROUP[Current Conditions] # Current condition description (e.g. Fair) self.WINDOW.setProperty("Current.Condition", " ".join([self.Localize.localize_text.get(word, word) for word in info["cc"][4].split(" ") if (word)])) # Current condition icon path (*see settings) self.WINDOW.setProperty("Current.ConditionIcon", os.path.join(self.Addon.getSetting("icon_path_weather"), info["cc"][5] + ".png")) # Current dew point (e.g. 46) self.WINDOW.setProperty("Current.DewPoint", self.Localize.localize_unit(info["cc"][16])) # Current condition icon code number (e.g. 34) self.WINDOW.setProperty("Current.FanartCode", info["cc"][5]) # Current condition or location based fanart path (*see settings) self.WINDOW.setProperty("Current.FanartPath", ["", os.path.join(self.Addon.getSetting("fanart_path"), [info["cc"][5], self.location_id][int(self.Addon.getSetting("fanart_type"))])][self.Addon.getSetting("fanart_path") != ""]) # Current feels like temperature (e.g. 62) self.WINDOW.setProperty("Current.FeelsLike", self.Localize.localize_unit(info["cc"][3])) # Current humidity (e.g. 49%) self.WINDOW.setProperty("Current.Humidity", "{value}%".format(value=info["cc"][12])) # Current moon phase description (e.g. New) self.WINDOW.setProperty("Current.Moon", " ".join([self.Localize.localize_text.get(word, word) for word in info["cc"][18].split(" ") if (word)])) # Current moon phase icon path (*see settings) self.WINDOW.setProperty("Current.MoonIcon", os.path.join(self.Addon.getSetting("icon_path_moon"), info["cc"][17] + ".png")) # Current barometric pressure (e.g. 30.25 in. ↑) self.WINDOW.setProperty("Current.Pressure", self.Localize.localize_unit(info["cc"][6], "pressure", status=info["cc"][7])) # Current sunrise (e.g. 7:39 AM) self.WINDOW.setProperty("Current.Sunrise", self.Localize.localize_unit(info["location"][5], "time")) # Current sunset (e.g. 7:02 PM) self.WINDOW.setProperty("Current.Sunset", self.Localize.localize_unit(info["location"][6], "time")) # Current temperature (e.g. 65) self.WINDOW.setProperty("Current.Temperature", self.Localize.localize_unit(info["cc"][2])) # Current UV index (e.g. 0 Low) self.WINDOW.setProperty("Current.UVIndex", ["{value} {description}".format(value=info["cc"][14], description=self.Localize.localize_text.get(info["cc"][15], info["cc"][15])), info["cc"][14]][info["cc"][14] == "N/A"]) # Current visibility (e.g. 10.0 miles) self.WINDOW.setProperty("Current.Visibility", self.Localize.localize_unit(info["cc"][13], "distance")) # Current wind (e.g. From WNW at 10 mph) self.WINDOW.setProperty("Current.Wind", self.Localize.localize_unit(info["cc"][8], "wind", direction=info["cc"][11])) # Current wind (e.g. From the West Northwest at 10 mph) self.WINDOW.setProperty("Current.WindLong", self.Localize.localize_unit(info["cc"][8], "wind", direction=info["cc"][11], long=True)) # Current wind direction in degrees (e.g. 300°) self.WINDOW.setProperty("Current.WindDegrees", "{value}°".format(value=info["cc"][10])) # Current wind direction (abbreviated) (e.g. WNW) self.WINDOW.setProperty("Current.WindDirection", self.Localize.localize_text_special.get(info["cc"][11], [info["cc"][11]])[0]) # Current wind direction (e.g. West Northwest) self.WINDOW.setProperty("Current.WindDirectionLong", self.Localize.localize_text_special.get(info["cc"][11], [info["cc"][11]])[-1]) # Current wind speed (e.g. 10 mph) self.WINDOW.setProperty("Current.WindSpeed", self.Localize.localize_unit(info["cc"][8], "speed")) # Current wind gust (e.g. Gust to 20 mph) self.WINDOW.setProperty("Current.WindGust", self.Localize.localize_unit(info["cc"][9], "wind", NA=True)) # Current wind gust speed (e.g. 20 mph) self.WINDOW.setProperty("Current.WindGustSpeed", self.Localize.localize_unit(info["cc"][9], "speed", NA=True)) # $END_GROUP # 5-day forecast - loop thru and set each day for day in info["days"]: # $BEGIN_GROUP[5 Day forecast] # Days name (e.g. Monday) self.WINDOW.setProperty("Day{day}.Title".format(day=day[0]), self.Localize.localize_text_special.get(day[1], [day[1]])[-1]) # Days name (e.g. Monday) self.WINDOW.setProperty("Day{day}.Day".format(day=day[0]), self.Localize.localize_text_special.get(day[1], [day[1]])[-1]) # Days abbreviated name (e.g. Mon) self.WINDOW.setProperty("Day{day}.DayShort".format(day=day[0]), self.Localize.localize_text_special.get(day[1], [day[1]])[0]) # Days date (e.g. October 1) self.WINDOW.setProperty("Day{day}.Date".format(day=day[0]), self.Localize.localize_unit(day[2], "monthdate", long=True)) # Days abbreviated date (e.g. Oct 1) self.WINDOW.setProperty("Day{day}.DateShort".format(day=day[0]), self.Localize.localize_unit(day[2], "monthdate")) # Days low temperature (e.g. 50) self.WINDOW.setProperty("Day{day}.LowTemp".format(day=day[0]), self.Localize.localize_unit(day[4])) # Days high temperature (e.g. 70) self.WINDOW.setProperty("Day{day}.HighTemp".format(day=day[0]), self.Localize.localize_unit(day[3])) # Days sunrise (e.g. 7:39 AM) self.WINDOW.setProperty("Day{day}.Sunrise".format(day=day[0]), self.Localize.localize_unit(day[5], "time")) # Days sunset (e.g. 7:02 PM) self.WINDOW.setProperty("Day{day}.Sunset".format(day=day[0]), self.Localize.localize_unit(day[6], "time")) # $END_GROUP # $BEGIN_GROUP[5 Day forecast (daytime)] # Daytime outlook icon code number (e.g. 34) self.WINDOW.setProperty("Day{day}.FanartCode".format(day=day[0]), day[7]) # Daytime humidity (e.g. 58%) self.WINDOW.setProperty("Day{day}.Humidity".format(day=day[0]), "{value}%".format(value=day[15])) # Daytime outlook description (e.g. Mostly Sunny) self.WINDOW.setProperty("Day{day}.Outlook".format(day=day[0]), " ".join([self.Localize.localize_text.get(word, word) for word in day[8].split(" ") if (word)])) # Daytime outlook brief description (e.g. M Sunny) (Does NOT localize properly) self.WINDOW.setProperty("Day{day}.OutlookBrief".format(day=day[0]), " ".join([self.Localize.localize_text.get(word, word) for word in day[13].split(" ") if (word)])) # Daytime outlook icon path (*see settings) self.WINDOW.setProperty("Day{day}.OutlookIcon".format(day=day[0]), os.path.join(self.Addon.getSetting("icon_path_weather"), day[7] + ".png")) # Daytime chance of precipitation (e.g. 60) self.WINDOW.setProperty("Day{day}.Precipitation".format(day=day[0]), day[14]) # Daytime wind (e.g. From WNW at 10 mph) self.WINDOW.setProperty("Day{day}.Wind".format(day=day[0]), self.Localize.localize_unit(day[9], "wind", direction=day[12])) # Daytime wind (e.g. From the West Northwest at 10 mph) self.WINDOW.setProperty("Day{day}.WindLong".format(day=day[0]), self.Localize.localize_unit(day[9], "wind", direction=day[12], long=True)) # Daytime wind direction in degrees (e.g. 300°) self.WINDOW.setProperty("Day{day}.WindDegrees".format(day=day[0]), "{value}°".format(value=day[11])) # Daytime wind direction (abbreviated) (e.g. WNW) self.WINDOW.setProperty("Day{day}.WindDirection".format(day=day[0]), self.Localize.localize_text_special.get(day[12], [day[12]])[0]) # Daytime wind direction (e.g. West Northwest) self.WINDOW.setProperty("Day{day}.WindDirectionLong".format(day=day[0]), self.Localize.localize_text_special.get(day[12], [day[12]])[-1]) # Daytime wind speed (e.g. 10 mph) self.WINDOW.setProperty("Day{day}.WindSpeed".format(day=day[0]), self.Localize.localize_unit(day[9], "speed")) # Daytime wind gust (e.g. Gust to 20 mph) self.WINDOW.setProperty("Day{day}.WindGust".format(day=day[0]), self.Localize.localize_unit(day[10], "wind", NA=True)) # Daytime wind gust speed (e.g. 20 mph) self.WINDOW.setProperty("Day{day}.WindGustSpeed".format(day=day[0]), self.Localize.localize_unit(day[10], "speed", NA=True)) # $END_GROUP # $BEGIN_GROUP[5 Day forecast (nighttime)] # Nighttime outlook icon code number (e.g. 33) self.WINDOW.setProperty("Night{day}.FanartCode".format(day=day[0]), day[16]) # Nighttime humidity (e.g. 49%) self.WINDOW.setProperty("Night{day}.Humidity".format(day=day[0]), "{value}%".format(value=day[24])) # Nighttime outlook description (e.g. Partly Cloudy) self.WINDOW.setProperty("Night{day}.Outlook".format(day=day[0]), " ".join([self.Localize.localize_text.get(word, word) for word in day[17].split(" ") if (word)])) # Nighttime outlook brief description (e.g. P Cloudy) (Does NOT localize properly) self.WINDOW.setProperty("Night{day}.OutlookBrief".format(day=day[0]), " ".join([self.Localize.localize_text.get(word, word) for word in day[22].split(" ") if (word)])) # Nighttime outlook icon path (*see settings) self.WINDOW.setProperty("Night{day}.OutlookIcon".format(day=day[0]), os.path.join(self.Addon.getSetting("icon_path_weather"), day[16] + ".png")) # Nighttime chance of precipitation (e.g. 60) self.WINDOW.setProperty("Night{day}.Precipitation".format(day=day[0]), day[23]) # Nighttime wind (e.g. From WNW at 5 mph) self.WINDOW.setProperty("Night{day}.Wind".format(day=day[0]), self.Localize.localize_unit(day[18], "wind", direction=day[21])) # Nighttime wind (e.g. From the West Northwest at 5 mph) self.WINDOW.setProperty("Night{day}.WindLong".format(day=day[0]), self.Localize.localize_unit(day[18], "wind", direction=day[21], long=True)) # Nighttime wind direction in degrees (e.g. 300°) self.WINDOW.setProperty("Night{day}.WindDegrees".format(day=day[0]), "{value}°".format(value=day[20])) # Nighttime wind direction (abbreviated) (e.g. WNW) self.WINDOW.setProperty("Night{day}.WindDirection".format(day=day[0]), self.Localize.localize_text_special.get(day[21], [day[21]])[0]) # Nighttime wind direction (e.g. West Northwest) self.WINDOW.setProperty("Night{day}.WindDirectionLong".format(day=day[0]), self.Localize.localize_text_special.get(day[21], [day[21]])[-1]) # Nighttime wind speed (e.g. 5 mph) self.WINDOW.setProperty("Night{day}.WindSpeed".format(day=day[0]), self.Localize.localize_unit(day[18], "speed")) # Nighttime wind gust (e.g. Gust to 10 mph) self.WINDOW.setProperty("Night{day}.WindGust".format(day=day[0]), self.Localize.localize_unit(day[19], "wind", NA=True)) # Nighttime wind gust speed (e.g. 10 mph) self.WINDOW.setProperty("Night{day}.WindGustSpeed".format(day=day[0]), self.Localize.localize_unit(day[19], "speed", NA=True))