Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!


Store Mp3's into mysql database ??? Easier way may be ?
New on LowEndTalk? Please Register and read our Community Rules.

All new Registrations are manually reviewed and approved, so a short delay after registration may occur before your account becomes active.

Store Mp3's into mysql database ??? Easier way may be ?

isansarisansar Member
edited May 2014 in Help

I'm trying to upload my Mp3's into db with specific tables (like - song_id , song_url ablum_id). And I know i can do this manually but i'm talking about huge mp3 files here. So, if anyone has done this before please help me. i just want to upload mp3's into db. GUI software may be? or php code ?

Please Suggest !!
Thanks Advance

Update : I will be storing URL only !!
Thanks for suggestion guys!

Comments

  • What you'd need to do is store it as a blob. You'll probably be advised from doing so as it's not really considered a "best practice", but is completely doable. If possible, store the MP3 on a file disk and then match the title up to the characteristics in the database.

  • mickeyrmickeyr Member

    I think he's looking for something more like this:

    http://s23.org/wiki/HowTo/Read_Mp3_ID3_tags_into_Sql_Database

    Thanked by 1isansar
  • You could use something like Helium Music Manager and link the database to MySQL. If your end goal is streaming your personal music collection though use Ampache or Subsonic. Or something more fully featured like Plex if that takes your fancy.

  • ATHKATHK Member

    JSON string in a text field? Just a suggestion not sure if it'll be the "proper" way depending on what you need to do I suppose...

  • A big JSON file probably isn't the best way to do it. At least use a document database like MongoDB or something like sqlite.

  • raindog308raindog308 Administrator, Veteran

    JSON...Mongo...WTF.

    Here is what you could do:

    for each file run mp3 tag binary (e.g., mp3info or whatever) to dump the mp3 tags for that mp3 parse tags however you want SQL: INSERT INTO mp3_files (title, artist, album) VALUES ( ?, ?, ?);

    There's probably a perl or python module to read mp3 tags directly.

    Thanked by 1hostnoob
  • Maybe it would be better to store the mp3 on the filesystem, and simply store the path to the mp3 (and other metadata) in database.

  • raindog308raindog308 Administrator, Veteran

    deptadapt said: Maybe it would be better to store the mp3 on the filesystem, and simply store the path to the mp3 (and other metadata) in database.

    Yeah I hope that's what he meant. You could store BLOBs in the DB but that would be silly. Instead, a table with the tags and file path. You could split out into many tables (artists, albums, etc.) with foreign keys if you want to get all 3NF on it.

  • AThomasHoweAThomasHowe Member
    edited May 2014

    raindog308 said: JSON...Mongo...WTF.

    For the record I wasn't advocating Mongo for this, just saying a collection of JSON (BSON) documents is at least better. Not sure MySQL is really the best idea either but I guess it depends what it's for, OP didn't explain much.

  • isansarisansar Member

    @AThomasHowe said:
    You could use something like Helium Music Manager and link the database to MySQL. If your end goal is streaming your personal music collection though use Ampache or Subsonic. Or something more fully featured like Plex if that takes your fancy.

    Is Helium Music Manger a browser based platform too?

  • isansarisansar Member

    @raindog308 said:
    Yeah I hope that's what he meant. You could store BLOBs in the DB but that would be silly. Instead, a table with the tags and file path. You could split out into many tables (artists, albums, etc.) with foreign keys if you want to get all 3NF on it.

    Yes exactly !! I can store mp3 somewhere and pull out the id tags and URL but I have no idea how so I begun :(
    Any ideas ??

  • ScionScion Member

    Use a text editor to create SQL insert statements for each row. With something like notepad++ and some creativity with replace all and macros you can do this on a large data set relatively easily. Then just run the insert statements as a script from the command line or phpmyadmin.

    Alternatively write a program that reads the data in whatever format you have it in and writes it out as SQL inserts. Depending on the original format that may be easier or harder than the first option.

    FWIW I don't recommend storing the mp3 data in the database. Store the paths to the files instead (as others have already mentioned).

    If you can tell us what format your original data is in and what your database schema looks like, maybe some kind soul here could write a script for you to help convert it.

  • isansarisansar Member

    original files

    Are all in .mp3 ext

    I tired doing it in notepad ++ but it's taking me too long to do so. I mean create album_id/song_id/URL for probably 1000s of albums. Tho I really appreciate your answer.

    I would like to store URL only. As everyone's recomd.

  • raindog308raindog308 Administrator, Veteran

    isansar said: I tired doing it in notepad ++ but it's taking me too long to do so. I mean create album_id/song_id/URL for probably 1000s of albums. Tho I really appreciate your answer.

    You need to learn a scripting/text processing language. Alternatively, find a tool that dumps mp3 tags into CSV and load it in that way, but you may have to do some scripting to iterate over the files. There are a million command-line tools for dumping mp3 tags and virtually all linux distros have them.

  • isansarisansar Member

    @mickeyr said:
    I think he's looking for something more like this:

    http://s23.org/wiki/HowTo/Read_Mp3_ID3_tags_into_Sql_Database

    Damn Right !!! exactly what i was looking for, I'm on half way now.
    Thanks @mickeyr.

Sign In or Register to comment.