-
-
Notifications
You must be signed in to change notification settings - Fork 107
Description
You must use the search before you create an issue!
- I did use the search, I promise!
Current Situation
Hello, I'm opening this feature request because I am not capable of writing all the code necessary to make a proper pull request.
First thing first, Tidal proposes the original cover under the name origin.jpg alongside their reduced variants (1280, 640, 320 etc.) and I have written (with help of AI) the code necessary to download these but I am not able right now to make a checkbox correctly appear in the settings so I am posting this here in hope someone at ease with Qt can do it.
Suggestion / Feature Request
Here is the code I added for the download of "origin.jpg" to work :
I put this function in the "Download" class.
def save_original_cover(self, track, output_dir):
"""
Downloads and saves the original cover image for a given track's album.
This method retrieves the highest quality cover image available for the album associated with the provided track.
If the cover image URL ends with '.jpg', it modifies the URL to point to the original image version.
The cover image is then downloaded and saved as 'origin.jpg' in the specified output directory.
If the output directory is provided as a file path, its parent directory is used as the destination.
Args:
track: An object representing the track, expected to have an 'album' attribute with an 'image' method.
output_dir (str or Path): The directory or file path where the cover image should be saved.
Returns:
Path: The full path to the saved cover image file.
"""
url_cover = track.album.image(1280)
if url_cover.endswith('.jpg'):
url_cover = url_cover.rsplit('/', 1)[0] + '/origin.jpg'
cover_data = self.cover_data(url=url_cover)
# Save to output_dir with a unique name, e.g., "{album_id}_origin.jpg"
filename = "origin.jpg"
# If output_dir is a file path, get its parent directory
output_dir_path = pathlib.Path(output_dir)
if output_dir_path.is_file():
output_dir_path = output_dir_path.parent
output_path = output_dir_path / filename
with open(output_path, "wb") as f:
f.write(cover_data)
return output_path
and righ after shutil.move(tmp_path_file, path_media_dst)
I added :
if isinstance(media, Track) :
self.save_original_cover(media, path_media_dst)
So ideally there would be a self.save_original_cover boolean that depends on a checkbox in the settings.
Sorry if this issue was really unclear, this is the first time I am ""trying"" to contribute to a project.
Also, that's a great piece of software !
What operating system do you use?
Windows
Version OS
Windows 11 24H2