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:\!Sorted_Downloads'
# custom formats
movieFormat = '''D:\!Sorted_Downloads\Movies\{ny}\{ny}{' CD'+pi}{subt}'''
seriesFormat = '''D:\!Sorted_Downloads\TV Shows\{n.replaceTrailingBrackets()}\{'Season '+s.pad(2)}\{n.replaceTrailingBrackets()} - {s00e00} - {t.replaceAll(/[!?.]+$/).replaceAll(/[`´‘’?]/, "'") .lowerTrail().replacePart(', Part $1')}'''
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', 'auto',
'-non-strict',
'--log-file', output + '/amc.log',
'--def',
'ut_state_allow=11',
'unsorted=y',
'music=y',
'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 (and hide cmd window)
subprocess.run(command, creationflags=0x08000000)
Code: Select all
[2017-07-08 07:20:34] Executing: "D:\!Sorted_Downloads\utorrent-postprocess.pyw" "" "11" "Silence 2016 1080p WEB-DL x264 AC3-JYK" "multi" "Subs\English.srt" "D:\Downloads\Silence 2016 1080p WEB-DL x264 AC3-JYK"