Puppy Linux Discussion Forum Forum Index Puppy Linux Discussion Forum
Puppy HOME page : puppylinux.com
"THE" alternative forum : puppylinux.info
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

The time now is Fri 01 Aug 2014, 06:00
All times are UTC - 4
 Forum index » House Training » HOWTO ( Solutions )
Pmplay - mplayer search / play script
Moderators: Flash, Ian, JohnMurga
Post new topic   Reply to topic View previous topic :: View next topic
Page 1 of 1 [3 Posts]  
Author Message
stu90


Joined: 25 Feb 2010
Posts: 1401
Location: England. Dell Inspiron 1501. Dpup

PostPosted: Tue 15 Feb 2011, 14:33    Post subject:  Pmplay - mplayer search / play script
Subject description: Zenity / Yad script + Xdialog version by seaside
 

Not sure where to post this but maybe some one might find some use for it.

What is it?
A basic 2 box GUI for Mplayer made with Zenity / Yad.



What does it do?
In the first GUI box you type path or drag and drop a directory that contains some media file/s you want to play with terminal Mplayer.
click ok and it will open the second GUI box
In the second box you enter either a word of file format to search for in that directory- example: Maiden or .mp3 or .avi

It then creates a playlist in /tmp out of the results that have Maiden in the file name or files that have an .mp3 extension and then terminal Mplayer plays that playlist.

To play a single meida file, example:
/root/music_video.avi
Type path or drag media file into GUI box one and leave GUI box two blank and click ok.

Word search.
If you know how your media files are formated blank space or under score - you can search for more than a one word string as long as it matches part of the actual file name.
example:
iron_maiden (if your files have under score instead of blank spaces.
iron maiden (if your files have black spaces instead of under scores)

requires Zenity / Yad it is only 26KB in size:
http://www.murga-linux.com/puppy/viewtopic.php?t=58306

pmplay Script.
http://dl.dropbox.com/u/3009188/pmplay.gz

Move Script to
/root/my-applications/bin
a click on it to decompress.

You can then drag it to desktop or run from terminal with command: pmplay

Last edited by stu90 on Sat 19 Feb 2011, 00:35; edited 1 time in total
Back to top
View user's profile Send private message 
seaside

Joined: 11 Apr 2007
Posts: 886

PostPosted: Thu 17 Feb 2011, 16:12    Post subject: Media Playing
Subject description: pmplay
 

Here's a variation using Gxine and Xdialog to run in puppy without adding Zenity/Yad or Mplayer.

Of course you could use Mplayer by uncommenting the line containing "mplayer" and commenting the line containing "gxine"
Code:

#!/bin/bash

list="/tmp/list.txt"
loc="`Xdialog --backtitle "Please choose directory..." --title "pmplay-1" --stdout --no-buttons --dselect /root/My-Music 0 0`"
if [ ! $? -eq 0 ];then
 exit
fi
string="`Xdialog --stdout --title "pmplay-2" --inputbox "Enter a word or format to search for:" 0 0 *.mp3`"

#find $loc -maxdepth 1 \( -iname "*$string*" \) 2> /dev/null > $list | rxvt -e mplayer -playlist $list
find $loc -maxdepth 1 \( -iname "*$string*" \) 2> /dev/null > $list | rxvt -e gxine -a $(cat /tmp/list.txt)

# make sure those filenames don't have spaces
# execute in dir
# for files in *.mp3; do mv "$files" `echo $files | tr ' ' '_'`; done



Cheers,
s
Back to top
View user's profile Send private message 
stu90


Joined: 25 Feb 2010
Posts: 1401
Location: England. Dell Inspiron 1501. Dpup

PostPosted: Fri 18 Feb 2011, 23:19    Post subject:  

Hey nice one seaside Smile

Here is update for Yad / Zenity Pmplay:

Now all in one window + added a third Box for playing pre made Mplayer playlists - leave Box1 and Box2 as the are and enter the path or drag the playlist to box three.



Code:
#!/bin/bash
#stu90 - pmplay v0.3

BOXR="/tmp/boxr"
PLAYL="/tmp/playlist"

yad --title "Pmplay" --form --separator=' ' \
--text " In Box1 enter or drag a directory to seach.  \n
 In Box2 enter a file format or word to seach. \n
 Or In Box3 enter a pre made playlist to play." \
--field=Box1 '/root' \
--field=Box2  '.mp3' \
--field=Playlist > $BOXR

if [ $? = 1 ];
then exit
fi

PL=$(cat $BOXR | awk '{ print $3 }')

if [ $PL ]; then
echo "playlist found '$PL'"
rxvt -e mplayer -playlist $PL
else 

DIR=$(cat $BOXR | awk '{ print $1 }')
STRING=$(cat $BOXR | awk '{ print $2 }')

retval=$?
case $retval in
0)
echo "Directory to search is '$DIR'"
echo "String to search for is '$STRING'"
find $DIR -maxdepth 1 \( -iname "*$STRING*" \) 2> /dev/null > $PLAYL | rxvt -e mplayer -playlist $PLAYL
;;
1)
echo "Cancel pressed.";;
esac
rm $BOXR $PLAYL
fi
exit
Back to top
View user's profile Send private message 
Display posts from previous:   Sort by:   
Page 1 of 1 [3 Posts]  
Post new topic   Reply to topic View previous topic :: View next topic
 Forum index » House Training » HOWTO ( Solutions )
Jump to:  

You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Powered by phpBB © 2001, 2005 phpBB Group
[ Time: 0.0510s ][ Queries: 11 (0.0057s) ][ GZIP on ]