Link to home
Start Free TrialLog in
Avatar of mafendee
mafendee

asked on

Creating mp3 database

Dear Experts,

I am currently trying to build an mp3 database on my postgresql DB system under Linux box. Please can anyone tell me how to proceed? I am a bit confuse how to store files (mp3) into the database because normally I just store an information such as names, addresses. I need to know where to on my disk/directory these mp3 files should be stored as well as command/query to initially store them.

Thank you for your help.
Avatar of ljian
ljian
Flag of United States of America image

The simplest way to do it is to store only  the name of the mp3 file along with full path in a VARCHAR field.
for ex: FILE= '/home/user/mp3/Beatles-Let it be.mp3'

You can then feed this field value to a command line player (mp123)

To store them in the database is very dificult ... should be treated as LOBs (Large Object Bynary)
Avatar of RanjeetRain
RanjeetRain

You will be inviting troubles by storing them in a database. Store them in the file system and protect them with file-system permissions. For the structure, my recommendation would be:

Table Artist_Band
=============
ID - Running serial
Artist_Band - The name of the Artist or the Band
Type - Artist or Band


Table Albums
=============
ID - Running serial
Album - Name of the album


Table Titles
=============
ID - Running serial
ID_Artist_Band - The ID of the Artist or the Band
ID_Album - The ID of the Album
Path - Path on the file system
Year - Year (Optional)
Genre - Genre (Optional)
Bit_Rate - Bit-rate (Optional)
Rating - Rating (Optional)
URL - URL (Optional)
... ... ...
... ... ...
Any other title specific info.
You will be inviting troubles by storing them in a database. Store them in the file system and protect them with file-system permissions. For the structure, my recommendation would be:

Table Artist_Band
=============
ID - Running serial
Artist_Band - The name of the Artist or the Band
Type - Artist or Band


Table Albums
=============
ID - Running serial
Album - Name of the album


Table Titles
=============
ID - Running serial
ID_Artist_Band - The ID of the Artist or the Band
ID_Album - The ID of the Album
Path - Path on the file system
Year - Year (Optional)
Genre - Genre (Optional)
Bit_Rate - Bit-rate (Optional)
Rating - Rating (Optional)
URL - URL (Optional)
... ... ...
... ... ...
Any other title specific info.

I reccomend store the entire spectrum of info as per MP3 Tag V2 spec.


Avatar of mafendee

ASKER

The thing is, if I just store the mp3 files by name, how can I later query and load it into the player or other program for further use? If I am right, in postgresql I could also use TEXT field instead of VARCHAR? Do you see any different between this two datatype?
ASKER CERTIFIED SOLUTION
Avatar of RanjeetRain
RanjeetRain

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Thank you for the answer. It was very quick and useful!
Glad to help!