Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -52,46 +52,49 @@ def main():
|
|
52 |
artist_name = artist_name.replace("_", " ")
|
53 |
else:
|
54 |
song_name, artist_name = "", ""
|
55 |
-
|
56 |
-
|
57 |
-
|
58 |
-
|
59 |
-
|
60 |
-
|
61 |
-
|
62 |
-
|
63 |
-
|
64 |
-
|
65 |
-
|
66 |
-
|
67 |
-
|
68 |
-
|
69 |
-
|
70 |
-
|
71 |
-
|
72 |
-
|
73 |
-
load_song_file(selected_file)
|
74 |
-
song_info = os.path.splitext(selected_file)[0].replace("_", " ")
|
75 |
-
st.markdown(f"**Selected Song:** {song_info}")
|
76 |
-
st.markdown(f"[📚Wikipedia]({create_search_url_wikipedia(song_info)})")
|
77 |
-
st.markdown(f"[🎥YouTube]({create_search_url_youtube(song_info)})")
|
78 |
-
st.markdown(f"[🎸Chords]({create_search_url_chords(song_info)})")
|
79 |
-
st.markdown(f"[🎶Lyrics]({create_search_url_lyrics(song_info)})")
|
80 |
-
|
81 |
st.header("🎼 Available Songs")
|
82 |
for file in all_files:
|
83 |
song_info = os.path.splitext(file)[0].replace("_", " ")
|
84 |
-
|
85 |
-
with
|
86 |
st.markdown(f"* {song_info}")
|
87 |
-
with
|
88 |
st.markdown(f"[📚Wikipedia]({create_search_url_wikipedia(song_info)})")
|
89 |
-
with
|
90 |
st.markdown(f"[🎥YouTube]({create_search_url_youtube(song_info)})")
|
91 |
-
with
|
92 |
st.markdown(f"[🎸Chords]({create_search_url_chords(song_info)})")
|
93 |
-
with
|
94 |
st.markdown(f"[🎶Lyrics]({create_search_url_lyrics(song_info)})")
|
95 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
96 |
if __name__ == '__main__':
|
97 |
main()
|
|
|
52 |
artist_name = artist_name.replace("_", " ")
|
53 |
else:
|
54 |
song_name, artist_name = "", ""
|
55 |
+
|
56 |
+
col1, col2 = st.columns([4, 1])
|
57 |
+
|
58 |
+
with col1:
|
59 |
+
#with st.expander("🎶 Song and Artist", expanded=True):
|
60 |
+
song_name_input = st.text_input("🎵 Song Name", value=song_name)
|
61 |
+
artist_name_input = st.text_input("🎤 Artist Name", value=artist_name)
|
62 |
+
chord_sheet_input = st.text_area("Chord Sheet", height=300)
|
63 |
+
if st.button("💾 Save", key="save_song"):
|
64 |
+
if song_name_input and artist_name_input:
|
65 |
+
filename = f"{song_name_input} by {artist_name_input}.txt".replace(" ", "_")
|
66 |
+
with open(filename, "w") as file:
|
67 |
+
file.write(chord_sheet_input)
|
68 |
+
st.success("Chord sheet saved.")
|
69 |
+
else:
|
70 |
+
st.error("Both Song Name and Artist Name are required.")
|
71 |
+
|
72 |
+
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
73 |
st.header("🎼 Available Songs")
|
74 |
for file in all_files:
|
75 |
song_info = os.path.splitext(file)[0].replace("_", " ")
|
76 |
+
icol1, icol2, icol3, icol4, icol5 = st.columns([4, 1, 1, 1, 1])
|
77 |
+
with icol1:
|
78 |
st.markdown(f"* {song_info}")
|
79 |
+
with icol2:
|
80 |
st.markdown(f"[📚Wikipedia]({create_search_url_wikipedia(song_info)})")
|
81 |
+
with icol3:
|
82 |
st.markdown(f"[🎥YouTube]({create_search_url_youtube(song_info)})")
|
83 |
+
with icol4:
|
84 |
st.markdown(f"[🎸Chords]({create_search_url_chords(song_info)})")
|
85 |
+
with icol5:
|
86 |
st.markdown(f"[🎶Lyrics]({create_search_url_lyrics(song_info)})")
|
87 |
|
88 |
+
|
89 |
+
with col2:
|
90 |
+
if selected_file:
|
91 |
+
load_song_file(selected_file)
|
92 |
+
song_info = os.path.splitext(selected_file)[0].replace("_", " ")
|
93 |
+
st.markdown(f"**Selected Song:** {song_info}")
|
94 |
+
st.markdown(f"[📚Wikipedia]({create_search_url_wikipedia(song_info)})")
|
95 |
+
st.markdown(f"[🎥YouTube]({create_search_url_youtube(song_info)})")
|
96 |
+
st.markdown(f"[🎸Chords]({create_search_url_chords(song_info)})")
|
97 |
+
st.markdown(f"[🎶Lyrics]({create_search_url_lyrics(song_info)})")
|
98 |
+
|
99 |
if __name__ == '__main__':
|
100 |
main()
|