News:

Rule #1 - Be Patient - Rule #2 - Don't ask when, if you don't contribute - Rule #3 - You have coding skills - LinuxMCE's small brother is available: http://www.agocontrol.com

Main Menu

Shoutcast4LMCE - Perl script to import Shoutcast streams into LMCE

Started by jeangot, February 17, 2009, 07:01:51 AM

Previous topic - Next topic

jeangot

Hello,

as promissed I made a little perl script to import Shoutcast Streams for Playback in LMCE.

WARNING!
This is one big hack, and writes directly into your LMCE Database. It is poorly tested and poorly coded, hence will possibly mess up your system. If you are not prepared to mess up your system, don't try this. Please don't ask me how to fix your database if it's broken. You have been warned!

Features:
Import Shoutcast streams by shoutcast genre, with the ability to import multiple Shoutcast genres into one LMCE genre and removing duplicates within each shoutcast genre, keeping only the highest bitrate stream for each duplicate station. Also has the ability to add generic album and performer tags for better sorting of the Shoutcast streams in the LMCE Media file browser.

Other warning:
Shoutcast does not permit the continuous querying of a large number of playlist files and will quickly block your IP address if you do so.
You should try to limit yourself to a few interesting categories, limit the number of streams per category to something reasonable and don't run the script more than once per week

The perl script needs to run on the Core. It requires the following perl packages:

XML::DOM
LWP::Simple
Mysql
List::Util

To install them, run on your core:
perl -e shell -MCPAN
Then "install nameofpackage" using the package names above including the double colon.

At the beginning of the script are a few options, including the part where you customize the Genres you want to import.

Note that shoutcast seems to limit the number of queries you can do in a given time from your IP, so when you run the script, it will stop every once in a while (when shoutcast blocks you) and then resume. So if you see it stop, just wait for a while...

Enjoy!

Jean

Marie.O

Line 154 looks wrong and all the other lines with tablename PK_FileFormat
If I helped you, feel free to buy me a coffee: [url="https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=2VKASZLTJH7ES"]https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=2VKASZLTJH7ES[/url]

jeangot

Posde,
what do you think is wrong there? I don't see anything obvious.
Jean

Marie.O

If I helped you, feel free to buy me a coffee: [url="https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=2VKASZLTJH7ES"]https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=2VKASZLTJH7ES[/url]

jeangot

Posde,
thanks. I corrected it and updated the script attached to my initial post.
That was precisely the part that was never tested since I had done these changes manually on my DB :-)

Jean