Page 1 of 1

java.nio.file.FileSystemException

Posted: 28 Aug 2017, 03:45
by alexander_q
Sysinfo (Windows Store):

Code: Select all

FileBot 4.7.12 (r5171)
JNA Native: 5.1.0
MediaInfo: 0.7.93
7-Zip-JBinding: 9.20
Chromaprint: 1.4.2
Extended Attributes: OK
Unicode Filesystem: OK
Script Bundle: 2017-05-15 (r500)
Groovy: 2.4.10
JRE: Java(TM) SE Runtime Environment 1.8.0_141
JVM: 64-bit Java HotSpot(TM) 64-Bit Server VM
CPU/MEM: 4 Core / 3 GB Max Memory / 39 MB Used Memory
OS: Windows 10 (amd64)
Package: APPX
Done ?(?????)?
Using qBittorrent v3.3.15 x64 to run script upon download completion:

Code: Select all

"D:\utorrent-postprocess.pyw" "%L" "" "%N" "multi" "" "%F"

Code: Select all

# Run Program: 
# "C:\path\to\utorrent-postprocess.pyw" "%L" "%S" "%N" "%K" "%F" "%D"
#
# Test with Console:
# python "C:\path\to\utorrent-postprocess.pyw" "Movie" "5" "Avatar" "multi" "" "X:\Files\Avatar"


import sys
import subprocess


# configuration
output = 'D:/'


# custom formats (use / instead of \ as directory separator)
movieFormat  = "D:/_Movies/{n} ({y})/{fn}"
seriesFormat = "D:/_TV Shows/{n}/{'Season '+s}/{fn}"
animeFormat  = '''{plex}'''
musicFormat  = '''{plex}'''


# required args
label, state, title, kind, file, directory = sys.argv[1:7]


command = [
	'filebot', '-script', 'fn:amc',
	'--output', output,
	'--action', 'move',
	'--conflict', 'override',
	'-non-strict',
	'--log-file', output + 'amc.log',
	'--def',
		'unsorted=y',
		'music=n',
		'artwork=n',
		'movieFormat='  + movieFormat,
		'seriesFormat=' + seriesFormat,
		'animeFormat='  + animeFormat,
		'musicFormat='  + musicFormat,
		'ut_label=' + label,
		'ut_state=' + state,
		'ut_title=' + title,
		'ut_kind='  + kind,
		'ut_file='  + file,
		'ut_dir='   + directory
]


# execute command only for certain conditions (disabled by default)
'''
if state not in ['5', '11']:
	print('Illegal state: %s' % state)
	sys.exit(0)
'''


# execute command (and hide cmd window)
subprocess.run(command, creationflags=0x08000000)

I regularly get failures that look like this:

Code: Select all

[MOVE] Failure: java.nio.file.FileSystemException: D:\_qBittorrent\The.Last.Ship.S04E03.720p.HDTV.X264-DIMENSION[rarbg]\The.Last.Ship.S04E03.720p.HDTV.X264-DIMENSION.mkv -> D:\_TV Shows\The Last Ship\Season 4\The.Last.Ship.S04E03.720p.HDTV.X264-DIMENSION.mkv: The process cannot access the file because it is being used by another process.
Any way to avoid them?

Re: java.nio.file.FileSystemException

Posted: 29 Aug 2017, 13:13
by rednoah
You can't use --action move because Windows won't allow one process to move or delete files that are used by another process.

Assuming that input/output folder is on the same filesystem, I'd recommend using --action hardlink to create an instant copy.

Re: java.nio.file.FileSystemException

Posted: 02 Sep 2017, 05:18
by alexander_q
Is there any way to hardlink then delete from the source afterwards?

Re: java.nio.file.FileSystemException

Posted: 02 Sep 2017, 07:37
by rednoah
alexander_q wrote: 02 Sep 2017, 05:18 Is there any way to hardlink then delete from the source afterwards?
That operation is called --action move. :lol:

:idea: You can't delete the source file because Windows won't let you. You could have your own script go through the FileBot history and try to delete files later on, and call that script after quitting utorrent to make sure all the files are released.