Fixed seconds > hⓂ️s
This commit is contained in:
parent
187e554d09
commit
add0dc5aad
25
app.py
25
app.py
@ -8,16 +8,19 @@ def get_seconds(t):
|
|||||||
return int(t[: t.find(":")]) * 60 + int(t[t.find(":") + 1 :])
|
return int(t[: t.find(":")]) * 60 + int(t[t.find(":") + 1 :])
|
||||||
|
|
||||||
def get_time(s):
|
def get_time(s):
|
||||||
h = int(s/3600)
|
print(s)
|
||||||
m = int((s%3600)/60)
|
print(type(s))
|
||||||
s = int((s%3600)%60)
|
hours = int(s/3600)
|
||||||
if s >= 3600:
|
minutes = int((s%3600)/60)
|
||||||
t = f'{h}:{m}:{s}'
|
seconds = int((s%3600)%60)
|
||||||
elif s >=60:
|
|
||||||
t = f'{m:s}'
|
|
||||||
else:
|
|
||||||
t= f'{s}'
|
|
||||||
|
|
||||||
|
if s >= 3600:
|
||||||
|
t = f'{hours}:{minutes}:{seconds}'
|
||||||
|
elif s >=60:
|
||||||
|
t = f'{minutes}:{seconds}'
|
||||||
|
else:
|
||||||
|
t= f'{seconds}'
|
||||||
|
return t
|
||||||
|
|
||||||
st.title("Music Report for Hindenburg")
|
st.title("Music Report for Hindenburg")
|
||||||
st.markdown(
|
st.markdown(
|
||||||
@ -60,9 +63,9 @@ if data:
|
|||||||
"Duration": get_seconds(duration),
|
"Duration": get_seconds(duration),
|
||||||
"Artist": l[3],
|
"Artist": l[3],
|
||||||
}
|
}
|
||||||
|
|
||||||
# Put data into a dataframe.
|
# Put data into a dataframe.
|
||||||
df = pd.DataFrame.from_dict(d, orient="index")
|
df = pd.DataFrame.from_dict(d, orient="index")
|
||||||
|
df['Duration'] = df['Duration'].apply(lambda s: get_time(s))
|
||||||
df["Title"] = df.index
|
df["Title"] = df.index
|
||||||
df.index = [i for i in range(1, df.shape[1] + 1)]
|
df.index = [i for i in range(1, df.shape[1] + 1)]
|
||||||
# CSS to inject contained in a string
|
# CSS to inject contained in a string
|
||||||
@ -72,7 +75,7 @@ if data:
|
|||||||
tbody th {display:none}
|
tbody th {display:none}
|
||||||
</style>
|
</style>
|
||||||
"""
|
"""
|
||||||
print(df)
|
|
||||||
# Inject CSS with Markdown
|
# Inject CSS with Markdown
|
||||||
st.markdown(hide_table_row_index, unsafe_allow_html=True)
|
st.markdown(hide_table_row_index, unsafe_allow_html=True)
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user