mirror of
https://gitlab.com/MrFry/mrfrys-node-server
synced 2025-04-01 20:24:18 +02:00
Album art for audio
This commit is contained in:
parent
227fa36e6c
commit
3a7818b403
2 changed files with 16 additions and 1 deletions
|
@ -96,7 +96,8 @@ function appGetFileType (app, wildcard, contentType, pageToRender) {
|
||||||
path: p,
|
path: p,
|
||||||
fname,
|
fname,
|
||||||
url,
|
url,
|
||||||
contentType
|
contentType,
|
||||||
|
albumArt: GetAlbumArt(p)
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
@ -108,6 +109,15 @@ const fileTypes = [
|
||||||
['/*.zip', 'application/zip']
|
['/*.zip', 'application/zip']
|
||||||
]
|
]
|
||||||
|
|
||||||
|
function GetAlbumArt (path) {
|
||||||
|
let tmp = path.split('.')
|
||||||
|
tmp.pop()
|
||||||
|
tmp = tmp.join('.').split('/')
|
||||||
|
let last = tmp.pop()
|
||||||
|
|
||||||
|
return tmp.join('/') + '/.' + last + '.png'
|
||||||
|
}
|
||||||
|
|
||||||
fileTypes.forEach((t) => {
|
fileTypes.forEach((t) => {
|
||||||
appGetFileType(app, t[0], t[1], t[2])
|
appGetFileType(app, t[0], t[1], t[2])
|
||||||
})
|
})
|
||||||
|
|
|
@ -21,6 +21,11 @@
|
||||||
<h2>
|
<h2>
|
||||||
<%= fname %>
|
<%= fname %>
|
||||||
</h2>
|
</h2>
|
||||||
|
<image
|
||||||
|
style="width:auto; max-height: 400px;"
|
||||||
|
onerror="this.style.display='none'"
|
||||||
|
src=<%= url + albumArt %>
|
||||||
|
/>
|
||||||
<audio id="audioPlayer" controls style="width:100%">
|
<audio id="audioPlayer" controls style="width:100%">
|
||||||
<source src="<%= url %><%= path %>?stream=true" type=<%= contentType %>>
|
<source src="<%= url %><%= path %>?stream=true" type=<%= contentType %>>
|
||||||
</audio>
|
</audio>
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue