Skip to content

Commit

Permalink
Fixed same codec conversion error
Browse files Browse the repository at this point in the history
  • Loading branch information
Dniel97 committed Mar 17, 2022
1 parent 056c9af commit 63171a0
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 2 deletions.
13 changes: 12 additions & 1 deletion orpheus/music_downloader.py
Original file line number Diff line number Diff line change
Expand Up @@ -483,10 +483,21 @@ def download_track(self, track_id, album_location='', main_artist='', track_inde
self.print('Warning: conversion_flags setting is invalid, using defaults')

conv_flags = conversion_flags[new_codec] if new_codec in conversion_flags else {}
temp_track_location = f'{create_temp_filename()}.{new_codec_data.container.name}'
new_track_location = f'{track_location_name}.{new_codec_data.container.name}'

stream: ffmpeg = ffmpeg.input(track_location, hide_banner=None, y=None)
stream.output(new_track_location, acodec=new_codec.name.lower(), **conv_flags, loglevel='error').run()
stream.output(temp_track_location, acodec=new_codec.name.lower(), **conv_flags, loglevel='error').run()

# remove file if it requires an overwrite, maybe os.replace would work too?
if track_location == new_track_location:
silentremove(track_location)
# just needed so it won't get deleted
track_location = temp_track_location

# move temp_file to new_track_location and delete temp file
os.rename(temp_track_location, new_track_location)
silentremove(temp_track_location)

if self.global_settings['advanced']['conversion_keep_original']:
old_track_location = track_location
Expand Down
2 changes: 1 addition & 1 deletion orpheus/tagging.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ def tag_file(file_path: str, image_path: str, track_info: TrackInfo, credits_lis
tagger.tags.RegisterTXXXKey('compatible_brands', 'compatible_brands')
tagger.tags.RegisterTXXXKey('major_brand', 'major_brand')
tagger.tags.RegisterTXXXKey('minor_version', 'minor_version')
tagger.tags.RegisterTXXXKey('Rating', 'RATING')
tagger.tags.RegisterTXXXKey('Rating', 'Rating')
tagger.tags.RegisterTXXXKey('upc', 'BARCODE')

tagger.tags.pop('encoded', None)
Expand Down

0 comments on commit 63171a0

Please sign in to comment.