Author Topic: Shoutcast4LMCE - Perl script to import Shoutcast streams into LMCE  (Read 3542 times)

jeangot

  • Guru
  • ****
  • Posts: 233
    • View Profile
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
« Last Edit: February 19, 2009, 08:09:37 am by jeangot »

Marie.O

  • Administrator
  • LinuxMCE God
  • *****
  • Posts: 3676
  • Wastes Life On LinuxMCE Since 2007
    • View Profile
    • My Home
Re: Shoutcast4LMCE - Perl script to import Shoutcast streams into LMCE
« Reply #1 on: February 17, 2009, 11:58:34 am »
Line 154 looks wrong and all the other lines with tablename PK_FileFormat

jeangot

  • Guru
  • ****
  • Posts: 233
    • View Profile
Re: Shoutcast4LMCE - Perl script to import Shoutcast streams into LMCE
« Reply #2 on: February 18, 2009, 04:45:50 am »
Posde,
what do you think is wrong there? I don't see anything obvious.
Jean

Marie.O

  • Administrator
  • LinuxMCE God
  • *****
  • Posts: 3676
  • Wastes Life On LinuxMCE Since 2007
    • View Profile
    • My Home
Re: Shoutcast4LMCE - Perl script to import Shoutcast streams into LMCE
« Reply #3 on: February 18, 2009, 11:28:12 am »
Are you sure, the name of the table is PK_FileFormat? ;)

jeangot

  • Guru
  • ****
  • Posts: 233
    • View Profile
Re: Shoutcast4LMCE - Perl script to import Shoutcast streams into LMCE
« Reply #4 on: February 19, 2009, 08:10:30 am »
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