Skip to content

Commit

Permalink
fix formatting
Browse files Browse the repository at this point in the history
  • Loading branch information
justin025 committed Dec 13, 2024
1 parent e27542c commit aaa37fb
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 9 deletions.
2 changes: 1 addition & 1 deletion src/onthespot/api/tidal.py
Original file line number Diff line number Diff line change
Expand Up @@ -285,7 +285,7 @@ def tidal_get_lyrics(token, item_id, item_type, metadata, filepath):
elif key in ['writers'] and config.get("embed_writers"):
lyrics.append(f'[au:{value}]')

lyrics.append(f'[by:{resp.get("lyricsProvider", '').title()}]')
lyrics.append(f'[by:{resp.get("lyricsProvider", "").title()}]')

if config.get("embed_length"):
l_ms = int(metadata['length'])
Expand Down
6 changes: 3 additions & 3 deletions src/onthespot/api/youtube.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ def youtube_get_search_results(token, search_term, content_types):
search_results = []

with YoutubeDL(ydl_opts) as ytdl:
result = ytdl.extract_info(f"ytsearch{config.get("max_search_results")}:{search_term}", download=False)
result = ytdl.extract_info(f'ytsearch{config.get("max_search_results")}:{search_term}', download=False)
for result in result['entries']:
search_results.append({
'item_id': result['id'],
Expand All @@ -51,7 +51,7 @@ def youtube_get_search_results(token, search_term, content_types):
'item_type': "track",
'item_service': "youtube",
'item_url': result['url'],
'item_thumbnail_url': f'https://i.ytimg.com/vi/{result['id']}/hqdefault.jpg'
'item_thumbnail_url': f'https://i.ytimg.com/vi/{result["id"]}/hqdefault.jpg'
})

logger.info(search_results)
Expand Down Expand Up @@ -104,7 +104,7 @@ def youtube_get_track_metadata(token, item_id):
info['item_url'] = info_dict.get('webpage_url', '')
info['release_year'] = info_dict.get('upload_date', '')[:4]
info['length'] = length
info['is_playable'] = True if info_dict.get('availability') == 'public' else False
info['is_playable'] = True if info_dict.get('availability', '') == 'public' else False
info['item_id'] = item_id

return info
6 changes: 3 additions & 3 deletions src/onthespot/downloader.py
Original file line number Diff line number Diff line change
Expand Up @@ -230,15 +230,15 @@ def run(self):
del stream_internal, stream.input_stream

elif item_service == "soundcloud":
bitrate = "128k"
default_format = ".mp3"
temp_file_path += default_format
# Don't know how to emit progress from ffmpeg
command = [config.get('_ffmpeg_bin_path'), "-loglevel", "error", "-i", f"{item_metadata['file_url']}", "-c", "copy", temp_file_path]
if os.name == 'nt':
subprocess.check_call(command, shell=False, creationflags=subprocess.CREATE_NO_WINDOW)
else:
subprocess.check_call(command, shell=False)
bitrate = "128k"
default_format = ".mp3"

elif item_service == 'deezer':
song = get_song_info_from_deezer_website(item['item_id'])
Expand Down Expand Up @@ -338,7 +338,7 @@ def yt_dlp_progress_hook(self, item, d):
'progress_hooks': [progress_hook]
}) as video:

video.download(f'https://www.youtube.com/watch?v={item['item_id']}')
video.download(f'https://www.youtube.com/watch?v={item["item_id"]}')
default_format = '.m4a'
bitrate = "256k"

Expand Down
4 changes: 2 additions & 2 deletions src/onthespot/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -195,7 +195,7 @@ def convert_audio_format(filename, default_format):
if filetype == default_format:
command += ['-c:a', 'copy']
else:
command += ['-ar', f'{config.get('file_hertz')}', '-ac', '2', '-b:a', f'{config.get('file_bitrate')}']
command += ['-ar', f'{config.get("file_hertz")}', '-ac', '2', '-b:a', f'{config.get("file_bitrate")}']

# Add user defined parameters
for param in config.get('ffmpeg_args'):
Expand Down Expand Up @@ -246,7 +246,7 @@ def embed_metadata(item, metadata):
command += ['-metadata', 'comment={}'.format(branding)]

if config.get("embed_service_id"):
command += ['-metadata', f'{item['item_service']}id={item['item_id']}']
command += ['-metadata', f'{item["item_service"]}id={item["item_id"]}']

for key in metadata.keys():
value = metadata[key]
Expand Down

0 comments on commit aaa37fb

Please sign in to comment.