Update app.py
Browse files
app.py
CHANGED
|
@@ -36,12 +36,11 @@ def create_search_url_lyrics(artist_song):
|
|
| 36 |
def load_song_file(filename):
|
| 37 |
with open(filename, "r") as file:
|
| 38 |
chord_sheet = file.read()
|
| 39 |
-
|
| 40 |
-
|
| 41 |
-
|
| 42 |
|
| 43 |
def main():
|
| 44 |
-
#with st.sidebar:
|
| 45 |
st.title('🎵 Song Files')
|
| 46 |
with st.expander("Select Song File", expanded=True):
|
| 47 |
all_files = [f for f in glob.glob("*.txt") if ' by ' in f]
|
|
@@ -52,11 +51,8 @@ def 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)
|
|
@@ -69,23 +65,18 @@ def main():
|
|
| 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
|
| 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)
|
|
|
|
| 36 |
def load_song_file(filename):
|
| 37 |
with open(filename, "r") as file:
|
| 38 |
chord_sheet = file.read()
|
| 39 |
+
st.text_area("Chord Sheet", chord_sheet, height=300, value=chord_sheet)
|
| 40 |
+
processed_sheet = process_chord_sheet(chord_sheet)
|
| 41 |
+
st.markdown(processed_sheet, unsafe_allow_html=True)
|
| 42 |
|
| 43 |
def main():
|
|
|
|
| 44 |
st.title('🎵 Song Files')
|
| 45 |
with st.expander("Select Song File", expanded=True):
|
| 46 |
all_files = [f for f in glob.glob("*.txt") if ' by ' in f]
|
|
|
|
| 51 |
artist_name = artist_name.replace("_", " ")
|
| 52 |
else:
|
| 53 |
song_name, artist_name = "", ""
|
|
|
|
| 54 |
col1, col2 = st.columns([4, 1])
|
|
|
|
| 55 |
with col1:
|
|
|
|
| 56 |
song_name_input = st.text_input("🎵 Song Name", value=song_name)
|
| 57 |
artist_name_input = st.text_input("🎤 Artist Name", value=artist_name)
|
| 58 |
chord_sheet_input = st.text_area("Chord Sheet", height=300)
|
|
|
|
| 65 |
else:
|
| 66 |
st.error("Both Song Name and Artist Name are required.")
|
| 67 |
|
|
|
|
| 68 |
st.header("🎼 Available Songs")
|
| 69 |
for file in all_files:
|
| 70 |
song_info = os.path.splitext(file)[0].replace("_", " ")
|
| 71 |
+
icol1, icol2 = st.columns([4, 1])
|
| 72 |
with icol1:
|
| 73 |
st.markdown(f"* {song_info}")
|
| 74 |
with icol2:
|
| 75 |
st.markdown(f"[📚Wikipedia]({create_search_url_wikipedia(song_info)})")
|
|
|
|
| 76 |
st.markdown(f"[🎥YouTube]({create_search_url_youtube(song_info)})")
|
|
|
|
| 77 |
st.markdown(f"[🎸Chords]({create_search_url_chords(song_info)})")
|
|
|
|
| 78 |
st.markdown(f"[🎶Lyrics]({create_search_url_lyrics(song_info)})")
|
| 79 |
|
|
|
|
| 80 |
with col2:
|
| 81 |
if selected_file:
|
| 82 |
load_song_file(selected_file)
|