File: mp3diag

package info (click to toggle)
mp3info 0.2.9-1
  • links: PTS
  • area: non-free
  • in suites: hamm, slink
  • size: 104 kB
  • ctags: 130
  • sloc: cpp: 1,013; makefile: 84; sh: 59
file content (62 lines) | stat: -rwxr-xr-x 1,795 bytes parent folder | download
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
60
61
62
#! /bin/bash

H=23
W=60
M=16

if [ "$1" = "" ]; then
   echo "Usage: $0 <filename>"
   exit
fi

if [ ! -f $1 ]; then
  echo "No such file"
  exit
fi

FILE="/tmp/mp3info.`whoami`.`date +%s`"

DATA=`mp3info -F1 $1 2>&1`

if [ "`echo $DATA | grep ^Error`X" != "X" ]; then
  echo "Error in MP3"
  exit
fi

while [ "$CHOICE" != "EXIT" ]; do
  TITLE=`echo $DATA | cut -f 1 -d \|`
  ARTIST=`echo $DATA | cut -f 2 -d \|`
  ALBUM=`echo $DATA | cut -f 3 -d \|`
  YEAR=`echo $DATA | cut -f 4 -d \|`
  COMMENT=`echo $DATA | cut -f 5 -d \|`
  GENRE=`echo $DATA | cut -f 6 -d \|`
  GNUM=`echo $DATA | cut -f 7 -d \|`
  dialog --menu "Select which option to change" $H $W $M Title "$TITLE" Artist "$ARTIST" Album "$ALBUM" Year "$YEAR" Comment "$COMMENT" Genre "$GENRE" "EXIT" "Done" 2>$FILE
  CHOICE=`cat $FILE`
  case $CHOICE in 
    Title)   dialog --inputbox "Enter Title" $H $W "$TITLE" 2>$FILE
             DATA=$(mp3info -F1 -t "$(cat $FILE)" $1)
             ;;
    Artist)  dialog --inputbox "Enter Artist" $H $W "$ARTIST" 2>$FILE
             DATA=$(mp3info -F1 -a "$(cat $FILE)" $1)
             ;;
    Album)   dialog --inputbox "Enter Album" $H $W "$ALBUM" 2>$FILE
             DATA=$(mp3info -F1 -l "$(cat $FILE)" $1)
             ;;
    Year)    dialog --inputbox "Enter Year" $H $W "$YEAR" 2>$FILE
             DATA=$(mp3info -F1 -y "$(cat $FILE)" $1)
             ;;
    Comment) dialog --inputbox "Enter Comment" $H $W "$COMMENT" 2>$FILE
             DATA=$(mp3info -F1 -c "$(cat $FILE)" $1)
             ;;
    Genre)   echo "dialog --radiolist \"Select Genre\" $H $W $M $(mp3info -p-$(expr $GNUM + 1)) 2>$FILE" >$FILE.g
             . $FILE.g
             DATA=$(mp3info -F1 -g "$(cat $FILE)" $1)
             ;;
    *)	     CHOICE=EXIT
             ;;
  esac
done

rm -f $FILE
rm -f $FILE.g