[IMPLEMENTED] Play Tracking Suggestion

  • 14 Replies
  • 6407 Views
*

MarkRH

  • Beta Tester
  • Full Member
  • ***
  • 203
    • View Profile
    • Mark Headrick's Website
[IMPLEMENTED] Play Tracking Suggestion
« on: November 12, 2016, 05:11:41 AM »
With the current Now Playing plugin and I am using (which is no longer maintained), it can do a variety of things.  You can get it from here: Brandon Fuller's Now Playing: A Winamp Plugin v3.9.4.0 One of them is sending a "Ping" where it will execute a given URL.



Basically, trying to get this to where I can make something similar to what I can do here: http://www.markheadrick.com/entertainment.shtml

This plugin will create an XML file of the last 10 songs and then upload it via FTP and my script that is called by this URL processes it.  I actually use this script to send out the tweet either automatically (auto=1) or manually from another script.  Anyway, if the current song's information could be sent with the script call via post or get variables then I can save the history on the server end in a database or something and skip the FTP thing.

Here's part of that XML file for reference:
Code: [Select]
<?xml version="1.0" encoding="UTF-8"?>
<now_playing playing="0" timestamp="2016-11-11T05:42:03-06:00">
    <song order="1" timestamp="2016-11-11T05:39:29-06:00">
        <title>Radar Rider</title>
        <artist>Riggs</artist>
        <album>Heavy Metal Soundtrack</album>
        <genre>Soundtrack</genre>
        <kind>mp3</kind>
        <track>9</track>
        <year>1981</year>
        <comments/>
        <time>166</time>
        <bitrate>128</bitrate>
        <disc>65531</disc>
        <playCount/>
        <compilation>No</compilation>
        <composer>Jerry Rigs/Marc Jordan</composer>
        <grouping/>
        <urlSource/>
        <file>C:\(removed)\Music\MP3\Soundtrack\Heavy Metal Soundtrack\Heavy Metal Soundtrack - 09 - Riggs - Radar Rider.mp3</file>
    </song>

I actually use the file path to know what album image to use.  This is one of the tweets I do with it: https://twitter.com/mrheadrick/status/794783927181463552

Anyway, wanted to put this out there.  I'm probably one of the only people that does this kind of thing so I understand if the priority to add this is low.

Thanks for all your work.
« Last Edit: January 24, 2017, 03:50:28 PM by dro »

*

dro

  • Admin / WACUP Developer
  • Administrator
  • Hero Member
  • *****
  • 1989
    • View Profile
    • WACUP (Winamp Community Update Project)
Re: Play Tracking Suggestion
« Reply #1 on: November 14, 2016, 01:50:07 AM »
I'm really doing it all wrong if decent plug-ins can get people to pay to use them :)


As for the request, it fits in perfectly with the ideas behind the Yule Log plug-in as a means to get the information from Winamp out into the world for whatever reason.

Sending a POST request of just the current song's information (as an XML body or parameterised) is easy enough with libcurl.


Though am already thinking it's best I add a JSON body equivalent and even the possibility to control what is sent (via ATF) instead of just hard-coding and hoping for the best.

Also is there any information in the current data set you get that's missing / needs tweaking ? Or would just making it more customisable solve that issue for you ?

-dro

*

MarkRH

  • Beta Tester
  • Full Member
  • ***
  • 203
    • View Profile
    • Mark Headrick's Website
Re: Play Tracking Suggestion
« Reply #2 on: November 14, 2016, 04:48:21 AM »
Looks like the logging will grab just about everything I use:
Code: [Select]
13_11_2016 - 22:30:28 - Classical - "Royal Philharmonic Orchestra" - "Hooked on Classics, Part 3" - Hooked on Classics - 1981 - 3 - 6:00 - 362 - 128 - (removed)\Music\MP3\Classical\Royal Philharmonic Orchestra-Hooked on Classics\Royal Philharmonic Orchestra - Hooked on Classics - 03 - Hooked on Classics, Part 3.mp3

Is the %length% just supposed to put the minutes? This song is 6:02.  The %length_seconds% looks correct though.  I'd program the date to look different but I just need to get it in some fashion.

Tying ATF formatting into this "ping" operation is fine.  Hmmm, close Winamp and it crashed. Sent the debug email.

*

dro

  • Admin / WACUP Developer
  • Administrator
  • Hero Member
  • *****
  • 1989
    • View Profile
    • WACUP (Winamp Community Update Project)
Re: Play Tracking Suggestion
« Reply #3 on: November 14, 2016, 03:39:29 PM »
Looks like the logging will grab just about everything I use:
Code: [Select]
13_11_2016 - 22:30:28 - Classical - "Royal Philharmonic Orchestra" - "Hooked on Classics, Part 3" - Hooked on Classics - 1981 - 3 - 6:00 - 362 - 128 - (removed)\Music\MP3\Classical\Royal Philharmonic Orchestra-Hooked on Classics\Royal Philharmonic Orchestra - Hooked on Classics - 03 - Hooked on Classics, Part 3.mp3

Is the %length% just supposed to put the minutes? This song is 6:02.  The %length_seconds% looks correct though.
In that example it should be being output as "6:02" when using %length% (will re-check as I re-used the code I use in JTFE so it should be working ok).


I'd program the date to look different but I just need to get it in some fashion.

Tying ATF formatting into this "ping" operation is fine.
I assume it's one of the RFC date formats that you'd want (based on what was in the earlier XML example). Just need to know which one and can look to get that added in.

Going with ATF and modifications of it may not be the ultimately best solution but for the most part it should suffice with it being a simpler way to access the metadata and custom data within how Winamp tends to want to work.

Hmmm, close Winamp and it crashed. Sent the debug email.
Although I thought I'd fixed that, it now transpires (as I'd not been able to fully test it) is that there's a hard-coded email address being used instead of what is specified via the config file. So you'll need to manually email those to my bug email address (am trying to figure out a quick solution to work around the native crash reporters issue :().

-dro

*

MarkRH

  • Beta Tester
  • Full Member
  • ***
  • 203
    • View Profile
    • Mark Headrick's Website
Re: Play Tracking Suggestion
« Reply #4 on: November 14, 2016, 07:59:49 PM »
I assume it's one of the RFC date formats that you'd want (based on what was in the earlier XML example). Just need to know which one and can look to get that added in.

Going with ATF and modifications of it may not be the ultimately best solution but for the most part it should suffice with it being a simpler way to access the metadata and custom data within how Winamp tends to want to work.

As long as the string can be converted with PHP using strtotime(); that's all I need. As it stands, it doesn't work.

Code: [Select]
<p>Time: <?= date('M/d/Y g:i:s A T',strtotime("13_11_2016 - 22:30:28")); ?></p>
Outputs: Time: Dec/31/1969 6:00:00 PM CST

Granted, since I know the format, I can programmatically create a string that will work with the function.   A string like "13-11-2016 22:30:28" does work.  So I could make the date be "%date% %time%" if date used dashes instead of underscores. Right now, in PHP I could just do a str_replace() to change "_" to "-".


*

Dr.Flay

  • Evil Genius
  • Beta Tester
  • Jr. Member
  • **
  • 99
  • AMIGA Forever
    • View Profile
    • About Me
Re: Play Tracking Suggestion
« Reply #5 on: December 13, 2016, 01:36:33 AM »
Henry00 of 00Laboritories is working on an update for his old plugin "HRequest".
It is aimed at working the other way round, but displays the current playing track.

"Description:   HRequest is a Winamp General Plugin that allows requesting songs through a website.
If you require remote controls or wish to let friends choose what they would like to listen then this is for you."
http://wayback.archive.org/web/20140208031127/http://00laboratories.com/?q=node/22

I can suggest he bring the new version here for testing. I have a beta, but as it was personally given and is not yet on the new site, so I won't hand it out without permission.

I will attach the old version so you have an idea of the setup.
Actually I can see this working well with people that host shoutcast radio.
My weekly radio show on Source FM ☛ 15% Extra

*

dro

  • Admin / WACUP Developer
  • Administrator
  • Hero Member
  • *****
  • 1989
    • View Profile
    • WACUP (Winamp Community Update Project)
Re: Play Tracking Suggestion
« Reply #6 on: December 13, 2016, 03:41:59 PM »
Hmm, was this posted in the correct thread or should it have been in https://getwacup.com/community/index.php/topic,54.0.html instead ? Just not sure something about remote playback control really works in a thread about now playing posting :)

-dro

*

Dr.Flay

  • Evil Genius
  • Beta Tester
  • Jr. Member
  • **
  • 99
  • AMIGA Forever
    • View Profile
    • About Me
Re: Play Tracking Suggestion
« Reply #7 on: December 14, 2016, 07:00:37 PM »
I know, I did think long and hard where to post, but it came to mind because of the need here.
It displays the current playing track on a website, and allows people to request tracks from playlists.
The new version is supposed to be more flexible, so it may be easier to use it with no playlists.

However....
I have other suggestions that may be more suitable.
Until Last.fm turned into a bag of poo, I relied on that to provide my playing now info, but since using "Simple Last.fm Scrobbler" for android, I have found a few more by looking in the settings.

https://f-droid.org/repository/browse/?fdid=com.adam.aslfms
https://github.com/tgwizard/sls

The services it lists are;
Last.fm
Libre.fm
Listen Brainz
Custom GNU-fm/Libre.fm Server
Custom Listen Brainz Server

Non-comercial sites and plugins are much more preferable I think.
My weekly radio show on Source FM ☛ 15% Extra

*

MarkRH

  • Beta Tester
  • Full Member
  • ***
  • 203
    • View Profile
    • Mark Headrick's Website
Re: Play Tracking Suggestion
« Reply #8 on: December 19, 2016, 12:53:07 AM »
Looks like the song length is working correctly now.
Code: [Select]
18-12-2016 - 18:33:55 - Soundtrack - "Basil Poledouris" - "Crystal Palace" - Conan The Destroyer - 1984 - 5 - 6:13 - 373 - 128 - (removed)\Music\MP3\Soundtrack\Basil Poledouris-Conan The Destroyer\Basil Poledouris - Conan The Destroyer - 05 - Crystal Palace.mp3 -
Now just looking forward to being able to execute a URL with song information attached to it.  :)  Hmm, someway to know that Winamp started/stopped playing, attached to the start/stop events perhaps.
« Last Edit: December 19, 2016, 12:56:33 AM by MarkRH »

*

dro

  • Admin / WACUP Developer
  • Administrator
  • Hero Member
  • *****
  • 1989
    • View Profile
    • WACUP (Winamp Community Update Project)
Re: Play Tracking Suggestion
« Reply #9 on: December 20, 2016, 11:35:20 PM »
Yeah, I need to pull my finger out and get it implemented ;)  When you say about knowing the state, I could either do it as an ATF field or can just go for specific configuration values to use for the distinct events (play, pause, unpause, stop).

-dro

*

dro

  • Admin / WACUP Developer
  • Administrator
  • Hero Member
  • *****
  • 1989
    • View Profile
    • WACUP (Winamp Community Update Project)
Re: Play Tracking Suggestion
« Reply #10 on: January 12, 2017, 06:54:09 PM »
Am in the process of finishing off the handling related to this new prefs page...

-dro

*

MarkRH

  • Beta Tester
  • Full Member
  • ***
  • 203
    • View Profile
    • Mark Headrick's Website
Re: Play Tracking Suggestion
« Reply #11 on: January 12, 2017, 10:48:08 PM »
Cool. I've actually been working on a database to store the song's Winamp has played. I can then use this to display the song history.  Looking forward to this update. :)

*

dro

  • Admin / WACUP Developer
  • Administrator
  • Hero Member
  • *****
  • 1989
    • View Profile
    • WACUP (Winamp Community Update Project)
Re: Play Tracking Suggestion
« Reply #12 on: January 24, 2017, 03:50:11 PM »
Thanks to the feedback Mark provided for the interim builds of the plug-in that he very kindly tested, the POST feature in the latest beta (#1400) should work without major issue :)

-dro

*

MarkRH

  • Beta Tester
  • Full Member
  • ***
  • 203
    • View Profile
    • Mark Headrick's Website
Re: [IMPLEMENTED] Play Tracking Suggestion
« Reply #13 on: January 24, 2017, 09:58:23 PM »
It saves the POST entries now. Yay. With this working I'll be using this much more.  http://www.markheadrick.com/entertainment.shtml is what I've played with both Winamp and Wacup..

Thanks for all your work!

*

dro

  • Admin / WACUP Developer
  • Administrator
  • Hero Member
  • *****
  • 1989
    • View Profile
    • WACUP (Winamp Community Update Project)
Re: [IMPLEMENTED] Play Tracking Suggestion
« Reply #14 on: January 24, 2017, 10:29:09 PM »
It saves the POST entries now.
For others reading this, this was a side-effect of using the interim build of the Yule Log plug-in without the full WACUP build update due to some internal changes which had been made that saving not work correctly.

Thanks for all your work!
8)

-dro