It's like dotfiles, but no, it's just Lua scripts I find useful.
Go to file
2025-01-15 05:20:07 -07:00
.abandoned reorganization! 2024-11-05 21:50:26 -07:00
htmlparser added dependencies of make-epub and fixed it :D 2024-11-05 00:53:24 -07:00
.gitignore closes #43 and starts #10 2024-12-11 23:41:39 -07:00
2pdf.lua Fix #20 2024-11-05 21:54:00 -07:00
2webm.lua Fix #20 2024-11-05 21:54:00 -07:00
720p.lua Fix #20 2024-11-05 21:54:00 -07:00
download-subtitles.lua requirements commented in download-subtitles.lua 2024-09-23 17:37:44 -06:00
htmlparser.lua fix #16, improved formatting 2024-11-05 16:19:37 -07:00
install-lua5.1-macos.sh script to install lua5.1 on macos because brew broke it for no reason :D 2024-02-18 18:10:27 -07:00
json.lua added dependencies of make-epub and fixed it :D 2024-11-05 00:53:24 -07:00
make-epub.lua fix #45 only downloads missing parts 2025-01-15 05:20:07 -07:00
pandoc_plaintext_reader.lua Ao3 support is less jank, but probably still unfinished. Close #38 2024-11-23 18:01:51 -07:00
print-arguments.lua ready for setup, test script 2024-01-13 01:35:29 -07:00
README.md automatic_naming more usable 2024-12-23 13:34:34 -07:00
reformat.lua note on line count 2024-01-13 21:17:19 -07:00
storage-statistics.lua lua_file_size imported as storage-statistics.lua 2024-01-13 19:52:12 -07:00
test.lua extremely hacky implementation of #38 2024-11-23 03:45:27 -07:00
unique-file-names.lua dealing with uniquitity weirdly 2024-05-23 20:57:51 -06:00
unique-file-paths.lua dealing with uniquitity weirdly 2024-05-23 20:57:51 -06:00
unique-files.lua dealing with uniquitity weirdly 2024-05-23 20:57:51 -06:00
utility-functions.lua utility.exists (file exists?) 2025-01-15 05:12:26 -07:00
utility-quickref-test.lua reorganization! 2024-11-05 21:50:26 -07:00
video-dl.lua forgot to make video-dl use utility-functions 2024-11-24 18:29:53 -07:00

.lua-files

Personally convenient Lua scripts to add to my path.

Installation

  1. Put this folder somewhere.
  2. Add that somewhere to your path. (On Windows, search for Environment Variables (it's "part of" Control Panel) and use the UI to add them to System variables.)
  3. (On Windows) Add .LUA to PATHEXT.

Config

A config.json file in this directory can be used to hold private information and default settings.

Right now the only setting is fa_cookie_string which needs to be set to a string curl can interpret as cookies for a logged-in FurAffinity user. Practically, this means something that looks like a=<secret>; b=<secret>; sz=<secret>.

Scripts

  • 2webm.lua: Converts everything in the working directory to .webm files.
  • llm.lua: (Windows only!) A very WIP script for working with LLMs through WSL using ollama.
  • print-arguments.lua: For testing how a Lua script receives arguments, because this can be platform-specific.
  • storage-statistics.lua: Prints a variety of statistics about the files within the current directory. Requires LFS.
  • test.lua: (Dev Test) Used repeatedly while working on these scripts to verify minor details I'm forgetful about.
  • utility-functions.lua: (Library) Required for many of these scripts to run.
  • video-dl.lua: A few premade command lines for using yt-dlp to download what I want quicker.

make-epub.lua

This script is only intended for personal use. Do not use it to infringe on copyright.

Usage:

  make-epub.lua <config (JSON file)> [action]

If "." is used instead of a JSON file, every JSON file in the current directory
will be used to make multiple ebooks back-to-back.

[action]: If not specified, all steps will be taken in order (except cleanall).
            download:  All pages will be downloaded to their own HTML files.
            convert:   Each page is converted to Markdown.
            concat:    A file is created for each section out of its pages.
            markdown:  Metadata frontmatter and Markdown section files will be
                       concatenated into a single Markdown file.
            epub:      Markdown file will be converted to an ePub using pandoc.
            cleanpage: All page files will be deleted, along with their extra
                       directories.
            cleanall:  Deletes everything except the config file and ePub.

[flag]: If "--continue" is passed, script will continue with the default order
          of actions from the action specified.

Requirements:
- Binaries:      pandoc, curl

The JSON config spec has two major variations ("Book" and "Anthology").

The following is shared:

  • authors: (Optional) Array of Strings: Author names. First in the list is used as a byline in the final output. (Legacy: An author string works as well. If this exists, it will be first.)
  • title: (Optional) String: Title of book.
  • cover_image_path: (Optional) String: Path to an image to use for the cover. (Due to a bug in Pandoc, this must not contain spaces!)
  • base_file_name: (Optional) String: Alternate final file name. (Default: "title by author" or just "title".)
  • keywords: Array of Strings: Keywords/Tags. (I'm not sure what the difference is in the final output so it goes in both.)
  • sections: See "Book"/"Anthology" variations. (I call LitErotica's stories sections - because they are often part of a larger whole.)
  • section_titles: (Optional) Array of Strings: The titles to be used for Table of Contents / headings. (If sections.naming is specified, section_titles will be ignored.)
  • extract_titles: (Optional) Boolean: Titles will be extracted from the first page of every section. (Note: This is compatible with sections.automatic_naming, but it can create repeated titles.)
  • lazy_titling: (Optional) Boolean: URLs will be used to generate section titles. (Warning: This process is likely to create janky titles. Note: This is compatible with sections.automatic_naming, but it can create repeated titles.)
  • page_counts: Array of Integers: The number of pages on LitErotica per "story". (I call them sections because this script was made to put together story series originally.)

Variation: Book

  • base_url: String: A partial URL that is the beginning of the URL used for each section (story) on LitErotica. (This script currently only works for stories that end in a padded two-digit number.) (Technically optional if first_section_url is specified, and sections.start and sections.finish are both 1.)
  • first_section_url: (Optional) String: Some stories don't have the same URL structure for their first section. This allows you to specify its full URL.
  • sections: Object defining which sections to download, and what to call them (ie. Chapters, Parts, ..).
    • start: (Optional) Number: Where to start. (1 is the default, since it is the most common.)
    • finish: Number: Where to end.
    • naming: (Optional) String: How to name sections in the final output. The result is [naming] [#] (using section numbers). (If not specified, sections will not have headings.)
    • automatic_naming: (Optional) Boolean: If any line matches "Prologue", "Epilogue", or "Chapter #" (any number), it will be made into a heading. (Note: This does not override naming. Both can be used together.) (Other patterns will be added as I find them.)

Example:

{
  "authors": ["Name"],
  "title": "Book",
  "base_file_name": "Book",
  "keywords": ["erotica", "fantasy"],
  "base_url": "https://www.literotica.com/s/title-ch-",
  "first_section_url": "https://www.literotica.com/s/title",
  "sections": {
    "start": 1,
    "finish": 4,
    "naming": "Chapter",
    "automatic_naming": true
  },
  "page_counts": [1, 5, 3, 3]
}

Variation: Anthology

  • manually_specified_sections: (Optional) Boolean, must be true. Technically not required as the script is capable of figuring out you are using this variation, but should be included.
  • sections: Array of Strings: A complete URL for each story.
  • section_titles: (Required) Array of Strings: The titles to be used for Table of Contents / headings. (Must be in the same order as sections.)
  • automatic_naming: (Optional) Boolean: Will match a single line against common patterns denoting the beginning of a chapter and add a heading on such lines. It's the same as sections.automatic_naming above.

Example:

{
  "authors": ["Name"],
  "title": "Anthology",
  "keywords": ["LitErotica", "erotica"],
  "manually_specified_sections": true,
  "sections": [
    "https://www.literotica.com/s/unique-title",
    "https://www.literotica.com/s/another-title"
  ],
  "section_titles": [
    "Unique Title",
    "Another Title"
  ],
  "page_counts": [5, 2]
}