Plugin configurations for Yammi

Yammi has a simple but powerful plugin concept, that allows to execute other programs (eg. the CD burning program K3b) feeding them information from Yammi (eg. the list of files you want to burn). Here are some plugin configurations that let you do lots of useful stuff from within Yammi.

If you want to write a new plugin, see the Plugin Howto page (and let me know about it if it is useful).

Grab and encode script

This script is invoked from Yammi for quickly ripping one song from a CD, encoding it and adding it to Yammi's database. (For ripping and encoding more than one song, I recommend using one of the available tools.)
The following script is installed together with Yammi by default. You can easily customize it to your needs (eg. let it encode with ogg vorbis).
#!/bin/bash
# script for grabbing and encoding a single track from cd
# example script provided for Yammi (see http://yammi.sourceforge.net)
# 3-2002 - 8-2002 by Oliver Noelle
# usage: yammiGrabAndEncode <trackNr> <artist> <title> <outfile>
#
# if you want to customize this:
# please make sure that <outfile> is only available when
# grabbing and encoding is completed
# Yammi relies on that! (it periodically checks whether <outfile> is existing)

# step 1: rip track from cd with the help of cdparanoia
echo "start grabbing..."
cdparanoia -q $1 "$4.wav"
echo "..done"

# step 2: encode the ripped track with the help of notlame
# here you can specify your encoding options like bitrate...
echo "start encoding..."
notlame -S -h --preset studio --ta "$2" --tt "$3" "$4".wav "$4.part"
echo "..done"

# step 3: mv the encoded mp3 file to final destination
rm "$4.wav"
mv "$4.part" "$4"

Shutdown script

This script is invoked if the sleep mode was activated and Yammi shuts down. The following entry is the default:
dcop ksmserver ksmserver "logout" 0 2 0
This has the same effect as choosing "Logout" / "Turn off computer" from the KDE menu. This should ensure that KDE shuts down properly, i.e. your session and open documents from running applications should be saved before shutting down.

MusicBrainz lookup

If you have the trm utility installed (see http://www.musicbrainz.org/products/trmgen/download.html) you can perform a music brainz search in konqueror for a song with a single click.
menu entry MusicBrainz Search
command konqueror http://www.musicbrainz.org/showtrm.html?trm=`/usr/bin/trm "{absoluteFilename}"`&
custom list
plugin mode single

Create CD Label

As you can burn a selection of songs to a CD from within Yammi, it makes perfectly sense to generate a cover for the very same selection of songs, using the information that Yammi can provide about these songs (artist, title, album, length, bitrate, ...) The best command line tool I found is cdlabelgen, which can be feeded with the entries for the cover. In the preferences of Yammi, you can define how one entry should look like via the custom list field, the following configuration creates reasonable covers with entries like:
1. Sylver - Turn The Tide (4:06)
If you used Yammi to burn song files to multiple CDs (data CDs), you can use the very same steps to generate a cover for your Data-CDs, with the difference that it will contain about a hundred entries instead of about 20 as a normal Audio-CD.
menu entry Create CD Label
command cdlabelgen -c "{inputString:title}" -s "{inputString:subtitle}" -b -w -i "{customList}" > /tmp/cover.ps
custom list {index}. {artist} - {title} ({length})%
plugin mode group

Export to m3u Playlist

Exports the selection of songs to a playlist file, readable by most media players.
menu entry Export as playlist (m3u)
command echo -n -e "#EXTM3U {customList}" > {fileDialog}
custom list #EXTINF:{lengthInSeconds},{artist} - {title}{newline}{absoluteFilename}{newline}
plugin mode group

Export to html page

Exports the selection of songs to a web page (html file), viewable by all browsers.
For this plugin to work, you need the files playlist-header.html and playlist-footer.html in the directory specified in the plugin command. (Save these files with the "Save link as..." function of your browser, they are not correct html).
menu entry Export to html page
command echo -n -e "`cat /home/oliver/work/playlist-header.html` {customListViaFile} `cat /home/oliver/work/playlist-footer.html`" > {fileDialog}
custom list <tr><td>{artist}</td><td>{title}</td><td>{length}</td></tr>
plugin mode group

Burn with K3b(audio)

Update: the new version of k3b uses --audiocd instead of --audio as a parameter. This plugin starts K3b with a new audio project, automatically adding all selected files, great for burning a selection of songs from Yammi onto an audio CD playable on any CD-Player. (technically, first an m3u file of the current selection of songs is created and passed to k3b).
You will need the fantastic burning program k3b for this script to work (but its worth getting it!).
menu entry Burn with K3b(audio)
command echo -n -e "#EXTM3U {customList}" > /tmp/burnlist.m3u && k3b --audiocd /tmp/burnlist.m3u &
custom list #EXTINF:{lengthInSeconds},{artist} - {title}{newline}{absoluteFilename}{newline}
plugin mode group

Burn with K3b(data)

Update: the new version of k3b uses --datacd instead of --audio as a parameter. This has the same effect as the plugin above, but uses a data project This means that you are not creating a normal audio CD but a data CD containing the mp3, ogg or whatever files without conversion.
menu entry Burn with K3b(data)
command k3b --datacd {customListViaFile} &
custom list (the underscore is to be replaced by a space) "{absoluteFilename}"_
plugin mode group

Export to csv File

Exports the selection of songs to a list readable by a spreadsheet (eg. KSpread, Excel).
Note: Avoid the occurrence of a semicolon (";") in the tags of your songs, as it will corrupt the export format.
(Another note: On my system it took KSpread about 10 minutes to open a csv-file with 3.000 song entries... better be patient!)
menu entry Export csv
command echo -e "{customList}" > /tmp/export.csv
custom list {artist};{title};{album};{length};{mediaList};{newline}
plugin mode group

Copy a song file to a specific directory

You can use this plugin to copy a selection of songs to a specific directory, for example to transfer songs to your portable media player.
menu entry Copy to...
command cp "{absoluteFilename}" "{directoryDialog}"
custom list
plugin mode single


Last update 09/3/2005.