2013-04-26 06:01:53 +02:00
|
|
|
|
# just-play-something.sh #
|
|
|
|
|
|
|
|
|
|
As its name indicates, the main goal of just-play-something.sh is to put
|
|
|
|
|
some music on. Just anything. What the name doesn't indicate is that the
|
|
|
|
|
music is played by MPD.
|
|
|
|
|
|
|
|
|
|
Its use case is to be binded to a physical button of my router (which is
|
|
|
|
|
also my music box), so that I don't have to start a device with an MPD
|
|
|
|
|
client to start music (this is especially useful when I first wake up in
|
|
|
|
|
the morning). Therefore, it is written with portability in mind and
|
|
|
|
|
doesn't use any utility that might not be present on embedded systems.
|
|
|
|
|
Here are the required dependencies (beside MPD itself and its
|
|
|
|
|
command-like client, mpc):
|
|
|
|
|
- time
|
|
|
|
|
- ps
|
|
|
|
|
- date
|
|
|
|
|
- md5sum
|
|
|
|
|
- sed
|
|
|
|
|
|
|
|
|
|
What this script will do for you:
|
|
|
|
|
- first of all, if the MPD daemon looks down, it will be restarted;
|
|
|
|
|
then,
|
|
|
|
|
- if there are songs in the playlist but the playback is paused, it will
|
|
|
|
|
unpause;
|
|
|
|
|
- if there are songs in the playlist but the playback is stopped, it
|
|
|
|
|
will start playing the playlist from the begining;
|
|
|
|
|
- if there are no songs in the playlist, it will add a random album from
|
|
|
|
|
your library and play it;
|
|
|
|
|
- if music is already playing, it will be paused.
|
|
|
|
|
|
2013-04-26 06:32:28 +02:00
|
|
|
|
Tips:
|
|
|
|
|
- You can bind a short button press to 'just-play-something', and a long
|
|
|
|
|
press (or another button) to 'mpc clear ; just-play-something', so
|
|
|
|
|
that if you don't like what is currently in the playlist, you can
|
|
|
|
|
force playing a random album with a long press.
|
|
|
|
|
- Running this script from another host works just fine by setting the
|
|
|
|
|
MPD_HOST variable (and possibly MPD_PORT), for example:
|
|
|
|
|
MPD_HOST=192.168.0.254 just-play-something
|
2013-04-26 06:01:53 +02:00
|
|
|
|
|
|
|
|
|
|
2013-04-26 05:16:33 +02:00
|
|
|
|
# metflac-field2field.sh #
|
|
|
|
|
|
|
|
|
|
[Français ci-dessous.]
|
|
|
|
|
|
|
|
|
|
metaflac-field2field.sh uses metaflac to process field to field
|
|
|
|
|
copy/move on FLAC file metadatas.
|
|
|
|
|
|
|
|
|
|
Invocation:
|
|
|
|
|
|
|
|
|
|
metaflac-field2field.sh <ACTION> <SRC_FIELD> <DST_FIELD> <FILE.flac> \
|
|
|
|
|
[ <FILE2.flac> [...] ]
|
|
|
|
|
|
|
|
|
|
<ACTION> is the action to perform on the fields, amongst “copy”, “move”,
|
|
|
|
|
“rmcopy” and “mvcopy”:
|
|
|
|
|
- copy: each occurrence of SRC_FIELD is duplicated to create an
|
|
|
|
|
occurrence of DST_FIELD; all the existing occurrences of SRC_FIELD and
|
|
|
|
|
DST_FIELD are kept.
|
|
|
|
|
- move: each occurrence of SRC_FIELD is moved to create an occurrence of
|
|
|
|
|
DST_FIELD; the existing occurrences of DST_FIELD are kept.
|
|
|
|
|
- rmcopy: the existing occurrences of DST_FIELD are deleted, then each
|
|
|
|
|
occurrence of SRC_FIELD is duplicated to create an occurrence of
|
|
|
|
|
DST_FIELD; the occurrences of SRC_FIELD are kept.
|
|
|
|
|
- rmmove: the existing occurrences of DST_FIELD are deleted, then each
|
|
|
|
|
occurrence of SRC_FIELD is moved to create an occurrence of DST_FIELD.
|
|
|
|
|
|
|
|
|
|
<SRC_FIELD> is the action's source field.
|
|
|
|
|
|
|
|
|
|
<DST_FIELD> is the action's destination field.
|
|
|
|
|
|
|
|
|
|
Finally, the file(s) on which the action has to be run are specified at
|
|
|
|
|
the end of the command line.
|
|
|
|
|
|
|
|
|
|
----
|
|
|
|
|
|
|
|
|
|
metaflac-field2field.sh utilise metaflac pour effectuer des actions de
|
|
|
|
|
copie ou déplacement de champ à champ sur les fichiers FLAC.
|
|
|
|
|
|
2010-01-03 23:10:04 +01:00
|
|
|
|
Invocation du script :
|
|
|
|
|
|
|
|
|
|
metaflac-field2field.sh <ACTION> <SRC_FIELD> <DST_FIELD> <FILE.flac> \
|
|
|
|
|
[ <FILE2.flac> [...] ]
|
|
|
|
|
|
2013-04-26 05:16:33 +02:00
|
|
|
|
<ACTION> est l'action à effectuer sur les champs, parmi « copy »,
|
|
|
|
|
« move », « rmcopy » et « mvcopy » :
|
|
|
|
|
- copy : chaque occurrence de SRC_FIELD est dupliquée pour créer une
|
|
|
|
|
occurrence de DST_FIELD ; toutes les occurrences existantes de
|
|
|
|
|
SRC_FIELD et de DST_FIELD sont conservées.
|
|
|
|
|
- move : chaque occurrence de SRC_FIELD est déplacée pour créer une
|
|
|
|
|
occurrence de DST_FIELD ; les occurrences existantes de DST_FIELD sont
|
|
|
|
|
conservées.
|
|
|
|
|
- rmcopy : les occurrences existantes de DST_FIELD sont supprimées, puis
|
|
|
|
|
chaque occurrence de SRC_FIELD est dupliquée pour créer une occurrence
|
|
|
|
|
de DST_FIELD ; les occurrences de SRC_FIELD sont conservées.
|
|
|
|
|
- rmmove : les occurrences existantes de DST_FIELD sont supprimées, puis
|
|
|
|
|
chaque occurrence de SRC_FIELD est déplacée pour créer une occurrence
|
|
|
|
|
de DST_FIELD.
|
2010-01-03 23:10:04 +01:00
|
|
|
|
|
|
|
|
|
<SRC_FIELD> est le champ source de l'action.
|
|
|
|
|
|
|
|
|
|
<DST_FIELD> est le champ de destination de l'action.
|
|
|
|
|
|
2013-04-26 05:16:33 +02:00
|
|
|
|
On spécifie ensuite un ou plusieurs fichier sur lequel ou lesquels
|
|
|
|
|
effectuer l'action.
|