source: gutenbach-queue/debian/lib/queue @ 39452be

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

First commit of gutenbach-queue as an actual package. Not yet tested.

  • Property mode set to 100755
File size: 1.4 KB
Line 
1#!/bin/bash
2
3found_current=
4
5if [ -e "/var/run/gutenbach/queue_times" ]; then
6    rm "/var/run/gutenbach/queue_times"
7fi
8
9cd /var/spool/lpd/gutenbach/
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/gutenbach/queue_times
15    fi
16done
17
18if [ -e /var/run/gutenbach/queue_times ]; then
19    for i in $(sort /var/run/gutenbach/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/gutenbach/exiftool_data ]; then
28            rm /var/run/gutenbach/exiftool_data
29        fi
30
31        exiftool "$song" >> /var/run/gutenbach/exiftool_data
32        title=$(cat /var/run/gutenbach/exiftool_data | grep "^Title " | sed 's/.*: //')
33        artist=$(cat /var/run/gutenbach/exiftool_data | grep "^Artist " | sed 's/.*: //')
34
35        if [ -z "$found_current" ]; then
36            host=$(cat "$i" | grep ^H=)
37            host=${host:2}
38            filenm="$(cat $i | grep "^filenames" | sed -e 's/filenames=//')"
39            album=$(cat /var/run/gutenbach/exiftool_data | grep "^Album " | sed 's/.*: //')
40            echo "$user@$host is currently playing: "
41            echo "$filenm"
42            echo "'$title'"
43            echo "by '$artist'"
44            echo "on '$album'"
45            echo ""
46            echo "Coming up in the queue:"
47            found_current="true" 
48        else
49            echo "$user: '$title' by '$artist'"
50        fi
51    done
52fi
Note: See TracBrowser for help on using the repository browser.