• I just finished my first hack for WordPress, which will get information from your music player about the current song and your playlist. This hack uses TCP/IP and a fairly simple query/response protocol to communicate with a plugin on your music player. Currently there is only support for XMMS, however if you know something about writing plugins for WinAMP, iTunes, etc. please have at it and send me the code/libraries so I can include it in future releases.
    To use this hack, simply install the plugin for your music player, drop the get_song() function into your my-hacks.php (enable my-hacks if you haven’t already) and call the get_song() function as follows:
    get_song(inputstring,host,port)
    For example, if I called:
    get_song(“Listening to %TITLE% (#%PLPOS% of %PLLEN% on playlist), localhost, 8082)
    it would return “Listening to Decade and One (#5 of 27 on playlist)”
    Since get_song() merely does a search and replace, you can also include html tags in the input string. As of now there are 8 things that you can query for, all of this is outlined in the README.
    https://alumni.imsa.edu/~eryanv/wordpress/getsong.tar.gz
    If you have any questions or comments please feel free to ask.
    PS:Kudos to anybody who knows the artist from the example.

Viewing 13 replies - 1 through 13 (of 13 total)
  • lol – probably nice & fun coding project, but i don’t really see the practical use

    eryanv, i’m interested in it! as for itunes, which i use, the only way i could figure out how to do it is to look at the iTunes Music Library.xml file and parse it out to find the “Last Played” field has the most recent play date. i’m not a programmer, so i’ll leave that one to you or anyone else that wants to integrate itunes ?? unfortunately, this will make it a bit difficult seeing as there aren’t too many plugins for windows itunes, and applescript isn’t going to become windowsscript anytime soon.
    there does seem to be a plugic from “listen-to”, but i haven’t heard good things about it.
    real quick how does it get the info? is the plugin supposed to place it on your server via ftp or a call to your machine? if so, what about the world with dynamic ip’s? just a little confused, but this looks good! keep it up!
    uplink

    Thread Starter eryanv

    (@eryanv)

    I can’t say much about iTunes, never used it myself, not owning a Mac ?? and not really wanting to depart from WinAmp on the rare occasion that I use Windows. XMMS was convienent because I’ve looked at plugins that have reported similar information and there are a bunch of functions available where all you need to do is call them to get whatever piece of info you need.
    There’s really two plugins. One for WP (client) and the other for the music player (server). The PHP code gets uploaded to whereever your blog is being hosted, and a call to the get_song function somewhere in one of your pages. The plugin for the music player would reside on your machine so that it could dish out the information. Basically a client-server architecture.
    As for the dynamic IP issue, let me give you a bit of background on what led me to create this. Originally the idea was simply a PHP script that would parse the output of XMMS InfoPipe (wrote the information out to a file) except there were some file permission errors. So I realized that I could get around this by using network sockets and a new plugin, which would also open it up to users of other music players. After I had finished and tested everything, only then did I realize that it was only really going to work for people who had static IP addresses. So anyways, I suppose most of that was pretty useless, but unless you use something like DynDNS to attach a name to your Dynamic IP, there’s not much you can do other than go in and change it manually in the function call.

    Sorry about that last post.
    But the B2 plugin for Newsgator supports the Playing right Now feature, even for iTunes on Windows.
    And it appears that iTunes support some WMP scheme for broadcasting playing now details.
    I have no idea what, but hopefully, it could give you a hint.

    There’s a nice bit of donation-ware at https://www.kung-foo.tv/itti.php
    Kung Tunes is an AppleScript application which reads the current track playing in iTunes and can also save the last x (configurable) tunes you’ve listened to. Very configurable, you can make it output any format (including php) files and even ftp them to the server. Then all you have to do is include the file, if you’ve set it up right.
    Works on Apple only though.

    Do you have some kind of script that will FTP a certain text file to a certain location?
    Cause rhythmbox has a built-in option to perform commands everytime a song changes, and it could easily be used for this.
    [email protected]

    Thread Starter eryanv

    (@eryanv)

    I don’t think the current design would support something like that.

    I have added a function to the Wiki that will parse the file created by kung-tunes, and echo it to wherever you define. You can see it running on my site under Diggin on: in the menu.
    Find it here: https://wiki.www.ads-software.com/index.php/Display%20current%20iTunes%20Track%20info
    Later
    Jesuit

    The code for parse a file vreated by using Kung tunes in the specified wordpress directory was given in th e wikki, ny Jesuit: where is that code placed?

    “Pretty simple really. If you are using kung-tunes (https://www.kung-foo.tv/itti.php) to upload the currently playing track info from iTunes to your site, you can now easily parse that file and echo the styled output to a predetermined location. Code Follows:

    function display_tunes() {
    $fp=fopen(“trackinfo.txt”,”r”);
    $track=fgets($fp,1024);
    echo “$track”;
    fclose($fp);
    }”

    kung tunes, iTunesBlogger, and other such programs, can typically use an HTTP POST method to send data direct to a PHP page/script on your site. That’s the method that I used for CG-WhatTunes, and it works great. Also, CG-WT integrates with CG-Amazon to provide cover art and amazon link for the current track, which lots of people wanted.

    I should have the WP1.5 CG-WT update together in the next few days…

    -d

    hi there,

    has anybody meanwhile adapted eryanv’s plug/hack to winamp?
    thanks!

    et

    Dunno — you can always use CG-WhatTunes with WinAmp… ??

    -d

    david, please check this thread!

Viewing 13 replies - 1 through 13 (of 13 total)
  • The topic ‘Currently Playing Song Plugin (released)’ is closed to new replies.