Author Topic: List of auto generated music urls.  (Read 15287 times)

e-motiv

  • Full Member
  • ***
  • Posts: 188
While I await some kind of tag notification in the API ::), I thought I'd make a plugin that is a kind of auto-playlist.
Here's a self-explanatory example:

There is this  FM radio program site hat ONLY provides it's own radio Flash software, but I DO know their mp3 files are just urls with a date behind it (more or less).
e.g. http://myradiostation.com/somefilename-HiQ-20110704.mp3.
So, my wish would be for a list that auto generates this week's full of mp3's. 

But I don't know where to start. For example:
- How do I make a "menu item" on the left (e.g. an entry in a group (e.g. "MyEntry" under "Playlists", or a seperate group (on same level as "library", "playlists", "internet", "computer") ?
- Which functions control it? Are they Windows forms or so or is it MB specific ? (I am new to windows "engine" :-) )
- How to populate a list? And do I have to make their (double) click behavior and right menu myself or can I take the default from MB?
- ...
Looking at the API functions, I guess it' might not ready yet for that, but I would be most happy to be mistaken!  ;D
Also any suggestions that I am going about this the wrong way, are also welcome.

And if it would not be possible via the API in the near future, feel free to move this to the wishlist.

P.S. No worries, I have the permission from that radio station to use those files how I see fit (as long as I don't overload or st. like that). That program love their listeners, just are tied by the radio station's policy and budgets...
  Developing @ e-motiv.net       --       Musicbee plugins: Speak Back - Ghost Tracks - Radio Dig

Steven

  • Administrator
  • Sr. Member
  • *****
  • Posts: 34392
with the current version of the api you can construct the "now playing list" only
NowPlayingList_Clear
NowPlayingList_QueueLast (probably the one you want to use)
NowPlayingList_QueueNext

e-motiv

  • Full Member
  • ***
  • Posts: 188
Thanks Steven.
I'll make my plugin with those for now.
  Developing @ e-motiv.net       --       Musicbee plugins: Speak Back - Ghost Tracks - Radio Dig

e-motiv

  • Full Member
  • ***
  • Posts: 188
By the way, How do I make users command this?

I mean, I added this to "Initialise" for now, but how do I add this to a menu or shortcut or any other GUI element?
  Developing @ e-motiv.net       --       Musicbee plugins: Speak Back - Ghost Tracks - Radio Dig

Steven

  • Administrator
  • Sr. Member
  • *****
  • Posts: 34392
there is MB_AddMenuItem but with the current MB version i only did a quick implementation to support boroda74's tag tools plugin.
I will make it a priority to get this sorted out for general usage and other API enhancements requested as a priority after bitmap skinning is done (hopefully this weekend)

e-motiv

  • Full Member
  • ***
  • Posts: 188
Great! Keep me posted.
  Developing @ e-motiv.net       --       Musicbee plugins: Speak Back - Ghost Tracks - Radio Dig

e-motiv

  • Full Member
  • ***
  • Posts: 188
with the current version of the api you can construct the "now playing list" only
NowPlayingList_Clear
NowPlayingList_QueueLast (probably the one you want to use)
NowPlayingList_QueueNext
Hmm..Clear works, but the other 2 do nothing.

I am calling them all in method "Configure" as follows (1.2.4201):
Code: C#
mbApi.NowPlayingList_Clear();
mbApi.NowPlayingList_QueueNext("http://download.streampower.be/vrt/klara/31_KL110005QMIX-snip_hi.mp3");
mbApi.NowPlayingList_QueueLast("http://download.streampower.be/vrt/klara/31_KL110005QMIX-snip_hi.mp3");
  Developing @ e-motiv.net       --       Musicbee plugins: Speak Back - Ghost Tracks - Radio Dig

Elberet

  • Full Member
  • ***
  • Posts: 167
The variable name "Uri" is somewhat misleading, I think. MusicBee accepts standard Windows paths for the PlayNow and Queue* commands (hint: those aren't URIs at all) and will actually refuse to open the same files when given as valid file:// URIs. MusicBee's Uri parameters are most likely more closely related to its database entries (which reference files on a local harddisk, after all) then actual URIs.

A clarification would be nice, tho, and I'd prefer if any exchange between MusicBee and plugins was using actual URIs. ;)

e-motiv

  • Full Member
  • ***
  • Posts: 188
Thanks, Elberet.
I wonder why Steven proposed them.

Anyway, so there is no way to add these URI(s)* anywhere?
* which are the radio streams of this topic (just in case  :P)
  Developing @ e-motiv.net       --       Musicbee plugins: Speak Back - Ghost Tracks - Radio Dig

Steven

  • Administrator
  • Sr. Member
  • *****
  • Posts: 34392
there is no block on uri's as such but looking at the code i see there is a block that MB needs to know about the file beforehand (the usual way would be the file is already in the library or a playlist). I will address that when i look the APIs soon

Elberet

  • Full Member
  • ***
  • Posts: 167
That explains a lot. So, essentially, MusicBee shouldn't care whether I say
NowPlayingList_PlayNow("E:\\Temp\\test.mp3");
or
NowPlayingList_PlayNow("file:///E:/Temp/test.mp3");

Correct?

Steven

  • Administrator
  • Sr. Member
  • *****
  • Posts: 34392
I am calling them all in method "Configure" as follows (1.2.4201):
Code: C#
mbApi.NowPlayingList_Clear();
mbApi.NowPlayingList_QueueNext("http://download.streampower.be/vrt/klara/31_KL110005QMIX-snip_hi.mp3");
mbApi.NowPlayingList_QueueLast("http://download.streampower.be/vrt/klara/31_KL110005QMIX-snip_hi.mp3");
i have changed it so MB does not need to know about the files you are playing beforehand. However the way its implemented is the file tags are read at the point you queue the file which for web-based links could take up to a few seconds if MB does not already have the file cached. If you are queing one or two files then i guess that wont matter too much.
I do have an internal mechanism for loading file tags a little before each file plays but its not straight-forward for me to hook that into the API, so i will only do that if you say you really need it.

e-motiv

  • Full Member
  • ***
  • Posts: 188
Thanks, Steven.  I will look into that asap.

Another thing, (also for other people that might read this):
This "asap" above could be a rather bit longer than expected from now. Reason: Recently some smoke came from my laptop and I have to send it to repair (again :( ) (within guarantee luckily).
And I don't have a backup laptop, but this one on which I am writing on now which I can use only a very few times.

So, as you may all know, I am not demotivated, just kinda helpless and angry with Asus.

Oh yeah, here is some advice to everyone: NEVER, NEVER buy an Asus!  Support really s****! And service is rather slow! Even if there hardware settings are really attractive..
  Developing @ e-motiv.net       --       Musicbee plugins: Speak Back - Ghost Tracks - Radio Dig

e-motiv

  • Full Member
  • ***
  • Posts: 188
I am back!
Yey! Although...waiting for 5 months to get money back from Asus repair service to be able to buy a new laptop and then only half of the money.
In short: NEVER BUY ASUS! (Hardware quality superb! Service and repair: Your hardware is outdated before anything happens!)

Anyway, it indeed seem to work now, Steven. Thanks! (Hook not needed..so far  ;) )


Some other things:
I installed 1.3.4321 (from 2.4218 or similar subversion number) and now the Plugins part of preferences doesn't refresh-load new plugins anymore after the first time.  You now have to close MusicBee to be able to see new plugins in the plugins folder. You may never have known it did refresh plugins before, but it was a huge developer benifit for me since I made a new plugin for each build (to test and try).
Now I have to close and restart MB after every build. 
Do you have any suggestions? Thanks.
  Developing @ e-motiv.net       --       Musicbee plugins: Speak Back - Ghost Tracks - Radio Dig

e-motiv

  • Full Member
  • ***
  • Posts: 188
The project is getting some progress.
Now I would like to do some more UI integrating, but I don't understand all API funtions.
So,...
..is there a wiki or api explanation yet? If not, pitty...
..more specifically, how can I add
......panel with entries (like "radio stations") and how to control it?
......OR
......an item under "Library", "Playlists", "Internet" or my own division and how to control it?
......OR
......any other solutions where I can add a list with "URLGenerators" of which each (on click) queues a list of URL's in the "Now Playing"?

Thanks!
  Developing @ e-motiv.net       --       Musicbee plugins: Speak Back - Ghost Tracks - Radio Dig