πŸ“ ISE_Manual.mdv4.7.4 · 2026-11-20

ISE β€” Intelligent Search Engine

The complete manual: operator guide and script reference. Master v9 (2026-11-25).

One manual for the ISE search mod on drugs-and-users.org and for every script and tool around it. It replaces ISE_Python_Scripts_Manual.md and every separate per-script manual and manual entry. ISE_help.html stays separate, because it is the in-app help for forum users (Β§8).

Contents

Part 1 β€” Operator guide

  1. What ISE does
  2. Where things run
  3. File layout
  4. Installing and uninstalling
  5. Building and refreshing the indexes
  6. The #do-not-index tag
  7. Searching: words, quotes, wildcards, AND/OR, sorting, result caps
  8. In-app help (/help)
  9. The reset checkboxes
  10. Known quirks of this SMF fork
  11. Troubleshooting

Part 2 β€” Script reference

  1. Two codebases, two settings mechanisms
  2. IndexBuilder.py and search.py (posts)
  3. PDFIndexer.py (and PDF-32bit-Indexer.py)
  4. PDFsearch.py
  5. MiscIndexer.py
  6. MiscSearch.py
  7. MegaSearch.py
  8. MediaIndexer.py
  9. MediaProcessor.py
  10. MediaSearch.py
  11. AudioProcessor.py
  12. audio_features.py
  13. MediaTranscriber.py
  14. SearchCommon.py
  15. SortEngine.py
  16. Shared modules and logging

Part 3 β€” Tools

  1. orphan_check.py
  2. pdf_duplicate_spotter.py and pdf_dupe_review.php
  3. audio_features_list.py
  4. audio_features2
  5. chktranscribe
  6. transcribe_pieces.sh
  7. cleanISE_Clone

Part 4 β€” Reference

  1. Interpreters and dependencies
  2. Open items and planned work
  3. Manual version history

Part 1 β€” Operator guide

1. What ISE does

ISE adds five search sources to SMF's CustomSearch dropdown:

Source What it searches Built by
ISE Post bodies and subjects across the whole forum, through ISE's own word index (not SMF's built-in search) IndexBuilder.py
ISEpdf Text extracted from PDF attachments, plus each PDF's filename and its topic's subject. A result opens the PDF.js viewer at the matching page PDFIndexer.py
ISEmisc Text attachments. Full content of .md .txt .text .json .html (HTML reduced to its visible text) and, since MiscIndexer 7.4.1#5, any other flat-text attachment (.csv, .log, no extension, ...). Code and config types (.py .php .js .sh ...) by filename and type only. Also each file's filename and topic subject MiscIndexer.py
ISEmega The same query run against ISE, ISEpdf and ISEmisc, merged into one page. It does not include ISEmedia, despite the name the three above
ISEmedia Images, video and audio, by keyword: filename, internal filename, post subject, AI captions of images and video frames, audio tags, and the speech in videos. Audio can also be filtered by tempo and key MediaIndexer.py, MediaProcessor.py, AudioProcessor.py, MediaTranscriber.py

Content is matched against pre-built JSON indexes, not the forum database, so an index only knows what was there when it was last built (Β§5). Filenames and subjects are a partial exception: PDFsearch.py and MediaSearch.py look some of them up in the database at search time (Β§15, Β§21).

ISEmedia loads no AI model at search time. The AI work is done when its stores are built: CLIP (Contrastive Language-Image Pretraining, a model that compares pictures with text) for image vectors, a small vision model for captions, CLAP (its audio counterpart) for audio tags, and a speech model for video transcripts. Re-ordering results with CLIP at search time is an opt-in (--clip, Β§21).

2. Where things run

Box Hostname Role in ISE
Live forum (forum.drugs-and-users.org) The forum and all five searches. Runs the post, PDF and Misc indexers on cron (Β§5.1), MediaIndexer and MediaProcessor (Β§5.2) and MediaTranscriber.py. 4 GB RAM + 4 GB swap. It had 2 GB until 2026-10-09; some notes in this manual date from then and say so
Clone clone Runs AudioProcessor.py (its audio model needs about 1.6 GB) and pushes the resulting audio_store.json to Live. MediaProcessor jobs run there too. Runs cleanISE_Clone, which tidies up after them. Clone's /bin holds the master copy of the shared /bin scripts
Dev A mirror of Live. 32-bit, so PDF indexing there uses PDF-32bit-Indexer.py (Β§14)

3. File layout

<SMF root>/
β”œβ”€β”€ Sources/Search.php β€” dispatcher: case 'ISE' / 'ISEpdf' / 'ISEmisc'
β”œβ”€β”€ Sources/ManageSettings.php β€” CustomSearch_use_ISE / _ISEpdf / _ISEmisc checkboxes,
β”‚ plus the ise_reset_pdfjs / ise_reset_isedata reset checkboxes (Β§9)
β”œβ”€β”€ Sources/Admin.php β€” registers CustomSearch in the admin menu
β”œβ”€β”€ Themes/default/index.template.php β€” dropdown options
β”œβ”€β”€ Themes/default/languages/Modifications.english.php β€” label strings (also patched under
β”‚ Themes/default/language/, singular, for installs that use it)
β”œβ”€β”€ Collabware/core_utils.py β€” settings and attachment lookup for the Collabware scripts (Β§12)
β”œβ”€β”€ ISE_Data/ β€” generated indexes, stores and logs (777, apache-owned)
β”‚ β”œβ”€β”€ word_index.json / post_store.json β€” posts (IndexBuilder.py)
β”‚ β”œβ”€β”€ word_index_pdf.json / pdf_store.json β€” PDFs (PDFIndexer.py)
β”‚ β”œβ”€β”€ word_index_misc.json / misc_store.json β€” Misc text attachments (MiscIndexer.py)
β”‚ β”œβ”€β”€ media_store.json β€” ISEmedia catalogue of images, video and audio (MediaIndexer.py)
β”‚ β”œβ”€β”€ embeddings_store.json β€” CLIP vectors (MediaProcessor.py); MediaSearch reads it only with --clip
β”‚ β”œβ”€β”€ captions_store.json β€” captions of images and video frames (MediaProcessor.py)
β”‚ β”œβ”€β”€ audio_store.json β€” audio tags, vectors, tempo, key, loudness (AudioProcessor.py, built on Clone)
β”‚ β”œβ”€β”€ transcripts_store.json β€” speech in videos (MediaTranscriber.py, written on Live)
β”‚ β”œβ”€β”€ pdf_duplicates.json / pdf_dupe_deleted.json β€” duplicate spotter and its review page (Β§29)
β”‚ β”œβ”€β”€ orphan_state.json β€” orphan_check.py (Β§28)
β”‚ β”œβ”€β”€ Settings_ISE.json β€” per-install {"environment", "install"} selector read by ise_settings.py
β”‚ β”œβ”€β”€ hf_cache/ β€” Hugging Face model cache (CLIP; and CLAP on Clone)
β”‚ β”œβ”€β”€ ise_trace.log, *.log β€” shared trace log and per-script logs
β”‚ └── lock, checkpoint and status files β€” listed in each script's section
β”œβ”€β”€ The_ISE_Project/ β€” all ISE scripts
β”‚ β”œβ”€β”€ qf_search_bridge.php β€” web entry point for ISE
β”‚ β”œβ”€β”€ qf_PDFsearch_bridge.php β€” web entry point for ISEpdf
β”‚ β”œβ”€β”€ qf_Miscsearch_bridge.php β€” web entry point for ISEmisc
β”‚ β”œβ”€β”€ qf_MegaSearch_bridge.php β€” web entry point for ISEmega
β”‚ β”œβ”€β”€ qf_Mediasearch_bridge.php β€” web entry point for ISEmedia (the only bridge that resolves python3.8)
β”‚ β”œβ”€β”€ search.py, PDFsearch.py, MiscSearch.py, MegaSearch.py, MediaSearch.py β€” the five searches
β”‚ β”œβ”€β”€ IndexBuilder.py, PDFIndexer.py, MiscIndexer.py β€” text indexers
β”‚ β”œβ”€β”€ MediaIndexer.py, MediaProcessor.py, AudioProcessor.py, MediaTranscriber.py β€” media indexers
β”‚ β”œβ”€β”€ audio_features.py, audio_vocab.txt β€” used by AudioProcessor.py
β”‚ β”œβ”€β”€ ise_noindex.py β€” the #do-not-index rule (Β§6); must sit beside the indexers
β”‚ β”œβ”€β”€ SearchCommon.py, SortEngine.py, ise_settings.py, ise_trace.py β€” shared modules (Β§25–27)
β”‚ β”œβ”€β”€ QueryParser.py, Tokeniser.py, ANDMatcher.py, IndexLookup.py, RankingEngine.py,
β”‚ β”‚ ResultFormatter.py, ise_render.py β€” post parsing, scoring and rendering internals
β”‚ β”œβ”€β”€ orphan_check.py, pdf_duplicate_spotter.py, pdf_dupe_review.php β€” maintenance tools (Β§28, Β§29)
β”‚ β”œβ”€β”€ reset_ise_data.php β€” install-time code hook (Β§4)
β”‚ └── ISE_help.html β€” shared in-app help page (Β§8)
└── pdfjs/ β€” bundled PDF.js viewer

Tools kept elsewhere: cleanISE_Clone in /bin on Clone and transcribe_pieces.sh in /root (Β§33, Β§34). Where audio_features_list.py, audio_features2 and chktranscribe are installed isn't recorded here (Β§30–32).

4. Installing and uninstalling

  1. Install the prerequisite mods first, in this order (see readme.txt in the package): Board-color-and-icons, Automatic Package Version Emulation, CustomSearch.
  2. Install ISE_V<version>.zip through SMF's Package Manager as normal.
  3. install_ise.php runs by itself. It creates The_ISE_Project/ and ISE_Data/ with 777 permissions, then starts IndexBuilder.py, PDFIndexer.py, MiscIndexer.py and MediaIndexer.py in the background, so the install itself returns at once. Each writes its own log under ISE_Data/. Since v9.5 it also fills ISE_Data/hf_cache (the CLIP model cache) if it is empty: copied from root's own Hugging Face cache when installing as root, otherwise downloaded in the background.
  4. Go to Admin > Configuration > Modification Settings > CustomSearch and untick then re-tick ISE, ISEpdf, ISEmisc, ISEmega and ISEmedia, saving each time. This makes the dropdown pick up all five.
  5. Test a search with each of the five before relying on it. ISEmedia runs under python3.8, not the interpreter the other four use, so a working ISE search says nothing about ISEmedia. The model cache matters only for --clip.

Uninstalling reverses the install.xml edits and deletes The_ISE_Project/ only. ISE_Data/ and pdfjs/ are deliberately left alone: they hold generated data (indexes, stores, logs, hf_cache, the PDF.js viewer) that shouldn't vanish because the mod was removed.

5. Building and refreshing the indexes

An index only knows what was there when it was last built. Rebuild after posts or attachments change, by hand or from cron.

5.1 Posts, PDFs and Misc (Live, python3)

cd <SMF root>/The_ISE_Project
python3 IndexBuilder.py --monitor # posts β†’ word_index.json / post_store.json
python3 PDFIndexer.py --monitor # PDFs β†’ word_index_pdf.json / pdf_store.json
python3 MiscIndexer.py --monitor # text attachments β†’ word_index_misc.json / misc_store.json

IndexBuilder.py and MiscIndexer.py rebuild everything on every run, with no resume, so they are safe to re-run at any time. PDFIndexer.py resumes by default and only adds PDFs it hasn't indexed yet (Β§14).

Suggested cron (adjust to the forum's posting and upload volume):

# Every 2 hours (on the hour) β€” rebuild the post index
0 */2 * * * python3 /var/www/html/The_ISE_Project/IndexBuilder.py >> /var/www/html/ISE_Data/indexbuilder.log 2>&1
# Every 2 hours (on the half-hour) β€” rebuild the Misc index
30 */2 * * * python3 /var/www/html/The_ISE_Project/MiscIndexer.py --monitor >> /var/www/html/ISE_Data/misc_indexer.log 2>&1
# Every 6 hours β€” fast PDF pass (PyMuPDF only)
5 */6 * * * python3 /var/www/html/The_ISE_Project/PDFIndexer.py --fast --monitor >> /var/www/html/ISE_Data/pdfindexer_fast.log 2>&1
# Every 2 days β€” thorough pass (both extractors) over PDFs not yet indexed.
# Resume mode: PDFs already indexed are skipped, so this is NOT a rebuild (that needs --fresh, see Β§14).
10 0 */2 * * python3 /var/www/html/The_ISE_Project/PDFIndexer.py --monitor >> /var/www/html/ISE_Data/pdfindexer_union.log 2>&1

5.2 Images and video (python3.8)

  1. python3.8 MediaIndexer.py catalogues every image, video and audio attachment into media_store.json (Β§19).
  2. python3.8 MediaProcessor.py --ft=image --progress (and --ft=video) makes CLIP vectors and captions for new items (Β§20). Mind Live's memory: see Β§20 before using --instances.

5.3 Audio (Clone)

AudioProcessor.py on Clone tags and measures the audio items listed in media_store.json and writes audio_store.json. Push that file to Live afterwards (Β§22).

5.4 Speech in videos (Live)

python3.8 MediaTranscriber.py transcribes new .mp4 videos into transcripts_store.json; chktranscribe shows how the job is doing (Β§24, Β§32).

5.5 Housekeeping (Clone)

cleanISE_Clone --apply clears old temporary files, oversized logs, old checkpoints and stale lock files out of ISE_Data (Β§34).

6. The #do-not-index tag

A post can be kept out of every ISE index, together with all its attachments, by writing #do-not-index in it. One shared module, ise_noindex.py (v1.2.0, 2026-10-17), holds the rule and every indexer calls it. It must sit in the same folder as the indexers; they refuse to run without it. python3 ise_noindex.py --version prints its version.

6.1 The rule

All three conditions must be true:

  1. The text #do-not-index is in the post body, in any letter case. The subject line is never looked at, and neither is the text inside attached files.
  2. It is on lines 1–5 of the body. SMF stores line breaks as <br />; the count treats <br />, <br>, <br/> and plain newlines alike. On line 6 or later it does nothing. Put it on line 1.
  3. The post's author is a Moderator or above: in the Administrator group (id 1) or the Global Moderator group (id 2), as primary or additional group, or a moderator of that post's own board. Anyone else's tag is ignored. The check is on who wrote the post, because SMF doesn't record who typed a tag into it, so a moderator adding the tag to a member's post has no effect. Only group membership by id counts, not what the group is allowed to do.

The group ids are constants at the top of ise_noindex.py. Check: this manual has called them ADMIN_GROUP / GLOBAL_MOD_GROUP, but an earlier note said PRIVILEGED_GROUPS; the file itself decides. If an account in another group must be able to mark posts, add that group's id there or make the account a moderator of the board.

What is excluded: the post itself, every attachment on it, and the thumbnail record SMF keeps for each image attachment (id_thumb). If the tag is removed later, the post and its attachments are indexed again on the next run.

6.2 What each indexer does

Script Since Behaviour
IndexBuilder.py (posts) 7.4.5 Marked posts are skipped; the summary shows (+N skipped: #do-not-index). Full rebuild every run, so a newly marked post drops out on the next run
PDFIndexer.py 8.7.0 Marked PDFs are never discovered, and anything already indexed is purged at the start of the run (also with --fastest). --single ID on a marked attachment prints REJECTED, removes any existing entry and exits 1
MiscIndexer.py 7.4.1#4 Attachments of marked posts are left out (catch-all files included); the run prints a skip count. Full rebuild every run
MediaIndexer.py ISE v9.9.10 Marked images, video and audio are left out of media_store.json. In --single mode the rest of the store is kept, but a marked id is removed
AudioProcessor.py 1.3.0 Marked audio is never encoded; stored items and their windows are removed at the start of every run (also with --attachid). --plan only reports. Push audio_store.json to Live afterwards
MediaTranscriber.py 1.0.0 A video in a marked post is never transcribed, and a stored transcript for one is removed
MediaSearch.py 1.11.0 A transcript is only shown for an attachment still in media_store.json, so one for a newly marked video never surfaces

Fails closed. If the list of marked posts can't be read from the database, every indexer stops with exit code 1 and writes nothing. None treats a failed lookup as "nothing is excluded".

6.3 What it does not cover

7. Searching: words, quotes, wildcards, AND/OR, sorting, result caps

The user-facing explanation is in the in-app help (Β§8). This section is the operator's view.

7.1 AND and OR

Every source requires every space-separated term by default (AND), as of search.py, PDFsearch.py, MiscSearch.py and MediaSearch.py v7.6.0/7.7.0/7.6.0/1.8.0. Prefix /sort use-OR to accept any term instead. An uppercase AND typed as a keyword is stripped before searching. This is SortEngine.extract_or_mode() (Β§26), called at the top of every get_ranked_results().

7.2 Quotes and punctuation (ISE posts)

7.3 Names and wildcards (ISEpdf, ISEmisc, ISEmedia)

These three share one copy of the matching code, SearchCommon.py (Β§25):

Check: the PDFsearch notes from before SearchCommon described its wildcard matching as case-sensitive, while SearchCommon's rule says names match case-insensitively and PDFsearch 7.8.0 says "no behaviour change". Test a mixed-case filename with a wildcard to see which holds.

7.4 Sorting with /sort

Type the directive in the search box, like /help. The older #ise-order-<mode> form still works; if both appear, /sort wins. Parsing happens in Python (SortEngine.py, Β§26), not in the bridges.

Directive Order Sources
/sort newest poster_time, newest first all five
/sort oldest poster_time, oldest first all five
/sort newmod modified_time newest first, falling back to poster_time for a post never edited ISE (posts) only
/sort oldmod the same, oldest first ISE (posts) only
/sort use-OR any term instead of every term (Β§7.1) all five

7.5 Result caps

Source Default How to see everything
ISE, ISEpdf, ISEmisc No cap through the UI (their bridges pass no --limit) β€”
ISEmega Soft cap of 180 cards (MEGA_SOFT_CAP) "Show all" link (&all=1, passed on as --all)
ISEmedia Soft cap of 180 cards (MEDIA_SOFT_CAP), with a red "Showing 180 of N β€” Show all" notice The same "Show all" link

Everything is still searched and ranked in full; the cap only limits how many cards are drawn. On the command line, --limit N shows exactly the best N. Before bridge v1.1.0, ISEmedia's bridge passed --limit 180, which silently cut results off.

8. In-app help (/help)

All five search UIs share one help page, The_ISE_Project/ISE_help.html: a single static file, web-accessible through the .htaccess <Files "*.html"> rule. It explains each source's search methods, including how quoting and wildcards differ between sources and the single-quote gap in ISE posts, stated plainly. It documents ISEmega and ISEmedia too (its ISEmedia section was updated for MediaSearch 1.6.0).

Two ways to reach it:

How it is wired:

HELP_TRIGGER = "/help"
HELP_HTML_PATH = os.path.join(os.path.dirname(os.path.abspath(__file__)), "ISE_help.html")

def _serve_help(html_path):
with open(HELP_HTML_PATH, "r", encoding="utf-8") as f:
content = f.read()
if html_path:
with open(html_path, "w", encoding="utf-8") as f:
f.write(content)
return True

search.py, PDFsearch.py and MiscSearch.py each define this pair; MegaSearch.py reuses search.py's copy and MediaSearch.py defines its own. Both paths log through ise_trace, and an SSH run starts a new trace as a normal search would.

The page carries its own copy of ResultFormatter.py's 13 themes and switcher. On load it reads whichever of ise_search_theme, ise_pdf_theme and ise_misc_theme is set in localStorage, so it opens in the theme last picked on a results page. ISEmedia's own theme key is ise_media_theme.

9. The reset checkboxes

Two checkboxes on the CustomSearch settings page set a one-shot reset for the next install or reinstall. Both default to unticked. Each clears itself once it has fired, so it can't wipe again on a later reinstall you didn't mean as a reset.

10. Known quirks of this SMF fork

11. Troubleshooting

Symptom Likely cause
Same results whatever the query The bridge PHP failed silently and served a stale output file
A search finds almost nothing on a busy forum The index wasn't rebuilt after content changed, or an indexer read the wrong instance's Settings.php or attachments folder
One instance's search shows another instance's data A script has a hard-coded absolute path instead of one relative to its own location. Check ATTACH_DIR, WORD_INDEX_PATH, *_STORE_PATH and the bridge's $script
Dropdown missing ISE options after install The index.template.php operation didn't match. Compare tabs and whitespace with the live file using cat -A
install_ise.php runs but nothing happens The_ISE_Project wasn't extracted yet when the code step ran. The code step must come after the extract steps in package-info.xml
A settings checkbox shows with no label The language-string <search> anchor didn't match, usually whitespace. Check the anchor byte for byte against a fresh copy of the live file (cat -A or od -c)
Package Manager says "Skipping Search" The <search> text really isn't in the target file. Pull the file off the server and diff it; an anchor that matched for an earlier version may not match now (Β§10)
A patch shows as installed but the page hasn't changed Look at the raw file on the server. If it is patched, suspect PHP OPcache or SMF's cache: restart Apache or call opcache_reset(), and clear SMF's cache under Admin > Maintenance
ISEmega or ISEmedia stops at 180 results Not a bug: their soft cap. Use "Show all" (Β§7.5)
PDF search over SSH prints "ISE ERROR β€” see ..." for a query with no matches PDFsearch.py older than 7.5.2 (Β§15)
orphan_check.py fails at once with ImportError: cannot import name 'BOARD_URL' orphan_check.py older than 7.4.2 (Β§28)
ModuleNotFoundError: No module named 'numpy' or 'torch' from a media script Wrong interpreter: the media scripts need python3.8. Over SSH use the full path, /usr/local/bin/python3.8; sudo's secure_path may not include /usr/local/bin
PermissionError: [Errno 13] ... /.cache from MediaSearch with --clip The model cache isn't reachable by apache. Check that ISE_Data/hf_cache/hub/models--timm--vit_base_patch32_clip_224.openai exists and is owned by apache:apache, and read ISE_Data/hf_cache_setup_status.log
An ISEmedia result with no visible link to the query Every card shows its match_evidence (term, field, value). Before 1.2.0, MediaSearch ranked by CLIP similarity alone and could show unrelated items; such a result means an old MediaSearch.py
A deleted audio attachment shows in ISEmedia as "No topic found" Its entry is still in audio_store.json. Run AudioProcessor.py --prune on Clone, then push the store (Β§22)
[!] No frame from ID n with duration 60.0 ffprobe is missing or failed, so MediaProcessor sampled past the end of a short clip (Β§20)
AudioProcessor says "FATAL: this host is 'forum'" It runs on Clone by default. Add --any-host, or --force (from 1.3.1), to run it elsewhere (Β§22)
A second run says it is already running AudioProcessor and MediaTranscriber allow one run at a time. Check with pgrep -fl <name> and wait (Β§22, Β§24)
The #do-not-index tag is ignored The tag is below line 5, or the author isn't a Moderator or above, or the author's group id isn't one ise_noindex.py knows (Β§6)

Part 2 β€” Script reference

12. Two codebases, two settings mechanisms

ISE's scripts come from two codebases joined into one project. Knowing which one a script belongs to saves chasing a settings or version problem in the wrong place.

ISE scripts Collabware scripts
Which search.py, PDFsearch.py, MiscSearch.py, MegaSearch.py, MediaSearch.py, IndexBuilder.py, PDFIndexer.py, MiscIndexer.py MediaIndexer.py, MediaProcessor.py (a four-way effort: Andrew, Claude, ChatGPT, Gemini). AudioProcessor.py also uses Collabware's helpers
Board URL and paths ise_settings.py: get_base_url() / get_project_url() read the per-install ISE_Data/Settings_ISE.json ({"environment": ..., "install": ...}) and look the URL up in a hand-checked table Collabware.core_utils: get_board_root(), get_data_dir(), load_smf_settings(), locate_attachment_file(), get_attachment_directories()
Version numbers Per file: search.py 7.x, MediaSearch.py 1.x, and so on A project-style tag in the doc-block ("ISE v9.9.10", "ISE v9.25") plus a RUNTIME_VERSION string kept in step by hand. Not the same counter as the package's own version (install_ise.php "9.5"). AudioProcessor.py uses its own per-file number
Logging ise_trace.py (Β§27) Their own --monitor / --verbose output

13. IndexBuilder.py and search.py (posts)

IndexBuilder.py

Version: 7.4.5 (2026-10-17). python3.

Builds ISE_Data/word_index.json and ISE_Data/post_store.json from every forum post. Every run is a full rebuild, so it is safe to run at any time; usage and cron are in Β§5.1. Since 7.4.5, posts marked #do-not-index are skipped and the summary ends with (+N skipped: #do-not-index) (Β§6).

search.py

Searches the post index. A query goes through QueryParser.parse() β†’ Tokeniser.tokenise() β†’ ANDMatcher.match() β†’ IndexLookup.py's lookup_word() / lookup_phrase():

Sort modes accepted (ORDER_KEYS): relevance, score, date (an old alias for newest), newest, oldest, newmod, oldmod, subject, board, author, occurrences. The directive is parsed inside get_ranked_results() itself, so MegaSearch's direct call gets it too; before that, a /sort routed through ISEmega leaked into the query as search words. newmod/oldmod fall back to poster_time for a post never edited (_effective_modified()).

SSH runs write the query to syslog themselves (Β§27). /help is handled as in Β§8.

14. PDFIndexer.py

Version: 8.7.0 (2026-10-17). python3.

Builds the PDF index. It finds every real PDF attachment on disk by magic bytes (the database's stored extension can be wrong), extracts the text of each page and writes:

Extraction engines

Two independent extractors run on every page, and the index takes the union of the words they find:

Tried and rejected: pdfplumber (its dependencies need cryptography compiled, which needs a Rust toolchain this CentOS 6 box doesn't have) and pypdfium2 (no wheel for this platform at any version).

Usage

python3 PDFIndexer.py --monitor                 # thorough (both engines); resumes if re-run
python3 PDFIndexer.py --fast --monitor # PyMuPDF only
python3 PDFIndexer.py --fresh --monitor # full rebuild, ignoring what's indexed
python3 PDFIndexer.py --start-at 5235 --monitor # restart a killed run from a known id
python3 PDFIndexer.py --limit 5 --dry-run --monitor # test without writing
python3 PDFIndexer.py --single 6474 --fast # index and trace one attachment, then exit

Options

Flag Default Description
--attach-dir DIR auto (<board root>/attachments) Folder to scan for PDF attachments
--dry-run off Discover and extract only; write nothing
--limit N none Process only the first N PDFs found (for testing)
--monitor off Live progress: which engine is running per file, new words per file, and a summary every 5%
--verbose off Also send log output to stdout, not just the log file
--fresh off Ignore the existing index and rebuild everything. Without it the run resumes: it loads the index and skips attachments already indexed
--checkpoint-every N 25 Save progress every N PDFs, so a crash (for example an out-of-memory kill) loses only recent work. 0 saves once at the end
--start-at ID_ATTACH none Skip every attachment below this id, to restart from a known point
--fast off PyMuPDF only, skipping pypdf. About 20 times faster per file and lighter on memory, but loses pypdf's extra coverage
--fastest off Skips attachment ids already in the index. Its full behaviour isn't recorded here; see --help. Refused with --single
--single ID_ATTACH none Index that one attachment and exit (8.6.1). It is checked with file(1) first: if it isn't a PDF, or no file with that id exists, the run prints REJECTED, exits 1, loads no index and writes nothing. If it is a PDF, it is re-processed even if already indexed and merged into the stores; no other attachment is touched. Prints --single N: trace lines ending with a RESULT line. Refused with --fresh or --fastest

Notes

PDF-32bit-Indexer.py (Dev)

Version: 8.6.0 (2026-10-05). The 32-bit edition, rebuilt from PDFIndexer.py 8.6.0 (it replaced the old 32-bit 8.2.3). Same options as 8.6.0, including --single and --fastest. Differences:

On Dev it writes Dev's own pdf_store.json / word_index_pdf.json unless run with --dry-run. It was built from 8.6.0, so unless it has been rebuilt since, it has neither 8.6.1's run-one-and-exit --single nor 8.7.0's #do-not-index.

Version history

15. PDFsearch.py

Version: 7.8.0 (2026-10-06). python3.

Searches the index PDFIndexer builds, and also checks every PDF attachment's own filename and its topic's subject, so a document titled with the right words is found even when the words never appear in its extracted text.

Usage

python3 PDFsearch.py listatt                     # console, every match
python3 PDFsearch.py heroin --limit 20 # capped, for a quick SSH check
python3 PDFsearch.py heroin --html /var/www/html/ISE_Data/results.html

The query is taken from argv[0] before argparse sees it (7.5.1), so a search starting with - or -- is searched rather than rejected as an unknown option. The query must therefore come first.

Flag Default Description
--limit N none (no cap) Cap the number of results
--html FILE none Write an HTML results page to this path
--source {ui,ssh} ssh Accepts the --source=ui the bridge passes. ise_trace.py works out UI or SSH itself from sys.argv

What a result can look like

Matching

Query words are matched exactly against word_index_pdf.json. Since 7.8.0 the wildcard test, the vocabulary wildcard and the filename/subject match come from SearchCommon.py (Β§7.3, Β§25), with no change in behaviour; tokenise() stays local because it mirrors this script's own index. A term without * or ? keeps the fast exact path; only a wildcard term scans the whole vocabulary.

syslog

UI searches are written to syslog by qf_PDFsearch_bridge.php before the script runs. SSH runs bypass the bridge, so the script logs the query itself (tag ise-pdf-search-ssh, message prefixed [SSH]). Both paths end up in syslog.

Version history

16. MiscIndexer.py

Version: 7.4.1#5 (2026-10-17). python3.

Builds the index for text attachments. Simpler than PDFIndexer: the files are already text, so there is no extraction step, no second engine and no resume. Every run is a full rebuild.

Writes:

Catch-all

Any regular file attachment outside the fixed lists is read as plain text and indexed like a .txt: a .csv, a .log, a file with no extension. Its file_type is its extension (none if it has none). Non-binary, flat text only. Left out:

The summary prints a Catch-all: line (indexed / skipped as not text-like / over the size limit). #do-not-index applies to catch-all files too.

Discovery

Plain-text files have no magic number to sniff, and SMF strips the real extension from attachment filenames on disk. So discovery is driven by the database: smf_attachments.fileext is cross-referenced with what is actually on disk (matched by the numeric id_attach prefix), and only attachments present in both are indexed.

Usage

python3 MiscIndexer.py --monitor                  # full rebuild with progress
python3 MiscIndexer.py --limit 5 --dry-run --monitor
python3 MiscIndexer.py --dry-run --monitor # see the Catch-all line before writing anything
Flag Default Description
--attach-dir DIR auto (<board root>/attachments) Folder to scan
--dry-run off Discover and read only; write nothing
--limit N none Process only the first N files found
--monitor off Live progress and running figures (unique words so far, memory in KB) every ~5%
--verbose off Also send log output to stdout

There is no --single. Earlier manuals described a 7.5.0 with --single ID_ATTACH; the actual latest script is the 7.4.1 line, which never had it.

End-of-run summary

Always printed: attachments matched against indexed, counts skipped as non-UTF-8 or empty, a breakdown by file type, unique words in the index, average words per file, the on-disk size of the index files and the log path. Non-UTF-8 files in the fixed list are skipped and logged, not decoded with a fallback; the log has their names.

Notes

Version history

17. MiscSearch.py

Version: 7.7.0 (2026-10-06). python3.

Searches the index MiscIndexer builds, and also each file's filename and topic subject, merged into one result per attachment. A title-only match is shown beside content matches, never dropped.

python3 MiscSearch.py listatt
python3 MiscSearch.py heroin --html /var/www/html/ISE_Data/misc_results.html
Flag Default Description
--limit N none (no cap) Cap the number of results
--html FILE none Write an HTML results page
--source {ui,ssh} ssh Accepts the bridge's --source=ui, as in PDFsearch

Version history: 7.7.0 (2026-10-06): tokenise(), the wildcard test, vocabulary wildcard and filename/subject match taken from SearchCommon.py; no behaviour change. 7.5.1: query taken from argv[0] before argparse.

18. MegaSearch.py

Version: 8.0#20 (2026-09-14). python3.

Calls search.py, PDFsearch.py and MiscSearch.py's get_ranked_results() directly (no subprocess, no CLI layer) and merges the three result lists into one page. It does not include ISEmedia, which is a separate, fifth source.

python3 MegaSearch.py "your query here" [--html FILE] [--limit N] [--all] [--source {ui,ssh}]

The query is taken from argv[0] (8.0#20), as in PDFsearch and MiscSearch 7.5.1, so it must come first on the command line.

19. MediaIndexer.py

Version: ISE v9.9.10 (2026-10-17). python3.8. Collabware (Β§12).

The first stage of ISEmedia: the catalogue. It reads smf_attachments for media types, works out each file's real path and writes ISE_Data/media_store.json: filename, MIME type (from mimetypes.guess_type()), extension, folder id, file hash and forum context (topic, board, post) for every item. It makes no vectors, captions or tags; MediaProcessor, AudioProcessor and MediaTranscriber do that from this catalogue.

Types catalogued: images jpg jpeg png webp gif (.gif was added late; 70 real GIFs were missed before that), video mp4 webm 3gp, and audio mp3 wav m4a flac ogg aac wma.

Flag Description
(none) Rebuild media_store.json from SMF. Only a plain run drops entries for deleted attachments
--attachid N One attachment only
--single ID_ATTACH As --attachid, plus --single N: trace lines ending in a RESULT line (ISE v9.9.1). The rest of the store is kept, except that a #do-not-index attachment is removed (v9.9.10)
--monitor Telemetry and performance figures
--verbose Detailed diagnostics

Version history: ISE v9.9.10 (2026-10-17): #do-not-index. ISE v9.9.1 (2026-10-01): --single.

20. MediaProcessor.py

Version: ISE v9.30 or later. The last full entry is v9.25 (2026-10-06); the v9.30 checkpoint rename is known from cleanISE_Clone (Β§34); the manuals until Master v8 still quoted ISE v9.18. python3.8. Collabware (Β§12).

The second stage of ISEmedia. For each image and video in media_store.json that has no vector yet it makes:

For video it samples --samples frames (default 3) from the first --window seconds (default 30.0), not the whole file, using ffprobe's duration. A run resumes from embeddings_store.json, so deleting a checkpoint loses no work.

Usage

python3.8 MediaProcessor.py --ft=image --instances=2 --progress
python3.8 MediaProcessor.py --ft=image --allow-truncated --progress
python3.8 MediaProcessor.py --ft=video --instances=2 --log
Flag Description
--attachid N One attachment only. Always runs as one instance
--chunk-size N At most N new items, then stop; re-run to carry on. Applies per instance
--force / --reindexall Re-process items that already have vectors, after a model or caption change
--skip-captions Vectors only
--samples N, --window S Video frames taken, and from how many opening seconds
--ft=image|video|all Split a run by type. image = jpg jpeg png webp gif; video = mp4 webm 3gp; default all. Items of the other type are left alone and not counted as skipped (v9.21)
--instances N Run N copies (1–4) in parallel. Copy k of N takes ids with id % N == k-1; its output lines start [k/N]. Each copy gets cores/N threads for torch and, if llama-mtmd-cli --help lists --threads, for llama (-t). The shared stores are saved under a lock (read, merge this copy's new keys, write), so copies can't overwrite each other (v9.21)
--progress [>] ID n (file) -- k of M in this run as an item starts; [<] ID n done -- k of M, frames, seconds, caption, [<] ID n FAILED -- ... or [<] ID n skipped -- ... when it ends; [~] before a caption retry of an already embedded item. M is the new items in this run, counted first. Already embedded items are skipped silently (--verbose lists them)
--allow-truncated Images whose file is cut short ("image file is truncated") are decoded as far as they go and embedded and captioned from what is there. Without it they fail on every run; re-uploading the file is the alternative (v9.23)
--log, --monitor, --verbose Log file, telemetry, detail

Memory on Live (4 GB RAM, 4 GB swap)

Files

Version history

21. MediaSearch.py

Version: 1.11.0 (2026-10-29). python3.8. Uses ise_settings.py like the other searches (Β§12).

Keyword search over images, video and audio. No model is loaded at search time: CLIP vectors, captions, audio tags and transcripts are all made at index time (Β§19–24). CLIP re-ordering is still available as an opt-in (--clip).

What it searches

Candidates are every attachment in media_store.json (images, video and audio), plus anything in captions_store.json and audio_store.json. Each term is checked against these fields:

Field Source Match rule Points
Filename database a.filename (else media_store) Whole string: a plain word is a substring; a wildcard must fit the whole name 25
Internal filename <id_attach>_<file_hash>, file_hash from media_store, else from the database query that fetches topics (1.7.1). Omitted when there is no hash As filename 25
Post subject database m.subject, HTML-unescaped As filename 15
Caption captions_store (images, and video frames keyed <id>_t<sec>), audio_store items and windows Whole words. The best-matching frame or window is shown 40
Tags audio_store item tags ([[keyword, prob, group], ...], keyword used) Whole words 40
Transcript transcripts_store (entries with status done) Matched like a caption; the card shows a short snippet around the first hit (1.11.0) 30

Tempo and key filters (1.7.0)

bpm:124 (Β±1.5), bpm:122-126, and key:Am, key:A-minor, key:F#, key:Gb-major are taken out of the query before tokenising (parse_filters()).

The values come from audio_store.json (AudioProcessor 1.1.0 and later): bpm, bpm_range, key, lufs, lra and changes per item, and bpm and key per window. Cards show, for example, 118-128 BPM (124), A minor, -9.8 LUFS, ~14 tracks and the approximate track changes.

Usage

python3.8 MediaSearch.py QUERY [--limit N] [--all] [--html FILE] [--clip] [--source {ui,ssh}]
python3.8 MediaSearch.py '*.png'
python3.8 MediaSearch.py '6204_*'
python3.8 MediaSearch.py '"brown horse"'
python3.8 MediaSearch.py '/sort newest *.mp3'

The query is taken from argv[0] before argparse, as in the other searches.

Flag Default Description
--limit N none Show exactly the best N
--all off Draw every match, bypassing the soft cap. The bridge passes it for &all=1
--html FILE none Write the results page. Draws at most MEDIA_SOFT_CAP = 180 cards unless --all or --limit is given, with a red "Showing 180 of N β€” Show all" notice when it caps
--clip off Load CLIP and add similarity Γ— 150 to image and video matches. Doesn't change which items match. Reads embeddings_store.json, which nothing else here reads
--keyword-only β€” Does nothing; kept for compatibility
--source {ui,ssh} ssh As in the other searches

API, bridge, ranking

Version history

22. AudioProcessor.py

Version: 1.3.1 (2026-11-25). Part of ISEmedia (The ISE Project). Runs on Clone.

AudioProcessor tags the forum's audio attachments (mp3, wav, flac, ogg, m4a, aac, wma) so that ISE's media search can find them by how they sound. It listens to each file with CLAP (Contrastive Language-Audio Pretraining: a model that places sounds and plain-English phrases in the same space, so the two can be compared), scores the file against a list of labels, and measures its tempo, key and loudness. Everything goes into ISE_Data/audio_store.json, which is then pushed to Live, where MediaSearch reads the tags. Live never loads the model.

Every run prints its version once, as it starts:

[*] AudioProcessor v1.3.1 (2026-11-25) -- Collabware / DMS-NX

Where it runs

Clone only, by default: CLAP needs about 1.6 GB of memory at its peak. On any other host the run stops at once with a FATAL line and touches nothing, unless --any-host or --force is given (--force since 1.3.1). ffmpeg and ffprobe must be on the PATH.

Running it

python3.8 /var/www/html/The_ISE_Project/AudioProcessor.py --plan      # what would be done, and how long
python3.8 /var/www/html/The_ISE_Project/AudioProcessor.py # do it; resumes where it left off
nohup python3.8 /var/www/html/The_ISE_Project/AudioProcessor.py --log > /dev/null 2>&1 &
python3.8 /var/www/html/The_ISE_Project/AudioProcessor.py --version # AudioProcessor.py v1.3.1 (2026-11-25)

A run with no options is always safe: it carries on from the last item it finished.

Options

Option Default What it does
--plan Finds every pending file, reads its length, prints the window count and a time estimate, then stops. Changes nothing, so it may run beside a real run
--attachid N Only this attachment
--features-only Adds tempo, key, loudness and track changes to items already in the store. CLAP is not loaded; vectors and tags are untouched. With --force: re-measure every item
--prune Removes stored items (and long-mix windows) whose attachment is no longer an audio item in media_store.json, then stops. Nothing is encoded. Ignored with --plan
--chunk-size N Process at most N pending items, then stop
--force Re-encode items that are already stored; if the store settings changed, rebuild the whole store. Since 1.3.1 it also lets the run go ahead on a host other than Clone
--threads N all cores CPU threads for the model
--batch N 4 Windows sent to CLAP per call
--long-threshold S 900 (15 min) Files longer than this are long mixes. A store setting (see below)
--stride S 30 Long mixes: seconds between window starts. A store setting
--samples N 6 Regular tracks: windows taken per track. A store setting
--top-k N 2 Most tags kept per vocabulary group
--vocab FILE audio_vocab.txt beside the script Label vocabulary
--sec-per-window S 19.6 Rate used for --plan's time estimate (Clone smoke test, 2 threads)
--any-host Run on a host other than Clone
--monitor End-of-run figures: items and windows done, mean rate, peak memory, store size
--verbose Each file as it starts, encode progress, and everything found: tempo, key, loudness, track changes, every tag with its probability, and a table of every window
--debug Debug output from the attachment lookup (locate_attachment_file)
--log [PATH] ISE_Data/audioprocessor.log Also append all output to a log
--version, -V Print AudioProcessor.py v1.3.1 (2026-11-25) and stop

Store settings. The model, its pinned revision, the window length (10 s), --long-threshold, --stride and --samples are recorded in the store. A run with different values is refused unless --force is given, which rebuilds the whole store: a store never mixes two sampling schemes.

What a run does

  1. Checks: the host, ffmpeg and ffprobe on the PATH, the attachment lookup (database reachable), and media_store.json present. Any failure: one FATAL line, exit 1, nothing touched.
  2. Run lock (not with --plan): see "One run at a time" below.
  3. Loads the vocabulary, the audio items listed in media_store.json (MediaIndexer's catalogue), and the store, then checks the store settings.
  4. #do-not-index: reads the list of marked posts straight from SMF through ise_noindex.py. Audio in a marked post is never encoded, and any already in the store (with its long-mix windows) is removed. With --plan the removals are only reported. If the list can't be read, the run stops (exit 1) and touches nothing.
  5. Stale entries: one line names any stored item whose id is no longer an audio item in media_store.json (attachment deleted from SMF, or media_store.json out of date). --prune removes them. Silence means there are none.
  6. Plans each pending file: finds it on disk, reads its length with ffprobe, picks its windows. A failed ffprobe is an error for that item, printed; the length is never guessed.
  7. Re-tags every stored vector if the vocabulary file changed since the last run (seconds; no audio is re-processed).
  8. Encodes each item and saves the store after every item, plus a progress checkpoint.
  9. Summary: one line for the store, then one line for each kind of failure that happened.

Sampling

Tags

Each vector is scored against the labels in audio_vocab.txt (editable; its header explains the format). In each [group] the top label is always kept, plus up to --top-k in total whose probability is at least half the top one. The tags are also joined into a plain "caption" string, so MediaSearch's keyword match works on them unchanged. The vectors (512 numbers each) are stored, so editing the vocabulary only needs a re-tag, which happens by itself on the next run.

Measurements

Taken from the same decoded windows by audio_features.py (Β§23):

A failed measurement never fails the item: it is printed and stored as null.

Store format

ISE_Data/audio_store.json, rewritten whole and atomically (temporary file, then rename) after every item:

{"_meta":   {model, revision, window_s, long_threshold, stride, samples,
vocab_sha1, vocab_labels, features_version, updated, writer},
"items": {"<id_attach>": {filename, extension, duration, class, windows: [start secs],
vector, tags, caption,
bpm, bpm_range, key, key_conf, level_db, lufs, lra, changes}},
"windows": {"<id_attach>_a<start>": {id_attach, start, vector, tags, caption,
bpm, bpm_conf, key, key_conf, level_db}}} # long mixes only

An item is written only when it is completely done, so its presence in items is what lets a run resume correctly.

Files

File Read / written Purpose
ISE_Data/media_store.json read MediaIndexer's catalogue; the list of audio items
ISE_Data/audio_store.json written after every item The store. Push it to Live after a run
ISE_Data/audio_store.json.<pid>.tmp written during a save Temporary file. A run killed in the middle of a save (kill -9) can leave one; safe to delete
ISE_Data/audio_store.json.lock written Run lock; holds the pid and start time of the running process. Safe to leave or delete when nothing is running
ISE_Data/audio_checkpoint.json written Human-readable progress snapshot
ISE_Data/audioprocessor.log written with --log Appended log; each run opens with its start time, version and options
ISE_Data/hf_cache/ read (filled on first download) CLAP model cache, tried first so no network round trip is needed
audio_vocab.txt read Label vocabulary, beside the script
audio_features.py imported Measurements
ise_noindex.py imported The #do-not-index list; must sit beside AudioProcessor.py
Collabware/core_utils.py imported Board root, data folder, attachment lookup

Mirror note: the existing exclude ISE_Data/audio_store.json* already covers the lock file and the temporary files.

Behaviour to know

Version history

Newest first. The source file's doc-block has the full wording.

23. audio_features.py

Version: 1.0.1 (2026-09-28). Used by AudioProcessor.py 1.1.0 and later.

This module takes signal measurements from audio that AudioProcessor has already decoded (mono float32, 48 kHz). It uses numpy only and loads no model.

Function Returns Method
estimate_bpm(x) (bpm, confidence) Autocorrelation of a spectral-flux onset envelope, for both the kick band (<250 Hz) and the full band, keeping the clearer. Uses a mild prior around 122 BPM and folds into 70–180
estimate_key(x) (key, confidence) Chroma (12 kHz copy, 8192-point FFT, median over time so kicks don't dominate), correlated with the Krumhansl–Kessler major and minor profiles
level_db(x) dBFS RMS level
file_loudness(path) (LUFS, LRA) ffmpeg ebur128 filter over the whole file
find_changes(windows) [start s] Flags a window where at least two of these change: tempo (by 3 BPM or more), key, or tag overlap (below 34%). Since v1.0.1 a change must also be at least 120 s after the last one kept, so a DJ blend spanning several windows counts once
summarise(...) item summary median and range of BPM, main key, mean level, LUFS/LRA, changes

Self-test

python3 audio_features.py --selftest runs these checks on synthetic audio:

It prints PASS or FAIL.

Limits

Version history

Newest first.

24. MediaTranscriber.py

Version: 1.1.0 (2026-10-29). Runs on Live, at any time, one run at a time. python3.8 (written to run under 3.6 as well).

Transcribes the speech of every .mp4 in media_store.json into ISE_Data/transcripts_store.json, which MediaSearch makes searchable (Β§21). It uses the same engine as the ts script: ffmpeg converts the sound to 16 kHz mono WAV, then llama-mtmd-cli runs Qwen3-ASR-0.6B Q8_0 (an automatic speech recognition model). No torch is loaded.

Usage

python3.8 MediaTranscriber.py                  all pending videos
python3.8 MediaTranscriber.py --dry-run what it WOULD do; changes nothing
python3.8 MediaTranscriber.py --chunk-size 20 at most 20 videos, then stop
python3.8 MediaTranscriber.py --attachid 4683 one video (add --force to redo it)
python3.8 MediaTranscriber.py --stop controlled stop of the running job
python3.8 MediaTranscriber.py --skip 2321 2647 --reason "music, no speech" flag videos; needs no run active
python3.8 MediaTranscriber.py --unskip 2321 clear the flag; the next run takes the video again
nohup python3.8 MediaTranscriber.py > /root/MediaTranscriber.out 2>&1 &

How it behaves

Files in ISE_Data

File Purpose
transcripts_store.json The store
.mediatranscriber.lock Run lock
.mediatranscriber.stop Exists only while a stop is pending
.mediatranscriber.status The video in flight; removed when the run ends; read by chktranscribe
transcribe_tmp/ Working audio, removed after each video and at the start of every run

Version history

25. SearchCommon.py

Version: 1.0.0 (2026-10-06).

One copy of the query and matching code used by PDFsearch.py, MiscSearch.py and MediaSearch.py. It lives in The_ISE_Project/ beside them and is imported the way SortEngine.py is. It must be installed on every host that runs those three. python3 SearchCommon.py prints its version and runs a self-check.

Adopted by MediaSearch 1.9.0, MiscSearch 7.7.0 and PDFsearch 7.8.0, all with no behaviour change.

26. SortEngine.py

Shared parsing of the /sort directive (Β§7.4), used by all five search scripts, so it is recognised the same way everywhere. Built in v9.3.0: v9.2's help page had promised /sort newest|oldest|newmod|oldmod before the code did it. The older file of the same name was dead code that nothing called.

def extract_order_mode(query: str, valid_modes: set, default: str) -> tuple:
# strips a /sort <mode> or #ise-order-<mode> directive out of query,
# resolving it against the caller's own valid_modes set.
# Returns (cleaned_query, order_mode).
Caller Accepted modes Notes
search.py relevance, score, date, newest, oldest, newmod, oldmod, subject, board, author, occurrences Parsed inside get_ranked_results() (Β§13)
PDFsearch.py relevance, score, newest, oldest No newmod/oldmod
MiscSearch.py relevance, score, newest, oldest The same
MegaSearch.py relevance, score, newest, oldest Stripped once in get_mega_results(), before any source sees the query (Β§18)
MediaSearch.py relevance, score, newest, oldest The same shape as PDF and Misc

SortEngine's own doc-block (v8.0, 2026-09-14) names only search.py, PDFsearch.py and MiscSearch.py as callers; it predates MediaSearch, which does import it.

27. Shared modules and logging


Part 3 β€” Tools

28. orphan_check.py

Version: 7.4.2 (2026-09-24). python3. A maintenance report meant for cron, not part of any search.

Finds attachments whose id_msg no longer resolves to a row in smf209_messages: the post they were uploaded against is gone (deleted, moved, or never finished). Avatars are left out: SMF stores them as attachments with id_msg=0 by design, and they would otherwise swamp every report with about 360 harmless entries. A small state file, ISE_Data/orphan_state.json, lets each run report only what is new since the last.

python3 orphan_check.py                   # text report to stdout
python3 orphan_check.py --html out.html # HTML report
python3 orphan_check.py --quiet-if-empty # print nothing when there are no new orphans (for cron)

7.4.2 (2026-09-24): every run had failed at once with ImportError: cannot import name 'BOARD_URL' from 'PDFsearch'. PDFsearch's BOARD_URL had been renamed BASE_URL when its settings moved onto ise_settings.py (v4.0, 2026-08-21), two days after orphan_check's last edit (2026-08-19). orphan_check never used it, so it was dropped from the import, leaving from PDFsearch import DB_CONFIG, ISE_ROOT.

29. pdf_duplicate_spotter.py and pdf_dupe_review.php

pdf_duplicate_spotter.py (python3) finds byte-identical PDF duplicates in the attachments folder: the same file uploaded again under a different id_attach, usually with a different filename or topic. It does not find near-duplicates (a different scan of the same book, an edited copy); PIHKAL/TIHKAL, for example, don't show up, as expected.

It reuses existing code instead of copying it: discover_pdfs() / ATTACH_DIR from PDFIndexer.py, and DB_CONFIG, get_topic_for_attachment() and build_download_url() from PDFsearch.py. Method: SHA-256 over each file's bytes, read in 1 MB chunks so no whole PDF is held in memory. Files with the same hash are identical, with no false positives possible.

Flag Default Description
--attach-dir DIR ATTACH_DIR (from PDFIndexer) Folder to scan
--json PATH ISE_Data/pdf_duplicates.json Where to write the report. pdf_dupe_review.php reads this path, so leave it unless you move that too
python3 pdf_duplicate_spotter.py
python3 pdf_duplicate_spotter.py --json /tmp/dupes.json

pdf_dupe_review.php is an admin-only page in The_ISE_Project/ that reads the spotter's JSON and lists every duplicate copy with two links: View post, and Delete post (one click, confirmed in JavaScript, guarded by SMF's session token). Delete removes the whole post through SMF's own removeMessage(), which also removes its attachment. The message row is first copied to ise_pdf_dupe_backup_v2 (metadata only, not the PDF: a record, not an undo, since SMF assigns new ids on delete), and deleted ids are remembered in ISE_Data/pdf_dupe_deleted.json so they stop appearing without re-running the spotter. An orphaned copy (its post already gone) still appears in its group but has no View or Delete link.

30. audio_features_list.py

Version: 1.0.6 (2026-10-06). Runs on Live, Clone or Dev (standard library only, Python 3.6+).

Read-only listing of every audio item's features from ISE_Data/audio_store.json: a "no" column (n/total), id, file name (from media_store.json, always shown in full, extension added if missing), size, BPM, BPM range, key, loudness (LUFS), loudness range (LRA), number of track changes and the item's tags, with a Path line under each file. Files are separated by a line of 9 dashes followed by a blank line. Writes nothing except the optional CSV.

Each file is found the same way AudioProcessor finds it, through Collabware's locate_attachment_file(). --attach-dir is only a fallback.

Check: that lookup goes through Collabware and the database, so "standard library only" above may no longer be true.

Usage

python3.8 audio_features_list.py                   # table, by id
python3.8 audio_features_list.py --sort bpm # also: name, key, lufs
python3.8 audio_features_list.py --csv out.csv # also write a CSV
python3.8 audio_features_list.py --data-dir DIR # default /var/www/html/ISE_Data
python3.8 audio_features_list.py --attach-dir DIR # fallback only; default /var/www/html/attachments

An item with no BPM has not had its features measured yet; run AudioProcessor.py --features-only on Clone for those.

Version history

Newest first.

31. audio_features2

Version: 1.0.0 (2026-10-06). Runs on Live, Clone or Dev (standard library only, Python 3.6+).

Read-only report of every stored feature of every audio item in ISE_Data/audio_store.json: tempo, key, loudness, track changes, tags by group, caption and any other field (vectors left out). Replaces the old one-line python3 -c command. Writes nothing.

Usage

audio_features2                  # all items, by ID
audio_features2 --id 6982 # one item
audio_features2 --windows # add the per-window table for long mixes
audio_features2 --sort bpm # id (default), name, bpm, key, lufs
audio_features2 --raw # exactly the old one-liner's output
audio_features2 --data-dir DIR # default /var/www/html/ISE_Data

Errors

A missing or bad store gives a one-line message and exit 1, with no traceback.

Version history

32. chktranscribe

Version: 1.1.0 (2026-10-29). A read-only monitor for MediaTranscriber (Β§24): running, idle or died; what it is on now; progress, speed and time left; failures; cross-checks. It changes nothing and takes no lock; it finds the job in /proc.

chktranscribe               # one report
chktranscribe --watch 30 # repeat every 30 s (Ctrl-C leaves it; the job is not affected)

Version history: 1.1.0 (2026-10-29): flagged videos listed separately. 1.0.0 (2026-10-29): first version.

33. transcribe_pieces.sh

Version: 1.0.0 (2026-09-26) Β· DM2S/NX (ISE) Β· Collabware

What it does

Transcribes the speech in a video or audio file with Qwen3-ASR-0.6B through llama-mtmd-cli. It cuts the audio into short pieces first (30 s by default), so no single call overflows the model context. A whole 5-minute track in one call failed with failed to find a memory slot.

The steps are:

  1. ffmpeg extracts the audio as 16 kHz mono PCM, the same as transcribe.sh.
  2. ffmpeg -f segment cuts it into N-second pieces. This step doesn't need ffprobe, which Live didn't have when this tool was written (Β§20, v9.25).
  3. llama-mtmd-cli runs once per piece, with stdin from /dev/null and --temp 0.
  4. The results are written as one line per piece, with a [mm:ss] start time.

Usage

/root/transcribe_pieces.sh /root/instagram-1790217713252.mp4        # 30 s pieces
/root/transcribe_pieces.sh /root/instagram-1790217713252.mp4 20 # 20 s pieces
KEEP=1 /root/transcribe_pieces.sh <file> # keep pieces + per-piece logs

Settings (environment variables)

Variable Default (Live paths)
LLAMA_BIN /root/llama.cpp/build/bin/llama-mtmd-cli
ASR_MODEL /root/models/qwen3-asr/Qwen3-ASR-0.6B-Q8_0.gguf
ASR_MMPROJ /root/models/qwen3-asr/mmproj-Qwen3-ASR-0.6B-Q8_0.gguf
ASR_PROMPT Transcribe this audio.
OUT_DIR /root/transcripts
KEEP 0 (set to 1 to keep the work folder)

To run it on Clone, set LLAMA_BIN, ASR_MODEL and ASR_MMPROJ to Clone's paths.

Output

Messages

Differences from transcribe.sh

Memory

The model and mmproj together are about 1 GB on disk. On Live (2 GB when this was written; 4 GB + 4 GB swap since 2026-10-09), avoid running this while MediaProcessor is captioning. MediaTranscriber (Β§24) does the same job for every video as a restartable job.

34. cleanISE_Clone

Version: 1.0.4 (2026-10-16) Runs on: Clone, as root. Lives in /bin (Clone's /bin is the master). Author: Another collaboration between Andrew.human and Claude.ai

Purpose

Keeps /var/www/html/ISE_Data free of leftovers, so it can be run often. It is deliberately small: it matches five kinds of file and nothing else.

Usage

cleanISE_Clone                      # dry run: prints what it would do, changes nothing
cleanISE_Clone --apply # does it
cleanISE_Clone --version # prints the version and exits
cleanISE_Clone -h # prints the usage and exit-code lines

--all-checkpoints (the v1.0.1 option) is still accepted, so older command lines keep working, but it does nothing: since v1.0.3 that behaviour is the default.

Run it with bash cleanISE_Clone or directly (./cleanISE_Clone, /bin/cleanISE_Clone), never with sh. On CentOS 6 sh is bash in POSIX mode, which refuses the done < <(find ...) loops: syntax error near unexpected token '<'.

The version line is printed once, at the start of every run.

Exit codes: 0 ok, 1 ISE_Data missing or an action failed, 2 bad argument, 3 the old-named checkpoint files were left alone because something is running (the other rules still ran).

Rules

Only files directly inside ISE_Data are looked at (no subdirectories).

# Matches Condition Action
1 *.tmp older than TMP_MIN (60 min) deleted
2 *.log bigger than LOG_MAX_KB (2048 KB) copied to <name>.log.1 (old .1 becomes .2, old .2 overwritten), then the original is emptied in place
3a processor_checkpoint.json and processor_checkpoint_i*of*.json (the names MediaProcessor used before v9.30) nothing is running: any age. Something is running: only the _i*of* ones, and only if older than CKPT_MIN (1440 min = 1 day) deleted
3b processor_checkpoint_i*of*.ckpt (current per-instance names, MediaProcessor v9.30 and later) older than CKPT_MIN (1440 min = 1 day) deleted
4 audio_store.json.pre* (hand-made restore copies, e.g. audio_store.json.pre2419) older than PRE_MIN (10080 min = 7 days) deleted
5 audio_store.json.lock older than PIDLOCK_MIN (60 min) and the process id written in it (pid N, started ...) no longer exists deleted

The five values (TMP_MIN, LOG_MAX_KB, CKPT_MIN, PRE_MIN, PIDLOCK_MIN) and the two paths (DIR = /var/www/html/ISE_Data, PROJ = /var/www/html/The_ISE_Project) are variables at the top of the script.

Rule 5 prints left alone instead when the file has no pid N, in it, or when process N still exists.

"Nothing running"

Only rule 3a depends on it. The script counts something as running if any of these is true:

When any of them is found, the script prints what it found, leaves the checkpoint files rule 3a would have removed, still runs every other rule, and exits 3. A plain shell script that holds none of those locks is not detected.

Checkpoint file names

MediaProcessor v9.30 writes processor_checkpoint.ckpt and processor_checkpoint_i<k>of<N>.ckpt (still JSON inside). The .ckpt names are deliberately not matched by the .json rule, so the last run's checkpoint survives cleanup. Old-named .json files already in ISE_Data are removed by rule 3a when nothing is running. Anything outside MediaProcessor that reads processor_checkpoint.json must be changed to the new name.

Never touched

No rule matches any of these, so they are never removed or changed: *_store.json, word_index*.json, processor_checkpoint.ckpt, audio_checkpoint.json, caption_failures.json, chain_snapshot.json, orphan_state.json, pdf_duplicates.json, pdf_dupe_deleted.json, and the lock files .mediaprocessor.lock and .mediawatchdog.lock.

Deliberately not included

Cron (suggested, not installed)

23 * * * * /bin/cleanISE_Clone --apply >> /var/log/cleanISE_Clone.log 2>&1

Each run writes a few lines, so that log grows slowly. Check it now and then. The cron line needs --apply; without it every run is a dry run. An exit code of 3 in that log only means a job was running at that moment and the old-named checkpoints were left until the next run.

Notes

Version history

Version Date Change
1.0.0 2026-10-12 First release: stale *.tmp removal, size-capped *.log rotation, old per-instance processor checkpoint removal. Dry run by default.
1.0.1 2026-10-16 Added --all-checkpoints: also removes processor_checkpoint.json and every per-instance checkpoint regardless of age, but only when nothing is running (exit 3 if something is). Arguments can be combined (--apply --all-checkpoints).
1.0.2 2026-10-16 Rule 4: audio_store.json.pre* older than 7 days is removed.
1.0.3 2026-10-16 Removing the old-named checkpoints when nothing is running is now the default (--all-checkpoints still accepted, does nothing). Goes with MediaProcessor v9.30 (.ckpt names): old .json names removed when idle, .ckpt names kept (per-instance ones once older than CKPT_MIN).
1.0.4 2026-10-16 Rule 5: a stale audio_store.json.lock (pid gone, older than 60 minutes) is removed.

Part 4 β€” Reference

35. Interpreters and dependencies

Interpreter Scripts Why
python3 (3.6.3 on Live, CentOS 6) search.py, PDFsearch.py, MiscSearch.py, MegaSearch.py, IndexBuilder.py, PDFIndexer.py, MiscIndexer.py, orphan_check.py, pdf_duplicate_spotter.py The original stack. Not moved to 3.8: no evidence they need it, and changing it risks scripts that work
python3.8 MediaIndexer.py, MediaProcessor.py, MediaSearch.py, AudioProcessor.py, MediaTranscriber.py torch, open_clip and numpy are installed only under 3.8; MediaProcessor also needs 3.7+ for subprocess.run(text=True)

36. Open items and planned work

37. Manual version history

Changes to the scripts are recorded in each script's own section. This history covers the manual.