```ruby
module Yomou

  class Bookshelf

    def initialize
      @conf = Yomou::Config.new

      Groonga::Context.default_options = {:encoding => :utf8}
      Groonga::Database.open(File.expand_path(@conf.database))
    end

    def ncode_exist?(ncode)
      novels = Groonga["NarouNovels"]
      novels.has_key?(ncode.upcase)
    end

    def register_ncode(ncode)
      novels = Groonga["NarouNovels"]
      ncodes = []
      if ncode.kind_of?(String)
        ncodes = [ncode]
      else
        ncodes = ncode
      end
      ncodes.each do |ncode|
        unless novels.has_key?(ncode.upcase)
          p "register ncode:#{ncode.upcase}"
          novels.add(ncode.upcase,
                     :yomou_status => YOMOU_NOVEL_NONE,
                     :yomou_sync_interval => YOMOU_SYNC_INTERVAL,
                     :yomou_sync_schedule => Time.now + YOMOU_SYNC_INTERVAL)
        else
          print "skip #{ncode.upcase}"
        end
      end
    end

  end
end
```

Add method to fetch ncodes from realpath
user
```ruby
module Yomou

  class Bookshelf

    def initialize
      @conf = Yomou::Config.new

      Groonga::Context.default_options = {:encoding => :utf8}
      Groonga::Database.open(File.expand_path(@conf.database))
    end

    def ncode_exist?(ncode)
      novels = Groonga["NarouNovels"]
      novels.has_key?(ncode.upcase)
    end

    def ncodes_from_realpath
      Dir.chdir(File.expand_path(@conf.directory)) do
        `find . -maxdepth 3 -name 'n[0-9]*'`.split.each do |entry|
          if entry =~ /\/(n.+)$/
            ncode = $1
            p ncode
            ncodes << ncode
          end
        end
      end
    end

    def register_ncode(ncode)
      novels = Groonga["NarouNovels"]
      ncodes = []
      if ncode.kind_of?(String)
        ncodes = [ncode]
      else
        ncodes = ncode
      end
      ncodes.each do |ncode|
        unless novels.has_key?(ncode.upcase)
          p "register ncode:#{ncode.upcase}"
          novels.add(ncode.upcase,
                     :yomou_status => YOMOU_NOVEL_NONE,
                     :yomou_sync_interval => YOMOU_SYNC_INTERVAL,
                     :yomou_sync_schedule => Time.now + YOMOU_SYNC_INTERVAL)
        else
          print "skip #{ncode.upcase}"
        end
      end
    end

  end
end
```
assistant