Need help converting my .bat file to python (almost done just need help on one thing)
Posted: 26 Nov 2017, 01:07
so I decided to look into switching up my bat file I've been using for the past few months or so in favor of using python. So I decided to go and grab the "utorrent-postprocess.pyw" and start my work on it to get it to my liking, so far I've gotten everything I have wanted so far done on it other than one small thing I can't figure out.
1. A while back I got help on this thread viewtopic.php?t=4768 and ended up with a groovy script for sonarr in the end, things have been working great so far with it and everything, but this is where the issue comes in. the bit that I uses the sonarr groovy script doesn't seem to run in python. I am currently using in my bat script which works but upon trying to switch and apply it to the python script just ends up throwing an error.
idk if I messed up somewhere or what exactly happened. If I take out my sonarr stuff the python script runs perfectly, but I'd love to be able to keep my sonarr script moving into python..
This is my current python script (with the sonarr stuff included)
1. A while back I got help on this thread viewtopic.php?t=4768 and ended up with a groovy script for sonarr in the end, things have been working great so far with it and everything, but this is where the issue comes in. the bit that I uses the sonarr groovy script doesn't seem to run in python. I am currently using
Code: Select all
exec="filebot -script %UPSR% --def id={id}"
Code: Select all
'exec=' + 'filebot', '-script', UPSR, '--def id={id}'
Code: Select all
Illegal Argument: java.nio.file.NoSuchFileException: C:\Windows\system32\{id} ({id})
No such property: id for class: Script1
Possible solutions: log, now, _def
groovy.lang.MissingPropertyException: No such property: id for class: Script1
Possible solutions: log, now, _def
at Script1.run(Script1.groovy:2)
at net.filebot.cli.ScriptShell.evaluate(ScriptShell.java:64)
at net.filebot.cli.ScriptShell.runScript(ScriptShell.java:74)
at net.filebot.cli.ArgumentProcessor.runScript(ArgumentProcessor.java:127)
at net.filebot.cli.ArgumentProcessor.run(ArgumentProcessor.java:29)
at net.filebot.Main.main(Main.java:111)
Failure (°_°)
Code: Select all
'exec=' + 'filebot', '-script', UPSR, '--def id={id}'
This is my current python script (with the sonarr stuff included)
Code: Select all
# Media file processing script for Filebot
# CLI https://www.filebot.net/cli.html
# Format https://www.filebot.net/naming.html
# Forums https://www.filebot.net/forums
# Qbittorrent Call ---
# "C:/Users/JourneyOver/Dropbox/Public/Folders/Filebot/MyStuff/Filebot_Wrapper.pyw" "%L" "" "%N" "multi" "" "%F"
import os
import sys
import subprocess
# Set up some logging
LOGDIR = os.path.expanduser(os.sep.join(["~","Dropbox/Public/Folders/Filebot/logs"]))
# Groovy Script Locations
UPSR = os.path.expanduser(os.sep.join(["~","Dropbox/Public/Folders/Filebot/MyStuff/update-sonarr.groovy"]))
# Base destinations to move files, no trailing slash. The subfolder is defined in the format string.
DESTINATION = 'D:/Shows'
# Rename action i.e: move | copy | keeplink | symlink | hardlink
ACTION = 'Move'
# Conflict resolution i.e: override | skip | fail
CONFLICT = 'Override'
# custom formats
#FILTERPATH = "@/" + os.path.expanduser(os.sep.join(["~","Dropbox/Public/Folders/Filebot/MyStuff/Filter.txt"]))
FORMATPATH = "@/" + os.path.expanduser(os.sep.join(["~","Dropbox/Public/Folders/Filebot/MyStuff/Formatting.txt"]))
# Old Age Filter Format
FILTERPATH2 = 'any{ age < 170 }{ airdate ? true : false }'
# Process Music Files
MUSIC = 'false'
# Download subtitles for the given languages i.e: en | de | fr
SUBTITLES = 'en'
# Fetch Artwork/NFO
ARTWORK = 'false'
# Generate *.url files and fetch all available backdrops
EXTRAS = 'false'
# Tell the given Kodi/XBMN instance to rescan it's library
#Kodi = 'host[:port]'
# Tell the given Plex instance to rescan it's library. Plex Home instances require an authentication token
PLEX = 'localhost:'
# Tell the given Emby instance to rescan it's library
#EMBY = 'host:apikey'
# Save reports to local filesystem
STOREREPORT = 'false'
# Skip extracting file
SKIPEXTRACT = 'false'
# Automatically remove empty folders and clutter files that may be left behind after moving the video files, or temporary extracted files after copying
CLEAN = 'true'
# Delete archives after extraction
DELETEAFTEREXTRACT = 'true'
# required args
label, state, title, kind, file, directory = sys.argv[1:7]
command = [
'filebot', '-script', 'fn:amc',
'--output', DESTINATION,
'--action', ACTION,
'--conflict', CONFLICT,
'-non-strict',
'-no-xattr',
'--filter',
FILTERPATH2,
'--log-file', LOGDIR + '/filebot-amc.log',
'--def',
FORMATPATH,
'excludeList=' + LOGDIR + '/filebot-history.log',
'music=' + MUSIC,
'subtitles=' + SUBTITLES,
'artwork=' + ARTWORK,
'extras=' + EXTRAS,
'storeReport=' + STOREREPORT,
'skipExtract=' + SKIPEXTRACT,
'clean=' + CLEAN,
'deleteAfterExtract=' + DELETEAFTEREXTRACT,
'plex=' + PLEX,
'ut_label=' + label,
'ut_state=' + state,
'ut_title=' + title,
'ut_kind=' + kind,
'ut_file=' + file,
'ut_dir=' + directory,
'exec=' + 'filebot', '-script', UPSR, '--def id={id}'
]
# execute command (and hide cmd window)
subprocess.run(command, creationflags=0x08000000)