Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 16 additions & 0 deletions resources/language/resource.language.en_gb/strings.po
Original file line number Diff line number Diff line change
Expand Up @@ -441,3 +441,19 @@ msgstr ""
msgctxt "#32132"
msgid "Enable Yosemite"
msgstr ""

msgctxt "#34001"
msgid "On"
msgstr ""

msgctxt "#34002"
msgid "Day Only"
msgstr ""

msgctxt "#34003"
msgid "Night Only"
msgstr ""

msgctxt "#34004"
msgid "Off"
msgstr ""
15 changes: 15 additions & 0 deletions resources/language/resource.language.es_es/strings.po
Original file line number Diff line number Diff line change
Expand Up @@ -442,3 +442,18 @@ msgctxt "#32132"
msgid "Enable Yosemite"
msgstr "Habilitar Yosemite"

msgctxt "#34001"
msgid "On"
msgstr "Encendido"

msgctxt "#34002"
msgid "Day Only"
msgstr "Solamente Dia"

msgctxt "#34003"
msgid "Night Only"
msgstr "Solamente Noche"

msgctxt "#34004"
msgid "Off"
msgstr "Apagado"
17 changes: 17 additions & 0 deletions resources/language/resource.language.pt_pt/strings.po
Original file line number Diff line number Diff line change
Expand Up @@ -441,3 +441,20 @@ msgstr "Ativar West Africa to the Alps"
msgctxt "#32132"
msgid "Enable Yosemite"
msgstr "Ativar Yosemite"

msgctxt "#34001"
msgid "On"
msgstr "Ligadas"

msgctxt "#34002"
msgid "Day Only"
msgstr "Apenas Dia"

msgctxt "#34003"
msgid "Night Only"
msgstr "Apenas a Noite"

msgctxt "#34004"
msgid "Off"
msgstr "Desligado"

27 changes: 24 additions & 3 deletions resources/lib/playlist.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
import tarfile
from random import shuffle
from urllib import request
import datetime as dt

import xbmc
import xbmcvfs
Expand All @@ -26,7 +27,6 @@
# Local save location of the entries.json file containing video URLs
local_entries_json_path = os.path.join(addon_path, "resources", "entries.json")


# Fetch the TAR file containing the latest entries.json and overwrite the local copy
def get_latest_entries_from_apple():
xbmc.log("Downloading the Apple Aerials resources.tar to disk", level=xbmc.LOGDEBUG)
Expand Down Expand Up @@ -81,8 +81,29 @@ def compute_playlist_array(self):
# Retrieve the location name
location = block["accessibilityLabel"]
try:
# Get the corresponding setting Bool by adding "enable-" + lowercase + no whitespace
current_location_enabled = addon.getSettingBool("enable-" + location.lower().replace(" ", ""))
# determine if current video is enabled (on, day, night, off)
current_location_state = addon.getSettingInt("enable-" + location.lower().replace(" ", ""))
xbmc.log(f"Current location state is {current_location_state}", level=xbmc.LOGDEBUG)
# returns True if system time between start/end time, else False
systime = xbmc.getInfoLabel("System.Time(hh:mm xx)")
systime = dt.datetime.strptime(systime, "%I:%M %p")
start_time = dt.datetime.strptime("6:00 AM", "%I:%M %p")
end_time = dt.datetime.strptime("6:00 PM", "%I:%M %p")
day = True if (start_time <= systime < end_time) else False
xbmc.log(f"Currently {'day' if day else 'night'}time", level=xbmc.LOGDEBUG)
# always on
if current_location_state == 0:
current_location_enabled = True
# enabled for day and currently day
elif current_location_state == 1 and day:
current_location_enabled = True
# enabled for night and currently night
elif current_location_state == 2 and not day:
current_location_enabled = True
# disabled
else:
current_location_enabled = False

except TypeError:
xbmc.log("Location {} did not have a matching enable/disable setting".format(location),
level=xbmc.LOGDEBUG)
Expand Down
Loading