'attach new file' broke down and erased my description so AGAIN :-((((((
Problem was erasing the video CCK file and reuploading a file for retranscode (HOW DO I DO THAT EASER BTW?) did not erase the old files, but still showed them. Problem is that the condition in _flashvideo_upload_files does not seem to work correctly. The workaround is not what I would call production quality, but better than nothing...
Workaround in flashvideo_module _flashvideo_upload_files:
// If they removed at least one file from the node...
/*
if (count($node->$cck_original_video_field['field_name']) < count($node->$cck_finished_video_field['field_name'])) {
*/
if (empty($node->$cck_original_video_field['field_name']) || empty($node->$cck_original_video_field['field_name'][0])) {
Below a patch that contains all my workarounds for the problem above and disabling the mp4 shortcut because my flashplayer does not like it plus thumbnails with different file types show up correctly to allow for imported videos from a dead Drupal 5 Open Video installation...
sorry I can't attach it so :
Index: flashvideo.module
===================================================================
--- flashvideo.module (Revision 476)
+++ flashvideo.module (Arbeitskopie)
@@ -704,7 +704,7 @@
$timestamp = time();
- if ((_flashvideo_get_filetype($oldfile->filepath) == 'flv' || _flashvideo_get_filetype($oldfile->filepath) == 'mp4') && !$create_thumbnail) {
+ if ((_flashvideo_get_filetype($oldfile->filepath) == 'flv' || _flashvideo_get_filetype($oldfile->filepath) == 'xxxmp4xxx') && !$create_thumbnail) {
db_query("UPDATE {files} SET filepath='%s', filename='%s', filesize=%d WHERE fid=%d", $newfile->filepath, $newfile->filename, $newfile->filesize, $newfile->fid);
// Insert this video into the flashvideo table if it is not already in there.
@@ -783,7 +783,7 @@
// If we are not creating a thumbnail...
if (!$create_thumbnail) {
// If they wish to delete the original video...
- if (flashvideo_variable_get($node_type, 'delete', 0) && (get_file_ext($oldfile->filepath) != 'flv' || get_file_ext($oldfile->filepath) != 'mp4')) {
+ if (flashvideo_variable_get($node_type, 'delete', 0) && (get_file_ext($oldfile->filepath) != 'flv' || get_file_ext($oldfile->filepath) != 'xxxmp4xxx')) {
// Delete the original file from the file system.
file_delete($oldfile->filepath);
@@ -983,8 +983,8 @@
$newfile->filename = basename($file->filepath, '.'. $extension) .'_'. $file->fid;
// Check for MP4
- if ($extension == 'mp4') {
- $params['videoext'] = 'mp4';
+ if ($extension == 'xxxmp4xxx') {
+ $params['videoext'] = 'xxxmp4xxx';
}
// Set the extension.
@@ -1037,7 +1037,7 @@
// just copy the video to the output path and set the status to converted. Otherwise, we will just
// go ahead and try and convert the video.
- if (!$create_thumbnail && ($extension == 'flv'|| $extension == 'mp4')) {
+ if (!$create_thumbnail && ($extension == 'flv'|| $extension == 'xxxmp4xxx')) {
// Move the file to the output directory
rename($filepath, $output_path);
}
@@ -1531,7 +1531,10 @@
$cck_finished_video_field_db_info = content_database_info($cck_finished_video_field);
$cck_finished_thumbnail_field_db_info = content_database_info($cck_finished_thumbnail_field);
// If they removed at least one file from the node...
+/*
if (count($node->$cck_original_video_field['field_name']) < count($node->$cck_finished_video_field['field_name'])) {
+*/
+ if (empty($node->$cck_original_video_field['field_name']) || empty($node->$cck_original_video_field['field_name'][0])) {
// Figure out which file(s) was removed.
$removed_files = db_query("SELECT * FROM {flashvideo} WHERE fid NOT IN (SELECT fid FROM {files}) AND nid = %d", $node->nid);
while ($removed_file = db_fetch_object($removed_files)) {
@@ -1808,7 +1811,10 @@
if (count($fids) == 1) {
// Find the thumbnail associated with this file ID.
+ /*
$thumb_file = db_fetch_object(db_query("SELECT filepath,fid FROM {files} WHERE (fid = %d) AND (filemime='jpg')", $fids));
+ */
+ $thumb_file = db_fetch_object(db_query("SELECT filepath,fid FROM {files} WHERE (fid = %d)", $fids));
}
}
else {
@@ -2063,7 +2069,7 @@
// See if the filepath exists.
$filepath = _flashvideo_get_filepath($filepath, $video['node_type']);
// Only continue if they specify a video file.
- if ($filepath && ($extension == 'flv'||$extension == 'mp4')) {
+ if ($filepath && ($extension == 'flv'||$extension == 'xxxmp4xxx')) {
// Find the video file in the flashvideo table.
$sql = "SELECT fv.oid, f.filepath, fv.width, fv.height, f.fid FROM {flashvideo} fv LEFT JOIN {files} f ON f.fid = fv.fid WHERE $flashmime AND (fv.status = %d) AND (f.filepath = '%s')";
$video_file = db_fetch_object(db_query($sql, FLASHVIDEO_STATUS_CONVERTED, $filepath));
@@ -2175,7 +2181,7 @@
function flashvideo_get_thumbnail_file($nid, $index) {
$sql = "SELECT f.filepath,f.fid FROM {flashvideo} fv
LEFT JOIN {files} f ON f.fid = fv.fid
- WHERE (fv.nid = %d) AND (f.filemime='jpg') AND (fv.video_index=%d)";
+ WHERE (fv.nid = %d) AND (f.filemime IN ('jpg', 'image/png')) AND (fv.video_index=%d)";
return db_fetch_object(db_query($sql, $nid, $index));
}
@@ -2240,8 +2246,7 @@
/**
* Implementation of hook_nodeapi().
*/
-function flashvideo_nodeapi(&$node, $op, $teaser) {
-
+function flashvideo_nodeapi(&$node, $op, $teaser, $a4=NULL) {
// Only if the node type is enabled.
if (flashvideo_variable_get($node->type, 'enable', 0)) {
switch ($op) {
| Comment | File | Size | Author |
|---|
Comments
Comment #1
asgalon commentedAh, the workaround makes it delete the old files, but inhibits the creation of the new transcoding. Have to work on it some more...
Comment #2
asgalon commentedA better working workaround, I just remove the crap from flashvideo when uploading a new file in the single video data CCK field: