You are not logged in.

#51 2011-05-09 12:38:55

zeltak
Member
From: New England
Registered: 2010-08-07
Posts: 168

Re: Albumbler - A psychic playlist generator

thx for the quick reply keenerd!

im really loving this little script. another question that arised from using it for ~2 days. is it possible to run this as a deamon or another way so that it auto loads an album once one is finished? i listen to music alomist 14 hours a day and its a bit tedious to go back an launch albumbler every X minutes. am i missing something? does this feature already exist?

thx alot for your amazing script, it rocks ;-)

zeltak

Offline

#52 2011-05-09 13:07:58

keenerd
Package Maintainer (PM)
Registered: 2007-02-22
Posts: 647
Website

Re: Albumbler - A psychic playlist generator

That is a feature I've always kind of wanted.  The only problem:  If you leave the computer, it will think you love everything.  (You have to skip an album in the first minute to register dislike.)  Personally I just leave my player set to shuffle and loop forever.  When I get tired of it looping I hit the albumbler button again.

Actually, what do you mean by "tedious"?  I have Albumbler bound to a hotkey (windows F9) so it is not at all tedious to relaunch when I hear silence.

Anyway, it can be done.  For instance, "mocp -i" tells you what is going on.  Make a loop and run it in the background.  Something like
# while (1) do; sleep 1; if ( "$(mocp -i)" == "State: STOP"  ); then albumbler; fi; done;
But don't try to run that, it is not real bash.

Offline

#53 2011-05-09 21:00:36

zeltak
Member
From: New England
Registered: 2010-08-07
Posts: 168

Re: Albumbler - A psychic playlist generator

thx keenerd

im actually using mpd and have zero codin skills (even in bash smile) . i guess having the loop always runing could casue problems if you want to add just song etc but it may be worh a try.

Also a few more questions if you dont mind. since the script works 'outside' of the player and since you said adding a fav mark manually is not an option, how does one go about re-adding an album back to the fav side. For example somtimes a album comes up that i dont partiucalarly want to listen to NOW but i still really like, if i quikcly replace that album it will go the bottom of the list and will rarely appear agian right?  how does one go around that?
also would be cool if you could at least  blackmark albums you really dont want to listen to ever agian so the album will go to the the bottom

thx again, really love your script

zeltak

Last edited by zeltak (2011-05-09 21:09:10)

Offline

#54 2011-05-09 22:59:14

keenerd
Package Maintainer (PM)
Registered: 2007-02-22
Posts: 647
Website

Re: Albumbler - A psychic playlist generator

It is more complicated than a yes/no choice.  Forcing an album to never show up is kind of hard under normal use.  It will appear less frequently, but there is always a tiny chance remaining.

Preferences are not absolutes.  There is no concept of "favorite" or "unliked", instead groups of song are figured by association.  Albumber will not think "he never/always wants to hear X" but rather "since he did not want to hear X, he probably also does not want to hear Y or Z".

In short, don't worry.  Albumber will figure it out.

Offline

#55 2011-05-09 23:45:59

zeltak
Member
From: New England
Registered: 2010-08-07
Posts: 168

Re: Albumbler - A psychic playlist generator

hehehe ok ill start trusting Albumber smile

thx again

Zeltak

Offline

#56 2011-05-12 02:44:59

keenerd
Package Maintainer (PM)
Registered: 2007-02-22
Posts: 647
Website

Re: Albumbler - A psychic playlist generator

kerobaros: PlaylistExts is in, set it to nothing to disable playlists.  (Some people had emailed me about configurable extensions, kills two birds with one patch.)

The default is
playlistexts = m3u

Offline

#57 2011-05-23 08:20:22

kerobaros
Member
Registered: 2009-09-28
Posts: 2

Re: Albumbler - A psychic playlist generator

keenerd: thanks kindly! Solves my problem perfectly. Sorry I haven't thanked you sooner, been offline for a while.

Been using XBMC to listen to music a lot lately. If only there was a way to use Albumbler with it... actually, I think there's a way. Here's hoping I remember it tomorrow! (Would anyone else use an Albumbler/XBMC mashup?)

Offline

#58 2011-05-28 05:27:19

skystrife
Member
Registered: 2010-09-13
Posts: 8

Re: Albumbler - A psychic playlist generator

Curious: how insane would this get if you wanted to do this with song-level granularity instead of album-level granularity?

Offline

#59 2011-08-22 13:38:28

jbaber
Member
Registered: 2010-11-22
Posts: 5
Website

Re: Albumbler - A psychic playlist generator

Thanks again for this script!

What I used to attribute to network lag, I now realize is some problem in how albumbler hands over its playlist to mocp.  Sometimes, a playlist is handed over to mocp with an incorrect path. 
The following setup works for most playlists albumbler chooses:

$ mount                
/dev/sda5 on / type ext4 (rw,errors=remount-ro)
proc on /proc type proc (rw,noexec,nosuid,nodev)
...
jbaber@$SERVERNAME:/home/jbaber on /home/jbaber/$LOCALNAME type fuse.sshfs (rw,nosuid,nodev,max_read=65536,user=jbaber)

$ cat /home/jbaber/.config/albumbler/albumbler.config  
[Settings]
player = mocp
timewindow = 600.0
maxplaylist = 1000
musicpaths = /home/jbaber/$LOCALNAME/$DRIVE/music
notify = ratpoison

but ocasionally, I get a playlist like

$ head /tmp/boo.m3u
#EXTM3U
#EXTINF:-1,/home/jbaber/01 - Images pour Orchestre_ No. 1 Gigues.mp3
/home/jbaber/01 - Images pour Orchestre_ No. 1 Gigues.mp3
#EXTINF:-1,/home/jbaber/02 - Children's Corner_ Doctor Gradus ad Parnassum.mp3
/home/jbaber/02 - Children's Corner_ Doctor Gradus ad Parnassum.mp3
#EXTINF:-1,/home/jbaber/03 - Children's Corner_ Jimbo's Lullaby.mp3
/home/jbaber/03 - Children's Corner_ Jimbo's Lullaby.mp3
#EXTINF:-1,/home/jbaber/04 - Children's Corner_ Serenade for the Doll.mp3
/home/jbaber/04 - Children's Corner_ Serenade for the Doll.mp3
#EXTINF:-1,/home/jbaber/05 - Children's Corner_ The Snow is Dancing.mp3

when it should look like this (the result of manually adding the referred to files to the playlist):

#EXTINF:473,1 Claude Debussy - Images pour Orchestre: No. 1 Gigues (Images pour Orchestre, etc...)
/home/jbaber/$LOCALNAME/$DRIVE/music/debussy/Images_pour_Orchestre,_etc/01-Images_pour_Orchestre_No._1_Gigues.mp3
#EXTINF:149,2 Claude Debussy - Children's Corner: Doctor Gradus ad Parnassum (Images pour Orchestre, etc...)
/home/jbaber/$LOCALNAME/$DRIVE/music/debussy/Images_pour_Orchestre,_etc/02-Children_s_Corner_Doctor_Gradus_ad_Parnassum.mp3
#EXTINF:199,3 Claude Debussy - Children's Corner: Jimbo's Lullaby (Images pour Orchestre, etc...)
/home/jbaber/$LOCALNAME/$DRIVE/music/debussy/Images_pour_Orchestre,_etc/03-Children_s_Corner_Jimbo_s_Lullaby.mp3
#EXTINF:179,4 Claude Debussy - Children's Corner: Serenade for the Doll (Images pour Orchestre, etc...)
/home/jbaber/$LOCALNAME/$DRIVE/music/debussy/Images_pour_Orchestre,_etc/04-Children_s_Corner_Serenade_for_the_Doll.mp3
#EXTINF:156,5 Claude Debussy - Children's Corner: The Snow is Dancing (Images pour Orchestre, etc...)

Even with this ocassional speedbump, albumbler is serving me 12 hours a day, and I thank you!

Offline

#60 2011-08-31 18:00:22

rejoin
Member
Registered: 2011-06-06
Posts: 43

Re: Albumbler - A psychic playlist generator

Really nice contribution! The only question is-where does it save the playlist? I don't see any m3u when i do lsof | grep mocp. Also, as mentioned before, can you play only a track, not the whole folder/playlist, and automatically randomise a new track, so I don't need to enter albumbler when the last track of the playlist finishes.

Offline

#61 2011-08-31 18:36:10

keenerd
Package Maintainer (PM)
Registered: 2007-02-22
Posts: 647
Website

Re: Albumbler - A psychic playlist generator

You won't find a playlist because there is not any.  Mocp does not use playlists internally.  It takes a directory path and plays all the audio files found in that path.

Single-file mode is not a feature because it requires too much attention to operate (you might have to hit Albumbler every few minutes, frequent enough to become a distraction) and because I find random transitions between artists to be very jarring.  Maybe I'll add it just so people can see how horrible it is and stop asking :-)

Auto-continue can be provided by a small bash daemon:

while (sleep 1); do if [[ "$(mocp -i | head -n 1)" == "State: STOP" ]]; then albumbler; fi; done

Last edited by keenerd (2011-08-31 22:55:37)

Offline

#62 2011-08-31 18:55:18

rejoin
Member
Registered: 2011-06-06
Posts: 43

Re: Albumbler - A psychic playlist generator

Oh ok, I thought it puts the tracks you haven't skipped in a playlist and than plays it with moc. It seems I didn't understand the way it works.

Offline

#63 2011-08-31 21:21:38

hut
Member
From: Hanover, Germany
Registered: 2010-03-12
Posts: 569
Website

Re: Albumbler - A psychic playlist generator

I've been using it for over 6 months now and it's a really nice way to change music, thanks


"hut_" or "h00th00t" in irc.freenode.net #archlinux
Ranger Mailing List: https://lists.nongnu.org/mailman/listinfo/ranger-users

Offline

#64 2011-09-27 12:53:53

sxe
Member
Registered: 2009-06-04
Posts: 103

Re: Albumbler - A psychic playlist generator

Hi keenerd,
thx for your script, looks like something really useful.
Can you tell me how rating works? How does the script know what i like/don't like. I saw that it depends on the time you listen to an album(track)?
How does the script see what i skip?

Thx

Offline

#65 2011-09-27 16:14:06

keenerd
Package Maintainer (PM)
Registered: 2007-02-22
Posts: 647
Website

Re: Albumbler - A psychic playlist generator

It tracks when you call it.  If you call Albumbler twice in rapid succession (less than a minute by default) it assumes the first suggestion was not liked.

Albumbler does not try to rate (in an absolute "N out of 5 stars" sense) your likes or dislikes.  Instead it forms relative associations.  For example, some times I feel like vocal music.  Other times I feel like instrumental.  Albumber figures out that there several clusters of music I prefer depending on my mood.  If I skip over something vocal, then I probably want something instrumental and vice versa.  (These clusters are gray, interconnected and fluid so take this as an extreme simplification.)

Offline

#66 2011-09-29 17:48:46

sxe
Member
Registered: 2009-06-04
Posts: 103

Re: Albumbler - A psychic playlist generator

ok, sound good. I like it so far.

Offline

#67 2011-10-02 09:58:17

sxe
Member
Registered: 2009-06-04
Posts: 103

Re: Albumbler - A psychic playlist generator

I have tested the script the last days and i really like it.
Its pretty much what i was looking for and its even player independent, thats great.

There is one last thing i would like to get changed.

At least on my system with clementine, the script adds all albums from one artist, not only one album. Is that intended?
I would like to get only one album, cause listening to 5 albums of the same artist in a row is a bit to much. wink

Any chance to get that feature?

Offline

#68 2011-10-02 18:09:06

keenerd
Package Maintainer (PM)
Registered: 2007-02-22
Posts: 647
Website

Re: Albumbler - A psychic playlist generator

How do you have your music arranged?  Albumbler is designed for a nested directories.  Here are two layouts:

artist (A)
    album (B)
        tracks (C)
    album (D)
        tracks (E)

artist (F)
     album - tracks (G)
     album - tracks (H)

Where A-E is what it expects, while it sounds like you are using a layout like F-H.

Of course, even with A-E, you can still get all the albums for an artist, since "artist (A)" is itself a directory.  But if you don't want that, just skip it.  (Albumbler does not count skipping all of an artist's tracks against the albums nested inside.)

Offline

#69 2011-10-02 19:18:05

sxe
Member
Registered: 2009-06-04
Posts: 103

Re: Albumbler - A psychic playlist generator

The folders where i saw this behavior is arranged like this:

artist (directory)
  album (directory)
    track1
    track2
    track3
    etc

I'm not sure if thats the arrangement you described with F-H.

Offline

#70 2011-10-02 21:04:41

keenerd
Package Maintainer (PM)
Registered: 2007-02-22
Posts: 647
Website

Re: Albumbler - A psychic playlist generator

No, that looks like the first form.  As long as tracks are in their own album directories, it'll be fine.

Right now the random number generator is hating you.  Hit skip and it'll work itself out.

Offline

#71 2012-01-19 02:44:03

ldolse
Member
Registered: 2012-01-18
Posts: 7

Re: Albumbler - A psychic playlist generator

I'm really digging Albumbler, but I'm running into one nagging issue integrating it into my system.  I'm incorporating it into a Puppy Linux based livecd centered around mpd and a variety of clients including Albumbler.  I'm also using EMPCd to handle remote control functions and other input event driven actions.  While EMPCd is primarily a native mpd client it also can execute any shell command, so I'm using it to call Albumbler.  Basically I just want to turn on the system, hit a key on a remote control, and have Albumbler choose an album.

It's the integration between EMPCd and Albumbler where I'm having problems, and based on my troubleshooting thus far it looks like the fault lies with Albumbler somehow.  EMPCd works for every other use case.  Specifically the problem lies with daemonizing EMPCd as a part of system initialization/rc.d.  When started this way EMPCd calls Albumbler, but Albumbler does nothing (I do see it momentarily spawn in the process list).  On the other hand if I manually start EMPCd after the system is booted then everything works as expected.  In both cases everything is running as root, but it seems like Albumbler doesn't like being called by anything spawned from rc.sysinit/rc.d.  This is getting a little beyond my depth in Linux though so I figured I'd ask here.

Note while I originally discovered this with Puppy Linux I've just spent the last couple hours successfully reproducing it with Arch.  If need be I can provide any of the startup scripts/config files I used with Arch.

Last edited by ldolse (2012-01-19 04:05:20)

Offline

#72 2012-01-19 04:05:08

keenerd
Package Maintainer (PM)
Registered: 2007-02-22
Posts: 647
Website

Re: Albumbler - A psychic playlist generator

Sounds like a pretty nice setup.  I am stumped as to why it is not working out for you.  Will probably need to see those configs.

Do both the "mpd" (socket based) and "mpc" (CLI based) modes fail?

Offline

#73 2012-01-19 04:49:53

ldolse
Member
Registered: 2012-01-18
Posts: 7

Re: Albumbler - A psychic playlist generator

Thanks for the quick reply.  Overall I'm quite happy with the setup and Albumbler has become my preferred means of queuing music.  For me personally it's not a big deal to log in and restart the daemon manually, but since I'm partially targeting Linux neophytes with the livecd I'd love to find a solution.

I hadn't thought about trying mpc, but just gave it a shot - it's exactly the same - also failing when EMPCd is daemonized from rc.sysinit but works if I start EMPCd manually.

Here are the more detailed repro instructions:

If neccessary, install the mpd and mpc packages (EMPCd won't even start unless mpd is running):

pacman -S mpd mpc
cp /usr/share/doc/mpd/mpdconf.example /etc/mpd.conf
mkdir -p ~/.mpd/playlists

from there mpd.conf will need to be properly configured with your music directory and audio settings so that it starts without errors, and several lines referring to ~/.mpd need to be uncommented/configured.  All the errors need to be eliminated so that it will successfully launch during bootup which will in turn guarantee EMPCd starts.

Download & compile empcd.

cd /tmp
curl https://nodeload.github.com/ldolse/empcd/tarball/master -o empcd.tar.gz
tar zxvf empcd.tar.gz
cd ldolse-empcd-ccff69b
make
make install

Create a /etc/empcd.conf file with the following text (the final line is the key one, assumes albumbler is in your path, 'exclusive off' is also important)

#########################################################
# ecmpd.conf by Jeroen Massar <jeroen@unfix.org>
# Example empcd configuration file
#
# Lines starting with '#' or '//' are comment lines 
# Repeating spaces and tabs are trimmed
#########################################################

#########################################################
# MPD settings
#########################################################
# Run empcd under the 'mpd' account
//user mpd

# mpd_host [<password>@]<host> (defaults to "localhost")
//mpd_host password@mpd.example.org

# mpd_port <port> (defaults to 6600)
//mpd_port 6600

# Device to read events from
//eventdevice /dev/input/event0

# Exclusive (default) / Non-Exclusive device access
//exclusive
//exclusive on
exclusive off
//nonexclusive

#########################################################
# Key configuration
#########################################################
#
# key <key-id> up|down|repeat <function> [arguments]
#
# down   = key gets pressed down
# up     = key goes up (after being pressed down)
# repeat = key is kept down and sends repeat events
#
# functions (also see 'empcd --list-functions'):
# exec <shellcmd>	Execute a shell command (eg exec mount /dev/sdb2 /mnt)
# mpd_next		MPD Next Track
# mpd_play		MPD Previous Track
# mpd_stop		MPD Stop Playing
# mpd_play		MPD Start Playing
# mpd_pause [on|off]	MPD Pause Toggle (no options) or set
# mpd_seek		MPD Seek
#			"mpd_seek 0"   - begin of track
#			"mpd_seek 100" - begin of track
#			"mpd_seek +10" - advance 10 seconds
#			"mpd_seek -20" - backward 20 seconds
# mpd_random		MPD Random Toggle (no options) or set
#
#
#########################################################
# Play/Pause
//key KEY_KP1		UP	mpd_play
//key KEY_KP0		UP	mpd_pause

# Prev/Next
//key KEY_KPMINUS	UP	mpd_prev
//key KEY_KPPLUS	UP	mpd_next

# Seek to the beginning of the current song
//key KEY_BACKSPACE	UP	mpd_seek 0

#  2 seconds back/forward on 1 hit,
# 10 seconds back/forward when holding
//key KEY_KPSLASH	UP	mpd_seek -2
//key KEY_KPSLASH	REPEAT	mpd_seek -10
//key KEY_KPASTERISK	UP	mpd_seek +2
//key KEY_KPASTERISK	REPEAT	mpd_seek +10

# Toggle random mode
//key KEY_KPDOT		UP	mpd_random toggle

# Pause button, hold it down to pause, release for resume
//key KEY_KPENTER	DOWN	mpd_pause on
//key KEY_KPENTER	UP	mpd_pause off

# Clear Playlist (MPD stops playing), Load Playlist, Play
//key KEY_KP0		DOWN	mpd_plst_clear
//key KEY_KP0		DOWN	mpd_plst_load /archive/music/play.lst
//key KEY_KP0		DOWN	mpd_play
key KEY_EQUAL		UP	exec albumbler

Create a /etc/rc.d/empcd file with the following text (only got the 'start' arg working):

#!/bin/bash

. /etc/rc.conf
. /etc/rc.d/functions

case "$1" in
  start)
    stat_busy "Starting empcd"
    /usr/sbin/empcd &> /dev/null
    if [ $? -gt 0 ]; then
      stat_fail
    else
      add_daemon empcd
      stat_done
    fi
    ;;
  stop)
    stat_busy "Stopping empcd"
    # nothing here yet
    if [ $? -gt 0 ]; then
      stat_fail
    else
      rm_daemon empcd
      stat_done
    fi
    ;;
  restart)
    $0 stop
    sleep 1
    $0 start
    ;;
  *)
    echo "usage: $0 {start|stop|restart}"
esac
exit 0

Add mpd and empcd (order is important) to the end of the 'daemons' line in /etc/rc.conf:

DAEMONS=(syslog-ng network crond mpd empcd)

Reboot the system and validate that both mpd and empcd are automatically launched and running.  empcd is configured in this case to monitor the system keyboard non-exclusively.  Just type the '=' sign without quotes and Albumbler 'should' be called and queue up an album, but at this point you'll be reproducing the problem and nothing will happen.  If you then kill empcd (manually via its pid) and restart it then hitting the '=' sign will start working and Albumbler will queue new albums just fine.  It doesn't matter whether you restart empcd by directly calling the binary or starting it using the init script, it just matters that you do it manually.  I've been using 'mpc status' here just to validate whether an album was loaded.

Last edited by ldolse (2012-01-19 05:06:33)

Offline

#74 2012-01-19 05:05:05

keenerd
Package Maintainer (PM)
Registered: 2007-02-22
Posts: 647
Website

Re: Albumbler - A psychic playlist generator

Thank you, you do a good bug report.  Give me a day or two to set it all up.

One other thing to try:  Some scripts do not like having to deal with stdout.  Try disabling albumbler's output.  In albumbler.config, set

notify = none

Offline

#75 2012-01-19 05:20:07

ldolse
Member
Registered: 2012-01-18
Posts: 7

Re: Albumbler - A psychic playlist generator

Great, thanks, and take your time.  No difference with notify = none.

Offline

Board footer

Powered by FluxBB