Skip to main content
Topic: One-click solution: play latest mp3 file in folder (Read 337 times) previous topic - next topic
0 Members and 1 Guest are viewing this topic.

One-click solution: play latest mp3 file in folder

Hi there,
I am wondering if it is possible to have a once click solution to play the latest mp3 file in a specified folder...?
The idea, or at least what I have in mind, is to have a somewhat floating button (always on top), which when clicked plays the latest mp3.
"The latest" could either be determined by filename or by creation date, but not by mp3tag.

I'm pretty new to foobaar, so if this inquiry has been solved already, please bear with me.

Thanks a lot in advance!
Marius

Re: One-click solution: play latest mp3 file in folder

Reply #1
Hi there,

(I've never seen such question. Points! for originality :D )

Possible? Yes, with requirements. 1) Of course you'd need foobar monitoring the specified folder for new tracks. (Library menu > Configure > Add... if not already)

2) Foobar does not index creation date timestamp from the filesystem, only %last_modified% date. For similar purposes though you could use %added% (date added to library) from Playback Statistics component. (Note that when you first install it, every track in your library gets the same (current) added date as mentioned in the docs. Any newly added tracks will be correct going forward)

(Side note: While there is a foo_filedate that adds filesystem dates, I think tracks have to be scanned, so it would be not automatic or "one-click")

3) Create an auto-playlist to monitor the specified folder for new tracks and sort descending. Library menu > Search, and enter, for example -

Code: [Select]
%path% HAS \folder name\ SORT DESCENDING BY %added%

To right of search bar click '...' > Create Auto-playlist. Rename the playlist "New Tracks" (or whatever)

4) Get Scheduler component to create the menu option / toolbar button / keyboard shortcut.

Setup in Preferences > Scheduler, under 'Action lists', Add an action named "Play newest track" (do not tick 'Restart after completion' box), then right-click it > Add actions for the following -

 - Change playlist: Select: "New Tracks"
 - Start playback: from track #1
 - Wait until 1 track played
 - Stop playback

Then under 'Event list', Add > 'Add menu item event', named "Play newest track", then right-click it > Assign action list > 'Play newest track'. OK to save Preferences.

Now you have a menu command for File > Scheduler > 'Play newest track'. Hopefully it works! :D You can assign it to a toolbar button (right-click toolbar > Customize Buttons) or keyboard shortcut (Preferences > Keyboard Shortcuts)

5) Of course that button is part of the foobar window. To make a floating button you could use Titlebar (foo_title) which is getting just a little more advanced using XML, as you can decipher on that page.

Time for dinner over here. ;)   If you get the above working, get back to me and we can go through making a skin, if you just want a simple play button. Or, maybe grab one from the foo_title Gallery page. It will need editing to point a button to your newly created menu command.

Cheers

Re: One-click solution: play latest mp3 file in folder

Reply #2
Wow!
That's a lot. Thanks a bunch for your help.
I will go work on it tomorrow.

Once again, thank you very much. Will report back tmrw.
Cheers, M.

Re: One-click solution: play latest mp3 file in folder

Reply #3
A couple issues I neglected ...

Since I tested this on my main install instead of a fresh one, some other components might have been at play for it to work. (I have 20 or so more). See how it goes for you.

Also, how often do you restart foobar? There is an issue using foo_title with custom menu commands this way. About 50% of the time foo_title will throw an error on startup, because of the way foobar randomly loads components. It just means having to go into Preferences and 'Apply Skin' sometimes - a bit of a nuisance. For me the usefulness of foo_title outweighs the odd error, but YMMV.

Re: One-click solution: play latest mp3 file in folder

Reply #4
Hey!
Great progress so far!

I have used your instructions on a totally clean install of foobar and it works like a charme.
Right now I use foo_title to have an always-on-top floating set of buttons. Once I click the upwards poited triangle, the main window (which has been reduced to a couple of pixels, just enough to show the standard foobar buttons) appears and I click on a newly added button which has been assigned to the Scheduler event.
All in all it's now a two click solution but it works for me. Perfectly.

If everything goes according to plan, foobar will be auto-started once a week and then the system keeps running until the next scheduled reboot (always at the same time).

Thanks a bunch for your help so far...I will report back tmrw.

Cheers, M.

Re: One-click solution: play latest mp3 file in folder

Reply #5
Great! :)

So not sure if you want to add the button to foo_title or not but here is a quick example skin.xml -

Code: [Select]
<?xml version="1.0" encoding="utf-8"?>

<skin
    author="mahonetwelve"
    name="foo_play_new"
    width="50"
    height="50"
anchor="top,left">

<layer name="play_new" type="button">
<geometry type="absolute">
<size x="48" y="48"/>
<position x="0" y="0"/>
</geometry>
<contents>
<action type="menu" button="left">
Play newest track
</action>
<normalImg src="play.png"/>
<overImg src="play.png"/>
<downImg src="play.png"/>
</contents>
</layer>
</skin>

The skins are installed in the foo_title folder (Preferences > foo_title > Open directory). You can use any text editor like Notepad, though it helps to have one that highlights syntax like Notepad++ (or these forums! ;) )

So as you can see the menu command in black text above. If you want to edit one of the other skins, look for a similar <layer type="button"> and <action type="menu"> where you just put the command name.

If you like you can save the above into a skin.xml file, inside a new 'foo_title\foo_play_new' folder. It also needs a play.png file - go over to Icons8 and download one you like (you can re-color it and so forth). Save it in the same folder. Note PNG files can have transparency, in addition to the options in foo_title preferences. You can save a different image for mouse hover and click, just change the src= filename in the skin. Of course if you want to get creative it helps to have some "photoshop" skills (I use Paint.NET)

Have fun! :D

 

Re: One-click solution: play latest mp3 file in folder

Reply #6
Hey,

sorry for the late reply - have been busy.

However, I can report that your solution is working superbly!
Currentl I'm using the %last_modified% - way of things. Also, following your suggestion I created my own floating button, using a ICO file from a free web ressource. By now, it's a genuine one-click solution. Thanks a lot for your support!

I do from time to time encounter the error you described upon reboot. But that's no biggy, with one simpe double-click foobar restarts and everything works.

Once again, thnanks a lot!
Cheers,
Marius


 
SimplePortal 1.0.0 RC1 © 2008-2020