Gepub.Doc

g GObject.GInterface GObject.GInterface Gio.Initable Gio.Initable GObject.GInterface->Gio.Initable GObject.Object GObject.Object Gepub.Doc Gepub.Doc GObject.Object->Gepub.Doc Gio.Initable->Gepub.Doc

Subclasses:

None

Methods

Inherited:

GObject.Object (37), Gio.Initable (2)

Structs:

GObject.ObjectClass (5)

class

new (path)

get_chapter ()

get_content ()

get_cover ()

get_current ()

get_current_id ()

get_current_mime ()

get_current_path ()

get_current_with_epub_uris ()

get_metadata (mdata)

get_n_chapters ()

get_resource (path)

get_resource_by_id (id)

get_resource_mime (path)

get_resource_mime_by_id (id)

get_resource_path (id)

get_resources ()

get_text ()

get_text_by_id (id)

get_toc ()

go_next ()

go_prev ()

resource_id_to_chapter (id)

resource_uri_to_chapter (uri)

set_chapter (index)

Virtual Methods

Inherited:

GObject.Object (7), Gio.Initable (1)

Properties

Name

Type

Flags

Short Description

chapter

int

r/w

The current chapter index

path

str

r/w/co

Path to the EPUB document

Signals

Inherited:

GObject.Object (1)

Fields

Inherited:

GObject.Object (1)

Class Details

class Gepub.Doc(**kwargs)
Bases:

GObject.Object, Gio.Initable

Abstract:

No

Structure:

Gepub.DocClass

classmethod new(path)
Parameters:

path (str) – the epub doc path

Raises:

GLib.Error

Returns:

the new Gepub.Doc created

Return type:

Gepub.Doc

get_chapter()
Returns:

the current chapter index, starting from 0

Return type:

int

get_content()
Returns:

the document content

Return type:

GLib.Bytes

get_cover()
Returns:

cover file path to retrieve with Gepub.Doc.get_resource

Return type:

str

get_current()
Returns:

the current chapter data

Return type:

GLib.Bytes

get_current_id()
Returns:

the current resource id

Return type:

str

get_current_mime()
Returns:

the current resource mime

Return type:

str

get_current_path()
Returns:

the current resource path

Return type:

str

get_current_with_epub_uris()
Returns:

the current chapter data, with resource uris renamed so they have the epub:/// prefix and all are relative to the root file

Return type:

GLib.Bytes

get_metadata(mdata)
Parameters:

mdata (str) – a metadata name string, Gepub.META_TITLE for example

Returns:

metadata string

Return type:

str

get_n_chapters()
Returns:

the number of chapters in the document

Return type:

int

get_resource(path)
Parameters:

path (str) – the resource path

Returns:

the resource content

Return type:

GLib.Bytes

get_resource_by_id(id)
Parameters:

id (str) – the resource id

Returns:

the resource content

Return type:

GLib.Bytes

get_resource_mime(path)
Parameters:

path (str) – the resource path

Returns:

the resource mime

Return type:

str

get_resource_mime_by_id(id)
Parameters:

id (str) – the resource id

Returns:

the resource content

Return type:

str

get_resource_path(id)
Parameters:

id (str) – the resource id

Returns:

the resource path

Return type:

str

get_resources()
Returns:

doc resource table

Return type:

{str: Gepub.Resource}

get_text()
Returns:

the list of text in the current chapter.

Return type:

[Gepub.TextChunk]

get_text_by_id(id)
Parameters:

id (str) – the resource id

Returns:

the list of text in the current chapter.

Return type:

[Gepub.TextChunk]

get_toc()
Returns:

the navigation list in order

Return type:

[Gepub.NavPoint]

go_next()
Returns:

True on success, False if there’s no next chapter

Return type:

bool

go_prev()
Returns:

True on success, False if there’s no previous chapter

Return type:

bool

resource_id_to_chapter(id)
Parameters:

id (str) – The resource id

Returns:

the chapter index to use with Gepub.Doc.set_chapter or -1 if the resource isn’t found

Return type:

int

This method tries to find the resource by id in the doc spine and will return the index in that list. If the resourse isn’t there this method will return -1.

resource_uri_to_chapter(uri)
Parameters:

uri (str) – The resource path

Returns:

the chapter index to use with Gepub.Doc.set_chapter or -1 if the resource isn’t found

Return type:

int

This method tries to find the resource by path in the doc spine and will return the index in that list. If the resourse isn’t there this method will return -1.

set_chapter(index)
Parameters:

index (int) – the index of the new chapter

Sets the document current chapter to index.

Property Details

Gepub.Doc.props.chapter
Name:

chapter

Type:

int

Default Value:

0

Flags:

READABLE, WRITABLE

The current chapter index

Gepub.Doc.props.path
Name:

path

Type:

str

Default Value:

None

Flags:

READABLE, WRITABLE, CONSTRUCT_ONLY

Path to the EPUB document