?
Solved

Creating mp3 database

Posted on 2004-05-02
7
Medium Priority
?
287 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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
Windows Server 2016: All you need to know

Learn about Hyper-V features that increase functionality and usability of Microsoft Windows Server 2016. Also, throughout this eBook, you’ll find some basic PowerShell examples that will help you leverage the scripts in your environments!

 

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 500 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

NEW Veeam Agent for Microsoft Windows

Backup and recover physical and cloud-based servers and workstations, as well as endpoint devices that belong to remote users. Avoid downtime and data loss quickly and easily for Windows-based physical or public cloud-based workloads!

Question has a verified solution.

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

Recently I was talking with Tim Sharp, one of my colleagues from our Technical Account Manager team about MongoDB’s scalability. While doing some quick training with some of the Percona team, Tim brought something to my attention...
In today's business world, data is more important than ever for informing marketing campaigns. Accessing and using data, however, may not come naturally to some creative marketing professionals. Here are four tips for adapting to wield data for insi…
In this video, Percona Solution Engineer Dimitri Vanoverbeke discusses why you want to use at least three nodes in a database cluster. To discuss how Percona Consulting can help with your design and architecture needs for your database and infras…
In this video, Percona Solutions Engineer Barrett Chambers discusses some of the basic syntax differences between MySQL and MongoDB. To learn more check out our webinar on MongoDB administration for MySQL DBA: https://www.percona.com/resources/we…

777 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