Starlucas0201 commited on
Commit
4b177dd
·
verified ·
1 Parent(s): e926f6f

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +22 -11
app.py CHANGED
@@ -3,27 +3,38 @@ import zipfile
3
  import sys
4
 
5
  ZIP_NAME = "musicnbrain.zip"
6
- MARKER = ".unzipped_ok"
7
 
8
  def unzip_once():
 
 
9
  if not os.path.exists(ZIP_NAME):
10
- print(f"'{ZIP_NAME}' not found — nothing to do.")
11
  return
 
12
  if os.path.exists(MARKER):
13
- print("Already unzipped. Exiting.")
14
  return
15
 
16
- with zipfile.ZipFile(ZIP_NAME, "r") as zf:
17
- zf.extractall(".")
18
- # optional: delete the zip to save space
19
  try:
 
 
 
 
 
20
  os.remove(ZIP_NAME)
21
- except Exception as e:
22
- print("⚠️ Couldn’t delete zip:", e)
23
 
24
- # drop a marker so we don't repeat
25
- open(MARKER, "w").close()
26
- print("✅ Unzipped successfully. Exiting now.")
 
 
 
 
 
 
 
27
 
28
  if __name__ == "__main__":
29
  unzip_once()
 
3
  import sys
4
 
5
  ZIP_NAME = "musicnbrain.zip"
6
+ MARKER = ".unzipped_ok"
7
 
8
  def unzip_once():
9
+ print("Starting unzip script...")
10
+
11
  if not os.path.exists(ZIP_NAME):
12
+ print(f"'{ZIP_NAME}' not found — nothing to unzip.")
13
  return
14
+
15
  if os.path.exists(MARKER):
16
+ print("Already unzipped. Skipping.")
17
  return
18
 
 
 
 
19
  try:
20
+ with zipfile.ZipFile(ZIP_NAME, "r") as zf:
21
+ print(f"Extracting {ZIP_NAME}...")
22
+ zf.extractall(".")
23
+ print("Extraction complete.")
24
+
25
  os.remove(ZIP_NAME)
26
+ print("Deleted zip file.")
 
27
 
28
+ open(MARKER, "w").close()
29
+ print("Created marker file.")
30
+
31
+ print("\nExtracted files:")
32
+ for root, dirs, files in os.walk("."):
33
+ for file in files:
34
+ print(os.path.join(root, file))
35
+
36
+ except Exception as e:
37
+ print("Unzip failed:", e)
38
 
39
  if __name__ == "__main__":
40
  unzip_once()