blob: 6ecb6f8f6f57f395441354aaf0db4b2c36ef9076 (
plain)
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
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
|
#!/sbin/sh
FILENAME=`echo $@ | rev | cut -d' ' -f1 | rev`
# check for flags
for i in $@; do
case "$i" in
"-"*) unset ARTISTFLAG ALBUMFLAG SONGFLAG
;;
esac
[ -n "$ARTISTFLAG" ] && ARTISTNAME="$ARTISTNAME $i"
[ -n "$ALBUMFLAG" ] && ALBUMNAME="$ALBUMNAME $i"
[ -n "$SONGFLAG" ] && SONGNAME="$SONGNAME $i"
[ -n "$TRACKFLAG" ] && TRACKNUMBER="$i" && unset TRACKFLAG
[ -n "$YEARFLAG" ] && YEARNUMBER="$i" && unset YEARFLAG
case "$i" in
"-a")
ARTISTFLAG="y"
;;
"-A")
ALBUMFLAG="y"
;;
"-t")
SONGFLAG="y"
;;
"-T")
TRACKFLAG="y"
;;
"-y")
YEARFLAG="y"
;;
esac
done
ARTISTNAME=`echo $ARTISTNAME | sed 's/^ //'`
ALBUMNAME=`echo $ALBUMNAME | sed 's/^ //'`
SONGNAME=`echo $SONGNAME | sed 's/^ //'`
# guess artist name from title
ARTISTNAME_GUESS=`echo "$FILENAME" | cut -d'-' -f1 | sed 's/_*$//;s/_/ /g'`
# guess album name from title
ALBUMNAME_GUESS=`echo "$FILENAME" | cut -d'-' -f2 | sed 's/^_*//;s/_*$//;s/_/ /g'`
# guess track number from title
TRACKNUMBER_GUESS=`echo "$FILENAME" | cut -d'-' -f3 | cut -d'_' -f2`
# guess song name from title
SONGNAME_GUESS=`echo "$FILENAME" | cut -d'-' -f3 | sed 's/^_[0-9]*_//;s/_/ /g;s/\.mp3$//'`
# get the artist name input
[ -z "$ARTISTNAME" ] && echo "Input the Artist name:\nGuessed name is $ARTISTNAME_GUESS" && read ARTISTNAME
[ -z "$ARTISTNAME" ] && ARTISTNAME="$ARTISTNAME_GUESS"
echo "$ARTISTNAME"
# get the album name input
[ -z "$ALBUMNAME" ] && printf "Input the Album name:\nGuessed name is %s" "$ALBUMNAME_GUESS" && read ALBUMNAME
[ -z "$ALBUMNAME" ] && ALBUMNAME="$ALBUMNAME_GUESS"
echo "$ALBUMNAME"
# get the track number input
[ -z "$TRACKNUMBER" ] && printf "Input the track number:\nGuessed number is %s" "$TRACKNUMBER_GUESS" && read TRACKNUMBER
[ -z "$TRACKNUMBER" ] && TRACKNUMBER="$TRACKNUMBER_GUESS"
echo "$TRACKNUMBER"
# get the song name input
[ -z "$SONGNAME" ] && printf "Input the song name:\nGuessed name is %s" "$SONGNAME_GUESS" && read SONGNAME
[ -z "$SONGNAME" ] && SONGNAME="$SONGNAME_GUESS"
echo "$SONGNAME"
# get the year input
[ -z "$YEARNUMBER" ] && echo "Input the year number:" && read YEARNUMBER
[ ! -z "$YEARNUMBER" ] && mid3v2 -y "$YEARNUMBER" $FILENAME
# set tags for file
mid3v2 -a "$ARTISTNAME" -A "$ALBUMNAME" -t "$SONGNAME" -T "$TRACKNUMBER" $FILENAME
|