-
Notifications
You must be signed in to change notification settings - Fork 27
/
mmconfig
executable file
·256 lines (251 loc) · 9.67 KB
/
mmconfig
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
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
#!/usr/bin/env bash
# mmconfig
# set up variables for microservices, has option for a graphical user interface
CONFIG="Y"
CONFIG_VERSION="1.0"
SCRIPTDIR=$(dirname "${0}")
. "${SCRIPTDIR}/mmfunctions" || { echo "Missing '${SCRIPTDIR}/mmfunctions'. Exiting." ; exit 1 ;};
funcDirectory() {
DIR_VAR_NAME="${1}"
DIR_VAR_VALUE="${!1}"
if [[ -n "${DIR_VAR_VALUE}" ]] ; then
DIR_DEFAULT="<default>${DIR_VAR_VALUE}</default>"
fi
cat << GTKDIR
<frame ${DIR_VAR_NAME}>
<hbox>
<entry accept="directory" fs-entry="Select a Directory">
${DIR_DEFAULT}
<variable>${DIR_VAR_NAME}</variable>
</entry>
<button>
<input file stock="gtk-open"></input>
<action type="fileselect">${DIR_VAR_NAME}</action>
</button>
</hbox>
</frame>
GTKDIR
}
funcEntry(){
ENTRY_VAR_NAME="${1}"
ENTRY_VAR_VALUE="${!1}"
ENTRY_LABEL="${2}"
ENTRY_WIDTH="${3}"
if [[ -n "${ENTRY_VAR_VALUE}" ]] ; then
ENTRY_DEFAULT="<default>${ENTRY_VAR_VALUE}</default>"
fi
cat << GTKENTRY
<vbox>
<text wrap="true" width-chars="${ENTRY_WIDTH}" xalign="0">
<label>${ENTRY_LABEL}</label>
</text>
<entry>
<variable>${ENTRY_VAR_NAME}</variable>
${ENTRY_DEFAULT}
</entry>
</vbox>
GTKENTRY
}
export MAIN_DIALOG=$(cat << MAINFORM
<window title="mmconfig configuration" resizable="false" window_position="0">
<vbox>
<text>
<label>Set up mmconfig variables</label>
</text>
<frame Navigate to and select the directories you have created>
<hbox>
$(funcDirectory OUTDIR_INGESTFILE)
$(funcDirectory OUTDIR_INGESTXDCAM)
</hbox>
<hbox>
$(funcDirectory OUTDIR_PAPER)
$(funcDirectory AIP_STORAGE)
</hbox>
<hbox>
$(funcDirectory PODCASTDELIVER)
$(funcDirectory YOUTUBEDELIVER)
</hbox>
<hbox>
$(funcDirectory TMPDIR)
$(funcDirectory CUSTOM_LOG_DIR)
</hbox>
<hbox>
$(funcDirectory LTO_INDEX_DIR)
$(funcDirectory LOCAL_MM_DIR)
</hbox>
</frame>
<frame Database and File Settings>
<hbox homogeneous="true">
$(funcEntry REGEX4PODCAST "Enter the regular expression you would like to use to determine if a file qualifies for podcast:" "80")
$(funcEntry REGEX4IA "Enter the regular expression you would like to use to upload to the Internet Archive:" "80")
</hbox>
<hbox homogeneous="true">
$(funcEntry OMNEONIP "Please enter the IP address for the server where you would like assets to be delivered:" "80")
$(funcEntry OMNEONPATH "Please enter the file path for the server where you would like assets to be delivered:" "80")
</hbox>
<hbox homogeneous="true">
$(funcEntry LTO_MD5_FLAGS "Please select the flags you would like md5deep to use (ex: md5deep -rel):" "80")
$(funcEntry FILE_MAKER_DB "Please enter the name of the filemaker database:" "80")
</hbox>
<hbox space-fill="false">
<text wrap="false" width-chars="60" xalign="0">
<label>Please choose Y or N to test and adjust volume during transcoding:</label>
</text>
<vbox>
<radiobutton>
<label>"Y"</label>
<variable>VOLADJUST</variable>
</radiobutton>
<radiobutton active="true">
<label>"N"</label>
<variable export="false">VOLADJUSTN</variable>
</radiobutton>
</vbox>
$(funcEntry DVDLABELPREFIX "Please enter the prefix you would like added to the filename in makedvd. You may leave this blank:" "80")
</hbox>
<hbox space-expand="true">
<text>
<label>Please choose Y or N to enable database logging:</label>
</text>
<vbox>
<radiobutton>
<action>if true enable:PREMIS_PROFILE</action>
<action>if true enable:PREMIS_NAME</action>
<label>"Y"</label>
<variable>PREMIS_DB</variable>
</radiobutton>
<radiobutton active="true">
<action>if true disable:PREMIS_PROFILE</action>
<action>if true disable:PREMIS_NAME</action>
<label>"N"</label>
<variable export="false">PREMIS_DBN</variable>
</radiobutton>
</vbox>
$(funcEntry PREMIS_PROFILE "Enter the name of the database profile:" "60")
$(funcEntry PREMIS_NAME "Enter the name of the database:" "60")
</hbox>
<hbox>
<checkbox>
<label>Auto update MySQL .plist?</label>
<variable>PREMIS_PLIST</variable>
</checkbox>
<checkbox>
<label>Generate video fingerprint?</label>
<variable>PERCEPTUAL_HASH</variable>
</checkbox>
</hbox>
</frame>
<frame Email Settings>
<hbox homogeneous="true">
$(funcEntry EMAIL_FROM "Please enter the email account that notifications will be sent from:" "80")
$(funcEntry SQL_ERROR_EMAIL_TO "Please the email account for the delivery of SQL Error Reports:" "80")
</hbox>
<hbox homogeneous="true">
$(funcEntry MAKEBROADCAST_DELIVERY_EMAIL_TO "Please enter the email account (or multiple accounts separated by a comma) makebroadcast notifications will be delivered to:" "80")
$(funcEntry MAKEYOUTUBE_DELIVERY_EMAIL_TO "Please enter the email account (or multiple accounts separated by a comma) makeyoutube notifications will be delivered to:" "80")
</hbox>
</frame>
<hbox>
<button ok></button>
<button cancel></button>
</hbox>
</vbox>
</window>
MAINFORM
)
#option 1 for output, uses sed
#GTK_OUTPUT="$(gtkdialog --program=MAIN_DIALOG)"
#if [[ "${GTK_OUTPUT}" == *"OK"* ]] ; then
#this sed converts all true or falses to Y's or N's, which is an issue for PERCEPTUAL_HASH and PREMIS_PLIST which pashua reads as 0 or 1
#echo "${GTK_OUTPUT}" | sed 's:true:Y:g;s:false:N:g;s:EXIT="OK"::g' > "${MM_CONFIG_FILE}"
#or
#echo "${GTK_OUTPUT}" | sed 's:VOLADJUST="true":VOLADJUST="Y":g;s:VOLADJUST="false":VOLADJUST="Y":g;s:PREMIS_DB="true":PREMIS_DB="Y":g;PREMIS_DB="false":PREMIS_DB="N":g;s:PERCEPTUAL_HASH="true":PERCEPTUAL_HASH="1":g;s:PERCEPTUAL_HASH="false":PERCEPTUAL_HASH="0":g;s:PREMIS_PLIST="true":PREMIS_PLIST="1":g;s:PREMIS_PLIST="false":PREMIS_PLIST="0":g;s:EXIT="OK"::g'
#cat "${MM_CONFIG_FILE}"
#else
#exit 0
#fi
#option 2 (based on original script)
eval "$(gtkdialog --program=MAIN_DIALOG)"
if [[ "${EXIT}" = "abort" ]] ; then
exit 0
elif [[ "${EXIT}" = "Cancel" ]] ; then
exit 0
elif [[ "${EXIT}" = "OK" ]] ; then
if [[ "${VOLADJUST}" = "true" ]] ; then
VOLADJUST="Y"
else
VOLADJUST="N"
fi
if [[ "${PREMIS_DB}" = "true" ]] ; then
PREMIS_DB="Y"
else
PREMIS_DB="N"
fi
if [[ "${PREMIS_PLIST}" = "true" ]] ; then
PREMIS_PLIST="1"
else
PREMIS_PLIST="0"
fi
if [[ "${PERCEPTUAL_HASH}" = "true" ]] ; then
PERCEPTUAL_HASH="1"
else
PERCEPTUAL_HASH="0"
fi
#echo "${VOLADJUST}" | sed 's:true:Y:g;s:false:N:g'
echo " OUTDIR_INGESTFILE = ${OUTDIR_INGESTFILE}"
echo " OUTDIR_INGESTXDCAM = ${OUTDIR_INGESTXDCAM}"
echo " OUTDIR_PAPER = ${OUTDIR_PAPER}"
echo " AIP_STORAGE = ${AIP_STORAGE}"
echo " PODCASTDELIVER = ${PODCASTDELIVER}"
echo " YOUTUBEDELIVER = ${YOUTUBEDELIVER}"
echo " TMPDIR = ${TMPDIR}"
echo " REGEX4PODCAST = ${REGEX4PODCAST}"
echo " REGEX4IA = ${REGEX4IA}"
echo " DVDLABELPREFIX = ${DVDLABELPREFIX}"
echo " OMNEONIP = ${OMNEONIP}"
echo " OMNEONPATH = ${OMNEONPATH}"
echo " CUSTOM_LOG_DIR = ${CUSTOM_LOG_DIR}"
echo " LTO_INDEX_DIR = ${LTO_INDEX_DIR}"
echo " LTO_MD5_FLAGS = ${LTO_MD5_FLAGS}"
echo " LOCAL_MM_DIR = ${LOCAL_MM_DIR}"
echo " EMAIL_FROM = ${EMAIL_FROM}"
echo " MAKEYOUTUBE_DELIVERY_EMAIL_TO = ${MAKEYOUTUBE_DELIVERY_EMAIL_TO}"
echo " MAKEBROADCAST_DELIVERY_EMAIL_TO = ${MAKEBROADCAST_DELIVERY_EMAIL_TO}"
echo " FILE_MAKER_DB = ${FILE_MAKER_DB}"
echo " SQL_ERROR_EMAIL_TO = ${SQL_ERROR_EMAIL_TO}"
echo " VOLADJUST = ${VOLADJUST}"
echo " PREMIS_DB = ${PREMIS_DB}"
echo " PREMIS_PROFILE = ${PREMIS_PROFILE}"
echo " PREMIS_NAME = ${PREMIS_NAME}"
echo " PREMIS_PLIST = ${PREMIS_PLIST}"
echo " PERCEPTUAL_HASH = ${PERCEPTUAL_HASH}"
{
echo "OUTDIR_INGESTFILE=\"${OUTDIR_INGESTFILE}\""
echo "OUTDIR_INGESTXDCAM=\"${OUTDIR_INGESTXDCAM}\""
echo "OUTDIR_PAPER=\"${OUTDIR_PAPER}\""
echo "AIP_STORAGE=\"${AIP_STORAGE}\""
echo "PODCASTDELIVER=\"${PODCASTDELIVER}\""
echo "YOUTUBEDELIVER=\"${YOUTUBEDELIVER}\""
echo "TMPDIR=\"${TMPDIR}\""
echo "REGEX4PODCAST=\"${REGEX4PODCAST}\""
echo "REGEX4IA=\"${REGEX4IA}\""
echo "DVDLABELPREFIX=\"${DVDLABELPREFIX}\""
echo "OMNEONIP=\"${OMNEONIP}\""
echo "OMNEONPATH=\"${OMNEONPATH}\""
echo "CUSTOM_LOG_DIR=\"${CUSTOM_LOG_DIR}\""
echo "LTO_INDEX_DIR=\"${LTO_INDEX_DIR}\""
echo "LTO_MD5_FLAGS=\"${LTO_MD5_FLAGS}\""
echo "LOCAL_MM_DIR=\"${LOCAL_MM_DIR}\""
echo "EMAIL_FROM=\"${EMAIL_FROM}\""
echo "MAKEYOUTUBE_DELIVERY_EMAIL_TO=\"${MAKEYOUTUBE_DELIVERY_EMAIL_TO}\""
echo "MAKEBROADCAST_DELIVERY_EMAIL_TO=\"${MAKEBROADCAST_DELIVERY_EMAIL_TO}\""
echo "FILE_MAKER_DB=\"${FILE_MAKER_DB}\""
echo "SQL_ERROR_EMAIL_TO=\"${SQL_ERROR_EMAIL_TO}\""
echo "VOLADJUST=\"${VOLADJUST}\""
echo "PREMIS_DB=\"${PREMIS_DB}\""
echo "PREMIS_PROFILE=\"${PREMIS_PROFILE}\""
echo "PREMIS_NAME=\"${PREMIS_NAME}\""
echo "PREMIS_PLIST=\"${PREMIS_PLIST}\""
echo "PERCEPTUAL_HASH=\"${PERCEPTUAL_HASH}\""
} > "${MM_CONFIG_FILE}"
fi