Solved

Creating mp3 database

Posted on 2004-05-02
7
279 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
How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

 

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

Better Security Awareness With Threat Intelligence

See how one of the leading financial services organizations uses Recorded Future as part of a holistic threat intelligence program to promote security awareness and proactively and efficiently identify threats.

Join & Write a Comment

Entity Framework is a powerful tool to help you interact with the DataBase but still doesn't help much when we have a Stored Procedure that returns more than one resultset. The solution takes some of out-of-the-box thinking; read on!
This article explains all about SQL Server Piecemeal Restore with examples in step by step manner.
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…

705 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

Need Help in Real-Time?

Connect with top rated Experts

18 Experts available now in Live!

Get 1:1 Help Now