File: draai123

package info (click to toggle)
draai 20201215-2
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, bullseye
  • size: 656 kB
  • sloc: sh: 854; perl: 170; makefile: 28
file content (59 lines) | stat: -rwxr-xr-x 1,268 bytes parent folder | download | duplicates (6)
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
59
#! /bin/bash

# draai123 - wrapper for ogg123 and mpg321.  See also music123.

#
# suggested usage:
#
#  ~$ cat <<EOT >muziekje
#   #!/bin/sh
#   find "$@" -type f | dr_permutate | while read t; do draai123 "$t"; done
#  EOT
#
#  ~$ muziekje [A-W]*
#  ~$ muziekje

#fixme: /bin/sh, use
#
#case $1 
#  *.ogg
#  ;;

if [[ "$1" == *.ogg ]]
then
    ogg123 -d alsa09 "$1"
    # ogg123 -d oss "$1"
    # 2>&1 | egrep -v '^Device|^Author|^Comments'
    # that would screw up the nice curses tricks...
    # it's NOT ogg123 which tries to be smart wether we have a tty.
    # it's probably grep screwing up.
    # | cat   works just fine.
elif [[ "$1" == *.mp3 ]]
then
    echo -n "Playing: "
    if command -v id3 >/dev/null
    then
        id3 -l "$1"
    elif command -v mp3info >/dev/null
    then
        echo
        mp3info "$1"
    else
        echo $1
    fi
    mpg321 -v -q "$1"
    # mpg321 "$1" 2>&1 | egrep -v '^High|^Version |^Uses |^THIS|^Directory'
elif [[ "$1" == *.flac ]]
then
    if command -v flac123 >/dev/null
    then
        flac123 "$1"
    else
        echo >&2 Skipping $1: no flac player found
    fi
else
    echo >&2 Skipping $1: .ogg nor .mp3 nor .flac
fi

echo '...........................................................................'