'Populate a dict of paths from iTunes Library|Books
Windows assumes pythoncom wrapper'

def _get_library_books(self):

    if self.verbose:
        logger().info(('\n    %s._get_library_books()' % self.__class__.__name__))
    library_books = {}
    library_orphans = {}
    lib = None
    if isosx:
        import appscript
        for source in self.iTunes.sources():
            if (source.kind() == appscript.k.library):
                lib = source
                if self.verbose:
                    logger().info(("        Library    source:    '%s'" % lib.name()))
                break
        else:
            if self.verbose:
                logger().error('        Library    source    not    found')
        if (lib is not None):
            lib_books = None
            if lib.playlists():
                for pl in lib.playlists():
                    if (pl.special_kind() == appscript.k.Books):
                        if self.verbose:
                            logger().info(("        Books    playlist:    '%s'" % pl.name()))
                        break
                else:
                    if self.verbose:
                        logger().info('        no    Library|Books    playlist    found')
                lib_books = pl.file_tracks()
                for book in lib_books:
                    if (book.kind() in self.Audiobooks):
                        if self.verbose:
                            logger().info(("            ignoring    '%s'    of    type    '%s'" % (book.name(), book.kind())))
                    else:
                        format = ('pdf' if book.kind().startswith('PDF') else 'epub')
                        path = (self.path_template % (book.name(), book.artist(), format))
                        if str(book.description()).startswith(self.description_prefix):
                            try:
                                if (book.location() == appscript.k.missing_value):
                                    library_orphans[path] = book
                                    if False:
                                        logger().info(("            found    iTunes    PTF    '%s'    in    Library|Books" % book.name()))
                            except:
                                if self.verbose:
                                    logger().error(('            iTunes    returned    an    error    returning    .location()    with    %s' % book.name()))
                        library_books[path] = book
                        if self.verbose:
                            logger().info(('            %-30.30s    %-30.30s    %-40.40s    [%s]' % (book.name(), book.artist(), book.album(), book.kind())))
            elif self.verbose:
                logger().info('        no    Library    playlists')
        elif self.verbose:
            logger().info('        no    Library    found')
    elif iswindows:
        lib = None
        for source in self.iTunes.sources:
            if (source.Kind == self.Sources.index('Library')):
                lib = source
                logger().info(("        Library    source:    '%s'    kind:    %s" % (lib.Name, self.Sources[lib.Kind])))
                break
        else:
            logger().error('        Library    source    not    found')
        if (lib is not None):
            lib_books = None
            if (lib.Playlists is not None):
                for pl in lib.Playlists:
                    if ((pl.Kind == self.PlaylistKind.index('User')) and (pl.SpecialKind == self.PlaylistSpecialKind.index('Books'))):
                        if self.verbose:
                            logger().info(("        Books    playlist:    '%s'" % pl.Name))
                        lib_books = pl.Tracks
                        break
                else:
                    if self.verbose:
                        logger().info('        ERROR:    no    Library|Books    playlist    found')
            elif self.verbose:
                logger().info('        ERROR:    no    Library    playlists    found')
            try:
                for book in lib_books:
                    if (book.KindAsString in self.Audiobooks):
                        if self.verbose:
                            logger().info(("            ignoring    %-30.30s    of    type    '%s'" % (book.Name, book.KindAsString)))
                    else:
                        format = ('pdf' if book.KindAsString.startswith('PDF') else 'epub')
                        path = (self.path_template % (book.Name, book.Artist, format))
                        if book.Description.startswith(self.description_prefix):
                            if (not book.Location):
                                library_orphans[path] = book
                                if False:
                                    logger().info(("            found    iTunes    PTF    '%s'    in    Library|Books" % book.Name))
                        library_books[path] = book
                        if self.verbose:
                            logger().info(('            %-30.30s    %-30.30s    %-40.40s    [%s]' % (book.Name, book.Artist, book.Album, book.KindAsString)))
            except:
                if self.verbose:
                    logger().info('    no    books    in    library')
    self.library_orphans = library_orphans
    return library_books
