You are not logged in.
does anyone know how to make an recently added tracks playlist in mpd, sonata etc?
thanx ![]()
Archlinux x86_64 | post-engineering | last.fm
Offline
I can't really help you out, but I'm interested in this feature as well.
Offline
If your filename(s) doesn't contain any spaces or "weird" signs, the following will work:
grep added ~/.mpd/mpd.log | tail -n 10 | awk '{print $6}' | mpc add
replace ~/.mpd/mpd.log with your logfile and replace 10 with the number of songs to add.
Edit: Fixed
Last edited by patogen (2009-07-09 18:03:37)
We met up with the aliens and guess what? They have no word for fluffy!
Offline
awk '{if ($5=="added") {sub(".*added ",""); line++; list[line]=$0}} END {for (i=line-10; i<line ;i++) {print list[i]}}' mpd.log | mpc addI tried to remake patogen's script without using tail or grep commands (just for fun). This script should also be more tolerable with special characters.
Offline
just used this:
find . -type f -mtime -1 |egrep '\.mp3$|\.flac$' | awk '{ sub(/^\./, "audio"); print }' | mpc addthis is assuming one of you mpd directories is 'audio' and you are in that directory. It doesn't choke on weird characters, so maybe mpc changed something in the last few years (sorry for necrobump...)
this gets songs added today, but can anyone show a better way to cut out the file name?
egrep "`date '+%b %d '`" log | grep added | cut -d':' -f4 | cut -d' ' -f3-100Last edited by tladuke (2011-05-16 21:54:43)
Offline
Sorry for resurrecting a dead topic, but I was searching all night for this thread because I'd remembered seeing it before. Because of the directory structure in my music folder (as far as I can tell), none of these were working for me. So I took a bit of a shortcut and made myself a script to manually create a playlist file in the correct format instead of trying to get mpc to add songs to the current playlist. I used everyone else's work for this, especially tladuke. But if anyone else is looking for this solution, I just put this in a file:
#!/bin/bash
cd /path/to/your/music/directory && find . -type f -mtime -1 | egrep '\.mp3$|\.flac$' | awk '{ sub(/^\.\//, ""); print }' > /path/to/mpd/playlists/directory/newmusic.m3uThat'll create a playlist called newmusic, which you can then play. Obviously replace those with your own music directory and playlist directory. I'm not great with this stuff, but that ended up working perfectly for me. YMMV.
Offline