IPB

Welcome Guest ( Log In | Register )

 
Reply to this topicStart new topic
foo_run and dynamic track titles
Nixdagibts
post Sep 18 2013, 18:21
Post #1





Group: Members
Posts: 71
Joined: 22-September 09
Member No.: 73370



I'm using foo_run and this command which works well for normal mp3 files. It opens my browser and expands %artist% and %title% variables correctly.
CODE
http://www.lastfm.de/music/$replace(%artist%, ,+)/_/$replace(%title%, ,+)

But it's not working for online radio streams with dynamic track titles (option under networking is enabled) because foo_run (and most other 3rd plugins) haven't implemented support for dynamic track titles.
The plugin just uses the radio URL instead of the artist and title. So far I only know Columns_UI and Panels_UI who support dynamic track titles.

Back in 2007 foo_run's developer foosion explained that it is too difficult to add support for dynamic track titles in plugins.
Maybe something has changed in this regards since 2007?

Is there any work-around for opening last.fm with %artist% and %title% grabbed from a dynamic source?
Go to the top of the page
+Quote Post
marc2003
post Sep 18 2013, 18:58
Post #2





Group: Members
Posts: 4326
Joined: 27-January 05
From: England
Member No.: 19379



foo_run is developed by Florian. wink.gif

also, i think you've misinterpreted foosion's reply in that thread.

QUOTE (foosion)
All components have access to these fields. It just depends on how they use the foobar2000 SDK. If they are not made to show dynamic tags, they won't.


QUOTE (foosion)
It's just as difficult (or easy) as reacting to normal playback events. If any developer has questions regarding the technical details, they should post in the development forum.


bold emphasis is mine.

as we haven't seen Florian around for quite some time, it's unlikely foo_run will be updated - but assuming you don't mind using buttons, i've made a script for WSH panel mod that can launch various websites using dynamic track titles. it looks like this...



the script is named web links inside this package. check the readme first. https://dl.dropboxusercontent.com/u/22801321/wsh/samples.zip

Go to the top of the page
+Quote Post
Nixdagibts
post Sep 19 2013, 21:23
Post #3





Group: Members
Posts: 71
Joined: 22-September 09
Member No.: 73370



Looks promising. One more question:

With foo_run I use something like
CODE
"D:\Audio Tools\MP3 Tag\Mp3tag.exe" "$directory_path(%path%)"

to open local software from within foobar

Can I do this with WSH panel mod too? So I can trash foo_run completely.
I only found "Add support to run main menu and context menu command." in the wiki.
But this would mean, I have to use foo_run and WSH panel mod simultaneously.

This post has been edited by Nixdagibts: Sep 19 2013, 21:23
Go to the top of the page
+Quote Post
marc2003
post Sep 20 2013, 05:33
Post #4





Group: Members
Posts: 4326
Joined: 27-January 05
From: England
Member No.: 19379



yup, that's certainly possible. rather than explain how to create it from scratch, here's how to extend the web links script i posted. on line 12, replace the entire b.update function with this....

CODE
b.update = function() {
if (!p.metadb) return;
var artist = encodeURIComponent(p.eval("%artist%"));
var title = encodeURIComponent(p.eval("%title%"));
var mp3tag = p.eval("\"D:\\Audio Tools\\MP3 Tag\\Mp3tag.exe\" \"$directory_path(%path%)\"");
var google = "https://www.google.co.uk/search?q=" + artist;
var myspace = "http://www.myspace.com/search/music?q=" + artist;
var lastfm = "http://www.last.fm/music/" + artist + "/_/" + title;
var youtube = "http://www.youtube.com/results?search_query=" + artist + "+" + title;
var discogs = "http://www.discogs.com/search?q=" + artist;
var allmusic = "http://www.allmusic.com/search/artists/" + artist;
b.buttons = {
google: new button(0, 0, 32, 32, {normal: "google.png", hover: "google_h.png"}, function() { p.browser(google); }, google),
myspace: new button(32, 0, 32, 32, {normal: "myspace.png", hover: "myspace_h.png"}, function() { p.browser(myspace); }, myspace),
lastfm: new button(64, 0, 32, 32, {normal: "lastfm.png", hover: "lastfm_h.png"}, function() { p.browser(lastfm); }, lastfm),
youtube: new button(96, 0, 32, 32, {normal: "youtube.png", hover: "youtube_h.png"}, function() { p.browser(youtube); }, youtube),
discogs: new button(128, 0, 32, 32, {normal: "discogs.png", hover: "discogs_h.png"}, function() { p.browser(discogs); }, discogs),
allmusic: new button(160, 0, 32, 32, {normal: "allmusic.png", hover: "allmusic_h.png"}, function() { p.browser(allmusic); }, allmusic),
mp3tag: new button(192, 0, 32, 32, {normal: "mp3tag.png", hover: "mp3tag_h.png"}, function() { p.run(mp3tag); }, "Mp3Tag")
}
window.Repaint();
}


obviously this needs the images creating and saved inside your foobar profile\marc2003\images folder. the filenames are in the 2nd to last line of code. one is a standard image and the other is the hover image - what you see when your mouse is over the button. this hover image is optional. if you want to just use the one image, the line of code can be re-written like this....

CODE
mp3tag: new button(192, 0, 32, 32, {normal: "mp3tag.png"}, function() { p.run(mp3tag); }, "Mp3Tag")


also, just to explain how that function is constructed:

the first number, 192, is the x co-ordinate in pixels from the top left. note how each button increments by 32 as that is my button size
the second number 0 is the y co-ordinate
the 3rd and 4th are the button width/height
the next argument is the image to use. as mentioned above, it's expected to be inside the marc2003\images folder.
next is the function to run when the button is clicked.
last is the tooltip that gets displayed when you hover your mouse over the button.

if you want to add/remove buttons, notice how each one is separated with a comma at the end of the line of code.

This post has been edited by marc2003: Sep 20 2013, 05:42
Go to the top of the page
+Quote Post
Nixdagibts
post Sep 21 2013, 20:29
Post #5





Group: Members
Posts: 71
Joined: 22-September 09
Member No.: 73370



Hey marc,

I got everything I need, thank you very much.
This is my own "b.update" function. The escaping was driving me crazy \(ಠ ὡ ಠ )/

CODE
b.update = function() {
    if (!p.metadb) return;
    var artist = encodeURIComponent(p.eval("%artist%"));
    var title = encodeURIComponent(p.eval("%title%"));    
    var lastfm = "http://www.lastfm.de/music/" + artist + "/_/" + title;            
    var google = "http://www.google.de/search?tbm=isch&biw=1766&bih=871&q=" + artist + "+" + title + "+Cover";
    var albumcover = p.eval("\"Powershell\" \"-File\" \"FoobarScripts\\exiftool.ps1\" \"%path%\" \"%filename%\"");
    var mrtzcmp3 = "http://www.mrtzcmp3.net/" + artist + "_" + title + "_1s.html"    
    var mp3tag = p.eval("'\"..\\..\\Audio Tools\\MP3 Tag [Portable]\\Mp3tag.exe\"' \"$directory_path(%path%)\"");          
    var audacity = p.eval("'\"..\\..\\Audio Tools\\Audacity [Portable]\\AudacityPortable.exe\"' \"%path%\"");
    var mp3gain = p.eval("\"FoobarScripts\\mp3gain\\mp3gain.cmd\" \"%path%\"");    
    var streamripper = p.eval("\"FoobarScripts\\streamripper\\streamripper.exe\" \"%path%\" \"-r\" \"-z\" \"-u\" \"-d 2.0\" \"FreeAmp/2.x\" \"-d\" \"C:\\Users\\nixdagibts\\Desktop\"");    
    
    b.buttons = {
        lastfm: new button(0, 0, 32, 32, {normal: "lastfm.png", hover: "lastfm_h.png"}, function() { p.browser(lastfm); }, "Lastfm"),
        google: new button(32, 0, 32, 32, {normal: "google.png", hover: "google_h.png"}, function() { p.browser(google); }, "Google"),
        albumcover: new button(64, 0, 32, 32, {normal: "albumcover.png", hover: "albumcover_h.png"}, function() { p.run(albumcover); }, "AlbumCover"),
        mrtzcmp3: new button(96, 0, 32, 32, {normal: "mrtzcmp3.png", hover: "mrtzcmp3_h.png"}, function() { p.browser(mrtzcmp3); }, "mrtzcmp3"),
        mp3tag: new button(128, 0, 32, 32, {normal: "mp3tag.png", hover: "mp3tag_h.png"}, function() { p.run(mp3tag); }, "Mp3Tag"),        
        audacity: new button(160, 0, 32, 32, {normal: "audacity.png", hover: "audacity_h.png"}, function() { p.run(audacity); }, "Audacity"),
        mp3gain: new button(192, 0, 32, 32, {normal: "mp3gain.png", hover: "mp3gain_h.png"}, function() { p.run(mp3gain); }, "mp3gain"),    
        streamripper: new button(224, 0, 32, 32, {normal: "streamripper.png", hover: "streamripper_h.png"}, function() { p.run(streamripper); }, "Streamripper")        
    }
    window.Repaint();
}



function albumcover: calls a Powershell script which uses exiftool to extract the embedded album cover. After that, it takes the resulting png and uploads it to Google images to search for similar images.
function mrtzcmp3: calls a website with the current selected artist and title and does bad things
function mp3tag: opens mp3tag for extensive tag editing (rarely used since masstager scripts can do most of this too), uses relative pathes. As a bonus, it looks for the directory of the currently selected song and open the whole folder in mp3tag
function audacity: opens audacity for music editing with the current selected track using mp3gain from commandline
function mp3gain: opens the following CMD script which normalizes the current selected track to 91 dB
CODE
@ECHO OFF
FoobarScripts\mp3gain\mp3gain.exe /r /p /s s %1
FoobarScripts\mp3gain\mp3gain.exe /g 2 /p /s s %1

function streamripper: ripps a playing online radio (automatic downloading, renaming+ tagging of files)
Go to the top of the page
+Quote Post

Reply to this topicStart new topic
1 User(s) are reading this topic (1 Guests and 0 Anonymous Users)
0 Members:

 



RSS Lo-Fi Version Time is now: 18th April 2014 - 17:54