public bool SaveSegments { get; set; }\r
public bool CreateSubFolder { get; set; }\r
public string Tag { get; set; }\r
- public bool UseMetadata {get; set;}\r
+ public bool CreateMetadata {get; set;}\r
+ public bool SendEmailOnError { get; set; }\r
+ public string ErrorEmailRecipient { get; set; }\r
+ public string ErrorEmailPattern { get; set; }\r
+ public bool SendEmailOnSuccess { get; set; }\r
+ public string SuccessEmailRecipient { get; set; }\r
+ public string SuccessEmailPattern { get; set; }\r
}\r
\r
public class Connection {\r
<None Include="Resources\configuration-ingest.json">\r
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>\r
</None>\r
- <None Include="Resources\configuration-nexio.json">\r
+ <None Include="Resources\configuration-control.json">\r
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>\r
</None>\r
</ItemGroup>\r
{\r
- "title": "Adáslebonyolítás",\r
+ "title": "Lebonyolítás",\r
"active": true,\r
"startInTray": false,\r
- "enableNameOverride": false,\r
+ "enableCustomMetadataId": true,\r
"filter": "avi",\r
"player": {\r
- "enabled": true,\r
- "autoStart": false,\r
- "segmentEditor": true\r
},\r
"source": {\r
"$type": "NEXIOSource",\r
"address": "ws://10.10.1.28/services/nexio"\r
},\r
"remote": {\r
- "address": "ftp://10.10.1.55:2098",\r
+ "address": "ftp://10.10.1.56:2098/MXF",\r
"userName": "administrator",\r
"password": "system"\r
}\r
"$type": "OctopusMetadata",\r
"server": {\r
"address": "http://10.10.1.28/services/rest/octopus",\r
- "userName": "dani",\r
- "password": "dani",\r
"timeout": 1000\r
}\r
},\r
"address": "Data Source=10.10.1.45\\sql16;Initial Catalog=PA_Echo;Persist Security Info=True;",\r
"userName": "MAM",\r
"password": "Echotv.hu",\r
- "timeout": 5\r
+ "timeout": 1000\r
}\r
},\r
{\r
"$type": "MediaCubeMetadata",\r
"server": {\r
"address": "http://10.10.1.28/services/rest/jobengine",\r
- "userName": "dani",\r
- "password": "dani"\r
+ "timeout": 1000\r
}\r
}\r
],\r
"targets": [\r
{\r
- "label": "Adásba",\r
+ "label": "Adásellenőrzés",\r
"processor": "FXPTargetProcessor",\r
"outputFormat": "%ID%",\r
+ "tag": "Adáskész",\r
"remote": {\r
- "address": "ftp://10.10.1.100:21/READY",\r
+ "address": "ftp://10.10.1.100:21/PLAYOUT_CHECK",\r
"userName": "mediacube",\r
- "password": "Broadca5T"\r
+ "password": "Broadca5T"\r
+ }\r
+ },\r
+ {\r
+ "label": "Archiválás",\r
+ "processor": "UNCTargetProcessor",\r
+ "outputFormat": "%ID%",\r
+ "tag": "Archiválás",\r
+ "createMetadata": true,\r
+ "remote": {\r
+ "address": "file://10.10.1.100/BRAAVOS/ARCHIVE"\r
}\r
}\r
]\r
"title": "Betöltés",\r
"active": true,\r
"startInTray": false,\r
- "enableCustomMetadataId": false,\r
+ "enableCustomMetadataId": true,\r
"player": {\r
"enabled": true,\r
"autoStart": false,\r
"$type": "OctopusMetadata",\r
"server": {\r
"address": "http://10.10.1.28/services/rest/octopus/",\r
- "userName": "user",\r
- "password": "password",\r
"timeout": 1000\r
}\r
},\r
"address": "Data Source=10.10.1.45\\sql16;Initial Catalog=PA_Echo;Persist Security Info=True;",\r
"userName": "MAM",\r
"password": "Echotv.hu",\r
- "timeout": 5\r
+ "timeout": 1000\r
}\r
},\r
{\r
"$type": "MediaCubeMetadata",\r
"server": {\r
"address": "http://10.10.1.28/services/rest/jobengine/",\r
- "userName": "user",\r
- "password": "password",\r
"timeout": 1000\r
}\r
}\r
"useMetadata": false,\r
"remote": {\r
"address": "file://10.10.1.100/BRAAVOS/OCTOPUS",\r
- "userName": "mediacube",\r
- "password": "Broadca5T"\r
+ "timeout": 1000\r
}\r
},\r
{\r
"processor": "UNCTargetProcessor",\r
"outputFormat": "%ID%",\r
"tag": "Betöltés",\r
- "saveSegments": false,\r
"killDateDays": 7,\r
- "createSubFolder": false,\r
- "useMetadata": false,\r
"remote": {\r
"address": "file://10.10.1.100/BRAAVOS/PLAYOUT_CHECK",\r
- "userName": "mediacube",\r
- "password": "Broadca5T"\r
+ "timeout": 1000\r
+ }\r
+ },\r
+ {\r
+ "label": "Archiválás",\r
+ "processor": "UNCTargetProcessor",\r
+ "outputFormat": "%ID%",\r
+ "tag": "Archiválás",\r
+ "useMetadata": true,\r
+ "remote": {\r
+ "address": "file://10.10.1.100/BRAAVOS/ARCHIVE",\r
+ "timeout": 1000\r
}\r
}\r
]\r
{\r
- "title": "Adásanyagok",\r
+ "title": "Ellenőrzés",\r
"active": true,\r
"startInTray": false,\r
"enableCustomMetadataId": true,\r
"address": "Data Source=10.10.1.45\\sql16;Initial Catalog=PA_Echo;Persist Security Info=True;",\r
"userName": "MAM",\r
"password": "Echotv.hu",\r
- "timeout": 0\r
+ "timeout": 1000\r
}\r
},\r
{\r
"outputFormat": "%ID%",\r
"saveSegments": true,\r
"tag": "Adáskész",\r
- "createSubFolder": false,\r
- "useMetadata": false,\r
"remote": {\r
"address": "file://10.10.1.100/BRAAVOS/PLAYOUT"\r
}\r
},\r
{\r
- "label": "Újravágásra",\r
+ "label": "Újravágás",\r
"processor": "UNCTargetProcessor",\r
"outputFormat": "%ID%",\r
- "tag": "Újravágásra",\r
+ "tag": "Újravágás",\r
"remote": {\r
"address": "file://10.10.1.100/BRAAVOS/PLAYOUT_NLE"\r
+ },\r
+ "sendSEmailOnSuccess" : true, \r
+ "successEmailRecipient": "vasary@elgekko.net",\r
+ "successEmailPattern": "A %TARGETNAME% újravágása szükséges."\r
+ },\r
+ {\r
+ "label": "Archiválás",\r
+ "processor": "UNCTargetProcessor",\r
+ "outputFormat": "%ID%",\r
+ "tag": "Archiválás",\r
+ "createMetadata": true,\r
+ "remote": {\r
+ "address": "file://10.10.1.100/BRAAVOS/ARCHIVE",\r
+ "timeout": 1000\r
}\r
}\r
-\r
]\r
}\r
"killDateDays": 0,\r
"tag": "Adáskész",\r
"createSubFolder": false,\r
- "useMetadata": false,\r
+ "createMetadata": false,\r
"remote": {\r
"address": "file://10.10.1.100/BRAAVOS/PLAYOUT/IceGateway",\r
"userName": "mediacube",\r
Message = e.Message;\r
workFlowAction.description = Message;\r
logger.Error(e);\r
+ if (parameters.TargetConfig.SendEmailOnError && !String.IsNullOrEmpty(parameters.TargetConfig.ErrorEmailRecipient) && !String.IsNullOrEmpty(parameters.TargetConfig.ErrorEmailPattern))\r
+ SendEmail(parameters.TargetConfig.ErrorEmailRecipient, parameters.TargetConfig.ErrorEmailPattern);\r
}\r
finally {\r
AfterExecute();\r
workFlowAction.successful = true;\r
if (parameters.TargetConfig.KillDateDays > 0)\r
UploadKillDateFile();\r
- if (parameters.TargetConfig.UseMetadata && parameters.ArchiveMetadata != null)\r
+ if (parameters.TargetConfig.CreateMetadata && parameters.ArchiveMetadata != null)\r
CreateMetadata();\r
if (parameters.TargetConfig.SaveSegments && parameters.Segments != null) {\r
SaveSegments();\r
parameters.Client.BroadcastOKForAir(parameters.VariantID);\r
- } \r
+ }\r
+ if (parameters.TargetConfig.SendEmailOnSuccess && !String.IsNullOrEmpty(parameters.TargetConfig.SuccessEmailRecipient) && !String.IsNullOrEmpty(parameters.TargetConfig.SuccessEmailPattern))\r
+ SendEmail(parameters.TargetConfig.SuccessEmailRecipient, parameters.TargetConfig.SuccessEmailPattern);\r
+ }\r
+\r
+ private void SendEmail(string to, string messagePattern) {\r
+ try {\r
+ string message = messagePattern.Replace("%TARGETNAME%", Output);\r
+ parameters.MediaCubeApi.Notify(to, messagePattern);\r
+ }\r
+ catch (Exception e) {\r
+ MessageBox.Show(parent, e.Message);\r
+ }\r
}\r
\r
private void SaveSegments() {\r
}\r
\r
private CopyProgressResult CopyProgressHandler(long total, long transferred, long streamSize, long StreamByteTrans, uint dwStreamNumber, CopyProgressCallbackReason reason, IntPtr hSourceFile, IntPtr hDestinationFile, IntPtr lpData) {\r
- if (transferred > 0) \r
- Progress = (int)((double) transferred * 100 / total );\r
+ if (transferred > 0)\r
+ Progress = (int)((double)transferred * 100 / total);\r
return CopyProgressResult.PROGRESS_CONTINUE;\r
}\r
\r
package user.commons.log4j2.appender;
import java.io.Serializable;
+import java.util.concurrent.ExecutorService;
+import java.util.concurrent.Executors;
import org.apache.logging.log4j.core.Appender;
import org.apache.logging.log4j.core.Core;
import org.apache.logging.log4j.core.util.Booleans;
/**
- * Send an e-mail when a specific logging event occurs, typically on errors or
- * fatal errors.
+ * Send an e-mail when a specific logging event occurs, typically on errors or fatal errors.
*
* <p>
- * The number of logging events delivered in this e-mail depend on the value of
- * <b>BufferSize</b> option. The <code>SmtpAppender</code> keeps only the last
- * <code>BufferSize</code> logging events in its cyclic buffer. This keeps
- * memory requirements at a reasonable level while still delivering useful
- * application context.
+ * The number of logging events delivered in this e-mail depend on the value of <b>BufferSize</b> option. The <code>SmtpAppender</code> keeps only the last
+ * <code>BufferSize</code> logging events in its cyclic buffer. This keeps memory requirements at a reasonable level while still delivering useful application
+ * context.
*
- * By default, an email message will formatted as HTML. This can be modified by
- * setting a layout for the appender.
+ * By default, an email message will formatted as HTML. This can be modified by setting a layout for the appender.
*
- * By default, an email message will be sent when an ERROR or higher severity
- * message is appended. This can be modified by setting a filter for the
- * appender.
+ * By default, an email message will be sent when an ERROR or higher severity message is appended. This can be modified by setting a filter for the appender.
*/
@Plugin(name = "HTMLMailAppender", category = Core.CATEGORY_NAME, elementType = Appender.ELEMENT_TYPE, printObject = true)
public final class HTMLMailAppender extends AbstractAppender {
private static final int DEFAULT_BUFFER_SIZE = 512;
- /** The SMTP Manager */
- private final SmtpManager manager;
-
- private HTMLMailAppender(final String name, final Filter filter, final Layout<? extends Serializable> layout,
- final SmtpManager manager, final boolean ignoreExceptions) {
- super(name, filter, layout, ignoreExceptions);
- this.manager = manager;
- }
-
/**
* Create a SmtpAppender.
*
* The email address of the sender.
* @param replyTo
* The comma-separated list of reply-to email addresses.
- * @param subject The subject of the email message.
- * @param smtpProtocol The SMTP transport protocol (such as "smtps", defaults to "smtp").
+ * @param subject
+ * The subject of the email message.
+ * @param smtpProtocol
+ * The SMTP transport protocol (such as "smtps", defaults to "smtp").
* @param smtpHost
* The SMTP hostname to send to.
* @param smtpPortStr
* @param smtpDebug
* Enable mail session debuging on STDOUT.
* @param bufferSizeStr
- * How many log events should be buffered for inclusion in the
- * message?
+ * How many log events should be buffered for inclusion in the message?
* @param layout
* The layout to use (defaults to HtmlLayout).
* @param filter
- * The Filter or null (defaults to ThresholdFilter, level of
- * ERROR).
- * @param ignore If {@code "true"} (default) exceptions encountered when appending events are logged; otherwise
- * they are propagated to the caller.
+ * The Filter or null (defaults to ThresholdFilter, level of ERROR).
+ * @param ignore
+ * If {@code "true"} (default) exceptions encountered when appending events are logged; otherwise they are propagated to the caller.
* @return The SmtpAppender.
*/
@PluginFactory
- public static HTMLMailAppender createAppender(@PluginConfiguration final Configuration config,
- @PluginAttribute("name") @Required final String name, @PluginAttribute("to") final String to,
- @PluginAttribute("cc") final String cc, @PluginAttribute("bcc") final String bcc,
- @PluginAttribute("from") final String from, @PluginAttribute("replyTo") final String replyTo,
- @PluginAttribute("subject") final String subject,
- @PluginAttribute("smtpProtocol") final String smtpProtocol,
- @PluginAttribute("smtpHost") final String smtpHost,
+ public static HTMLMailAppender createAppender(@PluginConfiguration final Configuration config, @PluginAttribute("name") @Required final String name,
+ @PluginAttribute("to") final String to, @PluginAttribute("cc") final String cc, @PluginAttribute("bcc") final String bcc,
+ @PluginAttribute("from") final String from, @PluginAttribute("replyTo") final String replyTo, @PluginAttribute("subject") final String subject,
+ @PluginAttribute("smtpProtocol") final String smtpProtocol, @PluginAttribute("smtpHost") final String smtpHost,
@PluginAttribute(value = "smtpPort", defaultString = "0") @ValidPort final String smtpPortStr,
- @PluginAttribute("smtpUsername") final String smtpUsername,
- @PluginAttribute(value = "smtpPassword", sensitive = true) final String smtpPassword,
- @PluginAttribute("smtpDebug") final String smtpDebug,
- @PluginAttribute("bufferSize") final String bufferSizeStr,
+ @PluginAttribute("smtpUsername") final String smtpUsername, @PluginAttribute(value = "smtpPassword", sensitive = true) final String smtpPassword,
+ @PluginAttribute("smtpDebug") final String smtpDebug, @PluginAttribute("bufferSize") final String bufferSizeStr,
@PluginElement("Layout") Layout<? extends Serializable> layout, @PluginElement("Filter") Filter filter,
@PluginAttribute("ignoreExceptions") final String ignore) {
if (name == null) {
}
final Configuration configuration = config != null ? config : new DefaultConfiguration();
- final SmtpManager manager = SmtpManager.getSmtpManager(configuration, to, cc, bcc, from, replyTo, subject,
- smtpProtocol, smtpHost, smtpPort, smtpUsername, smtpPassword, isSmtpDebug, filter.toString(),
- bufferSize);
+ final SmtpManager manager = SmtpManager.getSmtpManager(configuration, to, cc, bcc, from, replyTo, subject, smtpProtocol, smtpHost, smtpPort,
+ smtpUsername, smtpPassword, isSmtpDebug, filter.toString(), bufferSize);
if (manager == null) {
return null;
}
return new HTMLMailAppender(name, filter, layout, manager, ignoreExceptions);
}
+ /** The SMTP Manager */
+ private final SmtpManager manager;
+
+ private final ExecutorService executor = Executors.newFixedThreadPool(1);
+
+ private HTMLMailAppender(final String name, final Filter filter, final Layout<? extends Serializable> layout, final SmtpManager manager,
+ final boolean ignoreExceptions) {
+ super(name, filter, layout, ignoreExceptions);
+ this.manager = manager;
+ }
+
+ /**
+ * Perform SmtpAppender specific appending actions, mainly adding the event to a cyclic buffer and checking if the event triggers an e-mail to be sent.
+ *
+ * @param event
+ * The Log event.
+ */
+ @Override
+ public void append(final LogEvent event) {
+
+ executor.submit(() -> {
+ manager.sendEvents(getLayout(), event);
+ });
+
+ }
+
/**
* Capture all events in CyclicBuffer.
- * @param event The Log event.
+ *
+ * @param event
+ * The Log event.
* @return true if the event should be filtered.
*/
@Override
}
return filtered;
}
-
- /**
- * Perform SmtpAppender specific appending actions, mainly adding the event
- * to a cyclic buffer and checking if the event triggers an e-mail to be
- * sent.
- * @param event The Log event.
- */
- @Override
- public void append(final LogEvent event) {
- manager.sendEvents(getLayout(), event);
- }
}
import java.io.OutputStream;
import java.util.Date;
import java.util.Properties;
-import java.util.concurrent.ExecutorService;
-import java.util.concurrent.Executors;
import javax.activation.DataSource;
import javax.mail.Authenticator;
import javax.mail.PasswordAuthentication;
import javax.mail.Session;
import javax.mail.Transport;
+import javax.mail.internet.InternetAddress;
import javax.mail.internet.InternetHeaders;
import javax.mail.internet.MimeBodyPart;
import javax.mail.internet.MimeMessage;
+import javax.mail.internet.MimeMessage.RecipientType;
import javax.mail.internet.MimeMultipart;
import javax.mail.internet.MimeUtility;
import javax.mail.util.ByteArrayDataSource;
private final FactoryData data;
- private final ExecutorService executor = Executors.newFixedThreadPool(5);
-
protected SmtpManager(final String name, final Session session, final MimeMessage message, final FactoryData data) {
super(null, name);
this.session = session;
try {
if (appendEvent.getMarker() instanceof MediaCubeMarker) {
MediaCubeMarker mcm = (MediaCubeMarker) appendEvent.getMarker();
- //message.setRecipient(RecipientType.TO, new InternetAddress(mcm.getTo()));
+ message.setRecipient(RecipientType.TO, new InternetAddress(mcm.getTo()));
}
final LogEvent[] priorEvents = buffer.removeAll();
final InternetHeaders headers = getHeaders(contentType, encoding);
final MimeMultipart mp = getMimeMultipart(encodedBytes, headers);
-
- executor.submit(() -> {
- try {
- sendMultipartMessage(message, mp);
- } catch (MessagingException e) {
- System.out.println(e.getMessage());
- }
- });
+ sendMultipartMessage(message, mp);
} catch (final MessagingException | IOException | RuntimeException e) {
logError("Caught exception while sending e-mail notification.", e);
throw new LoggingException("Error occurred while sending email", e);