This repository was archived by the owner on Sep 11, 2020. It is now read-only.
Repository navigation
Expand file tree
/
Copy pathFilebot_Wrapper.pyw
More file actions
160 lines (130 loc) · 4.48 KB
/
Copy pathFilebot_Wrapper.pyw
File metadata and controls
160 lines (130 loc) · 4.48 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import sys
import subprocess
# required args
label, state, title, kind, file, directory = sys.argv[1:7]
################################################
### Media file processing script for Filebot ###
# FileBot.
#
# This script is a front-end wrapper for FileBot and the Automated Media Center script.
#
#
# FileBot - http://www.filebot.net
# Forums - https://www.filebot.net/forums
# Format Expressions - http://www.filebot.net/naming.html
# Command Line Interface - http://www.filebot.net/cli.html
#
# Subtitles are provided by OpenSubtitles.org. An OpenSubtitles.org account is required for this feature to
# function. See http://www.opensubtitles.org/en/newuser to register for an account. Once registered, run "filebot
# -script fn:configure" from a command prompt and follow the instructions.
#
#
################################################
### OPTIONS (case sensitive)
### Required ###
# Log File.
# Path to log file.
LOGDIR = '/path/to/logfolder'
# Base destinations to move files, no trailing slash. The subfolder is defined in the format string.
DESTINATION = 'C:/Media'
# Rename action i.e: move | copy | keeplink | symlink | reflink | hardlink | test
ACTION = 'Move'
# Conflict resolution i.e: override | skip | auto | index | fail
CONFLICT = 'Override'
# custom formats (use / instead of \ as directory separator)
movieFormat = '''{plex}'''
seriesFormat = '''{plex}'''
animeFormat = '''{plex}'''
musicFormat = '''{plex}'''
### Optionals ###
# Minimum Video Length (in milliseconds)
MVLEnabled = 'false'
MINLENGTHMS = '300000'
# Minimum File Size (in bytes).
MFSEnabled = 'false'
MINFILESIZE = '50000000'
# Process Music Files
MUSIC = 'false'
# Download subtitles for the given languages i.e: en, de, fr, es, ja, zh, ...
SUBEnabled = 'false'
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
KODIEnabled = 'false'
KODI = 'host[:port]'
# Tell the given Plex instance to rescan it's library. Plex Home instances require an authentication token
PLEXEnabled = 'false'
PLEX = 'host:apikey'
# Tell the given Emby instance to rescan it's library
EMBYEnabled = 'false'
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 = 'false'
# Delete archives after extraction
DELETEAFTEREXTRACT = 'false'
# Send Rescan Call to Sonarr/radarr (Requires Update_Sonarr_Radarr.groovy script)
# Must go in to groovy script and place API Keys In for both sonarr and radarr
SREnabled = 'false'
SonarrRadarr = '/path/to/Update_Sonarr_Radarr.groovy'
### Media file processing script for Filebot ###
################################################
command = [
'filebot', '-script', 'fn:amc',
'--output', DESTINATION,
'--action', ACTION,
'--conflict', CONFLICT,
'-non-strict',
'--log-file', LOGDIR + '/filebot-amc.log',
'--def',
'excludeList=' + LOGDIR + '/filebot-history.log',
'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
]
### Do Not Edit Beyond This Point ###
if MVLEnabled == "true":
command += ['minLengthMS=' + MINLENGTHMS]
if MFSEnabled == "true":
command += ['minFileSize=' + MINFILESIZE]
if MUSIC == "true":
command += ['music=' + MUSIC]
if SUBEnabled == "true":
command += ['subtitles=' + SUBTITLES]
if ARTWORK == "true":
command += ['artwork=' + ARTWORK]
if EXTRAS == "true":
command += ['extras=' + EXTRAS]
if KODIEnabled == "true":
command += ['kodi=' + KODI]
if PLEXEnabled == "true":
command += ['plex=' + PLEX]
if EMBYEnabled == "true":
command += ['emby=' + EMBY]
if STOREREPORT == "true":
command += ['storeReport=' + STOREREPORT]
if SKIPEXTRACT == "true":
command += ['skipExtract=' + SKIPEXTRACT]
if CLEAN == "true":
command += ['clean=' + CLEAN]
if DELETEAFTEREXTRACT == "true":
command += ['deleteAfterExtract=' + DELETEAFTEREXTRACT]
if SREnabled == "true":
command += ['exec=filebot -script ' + SonarrRadarr + ' --def type={type} id={id}']
# execute command (and hide cmd window)
subprocess.run(command, creationflags=0x08000000)