ziqiangao commited on
Commit
088fe02
·
verified ·
1 Parent(s): 826658b

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +4 -3
app.py CHANGED
@@ -46,10 +46,8 @@ def getTrigger(ad: int, a: list, max: int = 1024) -> int:
46
  def extract_cover_image(mp3_file):
47
  audio = MP3(mp3_file, ID3=ID3)
48
  if audio.tags == None:
49
- gr.Error("Mp3 is missing tags")
50
- raise Exception("Missing MP3 Tag")
51
 
52
- return None
53
  for tag in audio.tags.values():
54
  if isinstance(tag, APIC):
55
  image_data = tag.data
@@ -165,6 +163,9 @@ def main(file, name, fps=30, res: tuple=(1280,720), oscres=512, sr=11025):
165
  if cover_img is None:
166
  gr.Error("Mp3 must have a cover image")
167
  return # Exit if no cover image found
 
 
 
168
 
169
 
170
  title, artist = getTitleAndArtist(audio_path)
 
46
  def extract_cover_image(mp3_file):
47
  audio = MP3(mp3_file, ID3=ID3)
48
  if audio.tags == None:
 
 
49
 
50
+ return -1
51
  for tag in audio.tags.values():
52
  if isinstance(tag, APIC):
53
  image_data = tag.data
 
163
  if cover_img is None:
164
  gr.Error("Mp3 must have a cover image")
165
  return # Exit if no cover image found
166
+ else if cover_img === -1:
167
+ gr.Error("Mp3 is missing tags")
168
+ return
169
 
170
 
171
  title, artist = getTitleAndArtist(audio_path)