INTERACT FORUM

Please login or register.

Login with username, password and session length
Advanced search  
Pages: [1]   Go Down

Author Topic: Import of internet radio streams from Excel  (Read 3067 times)

MM_switcher

  • Junior Woodchuck
  • **
  • Posts: 88
Import of internet radio streams from Excel
« on: May 06, 2013, 02:48:53 am »

I like the great capabilities of JRMC18 when importing internet radio streams. Now I have a list of ~10k internet streams in MS-Excel I'd like to import into MC. Played around the weekend with copying some fields into an exported *.MPL, but didn't work.
Would be great, if this could somehow work  :)
Attached a small excerpt with 100 stations in case someone wants to try.

Thanks!
Logged

Matt

  • Administrator
  • Citizen of the Universe
  • *****
  • Posts: 42387
  • Shoes gone again!
Re: Import of internet radio streams from Excel
« Reply #1 on: May 06, 2013, 10:00:48 pm »

MPL should work, but you'll have to build it by hand.  However, pointing the record to a playlist instead of a stream might result in sketchy results.

A coming build adds the ability to browse SHOUTcast from Theater View.  It might be useful for you.
Logged
Matt Ashland, JRiver Media Center

MM_switcher

  • Junior Woodchuck
  • **
  • Posts: 88
Re: Import of internet radio streams from Excel
« Reply #2 on: May 07, 2013, 03:27:33 am »

Yea, I'm building the MPL now by hand; works, but lot of work.
If there are other people interested, we could open a new thread and share all the MPLs for radio streams that we have already collected?
The new feature you mentioned sounds great :-)
Logged

MrC

  • Citizen of the Universe
  • *****
  • Posts: 10462
  • Your life is short. Give me your money.
Re: Import of internet radio streams from Excel
« Reply #3 on: June 20, 2013, 03:03:30 am »

It should be easy enough to convert your excel spreadsheet exported as CSV into MPL.  I've previously posted several scripts to do this for others.  Ask if you still need help.
Logged
The opinions I express represent my own folly.

MM_switcher

  • Junior Woodchuck
  • **
  • Posts: 88
Re: Import of internet radio streams from Excel
« Reply #4 on: June 21, 2013, 04:56:46 am »

My wife always complains that I'm not good in searching. I tell her, I'm good in searching, maybe not in finding  ::)

Searched for half an hour on whole site with "csv" "mpl" "convert" w/o expected results.
Was also scanning all your posts until beginning of this year.
Couldn't find one script at all.

Could you please point me to a place where I can start?

Thanks in advance.
Logged

MrC

  • Citizen of the Universe
  • *****
  • Posts: 10462
  • Your life is short. Give me your money.
Re: Import of internet radio streams from Excel
« Reply #5 on: June 21, 2013, 11:49:47 am »

Sorry you had to spend so much time on this.  The forum search isn't so good with three-letter terms, and without using the author's name, it can be very tough to find things.

Normally I'd provide a link, but none of the scripts was one you'd use w/out modifications, so I was going to do it for you if you still had to convert your excel.

For the future, you can search things this way at Google:

   site:yabb.jriver.com -"Print Page" search terms here

This one should show you some of the scripts:

   site:yabb.jriver.com -"Print Page" activeperl  MrC 
Logged
The opinions I express represent my own folly.

MM_switcher

  • Junior Woodchuck
  • **
  • Posts: 88
Re: Import of internet radio streams from Excel
« Reply #6 on: June 21, 2013, 02:09:13 pm »

Thanks for proposing your help. Usually I want to learn to be able doing things on my own. But I'm not good in programming/scripting of any kind.

Please find attached an excel-file, which was my source for creating the MPL. The original contains more than 7k entries, but seems to be too large for uploading. So only Rock. If you would be so kind to share your script with me, I'd do in on my own for the rest.

Thanks again.
Logged

MrC

  • Citizen of the Universe
  • *****
  • Posts: 10462
  • Your life is short. Give me your money.
Re: Import of internet radio streams from Excel
« Reply #7 on: June 21, 2013, 02:35:00 pm »

You can send the entire file if you want to.

Can you tell me which columns you want imported and what exact MC fields you want these imported to (some are obvious, others such as Beschreibung would send me to Google translate).  If you want Genre imported, you currently have a backslash separator.  Is this how you'd like them imported (there is some benefit to that).

Edit: I see from the MPL you have enclosed how most of the fields should map.  Confirmation would still be helpful.
Logged
The opinions I express represent my own folly.

MM_switcher

  • Junior Woodchuck
  • **
  • Posts: 88
Re: Import of internet radio streams from Excel
« Reply #8 on: June 21, 2013, 03:58:06 pm »

You can send the entire file if you want to mrc at cappella dot us.

Can you tell me which columns you want imported and what exact MC fields you want these imported to (some are obvious, others such as Beschreibung would send me to Google translate).  If you want Genre imported, you currently have a backslash separator.  Is this how you'd like them imported (there is some benefit to that).

Edit: I see from the MPL you have enclosed how most of the fields should map.  Confirmation would still be helpful.

File is on its way.
Yes, I use backslash separator.
Yes, mapping of the fields as in the MPL would be fine.
I've provided translations in the mailed files.
Logged

MrC

  • Citizen of the Universe
  • *****
  • Posts: 10462
  • Your life is short. Give me your money.
Re: Import of internet radio streams from Excel
« Reply #9 on: June 21, 2013, 07:31:40 pm »

Try this.  It takes a long time to import, as MC appears to be analyzing the streams.  I had to leave before it finished, so I'm not sure how the data looks.
Logged
The opinions I express represent my own folly.

MM_switcher

  • Junior Woodchuck
  • **
  • Posts: 88
Re: Import of internet radio streams from Excel
« Reply #10 on: June 22, 2013, 05:32:47 am »

It loaded for 50min w/o result  :(
I did a comparison of one entry with the old and the new list. The following seems to me:
1. In general a second, <Field Name="Link2">, third, etc. field is not necessary, but doesn' lead to problems
2. The entries <Field Name="Web Media URL">, <Field Name="File Type">; <Field Name="Filename"> are missing in your file. I added them in the attached sample and it worked.

Could that be the solution for the complete list?
Logged

MrC

  • Citizen of the Universe
  • *****
  • Posts: 10462
  • Your life is short. Give me your money.
Re: Import of internet radio streams from Excel
« Reply #11 on: June 22, 2013, 11:25:23 am »

I'm not sure what file you used.  The file I uploaded contained Filename fields for each entry.

The Filename field is required to get the item to play at all.  The Web Media URL field causes the entry to appear under Audio > Connected Media > My Connected Media.  Without this field, and in any case, you can find the entries under Audio > Files.  If you want to find the audio links in both places, I'll add the Web Media URL field to duplicate the Filename field, and re-upload the file.

When I look this morning, the same file I attached had imported all entries (and actually had expanded them to about 11000 entries).  It took 4hrs 45mins, as many of the streams are remote and took a while to resolve (or timeout).
Logged
The opinions I express represent my own folly.

MrC

  • Citizen of the Universe
  • *****
  • Posts: 10462
  • Your life is short. Give me your money.
Re: Import of internet radio streams from Excel
« Reply #12 on: June 22, 2013, 11:28:50 am »

1. In general a second, <Field Name="Link2">, third, etc. field is not necessary, but doesn' lead to problems.

Above I'd asked which fields you wanted mapped, and how.  You said they were fine, so these Link# fields are included in the MPL.  If you want them imported as fields into MC, create new user fields with exactly the same name and case, and they will import into those fields.  Otherwise, the fields are ignored during the import process.
Logged
The opinions I express represent my own folly.

MrC

  • Citizen of the Universe
  • *****
  • Posts: 10462
  • Your life is short. Give me your money.
Re: Import of internet radio streams from Excel
« Reply #13 on: June 22, 2013, 11:33:34 am »

By the way, here is the perl code I wrote:

Code: [Select]
#!/usr/bin/perl

use strict;
use warnings;
use Text::CSV;

my $file = shift or
    die "Usage: $0 csvfile\nStopped";

my $csv = Text::CSV->new ( { binary => 1 } );

open (CSV, "<", $file) or die $!;

sub print_mpl {
    local $\ = "\r\n";

    print @_;
}

print_mpl '<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>';
print_mpl '<MPL Version="2.0" Title="Created from ', $0, '">';

my @fieldnames;
while (<CSV>) {

    if ($csv->parse($_)) {
        if ($. == 1) {
            @fieldnames = $csv->fields();
            for (@fieldnames) {
                $_ = 'Filename' if $_ eq 'Web Media URL';
            }
        }
        else {
            my @cells = $csv->fields();
            print_item(\@cells, \@fieldnames);
        }
    } else {
        my $error = $csv->error_input;
        print "CVS row parse error: $error";
    }
}
close CSV;

print_mpl '</MPL>';

sub print_item {
    my ($cellsref, $namesref) = @_;

    print_mpl '<Item>';
    for (my $i = 0; $i < @$namesref; $i++) {
        unless ($cellsref->[$i] eq '' or $cellsref->[$i] eq '-') {
            $cellsref->[$i] =~ s/\&/&amp;/g;
            $cellsref->[$i] =~ s/</&lt;/g;
            $cellsref->[$i] =~ s/>/&gt;/g;
            print_mpl '<Field Name="', $namesref->[$i], '">', $cellsref->[$i], '</Field>'
        }
    }
    print_mpl '<Field Name="Media Type">Audio</Field>';
    print_mpl '</Item>';
}
Logged
The opinions I express represent my own folly.

MM_switcher

  • Junior Woodchuck
  • **
  • Posts: 88
Re: Import of internet radio streams from Excel
« Reply #14 on: June 22, 2013, 12:01:50 pm »

Ah, me stupid  :(
I see my Radiofiles in a pane with media sub-type = Radio, and I always only looked there; that's the reaon I didn't see anything; darn..
Now I started again importing your file, this time with more patience.
Thanks also for the script; I'll try to get some knowlege on how to use it; install perl and so on
When finished importing I'll post the news. Have a nice weekend
Logged

MrC

  • Citizen of the Universe
  • *****
  • Posts: 10462
  • Your life is short. Give me your money.
Re: Import of internet radio streams from Excel
« Reply #15 on: June 22, 2013, 12:13:16 pm »

If you want to run the script, you'll need to install Perl, and you'll also need the Text::CSV module.  How you install these depend on the environment where you'll run the script.  Ask when you're ready.
Logged
The opinions I express represent my own folly.

MM_switcher

  • Junior Woodchuck
  • **
  • Posts: 88
Re: Import of internet radio streams from Excel
« Reply #16 on: June 22, 2013, 04:02:36 pm »

OMG, I'm excited!!!
It took 3:50, now I have 10308 radio stations. Most of them seem to work properly, I'll have to spend some years to listen to them all.
Thank you soooo much.
Logged

MrC

  • Citizen of the Universe
  • *****
  • Posts: 10462
  • Your life is short. Give me your money.
Re: Import of internet radio streams from Excel
« Reply #17 on: June 22, 2013, 05:15:47 pm »

Excellent - thanks for the update.
Logged
The opinions I express represent my own folly.
Pages: [1]   Go Up