Contrib

Post here your patches, tips, themes, scripts and so on.

Playing live BBC radio with MOC

Forums:

After a while of getting irritated that you can't play BBC radio with MOC, I've worked out a quite nice way of doing it. Note this is probably UK specific, no idea if it works abroad.

Turns out there are AAC streams available at URLs like: http://www.bbc.co.uk/radio/listen/live/r6_aaclca.pls MOC is happy playing these playlists, but the links within only last an hour.

Now you can continually download the playlist file, or you could put the following CGI script on a local webserver:-


#!/bin/sh

echo -n "Location: "

curl -s http://www.bbc.co.uk/radio/listen/live/r6_aaclca.pls \
| awk '/^File1/ { gsub(/^File1=/, ""); print }'

echo

The latest MOC (2.5.0-beta1) is happy following the redirects, so I can now have a local radio.m3u playlist which links to the script above, and keep all my favourite radio stations in one playlist.

Hope this proves useful to someone.

The simplest last.fm submit script

Forums:

I'm running MOC on OpenWRT which has very limited resources, so I needed a really simple last.fm scrobbling mechanism. On normal machines I just use Better behaved submission to last.fm, but on OpenWRT I wanted to get rid of python. 30MB of RAM is not a lot ;-)

The script I use still depends on lastfmsubmitd which is written in Python, but I run it on a different machine and export /var/spool/lastfm via nfs.

This script is really simple, I'm only posting it here to let you know that it is possible to do it _that_ simple :) I didn't add any thing like "wait for 50% of the track before submitting", I just submit as soon as playback starts. Anyone could just add a pause and a check if he needs it. It's also not very secure and error resistant, but it just does the trick.

OnSongChange = "/path/.moc/moc_simple.sh %a %t %d %r"

#!/bin/sh
pli=`mktemp -p /tmp/`
chmod 666 $pli
echo "---" > $pli
echo "album: $4" >> $pli
echo "length: $3" >> $pli
echo "title: $2" >> $pli
echo "time: !timestamp" `date "+%F %T"` >> $pli
echo "artist: $1" >>$pli
mv $pli [path to mounted /var/spool/lastfm]

Tip of the day: How to overcome ISP habbit to cut your audio stream every X period?

Forums:

Star up MOC with
$ mocp

Play an audio stream

Run this "watch" command:
$ watch --interval=900 'mocp -acp $(mocp -Q %file)'

Your stream will be reloaded every 900 seconds (15 minutes).

05 minutes = 300
10 minutes = 600
15 minutes = 900
25 minutes = 1500

Have fun!

MOC Notify-OSD

Forums:

For the past few months I had been looking for a good enough music player. MOC fulfills everything naturally, but I still want that notify-osd bubble in Ubuntu. Anyone got any scripts or such?

patch: pulseaudio backend

Forums:

I wrote a pulseaudio backend for MOC, mainly just to see if I could. Given how widespread pulseaudio is these days you might like to add this, as it gives slightly nicer integration with pulseaudio's mixer, and maybe some efficiency improvements. So I figured I'd upload it somewhere.

As it looks like I cannot attach files here I've put the patch up on http://marienz.net/m/moc-pulse.patch . This should apply to current svn MOC (I'm running a checkout from 2012-05-01, revision 2425).

The code seems to be stable (I've been using it for months), regular playback works fine, but the UI and seeking behave a little oddly because this backend has a much higher latency than MOC is used to. There are some workarounds in the code to counter this (explained in the comments). The user-visible problem is that small seeks do not work right.

I'll try to keep an eye on this forum for feedback/bug reports/etc.

Upload song to phone

Forums:

Hi there!

I just provide a useful script for those who want to upload songs to their phone connected by usb. It works perfectly for my Nokia 6120c and could probably be adapted to other phones without difficulty. Here is the script (require obexftp) :

http://pastebin.com/ebxmSGMR

Next, you just have to add this in ~/.moc/config :

ExecCommand1 = "upload_song_to_phone.sh %f"

Have fun!

--
Nicolas.

[PATCH] Can't enqueue songs while searching

Forums:

Hi,

I just discovered MOC and have been really enjoying it. Thanks!

The usual way I enqueue songs is to search for them, though, and the search window currently eats most commands. There was some chat about this on http://moc.daper.net/node/484 .

I wrote a short patch to address this. It's a little ugly because it calls the queue functions directly from interface_elements.c, but that seemed better than playing with the entry type to pass the queue key to menu_key() in interface.c. Let me know what you think. Cheers!

Patch (against r2360): http://pastebin.com/raw.php?i=SQ6ijra3

My first theme

Forums:

Maybe this theme not ideal but of course I like it and MOC too:)

# My color theme for MOC.
# by ksen-lin.
background = white black
frame = yellow black bold
window_title = yellow black bold
directory = white black
selected_directory = yellow black bold
playlist = white black bold
selected_playlist = green black bold
file = white black
selected_file = green black dim,underline
marked_file = yellow black bold
marked_selected_file = green black bold
info = blue black bold
selected_info = blue black bold
marked_info = green black bold
marked_selected_info = green black bold
status = white black
title = green black bold
state = yellow black bold
current_time = yellow black bold
time_left = yellow black bold
total_time = white black bold
time_total_frames = yellow black bold
sound_parameters = yellow black bold
legend = white black
disabled = blue black bold
enabled = white black bold
empty_mixer_bar = white black
filled_mixer_bar = green blue bold
empty_time_bar = white black
filled_time_bar = black blue
entry = white blue
entry_title = yellow black bold
error = red black bold
message = green black bold
plist_time = white black bold

Pages

Subscribe to RSS - Contrib