Musiql 0.0.20080602

Musiql is a command-line front-end to MPlayer that provides SQL-based music library management features using SQLite.
Musiql is a command-line front-end to MPlayer that provides SQL-based music library management features using SQLite. The project's goal is to provide a full set of music library management features without resorting to a menu-based interface.

Musiql imports music files into its database, extracting metadata from tags using Mutagen. SQL queries can then be used to retrieve lists of songs and play them in MPlayer. Static and dynamic playlists can be saved, and Musiql keeps track of playcounts and ratings for each track. Tracks can also be submitted to Last.FM as they are played, using lastfmsubmitd.

Musiql is written in Python, and uses pysqlite for database access.


You can get a summary of Musiql's options by running 'musiql --help'. The basic argument is the WHERE clause of a SQL query to your music database. Musiql will automatically prepend 'SELECT * FROM Tracks WHERE' to your query, so you should leave out that part. The fields in the default Banshee database that you can use to search on are:

MimeType TEXT,

Artist TEXT,
Composer TEXT,
Performer TEXT,
Conductor TEXT,
Lyricist TEXT,
AlbumTitle TEXT,
ReleaseDate DATE,
Label TEXT,
Title TEXT,
Subtitle TEXT,
Genre TEXT,

TrackNumber INTEGER,
TrackCount INTEGER,
DiskNumber INTEGER,
DiskCount INTEGER,
Duration INTEGER,

NumberOfPlays INTEGER,
LastPlayedStamp INTEGER,
DateAddedStamp INTEGER

One nice feature in SQLite is the REGEXP operater, which works like LIKE, but matches using regular expressions instead of only giving you wildcards.

There are a few special character sequences that Musiql recognizes in queries and replaces. These are:

~s Insert the 'SELECT * FROM Tracks WHERE' part of the clause.
This is done automatically at the beginning of the query, so
you only need it if you are doing a compound query. You should
use this instead of including the SELECT manually, so that you
don't have to worry about grabbing all the columns Musiql needs
in the right order.
~p'PATTERN' Insert a query that selects all songs in playlists with names
matching PATTERN, using SQL LIKE (with % as wildcard) for
matching. This inserts an entire SELECT statement, with no
need for any additional information from the user.
~P'PATTERN' Same as ~p, but uses REGEXP instead of LIKE.
~v'VIEW' Insert a query that selects all songs from the view named
VIEW. This will only match exact hits (no regular expressions
or wildcards are allowed). A view is a stored SELECT query.
It provides functionality similar to a smart playlist in
~d'DATE' Convert DATE from human-readable format to the machine's time
format (seconds since 1970 on UNIX systems). This is useful
if you want to search on the LastPlayedStamp column.
The date should be in the format 'dd Mon yy [HH:MM]'
(%d %b %y [%H:%M] in strftime format). The brackets indicate
that the time part is optional (i.e., don't include them).
For example, ~d'19 Apr 08' or ~d'19 Apr 08 23:00'.

Musiql will only execute a single statement, but you can issue compound SELECT statements joined by UNION, UNION ALL, INTERSECT, or EXCEPT. For a complete list of the SQL syntax supported by Musiql, see the SQLite website, bearing in mind that Musiql only allow you to submit SELECT statements, and even then, only the section following WHERE.

Once Musiql starts, it passes any keyboard input except the 1-5 keys through to MPlayer, so you can control playback normally. The 1-5 keys are used to rate songs. If you press one of these keys, it will update the song's rating in your database. You can then write queries that select songs with particular ratings. These keys normally control contrast, brightness, and hue in MPlayer, so you shouldn't miss them while playing audio.


Python 2.5

What's New in This Release:

The user-visible changes in this release are fairly minor. The biggest change is probably the addition of an easy way to install Musiql, using distutils. Running 'python install' as root will now install musiql into /usr/bin and its modules into wherever python keeps its modules on your system. Other changes include the addition of support for importing wma files and a bug fix for a crash that occurred if you tried to play a song with no artist or title. It is also now possible to replace a playlist using only one command: musiql -x foo -s foo "~pfoo UNION title like 'bar'" This will replace the playlist 'foo' with a new playlist of the same title that contains everything in the old playlist plus anything else that matches the
query. Previously, this would have simply deleted 'foo', since deletion happened after saving.

last updated on:
July 31st, 2008, 12:23 GMT
license type:
GPL (GNU General Public License) 
developed by:
Park Cram
ROOT \ Multimedia \ Audio
Download Button

In a hurry? Add it to your Download Basket!

user rating 5



Rate it!

Add your review!