>_ DevTrendspl

Język

Strona główna

Języki

Sekcje

Frontend Backend Mobilne DevOps AI / ML GameDev Blockchain Systemy wbudowane Bezpieczeństwo
Kotlin

How to build your own media library from scratch: Legado-E review

Familiar situation: you want to read a book, watch a series, or listen to a podcast, but each type of content requires a separate app. And if the content is scattered across different sites, your phone turns into a pile of icons. I recently came across the Luoyacheng/legado-E repository, which offers a radical approach to this problem.

legado

What is this thing anyway

Legado-E (or 阅读Sigma) is a fork of the popular open-source reader Legado. If the original project focused mainly on books, the Sigma version went further. Essentially, it's an empty "engine" with an advanced parser. You feed it rules (sources), and it transforms raw HTML from virtually any site into a clean reader or player interface.

The project is written in Kotlin and targets Android. The main feature here is that the app itself doesn't contain any content. It's a tool for those who like to customize everything to their liking and don't want to depend on the whims of streaming platforms or online libraries.

How Sigma differs from the original

The developers didn't reinvent the wheel and kept the Legado 3.0 base, but added several things that were really missing:

  • Multimedia. It's not just about text anymore. Sigma has an audio player with lyrics support and a video player that even handles danmaku (flying comments overlaid on video).
  • Improved source editor. Writing rules for site parsing became a bit easier. If you've ever tried debugging regex or XPath in a mobile interface, you'll understand why this matters.
  • Flexible subscriptions. The RSS and content update system works more reliably here than in the vanilla version.

How it works in practice

All the magic hinges on "sources" (Book Sources). You create a JSON file where you describe how to search for a book on a site, where the table of contents is, and how to extract the chapter text.

Interestingly, the app provides two types of API: via Web and via Content Provider. This allows you to, for example, manage your library remotely or integrate the reader with other services.

Technical stack under the hood

The project actively uses standard Android development libraries, but the dependency list is impressive:

  • Jsoup and JsoupXpath — for parsing the HTML tree.
  • Rhino Android — for executing JavaScript scenarios inside parsing rules.
  • OkHttp — for network requests.
  • LyricViewX — the library for displaying scrolling lyrics in the audio player.

Why developers might find this interesting

If you're into parsing or automation, Legado-E is an excellent testing ground. Instead of writing your own solution for reading data from some specific resource, you can just write a rule for this app.

By the way, the repository supports custom themes and flexible typography settings. You can change everything: from line spacing to conversion rules for Simplified Chinese to Traditional (though less relevant for the Russian-speaking segment, the mechanism for replacing text "on the fly" via regex is very powerful).

Is it worth trying

Legado-E is a specific project. It has a learning curve: you'll either need to search for ready-made source lists online (there are many on Telegram channels and forums), or figure out the JSON rule structure yourself.

Who will definitely like it:

  1. Those who want an "all-in-one" for all types of content in a single package.
  2. Those who value privacy and no ads (the app is completely clean).
  3. Developers who need a convenient client for their home servers or specific sites.

The downside is that documentation is mostly in Chinese, but the interface is intuitive, and the community on Discord and Telegram is quite responsive. If you feel cramped within regular readers, Sigma definitely deserves a spot on your smartphone.

Powiązane projekty