Updated editvorbis code.
There are now more options and safeguards.
This commit is contained in:
parent
a8353a9439
commit
bdff8389dd
26
README
Normal file
26
README
Normal file
@ -0,0 +1,26 @@
|
|||||||
|
==================
|
||||||
|
*** EditVorbis ***
|
||||||
|
==================
|
||||||
|
A shell script to allow you to edit vorbis tags using your favorite
|
||||||
|
editor.
|
||||||
|
|
||||||
|
# Dependencies
|
||||||
|
--------------
|
||||||
|
To use this script you will require the `vorbiscomment' tool.
|
||||||
|
|
||||||
|
# Installation
|
||||||
|
--------------
|
||||||
|
To install, you can use the `install.sh' script. This will install the
|
||||||
|
script as `$PREFIX/bin/editvorbis'. `$PREFIX' is an environment variable
|
||||||
|
that can be set, and is assigned to `/usr' by default (you may want to
|
||||||
|
use `/usr/local' instead).
|
||||||
|
|
||||||
|
# Usage
|
||||||
|
-------
|
||||||
|
Run the script with the `-h' option to get help information.
|
||||||
|
|
||||||
|
# License
|
||||||
|
---------
|
||||||
|
This script is licensed under the terms and conditions of the GNU
|
||||||
|
Affero General Public License version 3 or greater (see
|
||||||
|
`LICENSE' file for more information).
|
13
README.md
13
README.md
@ -1,13 +0,0 @@
|
|||||||
EditVorbis
|
|
||||||
==========
|
|
||||||
Edit vorbis tags using your favorite editor, you'll need to install `vorbiscomment`.
|
|
||||||
|
|
||||||
Usage
|
|
||||||
-----
|
|
||||||
```
|
|
||||||
editvorbis my_song.ogg
|
|
||||||
```
|
|
||||||
|
|
||||||
License
|
|
||||||
-------
|
|
||||||
This script is licensed under the terms and conditions of the [GNU Affero General Public License version 3 or greater](/LICENSE).
|
|
@ -16,8 +16,62 @@
|
|||||||
# You should have received a copy of the GNU Affero General Public License
|
# You should have received a copy of the GNU Affero General Public License
|
||||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
mkdir -p /tmp/editvorbis/
|
# constants
|
||||||
vorbiscomment "$1" > /tmp/editvorbis/comment.txt
|
APPNAME="editvorbis"
|
||||||
$EDITOR /tmp/editvorbis/comment.txt
|
VERSION="v2.0"
|
||||||
vorbiscomment -w -c /tmp/editvorbis/comment.txt "$1"
|
|
||||||
rm -rf /tmp/editvorbis/
|
# helper functions
|
||||||
|
function print_usage {
|
||||||
|
echo "Usage: $0 <file>"
|
||||||
|
echo "Usage: $0 -h | -v"
|
||||||
|
}
|
||||||
|
|
||||||
|
function print_info {
|
||||||
|
echo "$APPNAME $VERSION"
|
||||||
|
echo "Script for editing vorbis tags with your favorite editor."
|
||||||
|
}
|
||||||
|
|
||||||
|
# check number of arguments
|
||||||
|
if [ $# -ne 1 ]; then
|
||||||
|
echo "Wrong number of arguments."
|
||||||
|
print_usage
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
# show help information
|
||||||
|
if [ "$1" == "-h" ]; then
|
||||||
|
print_info
|
||||||
|
print_usage
|
||||||
|
echo " <file> File to edit tags."
|
||||||
|
echo " -h Show this help information."
|
||||||
|
echo " -v Show script version."
|
||||||
|
exit 0
|
||||||
|
fi
|
||||||
|
|
||||||
|
# print version
|
||||||
|
if [ "$1" == "-v" ]; then
|
||||||
|
echo "$APPNAME $VERSION"
|
||||||
|
exit 0
|
||||||
|
fi
|
||||||
|
|
||||||
|
# check if vorbiscomment is installed
|
||||||
|
command -v vorbiscomment > /dev/null
|
||||||
|
if [ $? == 1 ]; then
|
||||||
|
echo "Could not find vorbiscomment command in your PATH. Maybe it's not installed?"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
# check if the file exists
|
||||||
|
if [ ! -f $1 ]; then
|
||||||
|
echo "Regular file $1 does not exist."
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
TMPDIR="/tmp/editvorbis"
|
||||||
|
TAGFILE="$TMPDIR/$1.txt"
|
||||||
|
|
||||||
|
mkdir -p $TMPDIR
|
||||||
|
vorbiscomment "$1" > "$TAGFILE"
|
||||||
|
$EDITOR "$TAGFILE"
|
||||||
|
vorbiscomment -w -c "$TAGFILE" "$1"
|
||||||
|
rm -rf $TMPDIR
|
||||||
|
Loading…
Reference in New Issue
Block a user