开发者

Music Player Data Structure

开发者 https://www.devze.com 2023-03-16 05:55 出处:网络
I am making a music player for fun, and have run into a issue thinking about how to structure the data. My first thought was a tree structure where Genre was the root and each genre holds a list of ar

I am making a music player for fun, and have run into a issue thinking about how to structure the data. My first thought was a tree structure where Genre was the root and each genre holds a list of artists, each artist holds a list of albums, each album holds a list of song titles. The problem with this is that albums get split up because some songs on an album have a genre of "rock" and another song on 开发者_如何学Cthe same album might have a genre called "metal".

Any thoughts on a better approach?


First thing to note is that almost everyone has a different way of categorizing music so you might want to make the display format flexible.

A popular option is to 'import' music into a 'library' which is basically just scanning a user defined directory for supported formats, ripping out as much information as you can from each file and importing into an internal database.

Most players then let you select to display music by Album, Genre, Artist, etc.

0

精彩评论

暂无评论...
验证码 换一张
取 消