Need Help Converting my Script Into Python to Suppress Command Window
Posted: 31 Jan 2020, 15:47
I've been using my Filebot script executed by uTorrent for a long time and it's been running great. However lately I've noticed more games don't like it when these command windows popup, even though I try to suppress it with the "cmd /c START /MIN cmd /c filebot.exe". So I've been considering converting it to Python when I saw a thread here on the forums detailing how to do it, but as always I'm rather clueless about these scripts how to do it, as I didn't produce my own script for Filebot, and some nice people here on the forums helped me with that. Now I need help again and hope someone has the time to 'enlighten' me on how to do this 
viewtopic.php?t=5157
This is the script I use for uTorrent to execute:
Somehow that needs to be converted into this, and I'm completely lost here:

viewtopic.php?t=5157
This is the script I use for uTorrent to execute:
Code: Select all
filebot.exe -script fn:amc --output "Y:/Downloads" --action copy --conflict skip -non-strict "Y:/!torrent" --log-file "Y:/Downloads/amc.log" --def excludeList=amc.txt --def movieFormat="{genres.contains(/Documentary/) ? 'X:/Docus/' : 'X:/Movies/0/'}/{plex.name}/{plex.name}{'.'+vf}{'.'+vc}{'.'+ac}{'-'+group}" seriesFormat="{genres.contains(/Documentary/) ? 'X:/Docus/' : 'X:/TV Shows/1/'}{plex.tail}{'.'+source}{'.'+vf}{'.'+vc}{'.'+ac}{'-'+group}" animeFormat="X:/TV Shows/1/'}{plex.tail}{'.'+source}{'.'+vf}{'.'+vc}{'.'+ac}{'-'+group}" musicFormat="{genres.contains(/Audiobook/) ? 'X:/Audiobooks/' : 'X:/Music/'}{albumartist}/{album}/{t}" unsorted=y music=y extractFolder="Y:/Downloads/Unsorted" artwork=n deleteAfterExtract=y clean=y reportError=y gmail=account:password
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 = 'X:/Media'
# custom formats (use / instead of \ as directory separator)
movieFormat = '''{plex}'''
seriesFormat = '''{plex}'''
animeFormat = '''{plex}'''
musicFormat = '''{plex}'''
# required args
label, state, title, kind, file, directory = sys.argv[1:7]
command = [
'filebot', '-script', 'fn:amc',
'--output', output,
'--action', 'duplicate',
'--conflict', 'skip',
'-non-strict',
'--log-file', output + '/amc.log',
'--def',
'unsorted=y',
'music=y',
'artwork=y',
'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)