add coverart
This commit is contained in:
parent
d7eb2c0863
commit
c3e19308aa
|
@ -55,6 +55,8 @@ async def select_track(request, ws, data):
|
||||||
fpath = fpath.replace('flac', 'opus')
|
fpath = fpath.replace('flac', 'opus')
|
||||||
fpath = parse.quote(fpath)
|
fpath = parse.quote(fpath)
|
||||||
track['url'] = fpath
|
track['url'] = fpath
|
||||||
|
coverart = parse.urljoin(fpath, 'folder.jpg')
|
||||||
|
track['coverart'] = coverart
|
||||||
ret = {'event': 'track', 'ok': True, 'data': track}
|
ret = {'event': 'track', 'ok': True, 'data': track}
|
||||||
await ws.send_json(ret)
|
await ws.send_json(ret)
|
||||||
|
|
||||||
|
@ -68,9 +70,11 @@ async def random_track(request, ws, data):
|
||||||
fpath = track.pop('filepath')
|
fpath = track.pop('filepath')
|
||||||
track.pop('last_modified')
|
track.pop('last_modified')
|
||||||
fpath = config.static_prefix + os.path.relpath(fpath, config.music_dir)
|
fpath = config.static_prefix + os.path.relpath(fpath, config.music_dir)
|
||||||
fpath = fpath.replace('flac', 'opus')
|
fpath = fpath.replace('.flac', '.opus')
|
||||||
fpath = parse.quote(fpath)
|
fpath = parse.quote(fpath)
|
||||||
track['url'] = fpath
|
track['url'] = fpath
|
||||||
|
coverart = parse.urljoin(fpath, 'folder.jpg')
|
||||||
|
track['coverart'] = coverart
|
||||||
ret = {'event': 'track', 'ok': True, 'data': track}
|
ret = {'event': 'track', 'ok': True, 'data': track}
|
||||||
await ws.send_json(ret)
|
await ws.send_json(ret)
|
||||||
|
|
||||||
|
|
|
@ -6,6 +6,10 @@ body {
|
||||||
box-sizing: border-box;
|
box-sizing: border-box;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
img {
|
||||||
|
max-height: 100%;
|
||||||
|
}
|
||||||
|
|
||||||
main {
|
main {
|
||||||
height: 100%;
|
height: 100%;
|
||||||
display: grid;
|
display: grid;
|
||||||
|
|
|
@ -122,6 +122,7 @@ function track_recv(data) {
|
||||||
player.firstElementChild.src = data['url'];
|
player.firstElementChild.src = data['url'];
|
||||||
player.load();
|
player.load();
|
||||||
player.play();
|
player.play();
|
||||||
|
document.querySelector('#albumCover').firstChild.src = data['coverart'];
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Websocket send */
|
/* Websocket send */
|
||||||
|
|
Loading…
Reference in New Issue
Block a user