YadPlayer - Yad front end for mplayer

280 views
Skip to first unread message

dave

unread,
May 20, 2020, 11:53:59 PM5/20/20
to yad-common
Hi, 

I wrote a script (actually 1 big one and a couple smaller helper scripts) to be able to play songs from a "Artist/Album/Song" structured mp3/ogg/m4a songs library, mainly for the purpose of being able to build playlists in playlist.m3u file format so I can maintain a sync'd Music library between my PCs and phone (use Neutron player on Android) 

Requirements:

yad (obviously)
bash(v4+)
mplayer
imagemagick (for resizing album art)
xdg-open
wmctrl (moving and resizing windows)
xdotool (manipulating windows)
ffmpeg (for copying song files at louder levels - still working on that)
This only works if your music library exists in the Artist/Album/Song file structure

the first time you run the script it will
test if mplayer exists,
test if the path to your music folder exists, and
set the path to the folder where you will keep your 4 files for YadPlayer

Every Other Time you start YadPlayer,
your entire library starts playing randomly, and the Track Info window opens, while the main player window sets itself to the lower right
the Track Info window is set to timeout in 60 seconds but you can close it without stopping the music
or you could specify starting with a playlist like this:
$(cat ~/.scriptpath) yadPlayerDemo &


I'm a little reluctant to show you this as I'm not a professional computer guy (zero schooling) and probably break a lot of coding rules.  Also I use huge comments so I don't get lost trying to find where I'm at in the script (its helpful for that long skinny bar on the right side of some text editors).  Also there are still a lot of lines commented out from when I was troubleshooting.

In addition, I'm not sure if its okay with Victor if I use the name "YadPlayer", so if that's not wanted I can change it to YPlayer or something.

Lastly, I got it to work in the /home/user/Music folder and also in a different folder on another computer, so fingers crossed - Let me know if it works for you.

FOR SAFETY: maybe if you can test this, just copy a few artist folders into another expendable folder in case something I wrote deletes something (its never happened to me yet, but, like I said - I'm an amateur.)


Let me know of any improvement ideas you have (or better yet, feel free to just fix it and repost here :)

- Dave

YadPlayer.zip

dave

unread,
May 21, 2020, 12:08:15 AM5/21/20
to yad-common
One potential annoyance - if you don't already have artwork files in your album folders the script will open up a google image search for you to download into your Downloads folder, and once that's done you click the button and it just takes the most recent image file in downloads and puts it in the album folder.  My Android music player requires actual image files in the album folder so I wrote that in.  I guess it might be a good option to not do that.

jonathanbart...@googlemail.com

unread,
May 21, 2020, 5:37:32 PM5/21/20
to yad-common
I gave it a quick bash - all seems to run fine. I don't have lots of music files, etc, so it is probably overkill for my purposes but it certainly played a few mp3s. It started-up fine, although stopping it was a bit hard as it kept opening new windows. I can give it another bash if there's something specific you would like someone to test. I didn't get the image-search thing you mentioned. 

I was wondering how you got those nice text banners in the script... cunning, I see there are websites that do it for you. Interesting, keep up the great work!

On Thursday, 21 May 2020, 05:08:17 BST, dave <cedard...@gmail.com> wrote:


One potential annoyance - if you don't already have artwork files in your album folders the script will open up a google image search for you to download into your Downloads folder, and once that's done you click the button and it just takes the most recent image file in downloads and puts it in the album folder.  My Android music player requires actual image files in the album folder so I wrote that in.  I guess it might be a good option to not do that.

--
You received this message because you are subscribed to the Google Groups "yad-common" group.
To unsubscribe from this group and stop receiving emails from it, send an email to yad-common+...@googlegroups.com.
To view this discussion on the web visit
https://groups.google.com/d/msgid/yad-common/cdfdba86-f66a-480b-adfd-b01f45e9f047%40googlegroups.com
.

dave

unread,
May 21, 2020, 7:41:16 PM5/21/20
to yad-common
Thanks for the feedback.  Did you have wmctrl and xdotool installed?  I think those were the utilities I needed to get windows to close etc.  Although I just learned of using something like this:

trap "exit 1" TERM
export TOP_PID=$$

function close () {
   echo "Goodbye"
   kill -s TERM $TOP_PID
}
export -f close

Which might have been useful to close things as well

dave

unread,
May 22, 2020, 12:03:02 AM5/22/20
to yad-common
This version should test for wmctrl, xdotool, and imagemagick as well as mplayer
YadPlayer.zip

Jon Cooper

unread,
May 23, 2020, 10:38:45 AM5/23/20
to yad-common
Hello again, yes, I had to install wmctrl and it behaved fine this time. There are lots of messages coming up in the terminal window incl. OpenGl, etc. I can paste them up somewhere if that would be helpful. Is there a way to select a specific track, or have I completely missed the point ;-?

Best wishes

Jon.C.

On Fri, 22 May 2020, 05:03 dave, <cedard...@gmail.com> wrote:
This version should test for wmctrl, xdotool, and imagemagick as well as mplayer

--
You received this message because you are subscribed to the Google Groups "yad-common" group.
To unsubscribe from this group and stop receiving emails from it, send an email to yad-common+...@googlegroups.com.

dave

unread,
May 23, 2020, 1:33:08 PM5/23/20
to yad-common
You can go to the controls tab on the bigger window and then search for a track to play it.

Once you have the song you want playing, if you want more controls like finding specific points in the track you can open the song or the playlist externally in your default player.

Regarding the terminal messages, I just ignore that by starting the script from a launcher (no terminal open), and only use the terminal when I'm troubleshooting (although sometimes I trouble shoot by using yad messages instead of the terminal, then comment them out once I fix it)

dave

unread,
May 23, 2020, 1:34:21 PM5/23/20
to yad-common
I.e. there's a button "open song externally" and "open playlist externally" in the controls tab.

dave

unread,
May 24, 2020, 1:02:53 PM5/24/20
to yad-common
bug fixes (see attached)

YadPlayer.zip

RTX

unread,
Jun 19, 2020, 6:42:23 AM6/19/20
to yad-common


воскресенье, 24 мая 2020 г., 20:02:53 UTC+3 пользователь dave написал:
bug fixes (see attached)


It's funny.
But check your scripts:
shellcheck *.sh


 

dave

unread,
Jun 21, 2020, 11:03:40 PM6/21/20
to yad-common
Thanks for the tip!  It prints out a lot of suggestions, ha ha - It should keep me busy for a while :)

in the meantime, I've started keeping updates from now on here: http://cedar-chiropractic.com/YadPlayer.zip

The latest was a bug that screwed up the control fifo thing for pause & next in some instances

Robert Cooper

unread,
Jul 1, 2020, 3:05:56 PM7/1/20
to yad-common
Hi Dave,  

First, Awesome Mplayer frontend.  I've been testing it and have a  few questions. (I'm not a programmer, I myself have to hunt, patch and make scripts work when it comes to bash)

What OS are you using  to run your Mplayer.sh ?   I'm using SparkyLinux which is Debian true base (Buster / 10) and the Mplayer.sh path for $USER is not working. So I hard coded this user path to move forward with testing.  

I'll spend more time looking at your code to see how it handles the art import schema, do suggest using a different directory than ~/Downloads, maybe even give user the option of creating a new Directory for this purpose.  

The Art download fails on my system, where would the album art normally be stored ?

Have you seen the YRadio "Yad+Mplayer Radio Player" ?   Would adding your Art Inclusion & playlist options to this widely used Opensource Mplayer frontend be something you want to do (fork) ?


Thanks for sharing your program, Bobby

Julio C. Neves

unread,
Jul 2, 2020, 10:47:33 AM7/2/20
to yad-c...@googlegroups.com
did you try $ LOGNAME instead of $ USER?
Abraços,
Julio

» Não tem tempo para fazer um curso presencial?
» Na sua cidade não tem nenhum bom curso de Linux?
Somente nesta semana de 15-19/06, as inscrições estarão
abertas para uma nova turma. Veja mais detalhes em:

Também damos treinamento em sua empresa
em qualquer cidadecom certificado e nota fiscal.







--
You received this message because you are subscribed to the Google Groups "yad-common" group.
To unsubscribe from this group and stop receiving emails from it, send an email to yad-common+...@googlegroups.com.

dave

unread,
Jul 21, 2020, 5:16:49 PM7/21/20
to yad-common
Hi Bobby,

First, I'm glad you like it.  I'm running it on Ubuntu 20.04, and I don't know about the $USER thing.  For the Art download, its up to the user to make sure that the download folder is actually the /home/(user)/Downloads folder, and from there the script just figures out what the newest file is in that folder and moves the file to the same folder as the album folder that the song is in.   Then the next time a song from that album is played, when it checks for an image file it will skip the "art selection" part of the script.


I honestly haven't looked at the yradio, but I'm thinking I probably won't be looking to add that in there any time soon.  However if you want to just copy and paste my code into there I certainly wouldn't be against that :)


Like I said I don't consider myself a "programmer" but rather look at bash scripting as a way to solve personal computer needs on an "as needed" basis, relying a great deal on googling for people's previous questions about similar problems.


- Dave
Reply all
Reply to author
Forward
0 new messages