ziqiangao commited on
Commit
6499ba7
·
1 Parent(s): 717e2ff

allow metadata overriding

Browse files
Files changed (1) hide show
  1. app.py +8 -11
app.py CHANGED
@@ -232,22 +232,19 @@ def main(file, name, fps=30, res: tuple=(1280,720), oscres=512, sr=11025, lyrics
232
  if img:
233
  cover_file = Image.open(img)
234
  cover_img = extract_cover_image(audio_path)
 
 
235
  if cover_img is None:
236
- if img:
237
- cover_img = cover_file
238
- else:
239
- raise gr.Error("Mp3 must have a cover image, upload the image under the 'Metadata' section", duration=None)
240
  elif cover_img == -1 and not (tit or ast or img):
241
- if not img:
242
- raise gr.Error("Mp3 is missing tags, add the info under the 'Metadata' section", duration=None)
243
 
244
  title, artist = getTitleAndArtist(audio_path)
 
 
245
  if title == '' or artist == '':
246
- if not (tit or ast):
247
- gr.Warning('Missing Title or Artist')
248
- else:
249
- title, artist = tit, ast
250
- if img and cover_img == -1:
251
  color_thief = ColorThief(img)
252
  dominant_color = color_thief.get_color(quality=1)
253
  cover_img = cover_file
 
232
  if img:
233
  cover_file = Image.open(img)
234
  cover_img = extract_cover_image(audio_path)
235
+ if img:
236
+ cover_img = cover_file
237
  if cover_img is None:
238
+ raise gr.Error("Mp3 must have a cover image, upload the image under the 'Metadata' section", duration=None)
 
 
 
239
  elif cover_img == -1 and not (tit or ast or img):
240
+ raise gr.Error("Mp3 is missing tags, add the info under the 'Metadata' section", duration=None)
 
241
 
242
  title, artist = getTitleAndArtist(audio_path)
243
+ if tit and ast:
244
+ title, artist = tit, ast
245
  if title == '' or artist == '':
246
+ gr.Warning('Missing Title or Artist')
247
+ if img:
 
 
 
248
  color_thief = ColorThief(img)
249
  dominant_color = color_thief.get_color(quality=1)
250
  cover_img = cover_file