Spotnet (CONCEPT D29): - Index free.pt fully and import spots with their descriptions, categories and NZBs; a spot renames its release, since Spotnet names are more trustworthy than names derived from subjects. - Find passwords in spot descriptions too, and tell "needs a password we have" from "needs a password we don't have". Content inspection: - List the contents of 7z (.7z.001) archives, SFV sets, nicovideo uploads and other archive-like files; mark yEncBin .bin containers as encrypted. - Take real names from yEnc headers for randomly named files, and merge uploads that were split across posts. Storage (D31, D32): - Store segment lists zstd-compressed behind the FileStore accessor. - group:backfill indexes older headers at low priority and pauses when the NVMe or HDD part of the database gets too large. Grouping (D35, D36): - Lone header segments wait in staged_segments until a second segment of their file arrives, which drops the per-article junk binaries. - Counter grouping joins random-subject uploads by poster, [i/M] counter, part count and day. Search and maintenance (D33, D34): - A trigram-indexed search_text column, smaller indexes, estimated stats. - Passes that clean up nonsense names; weekly index maintenance; GC budgets per kind. - Web UI: grey out stale results while a search runs and cancel superseded requests. Count only up to 1,000 matches for the page, which made filter clicks take seconds (Newznab keeps the 10,000 cap). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
43 lines
2.3 KiB
TypeScript
43 lines
2.3 KiB
TypeScript
import { test } from '@japa/runner'
|
|
import db from '@adonisjs/lucid/services/db'
|
|
import testUtils from '@adonisjs/core/services/test_utils'
|
|
import FileStore from '#services/FileStore'
|
|
import ReleaseMergeService from '#services/ReleaseMergeService'
|
|
|
|
let keys = 0
|
|
async function postRelease(name: string, files: string[], poster: string) {
|
|
const now = new Date()
|
|
const [r] = await db
|
|
.table('releases')
|
|
.insert({ release_key: `merge${++keys}`.padEnd(40, 'm'), name, source: 'post', poster, groups: '[]', posted_at: now, first_seen_at: now, last_seen_at: now })
|
|
.returning('id')
|
|
await FileStore.insert(
|
|
files.map((f, i) => ({ filename: f, poster, date: now.getTime(), parts: 1, size: 10, release_id: r.id, groups: '[]',
|
|
segments: [{ number: 1, id: `${name}-${poster}-${i}@x`, size: 10 }], created_at: now, updated_at: now }))
|
|
)
|
|
return Number(r.id)
|
|
}
|
|
|
|
test.group('Split uploads', (group) => {
|
|
group.each.setup(() => testUtils.db().withGlobalTransaction())
|
|
|
|
test('merges one upload posted under a poster per volume, not reposts or other uploads', async ({ assert }) => {
|
|
const name = 'Masters.of.the.Universe.1987.Theatrical.Cut.2160p.BDRip-GRP'
|
|
const a = await postRelease(name, ['6c82910a43604dc5926ad25c45addcc5.part001.rar'], 'niSSYNy5zOW2VX@VMuLu_e7Gr.bIx')
|
|
const b = await postRelease(name, ['6c82910a43604dc5926ad25c45addcc5.part002.rar'], 'MgrZzFLB3D@MeK4_gntYXzh9g.LBQ')
|
|
const c = await postRelease(name, ['6c82910a43604dc5926ad25c45addcc5.part003.rar'], 'qNGVviOMN2AJrSzeXFZqvW@VzavS9GO.Y0b')
|
|
// A repost: the same file names again.
|
|
const repostName = 'Some.Repost.2026.1080p-GRP'
|
|
const r1 = await postRelease(repostName, ['abc.part01.rar'], 'p1@x')
|
|
const r2 = await postRelease(repostName, ['abc.part01.rar'], 'p2@x')
|
|
|
|
assert.deepEqual(await ReleaseMergeService.mergeSplitPosts({ dryRun: true }), { names: 1, releases: 2 })
|
|
await ReleaseMergeService.mergeSplitPosts()
|
|
assert.equal((await db.from('releases').where('id', a).first()).file_count, 3)
|
|
assert.equal((await db.from('releases').where('id', b).first()).file_count, 0)
|
|
assert.equal((await db.from('releases').where('id', c).first()).file_count, 0)
|
|
assert.equal((await db.from('releases').where('id', r1).first()).file_count, 1)
|
|
assert.equal((await db.from('releases').where('id', r2).first()).file_count, 1)
|
|
})
|
|
})
|