elitau / spotthestation

iCal Calendar feed with events of ISS flyovers
0 stars 0 forks source link

Cygnus sightings labeled as ISS #3

Open thislooksfun opened 2 years ago

thislooksfun commented 2 years ago

The NASA feed shows both ISS and Cygnus sightings, but all the events in the calendar feed say "ISS is above you". It would be nice if the Cygnus sightings showed up differently in the feed.

It seems the problem is here: https://github.com/elitau/spotthestation/blob/a0210d6a31f8c308f8a41cc02623a873831ea4e5/lib/spotthestation2/extract_event_attributes.ex#L70-L72

Here's an example of a Cygnus sighting vs an ISS sighting, taken from this feed:

<item>
  <title>2021-12-09 Cygnus Sighting</title>
  <pubDate>10 Dec 2021 04:44:29 GMT</pubDate>
  <description>
  Date: Thursday Dec 9, 2021 &lt;br/&gt;
  Time: 4:56 PM &lt;br/&gt;
  Duration: 7 minutes &lt;br/&gt;
  Maximum Elevation: 34&#176; &lt;br/&gt;
  Approach: 10&#176; above WNW &lt;br/&gt;
  Departure: 10&#176; above SSE &lt;br/&gt;
  </description>
  <guid>https://spotthestation.nasa.gov/sightings/view.cfm?country=United_States&amp;region=Washington&amp;city=Seattle&amp;ss=5A918FC5-E07B-635D-BA514485A163AC2A</guid>
</item>
<item>
  <title>2021-12-09 ISS Sighting</title>
  <pubDate>10 Dec 2021 04:44:29 GMT</pubDate>
  <description>
  Date: Thursday Dec 9, 2021 &lt;br/&gt;
  Time: 5:36 PM &lt;br/&gt;
  Duration: 4 minutes &lt;br/&gt;
  Maximum Elevation: 15&#176; &lt;br/&gt;
  Approach: 10&#176; above W &lt;br/&gt;
  Departure: 10&#176; above S &lt;br/&gt;
  </description>
  <guid>https://spotthestation.nasa.gov/sightings/view.cfm?country=United_States&amp;region=Washington&amp;city=Seattle&amp;ss=5A918FC6-ED9D-2E3C-8032F38DEE170717</guid>
</item>
elitau commented 2 years ago

What do you think about extracting the title from the feed but without the date and use this as the label?

thislooksfun commented 2 years ago

I would probably parse the title using /^\d\d\d\d-\d\d-\d\d (.+) Sighting$/, then replace "ISS" in the current string with the capture group. And, for future-proofing, if that regex doesn't match then you can fall back on just the event's title.

elitau commented 2 years ago

@thislooksfun I've updated and deployed the app.