Symbolic Links

Enma offers a feature known as "Symbolic Links" to optimize the retrieval of manga chapters. This feature is particularly useful when working with manga that have a large number of chapters, as fetching all chapter data can be time-consuming. By utilizing symbolic links, Enma defers the full data fetch until it's specifically requested by the user. This document explains how to use symbolic links to efficiently access manga chapters.

A Symbolic Link in the context of the Enma library is a reference to a manga chapter that doesn't immediately load all chapter details (such as pages). Instead, it provides a way to fetch those details on-demand. This approach significantly speeds up the process of getting manga information when the complete chapter data is not immediately needed.

Setting Up Enma

First, ensure you have Enma initialized and the desired source set. Here's a basic setup using the manganato source:

from enma import Enma

enma = Enma()
enma.source_manager.set_source('manganato')

When retrieving manga details, you can specify the use of symbolic links. This tells Enma to create symbolic links for chapters instead of fetching all their data:

doujin = enma.get(identifier='manga-kb951984', with_symbolic_links=True)

After obtaining a manga with chapters represented as symbolic links, you can access a specific chapter's full details on-demand using the symbolic link. Here's how you fetch data for the first chapter:

if doujin is not None and len(doujin.chapter) > 0:
    chapter_ref = doujin.chapters[0]  # Reference to the first chapter's symbolic link
    chapter = enma.fetch_chapter_by_symbolic_link(chapter=chapter_ref)
    # Now you can access chapter details, such as pages

Example

from enma import Enma

enma = Enma()
enma.source_manager.set_source('manganato')
doujin = enma.get(identifier='manga-kb951984', with_symbolic_links=True)

if doujin is not None and len(doujin.chapters) > 0:
    chapter_ref = doujin.chapters[0]
    chapter = enma.fetch_chapter_by_symbolic_link(chapter=chapter_ref)
    # Use `chapter` to access its full details now

Symbolic links are a powerful feature in Enma that allow for efficient manga data retrieval, especially for manga with a large number of chapters. By deferring the full data fetch to when it's specifically needed, applications can perform faster and provide a better user experience.

Last updated