Plugin Lyrics Manager for Amarok
Description
This script extends Amarok operations with lyrics. Lyrics Manager provides the following additional actions:
- edit lyrics with external editor,
- automatic text cleanup,
- export lyrics to file,
- import lyrics from file,
- erase lyrics from Amarok database,
- fill up lyrics with empty string,
- mass operations (process all files in the playlist).
The script is configurable via Amarok Script Manager. You can select menu items and features that you need, setup editor and storage directory for lyrics. All these parameters are saved in a config file and loaded silently at player startup.
Lyrics Manager takes care of HTML tags and special symbols in lyrics and lets you edit a plain text. If you enable editing features, you should configure editor. It can be any shell command with arguments, filename is inserted by script at the end. Editor must work in foreground mode.
If you enable file management features, you should configure texts directory. Script writes and reads files in it (don't forget to setup permissions). File names for each song are determined by template that is prompted during configuration. Supported placeholders are:
- %t for a title,
- %a for an artist,
- %l for an album,
- %r for a track number,
- %f for a filename without extension,
- %F for a filename,
- %% for a single percent symbol.
Any other % with a following symbol will be removed. Default template is "%a - %t.txt". Also you can save lyrics in the same dir where the audio file is. Use "Place text with music" option for that. "Automatic export after edit" feature helps you to keep texts directory up-to-date.
Files with an empty lyrics, i.e. lyrics that contain only space characters, are handled specially. You can choose whether to export and import empty lyrics or not. If you want to remove lyrics from Amarok database for particular file, use "erase" action. Player will automatically download lyrics when you play a file that has no lyrics entry in database. To prevent fetching you can use "fill up" action that will create that entry and put an empty string in it. This action applies only on empty lyrics, other cases are ignored.
Mass operations will save your time. They are also could be used to backup and restore lyrics. All items of playlist are handled sequentially and report is generated at the end.
Note that lyrics are stored by player only for those files that are in its collection. Script determines this status for each file and skips ones that are not in the collection.
Dependencies
- amaroK ≥ 1.4.3, < 2.0
- PERL ≥ 5.8
- KDialog ≥ 1.0 (optional: for GUI configuration)
Tested on: amarok 1.4.10; perl 5.8.8; kdebase 3.5.10.
License
The GNU General Public License (GPL), Version 2.
Download and install
Current version: Plugin Lyrics Manager 0.2.14.
Download archive and install the script using Amarok Script Manager. If you do not have KDialog installed (it comes with kdebase package) then configure the script manually using instructions in the next section.
Manual configuration
If you do not have KDialog installed then you have to configure the script manually. Run Lyrics Manager and then stop it. The script will create default config file at ~/.kde/share/apps/amarok/scripts-data/lyrics-manager.conf. You can edit it manually. Config is a simple ini-file, comments start with '#'. See example with full option set:
# Lyrics Manager configuration (this is example, not default) # preffered editor [string] editor=kwrite # texts directory [string] texts_dir=/mnt/data/music/lyrics # file template [string] file_template=%a - %t.txt # automatic export after edit [flag: 0 or 1] export_after_edit=1 # force empty lyrics export [flag: 0 or 1] export_empty=0 # force empty lyrics import [flag: 0 or 1] import_empty=0 # place text with music files (instead of texts dir) [flag: 0 or 1] place_texts_with_music=0 # menu configuration # menu item Edit lyrics [flag: 0 or 1] menu_item_edit=1 # menu item Export lyrics [flag: 0 or 1] menu_item_export=1 # menu item Import lyrics [flag: 0 or 1] menu_item_import=1 # menu item Erase lyrics [flag: 0 or 1] menu_item_erase=1 # menu item Export all playlist's lyrics [flag: 0 or 1] menu_item_export_all_playlist=1 # menu item Import all playlist's lyrics [flag: 0 or 1] menu_item_import_all_playlist=1 # menu item Fill up all empty playlist's lyrics [flag: 0 or 1] menu_item_fill_up_empty_all_playlist=1 # menu item Erase all playlist's lyrics [flag: 0 or 1] menu_item_erase_all_playlist=0
Known issues
The script could miss some special characters in lyrics if your locale is not Unicode. This seems to be DCOP restriction and there is nothing we can do.
Discussion
You can ask questions and suggest ideas in the corresponding topic of the blog or by sending emails directly. There is also the project page on KDE-Apps.org, but only registered users are allowed to comment there.
Thanks
Thanks to panzi (KDE-Apps.org), bleearg (KDE-Apps.org), BrutuZ (KDE-Apps.org), Max (xzoert.org), Vincent Ramos and others who suggested ideas and helped to test the script.
Change log
version 0.2.14 [02.12.2009]
- fix: bug in collection search algorithm for device paths containing special chars
version 0.2.13 [17.09.2009]
- update: improved flexibility of collection search algorithm
version 0.2.12 [20.07.2009]
- new: relative path support for file template
version 0.2.11 [24.05.2009]
- update: description and contacts
version 0.2.10 [01.05.2008]
- new: filename placeholders for file template
version 0.2.9 [27.08.2007]
- fix: denial that caused by xml tag
- fix: handling of special xml chars
version 0.2.8 [19.07.2007]
- new: option for placing text file at the same dir as music file
- update: prefix track by zero when it's smaller than 9
- fix: messages
version 0.2.7 [27.11.2006]
- update: improved flexibility of collection search algorithm
- fix: slash replacing in tags during filename composition from template
version 0.2.6 [23.11.2006]
- new: track placeholder for file template
- update: some db queries optimization
- update: not-found tags handling
- update: internal debug switch for queries
version 0.2.5 [03.10.2006]
- fix: switched to new db layout of amaroK 1.4.3
- update: versions of amaroK < 1.4.3 are not supported
version 0.2.4 [01.06.2006]
- fix: (for amaroK 1.4) lyrics tab refreshing when needed
- new: (for amaroK 1.4) a specification file
version 0.2.3 [02.05.2006]
- new: file template option for import/export
version 0.2.2 [29.03.2006]
- new: lyrics filling up
- new: lyrics erasing
- update: lyrics cleanup
- update: docs
version 0.2.1 [23.03.2006]
- fix: lyrics processing for amaroK 1.4
- update: lyrics cleanup
version 0.2 [13.03.2006]
- new: mass import and export
- new: menu management
- new: config file is optional, script can be configured for a time running
- new: tilde support for paths
- update: GUI configuration way and design
- update: config parser
- update: single import and export advanced
- update: docs
version 0.1.3 [04.03.2006]
- update: lyrics text processing
- update: code revision
- fix: configuration scheme
version 0.1.2 [25.02.2006]
- update: messages
- update: design
- fix: writing and reading lyrics files in some cases (empty files, bad permissions, etc.)
- update: docs
version 0.1.1 [24.02.2006]
- new: "export after edit" configuration option
version 0.1 [20.02.2006]
initial features:
- Edit, Export, Import functions via popup menu
- GUI configuration ("editor", "texts directory" options) using KDialog; manual configuration via editing plain-text config
- base cleaning up features (<br>, space, tabs, return removing)