Skip to content

codejar-lab/newsrack

 
 

Repository files navigation

newsrack

Generate a "newsrack" of periodicals for your ereader.

Uses calibre, GitHub Actions and hosted on GitHub Pages.

Running Your Own Instance

Enable Pages in your forked repository settings to deploy from GitHub Actions. If you wish to, from a different branch, customise _recipes_custom.py and add your own recipes to the recipes_custom/ folder. Remember to set the new branch as default so that GitHub Actions will build/deploy from the correct branch.

What Can Be Customised

  • The formats generated (src_ext, target_ext)
  • When periodical recipes are enabled (enable_on)
  • Remove/add recipes
  • cron schedule and job timeout interval in .github/workflows/build.yml

Example fork repo / Example customisations

Periodical Recipe Definition

# Defined in _recipes.py
Recipe(
    recipe="example",  # actual recipe name
    slug="example",  # file name slug
    src_ext="mobi",  # recipe output format
    category="news",  # category
    name="An Example Publication",
    # display name, taken from recipe source by default. Must be defined for built-in recipes.
    target_ext=[],  # alt formats that src_ext will be converted to
    timeout=300,  # max interval (seconds) for executing the recipe, default 180 seconds
    overwrite_cover=False,  # generate a plain cover to overwrite Calibre's
    enable_on=True,  # determines when to run the recipe
    retry_attempts=1,  # retry attempts on TimeoutExpired, ReadTimeout
    cover_options=CoverOptions(),  # cover options
),

Examples

Run a built-in Calibre periodical recipe:

Recipe(
    recipe="Associated Press",
    name="Associated Press",  # Required for built-in recipes
    slug="ap",
    src_ext="mobi",
    category="news",
),

Only generate epubs:

Recipe(
    recipe="example",  # example.recipe.py
    slug="example",
    src_ext="epub",  # generate epub
    target_ext=[],  # don't generate alt formats
    category="example",
),

Use enable_on to conditionally enable a recipe:

# instead of using the available functions, you can define your own custom functions for enable_on
from _recipe_utils import Recipe, onlyon_days, onlyat_hours, onlyon_weekdays

Recipe(
    recipe="example1",
    slug="example1",
    src_ext="epub",
    category="example",
    enable_on=onlyon_weekdays([0]),  # only on Mondays
),
Recipe(
    recipe="example2",
    slug="example2",
    src_ext="epub",
    category="example",
    enable_on=onlyon_days([1, 14]),  # only on days 1, 14 of each month
),
Recipe(
    recipe="example3",
    slug="example3",
    src_ext="epub",
    category="example",
    enable_on=onlyat_hours(list(range(6, 12)), -5),  # from 6am-11.59am daily, for the timezone UTC-5
),

Use calibre-generated cover:

Recipe(
    recipe="example",
    slug="example",
    src_ext="epub",
    category="example",
    overwrite_cover=False,
),

Customise the generated cover:

from _recipe_utils import CoverOptions

Recipe(
    recipe="example",
    slug="example",
    src_ext="epub",
    category="example",
    cover_options=CoverOptions(
        text_colour="white",
        background_colour="black",
        title_font_path="path/to/example.ttf",
        datestamp_font_path="path/to/example.ttf"
    ),
),

Available Recipes

In addition to built-in Calibre recipes, customised recipes (recipes/*.recipe.py) are included in this repository.

Recipes customised here have a modified publication_date which is set to the latest article date. This allows the outputs to be sorted by recency. The recipe title is also modified to include the latest article date or issue date/number.

In alphabetical order:

News
  1. Asahi Shimbun
  2. Channel News Asia
  3. The Financial Times
  4. The Guardian
  5. The JoongAng Daily
  6. The Korea Herald
  7. The New York Times
  8. The New York Times (Print)
  9. South China Morning Post
  10. Sydney Morning Herald
  11. Taipei Times
  12. The Washington Post
  13. The Japan Times
Magazines
  1. The Atlantic
  2. The Atlantic Magazine
  3. The Diplomat
  4. The Economist
  5. Harvard Business Review
  6. MIT Press Reader
  7. MIT Technology Review
  8. MIT Technology Review Magazine
  9. Nature
  10. Nautilus
  11. The New Yorker
  12. Poetry
  13. Politico
  14. ProPublica
  15. Rest of World
  16. Scientific American
  17. The Third Pole
  18. Time Magazine
  19. Vox
  20. Wired
Books
  1. Asian Review of Books
  2. Five Books
  3. London Review of Books
  4. The New Yorks Times - Books

About

Generate a newsrack of .mobi periodicals for your ereader

Resources

License

Stars

Watchers

Forks

Contributors

Languages

  • Python 97.7%
  • Other 2.3%