animetosho / Nyuu

Flexible usenet binary posting tool
221 stars 32 forks source link

Example in config.js doesn't work #115

Open Ravencentric opened 1 year ago

Ravencentric commented 1 year ago

I'm talking about this example

Steps to reproduce

  1. Uncomment this example
  2. Comment this
  3. Run nyuu -h abc.provider.com -S -u user -p password-n40 -k10 -g alt.binaries.boneless "folder with mkv files"

Current behavior

No NZB output

What am I trying to achieve?

I'm trying to provide a folder of mkv files as an input and have nyuu generate one nzb for each set of mkv+par2 files

When the example didn't work, I also tried to edit (below) but to no avail

nzb: function(filenum, filenumtotal, filename, filesize) {
    let baseFileName;

    // Split the filename by periods
    const parts = filename.split('.');

    // If it's an .mkv file, use everything before the last period as the base file name
    if (filename.endsWith('.mkv')) {
        baseFileName = parts.slice(0, -1).join('.');
    } 
    // If it's a .par or .par2-related file, look for ".vol" to determine the base file name
    else if (filename.includes('.vol') && filename.endsWith('.par2')) {
        const volIndex = filename.indexOf('.vol');
        baseFileName = filename.substring(0, volIndex);
    } 
    // For base .par2 files
    else if (filename.endsWith('.par2')) {
        baseFileName = parts.slice(0, -1).join('.');
    } 
    else {
        return;  // If the file doesn't match the expected patterns, do not add to any NZB
    }

    return [
        baseFileName,
        {
            writeTo: baseFileName + '.nzb',  // Each group will have its own NZB file named after the base filename
            writeOpts: {flags: 'w'}
        }
    ];
},
animetosho commented 1 year ago

Thanks for reporting.
Am I getting the same thing as you? I get a crash, which I've fixed, but not a successful run without an NZB.

Ravencentric commented 1 year ago

My first run was successful with no NZB but that's likely because config.js wasn't being used. I re-ran it with the config specified and it crashed. I'll test again and get back to you.