Hi, it would be a great feature to have hooks on conversion error and success in my opinion.
I´ve created a diff-patch for this but it needs a review.
--- ffmpeg_converter.module (saved version)
+++ (current document)
@@ -352,6 +352,7 @@
// Run conversion and check result.
$result = ffmpeg_converter_convert($input_file, $output_file, $preset->ffmpeg_wrapper, l(t('Source node'), 'node/' . $node->nid));
if (!$result) {
+ module_invoke_all('conversion_error', $node, basename($input_file)); // Pass node and filename for identification.
return false;
}
@@ -397,6 +398,7 @@
watchdog('ffmpeg_converter','FFmpeg converted the file %file to @format.',
array('%file' => basename($input_file), '@format' => $preset->ffmpeg_wrapper['ffmpeg_output_type']),
WATCHDOG_NOTICE, l(t('Source node'), 'node/' . $node->nid));
+ module_invoke_all('conversion_success', $node, basename($input_file)); // Pass node and filename for identification.
}
/**
//Kleve - Andreas Nilsson
Comments
Comment #1
zoo33 commentedMy apologies for the late reply.
This seems like a good idea. One thing I thought about is that the hook names probably need to begin with "ffmpeg_converter_" in order to not pollute the name space.
Can you give some more information on how you might use these hooks? Maybe provide an example implementation for each hook?
Comment #2
kleve commentedHi
I've implemented the hooks in a project I am currently involved in. They are used to notify users via email when a conversion fails, and when the conversion is complete. Below is an example implementation of one of the hooks.
Comment #3
zoo33 commentedMakes sense. Just a thought though, would it be better to implement this as two Rules events instead? Or maybe do both?
Comment #4
kleve commentedBoth sounds nice. That way the information can be used in Rules and is also accessible to others who do not want to use the default Rules actions and/or configure new ones.
Comment #5
zoo33 commentedI've created a patch with modified versions of the hooks. I changed the arguments somewhat, plus made it so that $node is possible to pass by reference to hook implementations, which gives them the ability alter the node before it's saved.
I would love to hear you opinion and some test results!
I still think corresponding Rules events would be good, but maybe we should start with just the hooks.
Comment #6
kleve commentedThis sounds great. Where can I have a look at your patch?
Also, It looks like you have assigned this issue to me or if I somehow managed to do this? Anyways, I am sorry but I did not notice this. That is why I have not done any modifications to my patch according to your previous comments.
Comment #7
zoo33 commentedI think you assigned yourself. :)
Forgot the patch, here it comes...
Comment #8
avpadernoI am closing this issue, as Drupal 6 is no longer supported.