You are not logged in.

#1 2015-05-31 09:35:10

jangler
Member
From: United States
Registered: 2015-05-09
Posts: 8
Website

Moss - create and execute playlists of arbitrary commands

I've been a happy user of MPD for several years, but I've often found that I want to put other things in my playlist besides audio files under a specific directory on my filesystem--and even if I could put those things in my playlist, MPD wouldn't know how to play them. To this end, I've created Moss, a client/server program that allows you to put whatever you want in a playlist. By default, playlist items are passed to /bin/sh -c for execution, but Moss can easily be configured to invoke a different program if the item matches a given regular expression.

For mpc users, the interface should be very familiar. Essentially no setup is required, except for optionally writing a ~/.mossrc or ~/.config/mossrc file (you could use the example file from the git repo as a starting point).

An AUR package is available. Let me know if you find a bug, have a suggestion, or just want to give general feedback.

Offline

#2 2015-06-04 11:32:22

jangler
Member
From: United States
Registered: 2015-05-09
Posts: 8
Website

Re: Moss - create and execute playlists of arbitrary commands

So this hasn't got much attention, but I've been using Moss for the past week or so and have found it to be useful and stable, so I implemented a couple more features and pushed out version 1.0.0. One of the new features is the -stdin flag, which allows additional arguments to be read from standard input. Among other things, this is useful for saving and loading playlists to/from files using moss ls > file and moss -stdin add < file. You could also shuffle the current playlist using (moss ls | shuf && moss clear) | moss -stdin add.

The other new feature is an optional <format> argument to the status command, which lets you easily print specific information like playlist index, playlist length, current item, process ID of current command, et cetera. If you have a song currently playing and want to view its metadata, you could use something like soxi `moss status %f`--or remove everything before the current playlist item using seq $(expr `moss status %i` - 1) | moss -stdin del.

The point is, I think I've made something that's nicely programmable and "composable", where a lot of functionality emerges from the design. There are probably a number of potential applications and patterns that haven't occurred to me yet.

Offline

#3 2015-06-04 11:36:20

Trilby
Inspector Parrot
Registered: 2011-11-29
Posts: 30,330
Website

Re: Moss - create and execute playlists of arbitrary commands

jangler - I support any creative ideas, but when I first saw this, I didn't get the point.  Maybe others have the same reservation: given that from what is posted here, it sounds like you give moss a list of commands/files each of which is passes to /bin/sh ... how is this any different from just making a shell script which would be much more flexible and would not require an additional subshell for each command?

I don't mean that as a criticism, just seeking clarification: what can moss do better than a shell script?


"UNIX is simple and coherent" - Dennis Ritchie; "GNU's Not Unix" - Richard Stallman

Offline

#4 2015-06-04 12:26:03

jangler
Member
From: United States
Registered: 2015-05-09
Posts: 8
Website

Re: Moss - create and execute playlists of arbitrary commands

Yes, I thought it might be difficult to understand the purpose--but your perspective is helpful.

Shell scripts are perfect for executing a static set of programs in a static order. Moss is designed for dynamic sets of commands, especially when those commands invoke media players. Say you're listening to an album using moss, but someone links you a video (or several) in IRC. You can easily insert those video links into your playlist, have them played automatically when the current song finishes, and then return to your music.

This is the primary way I use moss--as a sort of media player front-end. It's true that items are passed to /bin/sh -c by default, but I think of that as more of a special case. Normally, a different program is executed based on the item; e.g. if it ends in '.mp3', then run an mp3 player on it. So although I've described it in sort of vague, generic terms to emphasize that it can do anything (notably, putting moss commands in a playlist can be useful), a more practical way to think about it might be "MPD, but more flexible, and without that nasty client library".

Offline

Board footer

Powered by FluxBB