In my music player if you add songs to the playlist , program first creates a directory by the name of playlist and then a .txt
file. In this file , it adds the path or name of the song added in the playlist.Each entry is on a new 开发者_运维知识库line.So if i create a playlist named "Ghazals" and add 100 songs into that playlist 100 new lines are inserted in the txt file under the folder named "Ghazals".
If there are 50 playlists there will be 50 folders and in each folder there will be txt files that has the list of songs.
For sure,this is not the right way . What should i do to avoid this (the cluster) ? For example how do players like "window media player" save their playlists ?
Just use a single XML file! Its what iTunes does....
Edit: More (useful) details.
In an XML file, not only can you store data about audio files (meta data for fast searching, path to file, etc) but you can assign each one a unique ID. Then, in the same XML file, you can make lists of these ID's and call them playlists.
If you have iTunes, just find the Music Library file and open it with a text editor.
精彩评论