Skip to content

Commit

Permalink
server, downloader: fix issue with local covers
Browse files Browse the repository at this point in the history
  • Loading branch information
dxstiny committed Jun 22, 2024
1 parent dc87f7b commit 8d1c782
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion src/server/downloader/newDownloader.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@

from helper.asyncThread import asyncRunInThreadWithReturn
from helper.singleton import Singleton
from config.customData import LocalTrack
from config.customData import LocalTrack, LocalCover
from db.database import Database
from db.table.songs import SongModel
from dataModel.song import Song
Expand Down Expand Up @@ -96,6 +96,11 @@ def __init__(self) -> None:
os.mkdir("./_cache")

async def _getCover(self, song: SongModel) -> bytes:
if song.cover.startswith("local:"):
cover = LocalCover.fromDisplayPath(song.cover)
with open(cover.absPath, "rb") as file:
return file.read()

async with aiohttp.ClientSession() as session:
async with session.get(song.cover) as resp:
if resp.status != 200:
Expand Down

0 comments on commit 8d1c782

Please sign in to comment.