Skip to content

Commit

Permalink
visible duration
Browse files Browse the repository at this point in the history
  • Loading branch information
JarbasAl committed May 29, 2024
1 parent 7f1ab67 commit f58f1ce
Show file tree
Hide file tree
Showing 3 changed files with 32 additions and 21 deletions.
11 changes: 8 additions & 3 deletions __init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
from lingua_franca.format import nice_duration
from matplotlib.offsetbox import OffsetImage, AnnotationBbox
from mpl_toolkits.basemap import Basemap
from ovos_utils.time import to_local
from ovos_utils.time import to_local, now_local
from ovos_workshop.decorators import intent_handler
from ovos_workshop.decorators import resting_screen_handler
from ovos_workshop.intents import IntentBuilder
Expand Down Expand Up @@ -168,8 +168,10 @@ def handle_when(self, message):
pred = SatellitePredictions(lat, lon, altitude=0, days=1).predict()
dt = pred["rise"]["time"] # in user timezone
delta = pred["length"]
dur = dt - now_local()

duration = nice_duration(delta, lang=self.lang)
duration = nice_duration(dur, lang=self.lang)
visible_dur = nice_duration(delta, lang=self.lang)
caption = self.location_pretty + " " + dt.strftime("%m/%d/%Y, %H:%M:%S")
image = self.generate_map(lat, lon)

Expand All @@ -179,7 +181,9 @@ def handle_when(self, message):
"duration": duration,
"toponym": self.location_pretty
}, wait=True)
sleep(1)
self.speak_dialog("visible_for", {
"duration": visible_dur
}, wait=True)
self.gui.release()

@intent_handler(
Expand Down Expand Up @@ -352,5 +356,6 @@ def spk(utt, *args, **kwargs):
# The international space station is now over Central African Republic at 8.6270 latitude 21.5912 longitude
s.handle_when(Message(""))
# The I S S will be over XXX in seven minutes twenty five seconds
# It will be visible during seven minutes twenty five seconds
s.handle_about_iss_intent(Message(""))
# The International Space Station is a modular space station in low Earth orbit. The ISS programme is a multi-national collaborative project between five participating space agencies: NASA ( United States ) , Roscosmos ( Russia ) , JAXA ( Japan ) , ESA ( Europe ) , and CSA ( Canada ) .The ownership and use of the space station is established by intergovernmental treaties and agreements.
2 changes: 2 additions & 0 deletions locale/en-us/visible_for.dialog
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
It will be visible for {duration}
You will be able to see it for {duration}
40 changes: 22 additions & 18 deletions translations/en-us/dialogs.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,37 +3,41 @@
"The International Space Station is a modular space station in low Earth orbit. The ISS programme is a multi-national collaborative project between five participating space agencies: NASA (United States), Roscosmos (Russia), JAXA (Japan), ESA (Europe), and CSA (Canada).The ownership and use of the space station is established by intergovernmental treaties and agreements."
],
"location.unknown.dialog": [
"The space station is at {latitude} latitude {longitude} longitude but I don't know where this is",
"The ISS is now over {latitude} latitude {longitude} longitude but there is no associated geographic feature"
"The ISS is now over {latitude} latitude {longitude} longitude but there is no associated geographic feature",
"The space station is at {latitude} latitude {longitude} longitude but I don't know where this is"
],
"number.dialog": [
"{number} persons are on board of the international space station",
"{number} persons are on board of the space station",
"{number} persons are on board of the I S S",
"{number} persons are in orbit on board of the space station",
"there are {number} persons in orbit on board of the space station",
"there are {number} persons on board of the I S S",
"there are {number} persons on board of the international space station",
"there are {number} persons on board of the space station",
"there are {number} persons on board of the I S S",
"there are {number} persons in orbit on board of the space station"
"{number} persons are in orbit on board of the space station",
"{number} persons are on board of the I S S",
"{number} persons are on board of the international space station",
"{number} persons are on board of the space station"
],
"visible_for.dialog": [
"It will be visible for {duration}",
"You will be able to see it for {duration}"
],
"location.when.dialog": [
"The I S S will be over {toponym} in {duration}",
"The space station will be at {toponym} in {duration}",
"The international space station will be at {toponym} in {duration}"
"The international space station will be at {toponym} in {duration}",
"The space station will be at {toponym} in {duration}"
],
"who.dialog": [
"{people} are on board of the international space station",
"{people} are on board of the space station",
"{people} are on board of the I S S",
"{people} are in orbit on board of the space station",
"the following people are on board of the international space station, {people}",
"the following persons are on board of the international space station, {people}"
"the following persons are on board of the international space station, {people}",
"{people} are in orbit on board of the space station",
"{people} are on board of the I S S",
"{people} are on board of the international space station",
"{people} are on board of the space station"
],
"location.current.dialog": [
"The I S S is over {latitude} latitude {longitude} longitude which corresponds to {toponym}",
"The space station is at {latitude} latitude {longitude} longitude over {toponym}",
"It's at {latitude} latitude {longitude} longitude, over {toponym}",
"Over {toponym} at {latitude} latitude and {longitude} longitude",
"The I S S is over {latitude} latitude {longitude} longitude which corresponds to {toponym}",
"The international space station is now over {toponym} at {latitude} latitude {longitude} longitude",
"Over {toponym} at {latitude} latitude and {longitude} longitude"
"The space station is at {latitude} latitude {longitude} longitude over {toponym}"
]
}

0 comments on commit f58f1ce

Please sign in to comment.