admin commited on
Commit
aa904d9
·
1 Parent(s): 489ecd1
Files changed (1) hide show
  1. app.py +4 -3
app.py CHANGED
@@ -154,10 +154,10 @@ def upl_infer(audio_path: str, cache_dir="./__pycache__/mode1"):
154
  def url_infer(song: str, cache_dir="./__pycache__/mode2"):
155
  song_name = ""
156
  status = "Success"
157
- download_path = f"{cache_dir}/output.mp3"
158
- midi = pdf = xml = mxl = abc = jpg = None
159
  try:
160
  clean_cache(cache_dir)
 
161
  if (is_url(song) and "163" in song and "?id=" in song) or song.isdigit():
162
  song_id = extract_fst_int(song.split("?id=")[-1])
163
  song = f"https://music.163.com/song/media/outer/url?id={song_id}.mp3"
@@ -174,6 +174,7 @@ def url_infer(song: str, cache_dir="./__pycache__/mode2"):
174
  if song_name:
175
  title = song_name
176
 
 
177
  xml = midi2xml(midi, title)
178
  abc = xml2abc(xml)
179
  mxl = xml2mxl(xml)
@@ -182,7 +183,7 @@ def url_infer(song: str, cache_dir="./__pycache__/mode2"):
182
  except Exception as e:
183
  status = f"{e}"
184
 
185
- return status, download_path, midi, pdf, xml, mxl, abc, jpg
186
 
187
 
188
  if __name__ == "__main__":
 
154
  def url_infer(song: str, cache_dir="./__pycache__/mode2"):
155
  song_name = ""
156
  status = "Success"
157
+ audio = midi = pdf = xml = mxl = abc = jpg = None
 
158
  try:
159
  clean_cache(cache_dir)
160
+ download_path = f"{cache_dir}/output.mp3"
161
  if (is_url(song) and "163" in song and "?id=" in song) or song.isdigit():
162
  song_id = extract_fst_int(song.split("?id=")[-1])
163
  song = f"https://music.163.com/song/media/outer/url?id={song_id}.mp3"
 
174
  if song_name:
175
  title = song_name
176
 
177
+ audio = download_path
178
  xml = midi2xml(midi, title)
179
  abc = xml2abc(xml)
180
  mxl = xml2mxl(xml)
 
183
  except Exception as e:
184
  status = f"{e}"
185
 
186
+ return status, audio, midi, pdf, xml, mxl, abc, jpg
187
 
188
 
189
  if __name__ == "__main__":