Page 1 of 1

[solved] Enabling shuffling MP3 music player for Jessie

Posted: Thu May 05, 2016 5:40 pm
by Rive
This works, but just plays the mp3's all in sequential order...I am trying to randomize it to make playlists that are always different (shuffle feature), and I am stuck... :?

This is what I have so far-

This creates a start/run shortcut in Menu/Sound & Video (load just the mp3's in Music/playlist directory/folder, and then run shortcut. Controls work in the terminal window: e.g., "q"=quite (or close terminal), "spacebar"= pause play, "-" and "+" for volume. Simply minimize terminal window to taskbar for normal desktop use)

Create mp3 music playlist directory

Code: Select all

mkdir ./Music/playlist
open

Code: Select all

sudo nano /usr/share/applications/mp3player.desktop
Add below, then save with 'ctrl+ x', then 'y', then 'enter'

Code: Select all

[Desktop Entry]
Type=Application
Name=MP3 Playlist
Categories=AudioVideo;Player;
Exec=lxterminal --command "./mp3.sh Music/playlist/."
Terminal=false
Icon=/usr/share/icons/nuoveXT2/96x96/apps/music-player.png
open

Code: Select all

nano ./mp3.sh
Add below, then save with 'ctrl+ x', then 'y', then 'enter'

Code: Select all

#!/bin/bash

setterm -cursor off
setterm -clear all

for file in $1/*
do
 omxplayer "$file" > /dev/null
done

setterm -cursor on
Chmod

Code: Select all

sudo chmod +x mp3.sh

Re: Enable MP3 music player for Jessie

Posted: Fri May 06, 2016 11:52 am
by Rive
This adds a shuffle function (but breaks the terminal pause/play, and volume controls. To stop, click 'x in terminal). Volume has to be used at default, or controlled externally, and there is no 'pause' capability.

Trying to figure out how to restore omxplayer terminal controls (without breaking shuffle), and how to get the terminal to display current mp3 that is playing (after I solve controls issue)...

Code: Select all

nano ./mp3.sh

Code: Select all

#!/bin/bash

setterm -cursor off
setterm -clear all

for file in $1/*
do
< <(shuf -ze "$1"/*.mp3) omxplayer "$file" > /dev/null
done

setterm -cursor on

Re: Enabling shuffling MP3 music player for Jessie

Posted: Fri May 06, 2016 1:26 pm
by Rive
Alright. gave up on that...found a much better MP3 player for Jessie (GUI with shuffle).

Image

Code: Select all

sudo apt-get install moc
This creates a shortcut in Menu/Sound & Video

Code: Select all

sudo nano /usr/share/applications/mp3player.desktop

Code: Select all

[Desktop Entry]
Type=Application
Name=MP3 Player
Categories=AudioVideo;Player;
Exec=lxterminal --command "mocp"
Terminal=false
Icon=/usr/share/icons/nuoveXT2/96x96/apps/music-player.png
mocp basic controls

h=help
< or >= volume (or control volume directly via taskbar icon depending on audio config)
p or spacebar= pause
s=stop
b or n= back/forward
S=SHUFFLE
tab=switch
a=add item or directory to playlist
d=delete item from playlist
C=CLEAR PLAYLIST
V=SAVE PLAYLIST