# File lib/mpdserver.rb, line 57
        def initialize( port, db_file = nil, *args )
                super port, *args

                if db_file.nil?
                        db_file = __FILE__.gsub(/\/[^\/]*$/, '') + '/../data/database.yaml'
                end

                @status = {
                        :volume => 0,
                        :repeat => 0,
                        :random => 0,
                        :playlist => 1,
                        :state => 'stop',
                        :xfade => 0
                }
                @elapsed_time = 0
                @current_song = nil
                @database = YAML::load( File.open( db_file ) )
                @songs = @database[0]
                @playlists = @database[1]
                @artists = []
                @albums = []
                @titles = []
                @the_playlist = []
                @playback_thread = nil
                @filetree = {:name =>'', :dirs =>[], :songs =>[]}
                @songs.each_with_index do |song,i|
                        song['id'] = i
                        if !song['artist'].nil? and !@artists.include? song['artist']
                                @artists << song['artist']
                        end
                        if !song['album'].nil? and !@albums.include? song['album']
                                @albums << song['album']
                        end
                        if !song['title'].nil?
                                @titles << song['title']
                        end
                        if !song['file'].nil?
                                dirs = song['file'].split '/'
                                dirs.pop
                                the_dir = @filetree
                                dirs.each do |d|
                                        found = nil
                                        the_dir[:dirs].each do |sub|
                                                if sub[:name] == d
                                                        found = sub
                                                        break
                                                end
                                        end
                                        if found.nil?
                                                found = {:name => d, :dirs =>[], :songs =>[]}
                                                the_dir[:dirs] << found
                                        end
                                        the_dir = found
                                end # End dirs.each
                                the_dir[:songs] << song
                        end # End if !song['file'].nil?
                end # End @songs.each

                sort_dir @filetree
                @artists.sort!
                @albums.sort!
                @titles.sort!
        end