source: gutenbach-queue/queue @ 0b5842c

debianmacno-cupsweb
Last change on this file since 0b5842c was 0b5842c, checked in by Jessica B. Hamrick <jhamrick@…>, 14 years ago

Initial commit. The scripts should work, but they have some bugs.

  • Property mode set to 100755
File size: 1.3 KB
Line 
1#!/bin/bash
2
3found_current=
4
5if [ -e "/var/run/sipbmp3/queue_times" ]; then
6    rm "/var/run/sipbmp3/queue_times"
7fi
8
9cd /var/spool/lpd/sipbmp3/
10for i in $(ls . | grep ^hf); do
11    done=$(cat "$i" | grep done)
12    if [ ! -n "$done" ]; then
13        timestamp=$(cat "$i" | grep ^job_time= | sed 's/.*=//')
14        echo "$timestamp:$i" >> /var/run/sipbmp3/queue_times
15    fi
16done
17
18if [ -e /var/run/sipbmp3/queue_times ]; then
19    for i in $(sort /var/run/sipbmp3/queue_times); do
20        i=$(echo "$i" | sed 's/.*://')
21        prefix="df"${i:2}
22        for j in "$prefix"*; do song="$j"; done
23
24        user=$(cat "$i" | grep ^P=)
25        user=${user:2}
26   
27        if [ -e /var/run/sipbmp3/exiftool_data ]; then
28            rm /var/run/sipbmp3/exiftool_data
29        fi
30
31        exiftool "$song" >> /var/run/sipbmp3/exiftool_data
32        title=$(cat /var/run/sipbmp3/exiftool_data | grep "^Title " | sed 's/.*: //')
33        artist=$(cat /var/run/sipbmp3/exiftool_data | grep "^Artist " | sed 's/.*: //')
34
35        if [ -z "$found_current" ]; then
36            host=$(cat "$i" | grep ^H=)
37            host=${host:2}
38            album=$(cat /var/run/sipbmp3/exiftool_data | grep "^Album " | sed 's/.*: //')
39            echo "$user@$host is currently playing:"
40            echo "'$title'"
41            echo "by '$artist'"
42            echo "on '$album'"
43            echo ""
44            echo "Coming up in the queue:"
45            found_current="true" 
46        else
47            echo "$user: '$title' by '$artist'"
48        fi
49    done
50fi
Note: See TracBrowser for help on using the repository browser.