You are not logged in.

#1 2008-10-02 21:52:51

Procyon
Member
Registered: 2008-05-07
Posts: 1,819

ampc & pyampc - album-based mpd clients

ampc - latest version 0.8
pyampc - latest version 0.5

Both apps try to work in an album based setting. With support for making playlists and playback when you want everything organized by album only.

It is not like other mpd clients:
If you try to load an unsorted playlist, it will look very weird.
The playlist creation will result in one large playlist.
It has support for a smaller playlist of bookmarks

----------------------

pyampc

Dependencies: python-mpd

Screenshot:
Left pane: standard view with pstree
scrot20081221212247jk0.th.png

Left pane: play songs from a search
scrot20081225154358rn9.th.png

Left pane: change the configuration
scrot20081225154520za5.th.png

Playlist features:
Save, load, create a new one (entire database sorted by Album / Disc / Track)
Sort the current playlist
Remove a pattern (it's integrated in search, press 'R' for a menu) it will store removed tracks from the playlist in a 'removed' playlist so you can keep track of it and redelete them again later.

Playback feature:
Browse a list directly by album and track
Browse search results and other playlists in the left pane (play if they are in the main list)

Usage:
Press 'g' to configure. All the keys are there and some other options too.
Config is stored in ~/.pyampc
'a' gives an advanced features menu

Not in the configure are the keys: 1-9. Don't bind them, they are used for saving and storing a custom list that you load on the left (see screenshot 2) These are stored across sessions.

Keys:
uUmM: browse album. jk: browse track. z: play song browse is on or left pane selection is on. x: restore left pane. c: center right pane (stops browse mode). i: give info on current song or song browse is on. sSdD: browse left pane. g: configuration. a: advanced menu. q: quit. -=: next/prev song. {}: seek +/-5. p: toggle pause. /?: initiate quick search. nN: next/prev quick search match. R: remove menu for left pane results.

Bugs:
Special characters are unbindable, so all config keys must be characters. -> I know how to fix it now, may do it later.
On stop will try to go back to play/pause, or play the very first song, and quit if unsuccessful, I think this can happen if you clear the list externally. (proper stop support may be added later)
No password support. (no idea how to implement)
Config file problems? I have to run some tests
It sometimes crashes when you leave it in browse mode when the player goes to new albums.
I noticed screen corruption, but very rarely (just restart the client)
I had a zombie process id3info once, also fixable by restarting the client.

Bugs to verify:
Pressing keys causes a new cycle so holding a key to browse may be CPU intensive. (Solving this may give other problems.) (I have tried it a few times and it seems to be fine, but I don't know about data throughput for a net connection e.g.)

Plans:
I'm not changing a bit about it anymore, it does exactly what I want.

N.B./oddities:
It looks at mpd.conf to see the full path of the database, so it can run id3info and ogginfo to find out the bitrate of a song when you press 'i' (there are checks in place to not do anything if it can't find mpd.conf). This isn't very compatible, but I can't think of another way (status just gives the current song's bitrate and I like to compare two identical albums to decide which to delete.)


-------------------

ampc

Screenshot:
ampcdscreenshotgr4.th.pngthpix.gif
(an old screenshot, but the dmenu part is still like the latest version)

Playlist features:
Make a playlist sorted by Album / Disc / Track
Sort other playlists

Playback features:
Can pick anything from a short list of albums and tracks that are around the currently playing one.
Find and single pick support from search results, bookmarks, complete album list.

Usage:
Please see the other posts for specific explanation of options (documentation inside the program is lacking)
The latest version will require a bit of digging through the CONFIGURE part of the source.
After that it works with ampc -d, to launch a dmenu app
It can also work nicely as a ticker and ampc -3 -alt, but you have to wrap it around a while true.

Bugs:
Some problems with eval.
No documentation.
Messy source.

Plans:
Nothing.

Last edited by Procyon (2009-02-03 19:08:54)

Offline

#2 2008-10-03 13:23:00

Procyon
Member
Registered: 2008-05-07
Posts: 1,819

Re: ampc & pyampc - album-based mpd clients

First version:

Pastebin:

http://paste.pocoo.org/show/ZzwCzGAUmerNKkFZf9hf/


OPTIONS:

optional: ampc -db
This will clear your playlist and make a new one from everything in your database.
I put quite some effort into the sort. It won't just add root and mess everything up with unsorted filenames, but it will collect all the id3 tags and sort by Album / Disc / Track. If some songs don't have the tag they will be added as they were.

required once: ampc -st
This will store the album list in ~/.ampc
Everything depends on this. It makes the album list that is displayed. It is stored on HDD because if it's big mpd will be a bit too slow to give it to netcat swiftly.

select menu (in a term): ampc -s
It will display the regular view with some player commands (like next/prev).
Everything is prefixed with a number. You can choose anything in the list and it will either ignore it, play it, send it to mpd, find it*, or run it.
*find only works well in dmenu

dmenu: ampc -d
Same as select.

under the hood: ampc -p "commands"
(this is what the UIs do, commands needs to be in 1 arg (quote it))
ampc -p "(songID) any text" -- plays songid (these are shown in the UI)
ampc -p "find searchtext" -- searches and plays first match
ampc -p "exec program args" -- runs another program
(anything else) ampc -p "pause" -- sends the command to mpd

Examples you can send to mpd: next/previous/pause/stop/repeat 1/etc

New in this version:

I added dialog support. ./ampc -dl
It was easier than I thought, especially since it looks alright without using any advanced features (just --menu).

Find was changed to './ampc -f search terms'
It will give back a list of matches.
That means ./ampc -d -f search terms, will let you pick a result to play in dmenu.
Since dialog also can't change what you pick, I added an input box function for it called dialog_find, it works only in select and dialog menu, so if you select it in dmenu nothing happens

Added replay current song. ./amp -r
It just seeks to 0 of current song.

Pastebin:

http://paste.pocoo.org/show/Rw2nCUYa94wLoVV5MPTL/

Screenshot of dialog:

scrot20081003150802ni8.th.pngthpix.gif

Last edited by Procyon (2008-12-22 11:04:11)

Offline

#3 2008-10-04 16:56:56

Procyon
Member
Registered: 2008-05-07
Posts: 1,819

Re: ampc & pyampc - album-based mpd clients

V3

There was a bug that ignores the last item in the database when making a playlist.
And a bug where browse doesn't work on the first album.

I added bookmarks. I think "the mpd-way" is to use a bookmarks playlist. It will now add files to it or load files from it. Loading works by searching for the filename in the current playlist. So if the bookmark isn't in your playlist, it doesn't work.

And you can now specify how many tracks/albums to display.

Also I moved everything configurable to the top.

New options:
-bml   Show your bookmarks playlist
-bms  Stores current song in your bookmarks playlist
-anb n  Show n albums before & after
-tnb n  Show n tracks before & after

I have to repeat: when you try it out, don't forget ampc -st.

Pastebin:

http://paste.pocoo.org/show/a10EyqxwzpIXRBaLtqgE/

Edit:
I forgot one close statement in the database creation, so it will wait for timeout (I thought it was taking long). And you can specify both before and after for the grep search.
http://paste.pocoo.org/show/xSdzZNTv8NfFTavt8cog/

Last edited by Procyon (2008-10-08 14:28:49)

Offline

#4 2008-10-17 00:52:57

Procyon
Member
Registered: 2008-05-07
Posts: 1,819

Re: ampc & pyampc - album-based mpd clients

A minor edit, the find usage was repeating the search (debug leftover)
I moved some stuff around. It's not of influence. I wanted to add a feature which needed it, but I didn't want to add it after all.

http://paste.pocoo.org/show/RxhQRXwzN38mk5T3KpW3/

Other bugs I noticed: sometimes dmenu doesn't show up, blocks the keyboard and doesn't respond. CTRL+ALT+F1 and pkill dmenu (and/or ampc?) fixes it. It's only happened twice to me.
I think it has something to do with netcat not closing and dmenu waiting for input while still blocking the keyboard. There must be a case where 'close' isn't echo'ed.

And restarting mpd changes the playlist numbering. I don't really know how this works, I think it only happens if there are gaps in the numbering. If the album list doesn't display, run ./ampc -st again.

I'm still thinking about adding something to edit the playlist. Probably just an editable search that removes songs. (so you can get rid of 'instrumental/karaoke' songs e.g.)

Offline

#5 2008-10-17 14:46:46

Procyon
Member
Registered: 2008-05-07
Posts: 1,819

Re: ampc & pyampc - album-based mpd clients

http://paste.pocoo.org/show/aqTDqj9Bu95Ne4cvuEuF/

Added the filtering.

As it is the following happens after running "ampc -rm search term"
A file is made (/tmp/ampc_rmfile) which will have "(ID) file information" for everything that matched.
It will run an editor (leafpad) on it. You can delete lines you don't want to have filtered out of your playlist
It will remove these.

You can change this behavior in the script with
a_autoeditremovefile=true
a_autoeditor=leafpad
a_autoremoveafteredit=true

So a manual approach, after setting the two booleans to false:
ampc -rm search term
leafpad /tmp/ampc_rmfile
ampc -rmf

(The above commands are added in "Player controls" but commented)

Note that -rm and -f too do not use an AND search, so if the title is "foo bar instrumental" then "ampc -rm instrumental foo" will not match it. but e.g. "bar instrumental" will.

I may change this and update the post. (see edit below)

BTW concerning the dmenu hanging bug, I didn't find the trouble maker.
And the playlist IDs changing after restarting mpd will probably happen by using the filter.

Edit:

Adding "AND search" was easier than expected. I hope it works as expected though, I didn't test it thoroughly, but I think I got it

http://paste.pocoo.org/show/s8i8vt9yP8xtvZCJjy7t/

This applies to -f and -rm.

Last edited by Procyon (2008-10-17 16:28:06)

Offline

#6 2008-10-17 16:55:58

fflarex
Member
Registered: 2007-09-15
Posts: 466

Re: ampc & pyampc - album-based mpd clients

I've checked out this thread every time you've updated it now, because it sounds interesting, but I still can't figure out exactly what this is. Is it meant to be a full-blown client implemented with bash and mpc? Is it just a script to help you build mpd playlists in your own way? Who would use this and how would they use it?

Offline

#7 2008-10-17 18:29:55

Procyon
Member
Registered: 2008-05-07
Posts: 1,819

Re: ampc & pyampc - album-based mpd clients

Thanks for the interest.

It is split up in two programs.

The first is the playlist maker:
"ampc -db" makes a playlist sorted by Album / Disc / Track.

This should be useful for anyone who is annoyed by their client messing up their playlist with artist based sorting or directory based sorting. (Take "mpc -ls | mpc -add(?)" for example.) If your music directory is structured exactly for mpd, then this won't be very interesting. It's also not interesting if you like to make a very personalized playlist.

The rest of the program is really steering a running mpd.
By that I mean the program only changes the current song and exits.
So it's like mpc in that regard.

The UI should be interesting if you like to see what album comes next. And if you like to browse by album and pick the next song to play by album.

So it presumes an album based playlist, but it's not necessary (so you can use it with your own playlist without having used "ampc -db", but it may be unsorted)

Usage now comes down to:

"ampc -st" to store the album list in ~/.ampc
This is needed after the playlist changes (you can tell if you don't see albums)

To test it you can run "ampc" in a terminal and it will output an album list and a track list.
Comment this out though (the defaults are a bit personalized) firstline='echo "-----($(usefulinfo_oneline))"'

The UIs then are: select -s / dialog -dl / dmenu -d

Dialog and screen should work fine, dmenu needs some configuration because I use the vertical patch.

And configuration is also needed for the player controls because it's set for dmenu (you can tell by the -d switches instead of -dl)
And the player controls by default also do not have previous/next song/etc, because I have bound those to multimedia keys.

So:
a_dm='dmenu -i -l 24 -rs -ni -xs -p ampc'
Can be changed to a_dm='dmenu -i' to use the horizontal dmenu.

And you can change "a_player_controls" to something like this, for dialog usage:
a_player_controls='echo pause
echo next
echo exec ampc -dl -b
echo exec ampc -bms
echo exec ampc -dl -bml
echo dialog_find'

I think that is all that is needed.

Offline

#8 2008-10-18 22:41:32

fflarex
Member
Registered: 2007-09-15
Posts: 466

Re: ampc & pyampc - album-based mpd clients

Ah, I see. Well I don't think I have a use for this myself, because my collection is handled fairly well by MPD. But it's still a neat project, good luck with it.

Offline

#9 2008-10-20 12:34:58

Procyon
Member
Registered: 2008-05-07
Posts: 1,819

Re: ampc & pyampc - album-based mpd clients

Bug fix: the "AND search" for finding didn't work with just one term. I made a quick patch, I'll make a more efficient fix later.

I also replaced -q with -1 for 1 line. And it's easier to configure. I forgot to put in the comment there things you can put in it. Which is: $a_calb (current album), $a_csong (current song), $a_cperc (current percentage complete).

http://paste.pocoo.org/show/hETddbC89cylQF7Ffjsq/

Something else that is on my mind is unifying the frequently occurring sed command to extract info from an mpd playlist. I already combined -f and -rm, but I'll look into making the entire program nicer.

Offline

#10 2008-10-29 00:07:04

Procyon
Member
Registered: 2008-05-07
Posts: 1,819

Re: ampc & pyampc - album-based mpd clients

Some bug fixes, simplifications and new features

http://paste.pocoo.org/show/LdjJpGryjuFIUxbCHoau/

New features:
-rep (toggle repeat current song mode)
-refr/-sort (for sorting other playlists, -refr will change the playlist file itself, -sort only gives filenames as output. I use this for my bookmarks playlist)
-proc (internal use, it will display mpd output nicely.)

Source code changed a lot, it should be a little bit faster now, because of less recursive calls. I also removed lots of useless comments.

It shouldn't be too hard now to switch from Album to Artist Album sorting.

Removed select menu. (I may axe dialog too)

-r (replay current song) removed

-f should work better now

-rm now incorporates -rmf. It also writes a log of files removed to ~/.ampc_filterlog
This should be useful when you make a new DB and want to remove them again.
I'll write an update that can map the files to IDs.

I found that the hanging bug was caused by some characters in the album name. I wonder if I got them all now.

Plans: change the output to different profiles, instead of countless switches. Because I really like how -1 works now (look at the source code in Configure).

Bugs: there is at least one missing file bug (for a bookmarks.m3u). I'll put some checks in place.

Offline

#11 2008-11-03 13:09:15

Procyon
Member
Registered: 2008-05-07
Posts: 1,819

Re: ampc & pyampc - album-based mpd clients

New version! http://paste.pocoo.org/show/LNu4TfxkzIAnp1QXUZ4g/

Changed how things are displayed, so now you have to pick/configure a tier.

Different tiers have different variables available, because they can be quite costly to generate. Like this you can use time to compare tier 1 to 4 and see it's a lot faster.
And there are two alternatives per tier, usable like this: ampc -1 (regular tier 1) or ampc -4 -alt (alternative tier 4)

Without any arguments it won't display anything, but will make all the variables.

Internally I changed the mpd command processor to awk which is a lot more efficient. Except where it's just one bit of information you want though, that's faster manually.

Added -rest (restore). It will remove files from the playlist that you have removed before using -rm. Because -rm will generate a log in ~/.ampc_filterlog.

Added another character causing trouble in album names to escape.

Remaining bugs: a " in the filename will cause -rest to likely ignore that file. I don't think I've ever seen such a filename though, and it's not very likely that it will be -rm'ed as well.

Plans: Change all the variable names to make more sense.

Edit: and there is a small bug where write(stdout): Broken pipe is printed on stderr, but nothing seems to have gone wrong. It happens infrequently. Maybe it's because mpd is getting polled too often? I'm having trouble reproducing it though.

Last edited by Procyon (2008-11-03 22:35:44)

Offline

#12 2008-11-17 17:57:47

Procyon
Member
Registered: 2008-05-07
Posts: 1,819

Re: ampc & pyampc - album-based mpd clients

New version.

It's now dash compatible which shaves about 10 milliseconds off running time.
To revert to bash compatibility, append -e to the echo statements (that have escape codes (\n, \r))

http://paste.pocoo.org/show/AqdwByWrgJ1oboK16aGC/

Offline

#13 2008-12-21 21:39:33

Procyon
Member
Registered: 2008-05-07
Posts: 1,819

Re: ampc & pyampc - album-based mpd clients

ampc is now done. There are some bugs left that have to do with eval being unable to process a filename or artist name, but nothing serious. (I will clean it up if someone wants)


I have started a new project, pyampc, which will be a persistent ncurses app in python using python-mpd (in [extra]).

It will use a two panel look, where the left panel can display various stuff and the right panel can browse around in an album list and track list.

Preview:
scrot20081221212247jk0.th.png

I'll post a new update as soon as it can be used without having to customize.

Offline

#14 2008-12-24 16:44:34

Procyon
Member
Registered: 2008-05-07
Posts: 1,819

Re: ampc & pyampc - album-based mpd clients

New version of pyampc is out. Please see the update post #1.

URL: http://paste.pocoo.org/show/Nk1EmYyZk4LZJEoU4Sc1/

Offline

#15 2008-12-25 15:00:28

Procyon
Member
Registered: 2008-05-07
Posts: 1,819

Re: ampc & pyampc - album-based mpd clients

New version of pyampc (see #1)

URL: http://paste.pocoo.org/show/ryZbG9JqA9NXCmVDl5eu/

Changelog:
Nicer display of left pane search and of config
Storing search results (1-9) and it works across sessions (because it is stored in cfg file ~/.pyampc)
Across versions, config doesn't need to be deleted anymore (I had put it as a suggestion earlier)
When you start with an empty list, it will make a new list if you don't have any previous playlists.
Added basic player controls: seeking +/- 5s, next/previous song

Offline

#16 2008-12-29 16:08:43

Procyon
Member
Registered: 2008-05-07
Posts: 1,819

Re: ampc & pyampc - album-based mpd clients

New version.

URL: http://paste.pocoo.org/show/qG3FZOrDAQW19MgJ06yn/

Changelog:
Added remove function. It is integrated in search (and so also 'show playlist in left pane') and is a menu accessible with 'R'.
Added quick searching.
Added copy filename to X11 clipboard in advanced menu.
Changed all the configuration options names. This makes removing ~/.pyampc recommended (but not necessary) when you have used an older version.

Offline

#17 2009-01-03 19:35:29

Procyon
Member
Registered: 2008-05-07
Posts: 1,819

Re: ampc & pyampc - album-based mpd clients

New version.

URL: http://paste.pocoo.org/show/Dkm79P5BP8R6o9xqkzGF/

Changelog:
Browse mode ends after picking a song.
Using pads instead of windows eliminates the need for a strict addnstr which solves the unicode bug. (there is still one extra blank line at the right or else wide character will wrap)
Rebound play previous/next song, because arrow keys and such will do '['

Offline

#18 2009-01-15 03:02:47

Procyon
Member
Registered: 2008-05-07
Posts: 1,819

Re: ampc & pyampc - album-based mpd clients

New version.

URL: http://paste.pocoo.org/show/PfIAE7hocDLjvfs0yEW6/

Changelog:
Many bugs fixed including old ones like the wrapper bug and resize bug
Search is now "AND"
Added two options to update the playlist.

Last edited by Procyon (2009-01-15 03:04:57)

Offline

Board footer

Powered by FluxBB