Author Topic: Import playlists (m3u)?  (Read 3117 times)

dothedog

  • Veteran
  • ***
  • Posts: 82
    • View Profile
Import playlists (m3u)?
« on: May 22, 2011, 06:38:22 pm »
I have seen a few old references to some work done on importing m3u playlists, e.g. here:
http://forum.linuxmce.org/index.php?topic=5803.0

and I noticed that there is an "Export" button in the webadmin. I am still looking for an "import" function. I have a few playlists that are pretty large, but are in m3u format. Barring a "button", can this be done in mysql? I looked at the PlaylistEntry table and the only thing I couldn't figure out was the FK_File. Where is that number located? Any thoughts on a stand alone script to build a Playlist?

Dothedog

Marie.O

  • Administrator
  • LinuxMCE God
  • *****
  • Posts: 3676
  • Wastes Life On LinuxMCE Since 2007
    • View Profile
    • My Home
Re: Import playlists (m3u)?
« Reply #1 on: May 22, 2011, 08:24:11 pm »
you have to write a script, that references the entries in the m3u file with the entries in the table File of LinuxMCE. After doing that, create the necessary entries into the Playlist table prefixing the found PK_File number with F

dothedog

  • Veteran
  • ***
  • Posts: 82
    • View Profile
Re: Import playlists (m3u)?
« Reply #2 on: May 23, 2011, 01:32:27 am »
posde,
Thanks for the reply. I understand what has to happen with the script, parse the records, look up  PK_File in File then insert t all into PlaylistEntry. I am afraid however it is beyond my scripting foo skills. Has someone written something that I can edit ?

DoTheDog

Marie.O

  • Administrator
  • LinuxMCE God
  • *****
  • Posts: 3676
  • Wastes Life On LinuxMCE Since 2007
    • View Profile
    • My Home
Re: Import playlists (m3u)?
« Reply #3 on: May 23, 2011, 07:42:03 am »
No such script exists at the moment.

And I am sure, you will be fine doing it. Take one step at a time, search the web, I am sure lots of scripts already exist to parse a m3u file from bash or perl or python or whatnot. start little, and let it grow

purps

  • NEEDS to work for LinuxMCE
  • ***
  • Posts: 1402
  • If it ain't broke, tweak it
    • View Profile
Re: Import playlists (m3u)?
« Reply #4 on: May 24, 2011, 02:44:28 pm »
This is something that I would be interested in also - I have extensive playlists on a separate ubuntu desktop that I would like to import into LMCE.

I understand an .m3u file is essentially just a list of paths, correct? Would the script need to replace this path with "/mnt/device/76/public/data/music" or whatever, or would the script only be interested in the last part i.e. the filename?

dothedog, do you want to get together on IRC at some point and attempt this together? My scripting skills aren't amazing, but two heads will be better than one.

Cheers,
Matt.
1004 RC :: looking good :: upgraded 01/04/2013
my setup :: http://wiki.linuxmce.org/index.php/User:Purps

Marie.O

  • Administrator
  • LinuxMCE God
  • *****
  • Posts: 3676
  • Wastes Life On LinuxMCE Since 2007
    • View Profile
    • My Home
Re: Import playlists (m3u)?
« Reply #5 on: May 24, 2011, 02:46:29 pm »
You need to find out, where the file is in the LinuxMCE hierarchie, to find its PK_File ID. The Playlist table only cares about the PK_File