Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -6,35 +6,35 @@ import base64
|
|
| 6 |
from bs4 import BeautifulSoup
|
| 7 |
import hashlib
|
| 8 |
import json
|
| 9 |
-
import uuid
|
| 10 |
import logging
|
| 11 |
from typing import Optional, Dict, List, Any
|
| 12 |
from pathlib import Path
|
| 13 |
-
from shot_scraper import
|
| 14 |
|
| 15 |
-
#
|
| 16 |
logging.basicConfig(level=logging.INFO)
|
| 17 |
logger = logging.getLogger(__name__)
|
| 18 |
|
| 19 |
-
#
|
| 20 |
-
|
| 21 |
-
'app.py', 'requirements.txt', 'pre-requirements.txt',
|
| 22 |
-
'packages.txt', '
|
| 23 |
-
"backup.py", "
|
| 24 |
]
|
| 25 |
|
| 26 |
-
|
| 27 |
-
"
|
| 28 |
-
"
|
| 29 |
-
"
|
| 30 |
-
"
|
| 31 |
-
"
|
| 32 |
-
"
|
| 33 |
-
"
|
| 34 |
-
"
|
| 35 |
-
"
|
| 36 |
-
"
|
| 37 |
-
"
|
| 38 |
}
|
| 39 |
|
| 40 |
def initialize_history() -> None:
|
|
@@ -302,24 +302,21 @@ def show_download_links(subdir: str) -> None:
|
|
| 302 |
st.write(f"File not found: {file}")
|
| 303 |
|
| 304 |
def main() -> None:
|
| 305 |
-
"""
|
| 306 |
-
st.sidebar.title("
|
| 307 |
-
st.sidebar.subheader("
|
| 308 |
-
|
| 309 |
-
#
|
| 310 |
-
st.
|
| 311 |
|
| 312 |
-
for name, url in
|
| 313 |
if st.sidebar.button(name):
|
| 314 |
-
st.write(f"
|
| 315 |
download_html_and_files(url, name.replace(" ", "_"))
|
| 316 |
|
| 317 |
-
# Debugging statement
|
| 318 |
-
st.write("Debugging: main function completed")
|
| 319 |
-
|
| 320 |
# Initialize history
|
| 321 |
initialize_history()
|
| 322 |
|
| 323 |
if __name__ == "__main__":
|
| 324 |
main()
|
| 325 |
-
st.write("
|
|
|
|
| 6 |
from bs4 import BeautifulSoup
|
| 7 |
import hashlib
|
| 8 |
import json
|
| 9 |
+
import uuid
|
| 10 |
import logging
|
| 11 |
from typing import Optional, Dict, List, Any
|
| 12 |
from pathlib import Path
|
| 13 |
+
from shot_scraper import shotscraper # importing shot-scraper
|
| 14 |
|
| 15 |
+
# set up logging
|
| 16 |
logging.basicConfig(level=logging.INFO)
|
| 17 |
logger = logging.getLogger(__name__)
|
| 18 |
|
| 19 |
+
# constants
|
| 20 |
+
excluded_files = [
|
| 21 |
+
'app.py', 'requirements.txt', 'pre-requirements.txt',
|
| 22 |
+
'packages.txt', 'readme.md', '.gitattributes',
|
| 23 |
+
"backup.py", "dockerfile"
|
| 24 |
]
|
| 25 |
|
| 26 |
+
urls = {
|
| 27 |
+
"chordify - play along chords": "https://chordify.net/",
|
| 28 |
+
"national guitar academy - guitar learning": "https://www.guitaracademy.com/",
|
| 29 |
+
"ultimate guitar - massive song database": "https://www.ultimate-guitar.com/",
|
| 30 |
+
"wolf alice": "https://www.chordie.com/song.php/songartist/wolf+alice/index.html",
|
| 31 |
+
"everclear": "https://www.chordie.com/song.php/songartist/everclear/index.html",
|
| 32 |
+
"jungle": "https://www.ultimate-guitar.com/artist/jungle_47745",
|
| 33 |
+
"mylie cyrus": "https://www.ultimate-guitar.com/search.php?title=mile+cyrus&spelling=mylie+cyrus",
|
| 34 |
+
"kanye": "https://www.ultimate-guitar.com/search.php?search_type=title&value=kanye%20west",
|
| 35 |
+
"cat stevens": "https://www.ultimate-guitar.com/search.php?search_type=title&value=cat%20stevens",
|
| 36 |
+
"metric": "https://www.ultimate-guitar.com/search.php?search_type=title&value=metric",
|
| 37 |
+
"john lennon": "https://www.ultimate-guitar.com/search.php?search_type=title&value=john%20lennon",
|
| 38 |
}
|
| 39 |
|
| 40 |
def initialize_history() -> None:
|
|
|
|
| 302 |
st.write(f"File not found: {file}")
|
| 303 |
|
| 304 |
def main() -> None:
|
| 305 |
+
"""main application function."""
|
| 306 |
+
st.sidebar.title("infinite dataset hub")
|
| 307 |
+
st.sidebar.subheader("available urls")
|
| 308 |
+
|
| 309 |
+
# Add a title to the app
|
| 310 |
+
st.title("Music Download App")
|
| 311 |
|
| 312 |
+
for name, url in urls.items():
|
| 313 |
if st.sidebar.button(name):
|
| 314 |
+
st.write(f"downloading content from {url}")
|
| 315 |
download_html_and_files(url, name.replace(" ", "_"))
|
| 316 |
|
|
|
|
|
|
|
|
|
|
| 317 |
# Initialize history
|
| 318 |
initialize_history()
|
| 319 |
|
| 320 |
if __name__ == "__main__":
|
| 321 |
main()
|
| 322 |
+
st.write("debugging: app launched successfully.")
|