File: README.Usage

package info (click to toggle)
minirok 0.9.2-1
  • links: PTS
  • area: main
  • in suites: lenny
  • size: 372 kB
  • ctags: 378
  • sloc: python: 2,427; xml: 152; cpp: 118; sh: 70; makefile: 45
file content (104 lines) | stat: -rw-r--r-- 4,104 bytes parent folder | download
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
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
UI hints
========

  * Enqueue tracks in the playlist with Ctrl+RightButtonClick, like in
    Amarok.

  * Mark a track as "stop after this track" with Ctrl+MiddleButtonClick.

  * Press return in the tree view search line to append all the search
    results to the playlist, starting playback if the playlist was empty
    and the player stopped. Press return as well in the playlist search
    line to start playing the first track in the search result.


DCOP interface
==============

Minirok exports a DCOP interface containing functions to perform
Playlist actions (play, pause, playPause, stop, next, previous,
stopAfterCurrent), and a function to retrieve the currently playing
track, "nowPlaying".

This last functions comes in two flavours: without an argument, it will
return a string like "Artist - Title", or just "Title" if there's no
known artist. However, you can pass a string argument that will be
formatted against a dict of the tags with the Python % operator. For
example:

  % dcop minirok player nowPlaying "%(Artist)s - %(Title)s (%(Album)s)"

Do not forget the "s" after the brackets, it's needed by Python.

There is also a appendToPlaylist function, which does the same as
`minirok --append`. The function takes a QStringList as argument, so to
invoke it you must place the arguments between square brackets, like this:

  % dcop minirok player appendToPlaylist [ /path/to/file.mp3 ... ]

Note that you have to specify the full paths of files, or it won't work.

Finally, there is a toggleWindow function, which hides/shows the main
window.


Global shortcuts
================

One of the top items in the list of features I wanted was global shortcuts,
since I can't live without them. However, having them directly supported
in the application turned out impossible, because there's a bug in PyKDE
that makes the program crash when they're used. (See gaccel.py in the
pykde-bugs/ directory for an example and a link to a mailing list thread.
With a bit of luck, the Python bindings for KDE 4 won't suffer from this
bug.)

So the next option is using KHotKeys and DCOP. A default set of bindings
is provided, but it is disabled by default. To activate it, go to
Control Centre -> Regional & Accessibility -> Input Actions; there
should be a "Minirok" group there. Uncheck the "Disable" box, and voilĂ .
You can of course change the default keys.

If a Minirok group is not available, this probably means you're running
Minirok directly from the source tree, or that something went wrong with
kconf_update. You can go to the General Settings tab, and import directly
minirok.khotkeys by specifying the full path to its location (in the
source tree is in the config/ subdirectory).


Regular expressions
===================

Instead of reading tags from audio files, a Python regular expression
can be used to guess them from the filename. The full patch will be
searched, but the regular expression does not need to match the full
path (for pythonistas, it'll be a re.search, not a re.match). The tags
will be extracted from the named groups of the match, namely: "title",
"artist", "album", and "track".

Even if a regular expression is configured, tags will still be read from
the files in the background. This can be configured in the Preferences
dialog so that they are never read, or only if the regular expression
did not match. A regular expression match with an empty "title" group is
considered as failure to match.

An example of a simple regular expression that matches "Artist - Title.mp3"
would be:

    '/((?P<artist>.+?) - )?(?P<title>.+)\.[^.]+$'

A more elaborated one, the one I use:

    '(?i).*?/(\(\d+\) )?(?P<album>[^/]+(/(CD|vol|disco) *\d+)?)/((?P<track>\d+)_)?((?P<artist>[^/]+?) - )?(?P<title>[^/]+)\.[^.]+$'

This matches, case insensitively:

    .../Album/Artist - Title.mp3
    .../Album/07_Artist - Title.mp3
    .../(year) Album/07_Artist - Title.mp3
    .../(year) Album/cd 1/07_Artist - Title.mp3

For more information on Python regular expression:

    http://docs.python.org/lib/module-re.html
    http://docs.python.org/lib/re-syntax.html