Skip to content

Commit

Permalink
Update webapp
Browse files Browse the repository at this point in the history
  • Loading branch information
Eagleshot committed Oct 25, 2023
1 parent a92fe5a commit 5562ab2
Showing 1 changed file with 15 additions and 8 deletions.
23 changes: 15 additions & 8 deletions Webapp/streamlit_app.py
Original file line number Diff line number Diff line change
Expand Up @@ -66,8 +66,9 @@
files = [file for file in files if file.endswith(".jpg")]

# Camera name
# TODO Display camera id
if len(files) > 0:
cameraname = files[-1][14:-21]
cameraname = files[-1][15:-21]
else:
cameraname = FTP_FOLDER

Expand Down Expand Up @@ -97,7 +98,7 @@

# Convert the timestamp to datetime
# TODO Timestamp is UTC
df['Timestamp'] = pd.to_datetime(df['Timestamp'], format='%Y-%m-%d %H:%M:%SZ')
df['Timestamp'] = pd.to_datetime(df['Timestamp'], format='%Y-%m-%d %H:%M:%S')


##############################################
Expand Down Expand Up @@ -125,8 +126,9 @@
endDateTime = datetime.combine(endDate, endTime)

# Filter the dataframe
df = df[(df['Timestamp'] >= startDateTime)
& (df['Timestamp'] <= endDateTime)]
# TODO
# df = df[(df['Timestamp'] >= startDateTime)
# & (df['Timestamp'] <= endDateTime)]

# Login
# TODO Improve security (e.g. multiple login attempts)
Expand Down Expand Up @@ -266,12 +268,17 @@
dfMap = df[df['Latitude'] != "-"]
dfMap = dfMap[dfMap['Longitude'] != "-"]

# Get the latitude and longitude
lon = float(dfMap['Latitude'].iloc[-1])
lat = float(dfMap['Longitude'].iloc[-1])
lat = 0.0
lon = 0.0
try:
# Get the latitude and longitude
lon = float(dfMap['Latitude'].iloc[-1])
lat = float(dfMap['Longitude'].iloc[-1])
except:
pass

# Check if OpenWeather API key is set
if st.secrets["OPENWEATHER_API_KEY"] != "":
if st.secrets["OPENWEATHER_API_KEY"] != "" and lat != 0.0:

# # Reverse geocoding with OpenWeatherMap
# base_url = "http://api.openweathermap.org/geo/1.0/reverse?"
Expand Down

0 comments on commit 5562ab2

Please sign in to comment.