Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Post processing failure #1789

Closed
marcmv1 opened this issue Oct 23, 2020 · 7 comments
Closed

Post processing failure #1789

marcmv1 opened this issue Oct 23, 2020 · 7 comments

Comments

@marcmv1
Copy link

marcmv1 commented Oct 23, 2020

The directory is somehow getting rewritten so the show cannot be processed

Right directory
2020-10-22 20:13:06 INFO ::COPYLINK: SOURCE FOLDER: [C:\Marc\Torrents\Completed\tv\SHOW_NAME.AMZN.WEBRip.DDP5.1.x264-NTb[rarbg]]

This doesn't exist
2020-10-22 20:13:06 INFO ::COPYLINK: TARGET FOLDER: [tv\SHOW_NAME.AMZN.WEBRip.DDP5.1]

Full log:
2020-10-22 20:13:00 INFO ::MAIN: Loading config from [C:\Marc\Torrents\scripts\nzbToMedia\autoProcessMedia.cfg]
2020-10-22 20:13:00 INFO ::MAIN: Python v3.9 will reach end of life in 1809 days.
2020-10-22 20:13:00 INFO ::MAIN: Checking database structure...
2020-10-22 20:13:00 DEBUG ::MAIN: Checking Initial Schema database upgrade
2020-10-22 20:13:00 DEBUG ::MAIN: InitialSchema upgrade not required
2020-10-22 20:13:00 DEBUG ::MAIN: Checking if we can use git commands: "C:\Program Files\Git\bin\git.exe" version
2020-10-22 20:13:00 DEBUG ::MAIN: Executing "C:\Program Files\Git\bin\git.exe" version with your shell in C:\Marc\Torrents\scripts\nzbToMedia
2020-10-22 20:13:00 DEBUG ::MAIN: "C:\Program Files\Git\bin\git.exe" version : returned successful
2020-10-22 20:13:00 DEBUG ::MAIN: Using: "C:\Program Files\Git\bin\git.exe"
2020-10-22 20:13:00 DEBUG ::MAIN: Executing "C:\Program Files\Git\bin\git.exe" symbolic-ref -q HEAD with your shell in C:\Marc\Torrents\scripts\nzbToMedia
2020-10-22 20:13:00 DEBUG ::MAIN: "C:\Program Files\Git\bin\git.exe" symbolic-ref -q HEAD : returned successful
2020-10-22 20:13:00 INFO ::MAIN: Checking if git needs an update
2020-10-22 20:13:00 DEBUG ::MAIN: Executing "C:\Program Files\Git\bin\git.exe" rev-parse HEAD with your shell in C:\Marc\Torrents\scripts\nzbToMedia
2020-10-22 20:13:00 DEBUG ::MAIN: "C:\Program Files\Git\bin\git.exe" rev-parse HEAD : returned successful
2020-10-22 20:13:00 DEBUG ::MAIN: Executing "C:\Program Files\Git\bin\git.exe" fetch origin with your shell in C:\Marc\Torrents\scripts\nzbToMedia
2020-10-22 20:13:01 DEBUG ::MAIN: "C:\Program Files\Git\bin\git.exe" fetch origin : returned successful
2020-10-22 20:13:01 DEBUG ::MAIN: Executing "C:\Program Files\Git\bin\git.exe" rev-parse --verify --quiet '@{upstream}' with your shell in C:\Marc\Torrents\scripts\nzbToMedia
2020-10-22 20:13:01 DEBUG ::MAIN: git didn't return newest commit hash
2020-10-22 20:13:01 INFO ::MAIN: No update needed
2020-10-22 20:13:01 INFO ::MAIN: nzbToMedia Version:bf05f1b4e706ff64f47cb938e412e63f82361892 Branch:master (Windows 10)
2020-10-22 20:13:01 WARNING ::MAIN: Failed to locate ffmpeg.exe. Transcoding disabled!
2020-10-22 20:13:01 WARNING ::MAIN: Install ffmpeg with x264 support to enable this feature ...
2020-10-22 20:13:01 DEBUG ::MAIN: Connecting to qbittorrent: http://localhost:8082
2020-10-22 20:13:01 INFO ::MAIN: #########################################################
2020-10-22 20:13:01 INFO ::MAIN: ## ..::[TorrentToMedia.py]::.. ##
2020-10-22 20:13:01 INFO ::MAIN: #########################################################
2020-10-22 20:13:01 DEBUG ::MAIN: Options passed into TorrentToMedia: ['C:\Marc\Torrents\scripts\nzbToMedia\TorrentToMedia.py', 'C:\Marc\Torrents\Completed\tv|SHOW_NAME.AMZN.WEBRip.DDP5.1.x264-NTb[rartv]|tv|93f4b072275016b36f4673f7b7c0330b31fc7def']
2020-10-22 20:13:01 DEBUG ::MAIN: Adding TORRENT download info for directory C:\Marc\Torrents\Completed\tv to database
2020-10-22 20:13:01 DEBUG ::MAIN: Received Directory: C:\Marc\Torrents\Completed\tv | Name: SHOW_NAME.AMZN.WEBRip.DDP5.1.x264-NTb[rartv] | Category: tv
2020-10-22 20:13:01 DEBUG ::MAIN: SEARCH: Found the Category: tv in directory structure
2020-10-22 20:13:01 INFO ::MAIN: SEARCH: Could not find a unique directory for this download. Assume a common directory.
2020-10-22 20:13:01 INFO ::MAIN: SEARCH: We will try and determine which files to process, individually
2020-10-22 20:13:01 DEBUG ::MAIN: Determined Directory: C:\Marc\Torrents\Completed\tv | Name: SHOW_NAME.AMZN.WEBRip.DDP5.1.x264-NTb[rartv] | Category: tv
2020-10-22 20:13:01 INFO ::MAIN: Auto-detected SECTION:SickBeard
2020-10-22 20:13:01 DEBUG ::MAIN: Stopping torrent SHOW_NAME.AMZN.WEBRip.DDP5.1.x264-NTb[rartv] in qbittorrent while processing
2020-10-22 20:13:06 INFO ::MAIN: Output directory set to: tv\SHOW_NAME.AMZN.WEBRip.DDP5.1
2020-10-22 20:13:06 DEBUG ::MAIN: Scanning files in directory: C:\Marc\Torrents\Completed\tv
2020-10-22 20:13:06 DEBUG ::MAIN: Found 1 files in C:\Marc\Torrents\Completed\tv
2020-10-22 20:13:06 DEBUG ::MAIN: Looking for files with modified/created dates less than 5 minutes old.
2020-10-22 20:13:06 DEBUG ::MAIN: Found file SHOW_NAME.AMZN.WEB-DL.DDP5.1.H.264-NTb.mkv with date modified/created less than 5 minutes ago.
2020-10-22 20:13:06 INFO ::COPYLINK: MEDIAFILE: [SHOW_NAME.AMZN.WEB-DL.DDP5.1.H.264-NTb.mkv]
2020-10-22 20:13:06 INFO ::COPYLINK: SOURCE FOLDER: [C:\Marc\Torrents\Completed\tv\SHOW_NAME.AMZN.WEBRip.DDP5.1.x264-NTb[rarbg]]
2020-10-22 20:13:06 INFO ::COPYLINK: TARGET FOLDER: [tv\SHOW_NAME.AMZN.WEBRip.DDP5.1]
2020-10-22 20:13:06 INFO ::COPYLINK: MEDIAFILE already exists in the TARGET folder, skipping ...
2020-10-22 20:13:06 DEBUG ::MAIN: Checking for archives to extract in directory: C:\Marc\Torrents\Completed\tv
2020-10-22 20:13:06 INFO ::MAIN: FLATTEN: Flattening directory: tv\SHOW_NAME.AMZN.WEBRip.DDP5.1
2020-10-22 20:13:06 DEBUG ::MAIN: Checking for empty folders in:tv\SHOW_NAME.AMZN.WEBRip.DDP5.1
2020-10-22 20:13:06 INFO ::MAIN: Found 1 media files in tv\SHOW_NAME.AMZN.WEBRip.DDP5.1
2020-10-22 20:13:06 INFO ::MAIN: Calling SickBeard:tv to post-process:SHOW_NAME.AMZN.WEBRip.DDP5.1.x264-NTb[rartv]
2020-10-22 20:13:06 DEBUG ::SERVER: Attempting to connect to server at http://localhost:8081
2020-10-22 20:13:08 DEBUG ::SERVER: Server responded at http://localhost:8081
2020-10-22 20:13:08 INFO ::MAIN: Attempting to auto-detect tv fork
2020-10-22 20:13:10 INFO ::MAIN: SickBeard:tv fork auto-detection found custom params {'is_priority': None, 'failed': None, 'type': None, 'force': None, 'delete_on': None, 'process_method': None, 'proc_dir': None}
2020-10-22 20:13:10 INFO ::MAIN: SickBeard:tv fork set to custom
2020-10-22 20:13:10 POSTPROCESS::SICKBEARD: SUCCESS: The download succeeded, sending a post-process request
2020-10-22 20:13:10 DEBUG ::SICKBEARD: Opening URL: http://localhost:8081/home/postprocess/processEpisode with params: {'failed': 0, 'process_method': 'copy', 'proc_dir': 'tv\SHOW_NAME.AMZN.WEBRip.DDP5.1', 'quiet': 1, 'nzbName': 'SHOW_NAME.AMZN.WEBRip.DDP5.1.x264-NTb[rartv]'}
2020-10-22 20:13:12 POSTPROCESS::SICKBEARD: Post-processing attempted but directory doesn't exist: tv\SHOW_NAME.AMZN.WEBRip.DDP5.1
2020-10-22 20:13:12 ERROR ::MAIN: A problem was reported in the autoProcess* script. If torrent was paused we will resume seeding
2020-10-22 20:13:12 DEBUG ::MAIN: Starting torrent SHOW_NAME.AMZN.WEBRip.DDP5.1.x264-NTb[rartv] in qbittorrent
2020-10-22 20:13:17 ERROR ::MAIN: A problem was reported in the C:\Marc\Torrents\scripts\nzbToMedia\TorrentToMedia.py script.

@clinton-hall
Copy link
Owner

It looks like you have

[Torrent]
    outputDirectory = 

which means TorrentToMedia will try and copy/link to tv\SHOW_NAME.AMZN.WEBRip.DDP5.1.x264-NTb[rarbg]

if you want this to link to C:\Marc\Torrents\Completed\tv\SHOW_NAME.AMZN.WEBRip.DDP5.1.x264-NTb[rarbg]
then set

[Torrent]
    outputDirectory = C:\Marc\Torrents\Completed\

@marcmv1
Copy link
Author

marcmv1 commented Oct 23, 2020

Yup I get what you're saying but that isn't what's happening. The directory name is being truncated.

We go from this:
[C:\Marc\Torrents\Completed\tv\SHOW_NAME.AMZN.WEBRip.DDP5.1.x264-NTb[rarbg]]

To this:
2020-10-22 20:13:06 INFO ::COPYLINK: TARGET FOLDER: [tv\SHOW_NAME.AMZN.WEBRip.DDP5.1]

Notice that it's missing .x264-NTb[rarbg] from the filename

@clinton-hall
Copy link
Owner

clinton-hall commented Oct 23, 2020

There is a section of code that tried to identify the download, and since the download is not in it's own directory, it tries to find a file with the same name as the download name.

Other clients pass the download name with the .mkv extension. It appears qBT does not. So it doesn't match.

Ultimately here when it creates the output directory, it strips the "extension" from the name (in this case stripping off the .x264-NTb[rarbg])

Ultimately there needs to be a fix to this to correctly match the file name to the input name... this would then prevent the truncating of the output directory...

But the script will create this directory and this will still process fine without the .x264-NTb[rarbg] in the directory... this will still be in the file name.

The Main issue I see is that it is trying to link to a Directory Structure that doesn't exists at all.

tv\SHOW_NAME.AMZN.WEBRip.DDP5.1.x264-NTb[rarbg] is no more likely to exist than tv\SHOW_NAME.AMZN.WEBRip.DDP5.1

If you set

[Torrent]
    outputDirectory = C:\Marc\Torrents\Processed\

then the script will copy/link the structure as
C:\Marc\Torrents\Processed\tv\SHOW_NAME.AMZN.WEBRip.DDP5.1\SHOW_NAME.AMZN.WEBRip.DDP5.1.x264-NTb[rarbg].mkv
And that should still get processed fine by SickChill and then the empty C:\Marc\Torrents\Processed\tv\SHOW_NAME.AMZN.WEBRip.DDP5.1 directory gets deleted anyway.

I just updated this to specify a different output directory to your input directory.
I also recommend setting

[Torrent]
    useLink = hard

@marcmv1
Copy link
Author

marcmv1 commented Oct 23, 2020

Thanks, this fixed it. Must be a new quirk with QBT 4.3 because this config has been working for a long time.

Thanks for the tip about hard links. I have it set to copy so it stays in QBT long enough to seed then delete and then will stay in my TV directory until I'm done watching and can delete.

Appreciate your quick help and your time maintaining nzbtomedia.

@marcmv1 marcmv1 closed this as completed Oct 23, 2020
@clinton-hall
Copy link
Owner

re hard link vs copy:

Copy will work, as you say, but it will be slower (has to replicate the data) and will take up twice as much hard disk space.

A Hard link will achieve the exact same result... It will appear as a new file (a new file header that points at the same data block) that can be renamed, while the original file is available to seed. When you eventually complete seeding and delete the original file, that simply deletes the file header, but since there is still another file header pointing at the data, the data will remain.

Basically hard link (on the same disk, where supported) looks and behaves the same as a copy, but it doesn't use any additional (significant) hard drive space, and is nearly instantaneous.

Up to you, but personally I would use hard link over copy.

@marcmv1
Copy link
Author

marcmv1 commented Oct 23, 2020

Wow that's great, thanks for the tip!

@clinton-hall
Copy link
Owner

I just pushed a fix to Nightly that should allow this to identify the single file that matches the download name (without the extension). This will then add the extra details back to the directory when hard linking and then process...

So hopefully a bit cleaner.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants