-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathmpdplaylist
More file actions
executable file
·58 lines (52 loc) · 1.23 KB
/
Copy pathmpdplaylist
File metadata and controls
executable file
·58 lines (52 loc) · 1.23 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
#!/bin/sh
#
# mpdpl2html - MPD playlist to HTML
# by pfish - 2010
# Version 0.1
# License: GPL 2
#
# Requirements:
# mpd
# mpc
# sed
#
#USER=`whoami`
PLAYLIST=$(mpc playlist)
FILE="mpdplaylist.html"
DATE=$(date -R)
rm -f /tmp/mpd_playlist_tracks
echo "$PLAYLIST" | while read line; do
artist=$(echo "$line"|awk -F ' - ' '{ print $1 }')
title=$(echo "$line"|awk -F ' - ' '{ print $2 }')
echo "<tr class=\"newartist\"><td rowspan=\"1\">${artist}</td>" >> /tmp/mpd_playlist_tracks
echo "<td>${title}</td></tr>" >> /tmp/mpd_playlist_tracks
done
echo "<!-- Generated with mpdpl2html by pfish - $DATE -->
<html>
<head>
<meta charset=\"utf-8\"/>
<link rel=\"stylesheet\" href=\"https://css.53280.de/bootstrap.min.css\">
<style>
body{background:#eee}
table{
margin:5em auto;
max-width:56em;
background: white;
}
</style>
<link href=\"https://css.53280.de/font-awesome.min.css\" rel=\"stylesheet\">
</head>
<body>
<div class=\"table-responsive\">
<table id=\"music\" style=\"white-space: nowrap;\" class=\"table table-bordered\">
<thead>
<tr>
<th>Artist</th>
<th>Title</th>
</tr>
</thead>
<tbody>
$(cat /tmp/mpd_playlist_tracks)
<hr />
</body>
</html>" > $FILE