mckabue commited on
Commit
e2e5e1d
·
1 Parent(s): 5b99258

# Adding underscore to ignore, otherwise, docker fails with error:

Browse files

# TypeError: unsupported operand type(s) for |: 'type' and 'NoneType'

Files changed (1) hide show
  1. app.py +4 -4
app.py CHANGED
@@ -18,7 +18,7 @@ def video_id() -> str:
18
  try:
19
  title: str = request.json.get('title')
20
  artist: str = request.json.get('artist')
21
- youtube: YouTube = get_youtube_song(title, artist)
22
  return youtube.video_id
23
  except Exception as e:
24
  return str(e)
@@ -34,8 +34,8 @@ def parse_csv():
34
  return shazamlibrary_df.to_html(index=False, justify="left")
35
  except Exception as e:
36
  return str(e)
37
-
38
-
39
- def get_youtube_song(title: str, artist: str) -> YouTube | None:
40
  search_result = Search(f'{title} by {artist}')
41
  return search_result.results[0] if search_result.results else None
 
18
  try:
19
  title: str = request.json.get('title')
20
  artist: str = request.json.get('artist')
21
+ youtube: YouTube = _get_youtube_song(title, artist)
22
  return youtube.video_id
23
  except Exception as e:
24
  return str(e)
 
34
  return shazamlibrary_df.to_html(index=False, justify="left")
35
  except Exception as e:
36
  return str(e)
37
+ # Adding underscore to ignore, otherwise, docker fails with error:
38
+ # TypeError: unsupported operand type(s) for |: 'type' and 'NoneType'
39
+ def _get_youtube_song(title: str, artist: str) -> YouTube | None:
40
  search_result = Search(f'{title} by {artist}')
41
  return search_result.results[0] if search_result.results else None