SciLor's Open Source Forums
http://forum.scilor.com/

Code Contribution
http://forum.scilor.com/viewtopic.php?f=56&t=641
Page 1 of 1

Author:  opcon [ Mon Feb 21, 2011 11:22 am ]
Post subject:  Code Contribution

Thanks for the awesome app SciLor, and thanks also for releasing your source code.

I had a play around with it, and added a function for downloading a playlist straight from the playlist id, without logging in first. I also managed to download just enough of the mp3 file to read the header from it, which contains the bitrate, however that is a bit harder to implement (and I did it in C#, not VB) but I will post the code soon.

Anyway, here is the code to download straight from a playlist ID.



And the buttons :



And how to get the playlist url :
1. Open the playlist in grooveshark.
2. And there it is :

Author:  SciLor [ Mon Feb 21, 2011 4:45 pm ]
Post subject:  Re: Code Contribution

Thank you for posting the code here, I never thought about it that it is possible to load the playlist without being logged in, but if I find time, it will be implemented soon.

I am really interested in the bitrate code, I just read about it, but hadn't the time to really implement that. C# isn't a problem vb.net and c# are quite the same!

Author:  opcon [ Tue Feb 22, 2011 7:54 am ]
Post subject:  Re: Code Contribution

Yeah, the way I did it for testing the bitrate function, was to actually create a .dll of the mp3header reader class, which I could then access from visual basic, within your app :). This was easier than converting the C# code to VB.

I found the mp3 header class from here : , but I created an overload for it to accept a filestream object, because otherwise I was having problems with getting "The file is in use by another process" exceptions, even after closing the file. .Net seems to do that sometimes :p. Oh, and I also changed it a bit so it doesn't close the filestream once it's done. I'll upload the modified class soon.

After that, I just put a try...catch block in your download loop, and within that, first called ReadMp3Information with the filestream object, then if intBitrate was not 0, we have downloaded enough of the file to read the header, and get the bitrate :). I made a sample application in C#, which takes a playlist ID, and prints out a text file of all the songs in the playlist. Of course, I based it off your grooveshark API :).

(Link to my program coming soon)

Unfortunately it will never find the bitrate for some songs, maybe because the header info is stuffed up, who knows. In this case I have added a timeout which sets the bitrate to 0.

It is unrealistic to poll every song in the download list for it's bitrate, but maybe if the user could poll selected songs?

Author:  SciLor [ Tue Jan 03, 2012 11:27 pm ]
Post subject:  Re: Code Contribution

You still got the source laying around of the bitrate tester?

Author:  opcon [ Wed Jan 04, 2012 3:17 am ]
Post subject:  Re: Code Contribution

Ah..Shit, I dunno. I'll do some digging.

Author:  opcon [ Wed Jan 04, 2012 12:20 pm ]
Post subject:  Re: Code Contribution

Okay, I found it! Be warned this was using an old rebuilt version of your Grooveshark API, so it'll probably need replacing, but the rest of it should work reasonably well. Also, there's no comments on the code, and all I did was rar up the whole folder. But maybe you'll find it useful!


Author:  SciLor [ Wed Jan 04, 2012 6:48 pm ]
Post subject:  Re: Code Contribution

Thank you for digging ;)

I will just exchange the dlls than it should work fine. I try to keep my dll backwards compatible!

Page 1 of 1 All times are UTC + 1 hour [ DST ]
Powered by phpBB® Forum Software © phpBB Group
http://www.phpbb.com/