You are not logged in.

#1 2014-02-24 17:52:51

Rasi
Member
From: Germany
Registered: 2007-08-14
Posts: 1,914
Website

Help with a mpd parsing script

Hi... I am trying to create html outputs including album ratings via bash script parsing mpd.

The way I want it to work: I have a "rating.txt" file in each album directory.
i parse mpd info (artist first column, album 2nd column) and create a html file out of it.

this works fine. but i can't figure out how to get the ratings in the final file.

this is what i tried:

#!/bin/bash
echo '<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=utf-8" />
<meta name="robots" content="noindex" />
<title>My Music</title>
<body>
<script type="text/javascript" src="jquery.min.js"></script>
<script type="text/javascript" src="jquery.tablesorter.js"></script>
<script type="text/javascript"><!--
--></script>
<h1>My Music</h1>
<table id="music" class="tablesorter">
<thead>
  <tr>
    <th>Artist</th>
    <th>Album</th>
    <th>Rating</th>
 </tr>
 </thead>
 <tbody>'
while IFS='/' read -r artist
do
    printf "<tr><td>%b</td><td>" "$artist"
    while IFS='/' read -r f1 f2 f3 f4
    do
	#echo "$f1"
	printf "%b<br />\n" "$f3"
    done < <(mpc find albumartist "$artist") | sort -u
    echo "</td><td>$(cat "/mnt/wasteland/Audio/Rips/$(mpc find albumartist "$artist" | cut -d '/' -f 1-3 | uniq)"/album_rating.txt)</td></tr>"
done < <(mpc list albumartist)
echo "</table></body></html>"

any ideas?

Last edited by Rasi (2014-02-24 17:53:17)


He hoped and prayed that there wasn't an afterlife. Then he realized there was a contradiction involved here and merely hoped that there wasn't an afterlife.

Douglas Adams

Offline

Board footer

Powered by FluxBB