// OpenKobo opens a Kobo eReader device and the database.
OpenKobo opens a Kobo eReader device and the database.
// OpenKobo opens a Kobo eReader device and the database .
func OpenKobo(path string) (*Kobo, error) {
	if _, err := os.Stat(path); err != nil {
		return nil, err
	} else if _, err = os.Stat(filepath.Join(path, ".kobo")); err != nil {
		return nil, fmt.Errorf("could not access .kobo directory, is this a Kobo eReader: %v", err)
	}
	path, err := filepath.Abs(path)
	if err != nil {
		return nil, err
	}
	db, err := sql.Open("sqlite3", filepath.Join(path, ".kobo", "KoboReader.sqlite"))
	if err != nil {
		return nil, fmt.Errorf("could not open KoboReader.sqlite: %w", err)
	}
	if err := db.Ping(); err != nil {
		return nil, fmt.Errorf("could not open KoboReader.sqlite: %w", err)
	}
	return &Kobo{path, db}, nil
}
func OpenKobo ( path string ) ( * Kobo , error ) { if _ , err := os . Stat ( path ) ; err != nil { return nil , err } else if _ , err = os . Stat ( filepath . Join ( path , " " ) ) ; err != nil { return nil , fmt . Errorf ( " " , err ) } path , err := filepath . Abs ( path ) if err != nil { return nil , err } db , err := sql . Open ( " " , filepath . Join ( path , " " , " " ) ) if err != nil { return nil , fmt . Errorf ( " " , err ) } if err := db . Ping ( ) ; err != nil { return nil , fmt . Errorf ( " " , err ) } return & Kobo { path , db } , nil }
OpenKobo opens a Kobo eReader device and the database.
OpenKobo opens a Kobo eReader device and the database .