Command:
Code: Select all
"Q:/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 = 'Q:/'
# custom formats (use / instead of \ as directory separator)
movieFormat = "Q:/_Movies/{n} ({y})/{fn}"
seriesFormat = "Q:/_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', 'hardlink',
'--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)
Code: Select all
Python 3.6.3 (v3.6.3:2c5fed8, Oct 3 2017, 17:26:49) [MSC v.1900 32 bit (Intel)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>>
Code: Select all
FileBot 4.7.14 (r5234)
JNA Native: 5.2.0
MediaInfo: 0.7.99
7-Zip-JBinding: 9.20
Chromaprint: 1.4.2
Extended Attributes: OK
Unicode Filesystem: OK
Script Bundle: 2017-11-21 (r512)
Groovy: 2.4.12
JRE: Java(TM) SE Runtime Environment 1.8.0_151
JVM: 64-bit Java HotSpot(TM) 64-Bit Server VM
CPU/MEM: 8 Core / 3 GB Max Memory / 34 MB Used Memory
OS: Windows 10 (amd64)
Package: APPX
Done ?(?????)?