Solved

Creating mp3 database

Posted on 2004-05-02
7
283 Views
Last Modified: 2012-06-21
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.
0
Comment
Question by:mafendee
  • 4
  • 2
7 Comments
 
LVL 2

Expert Comment

by:ljian
ID: 10972152
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)
0
 
LVL 19

Expert Comment

by:RanjeetRain
ID: 10977959
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.
0
 
LVL 19

Expert Comment

by:RanjeetRain
ID: 10978001
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.


0
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 

Author Comment

by:mafendee
ID: 10986060
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?
0
 
LVL 19

Accepted Solution

by:
RanjeetRain earned 125 total points
ID: 10986266
If you store the filename, you'd be happier and would be spending much less time coding. You just have to construct and pass the full file name to the media player you use. But if you store the MP3 file in a BLOG field, God help you. I don't know of any media player capable of playing directly from a database BLOG field. YOu will have to extarct the content and generate a temporary file anyway. Scary it sonuds tome, to say the least.

>> Do you see any different between this two datatype?
That depends on the implementation. Typically TEXT type is a large CHAR type which allows you to store large amounts of text. But it is of fixed width. You might endup wasting a lot of space in your DB. A VARCHAR is a flexible length text filed. It occupies ONLY enough required amount of storage space.


~ Ranjeet Rain


0
 

Author Comment

by:mafendee
ID: 11015770
Thank you for the answer. It was very quick and useful!
0
 
LVL 19

Expert Comment

by:RanjeetRain
ID: 11017179
Glad to help!
0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
AWS RDS Backups? 3 63
Access Importing Table Query With Specific Timestamp Daily 2 43
MySQL-Design Help 12 44
Assigning Database Principals to Database Roles 3 19
This article explains all about SQL Server Piecemeal Restore with examples in step by step manner.
Recently, Microsoft released a best-practice guide for securing Active Directory. It's a whopping 300+ pages long. Those of us tasked with securing our company’s databases and systems would, ideally, have time to devote to learning the ins and outs…
Video by: Steve
Using examples as well as descriptions, step through each of the common simple join types, explaining differences in syntax, differences in expected outputs and showing how the queries run along with the actual outputs based upon a simple set of dem…
Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…

730 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question