Just wanted to flag a conflict between flashvideo module and filefield_paths. This may actually extend to any module that dynamically manipulates files on the node.

Flashvideo lets you create a separate field for storage of the FLV file that it generates. On creating this field I set a simple directly "flashvideo/flv".

When flashvideo goes to create the FLV, it tries to find out the path per this excert from flashvideo.module:

function flashvideo_convert($file, $node_type, $create_thumbnail = FALSE, $params = array()) {  
     ...
      $field = content_fields($field_name, $node_type); // Get array of info about the field.
      $filefield_path = $field['widget']['file_path']; // Get the specific file path that was set for the field.
      // If they have Token module installed, search the $filefield_path for tokens and get them replaced.
      if (module_exists('token')) {
        $filefield_path = token_replace($filefield_path, 'user', $account);
      }
      ...

content_fields() returns an empty path for storage because filefield_paths has hidden the filefield modules "Path" setting and replaced it with it's own.

In my case I didn't care about special token handling for flashvideo, so I was able to uninstall Filefield Paths temporarily, set the path, and turn on Filefield paths again. This is now saving my files directly.

Anyway, I don't know if this can be fixed by filefield_paths alone, without also changing flashvideo module in some way. But at least there's a chance someone can google this solution now. Putting this as a feature request for want of a better category.

CommentFileSizeAuthor
#8 flashvideo.inc_.txt384 bytesDeciphered
Support from Acquia helps fund testing for Drupal Acquia logo

Comments

sime’s picture

Added a link to here from http://drupal.org/node/713374

Deciphered’s picture

Hi sime,

Unfortunately due to the heavy requirements of the FlashVideo (FFMPEG, etc), it will take me some time to get to this issue, but if you can provide me with some information on the settings you used so I can better reproduce the issue when I do get time it would be greatly appreciated.

Anything you believe is relevant, the FlashVideo settings, the FileField settings, etc.

Cheers,
Deciphered.

sime’s picture

You should be able to reproduce like this:

1. create a new node type, with a file field.
2. install filefield_paths
3. edit the flefield and set the directory path to "foobar" (ignore tokens). this changes filefield_paths settings of course.

4. then do

dpr(content_fields('fieldname', 'nodetype'));

You'll see the widget doesn't have a path setting.

solution 1
You could double-save the filefield_path setting to the widget settings. But this could be weird, especially if the user sets node tokens - they won't work.

solution 2
Give the user the choice to decide which fields they want to use filefield_paths on. I'd like this, but you have to set up UI for the settings which is always a bit naff for this sort of thing.

solution 3
Document the issue somehow. So people know to switch off your module temporarily to set widget path.

solution 4
Flag the whole thing as an edge case - how many people use these modules together anyway?

sime’s picture

I suppose the point above is that this could effect any module that wants to get a file path directly from the widget settings.

I don't know how many (if any) other modules do this, but you won't need to set up flashvideo to replicate.

sime’s picture

Solution 5
Don't hide the widget path box from the filefield edit form. Instead, add a description to it: "Path to use if, for any reason, custom tokens are not available."

3dloco’s picture

Issue tags: +filefield path, +FlashVideo, +compatibility, +module support, +user directories, +active updating

@Sime: Wow your posting is great! I've been having this same issue with Flashvideo and Filefield paths, thanks for your post.


In my case I do need to have the flv file in user directories, so I am currently using "active updating" to move the converted flv file until flashvideo supports it.

1. This will move the flv file. However, it gives this error to the user initially:

The selected file /var/www/…/httpdocs could not be copied.

2. After showing the error, it moves the file. I suspect that active updating wants to move the flv file before it exists.

How can I get around this or turn this error off, especially because I don't want users to see /var/www/…/httpdocs...



For reference, this issue is posted on the Flashvideo #390212: FlashVideo and FileField Paths Integration The post is quite long, so for replies related to flashvideo currently not supporting filefieldpaths see #31, 35, 39, 40, 42, and 43.

Thanks!

KH

Deciphered’s picture

Sime,

While some of your suggestions are valid, the problem is that whether or not flashvideo or any other module had the filefield path path settings available to them, they would still have issues.
The section of code you quoted from flashvideo is attempting to parse the tokens itself, this would not however result in the correct path as it doesn't have support for Node tokens (the whole premise behind FileField Paths).

I am looking into a solution for this issue and will hopefully have one shortly.

Thank you for your patience.

Cheers,
Deciphered.

Deciphered’s picture

Status: Active » Needs review
FileSize
384 bytes

Hi guys,

I have a working solution, it will need proper testing as the development setup I built it on wasn't actually achieving the video conversion. It was however creating the image so I know that part is working, at least on my setup it is.
I believe the moving of the video will still be an issue, but it should be easily fixed once I can get the conversion running.

If you save the attached file as 'flashvideo.inc' in the '/sites/all/modules/filefield_paths/modules' directory it should just work.

Look forward to your feedback.

Cheers,
Deciphered.

3dloco’s picture

Status: Needs review » Active

Hello Deciphered,

Thanks for working on this! I really appreciate your effort and quick response.

I tested the file that you attached above and as you suspected, moving the videothumbnail image works but moving the converted flashvideo is still an issue, as it goes to the root of the files folder instead of going to the user's folder.

I tested using two different settings on Flashvideo (when to convert the video) as follows:

I. Converting videos immediately on node creation:

1. I get the error message below:

The selected file could not be copied, because no file by that name exists. Please check that you supplied the correct filename.

2. Thumbnail is moved to the right location files/[uid]/videothumnail.jpg (as per filefieldpaths)

3. Video is not placed on the right location, instead it is on files/flashvideo.flv (it goes to the root of the files folder).

II. Converting videos during cron.

Same behavior as I, but no error message.

Everything else works fine.

Thanks,

KH

3dloco’s picture

Hello Deciphered,

Just checking with you to see if you had a chance to do some work on the flashvideo.inc file and if you have any updates.

Thanks,

KH

Deciphered’s picture

Hi 3dloco,

I had hoped to get sime to run a few tests for me via IRC over the weekend, but I was flat-out and unable to get online much.
If you are able to run some tests for me I would be extremely grateful.

They're simple enough, just install the devel module on your site and stick the following code in side the filefield_paths_flashvideo_save_file() (sites/all/modules/filefield_paths/modules/flashvideo.inc) and let me know the results:
dpm($newfile);

Once you've done that, I should be able to get the support ready for commit.

Cheers,
Deciphered.

3dloco’s picture

Hello Deciphered,

Thanks, I am not able to test it right now, but I will later on tonight and report back the results to you as soon as possible.

Regards,

KH

3dloco’s picture

Hello Deciphered,

I tested the modifications to flashvideo.inc. However, moving the converted flashvideo is still an issue (it still goes to the root of the files folder instead of going to the user's folder).

Below is a summary of my tests including some of the log errors.

1. Enabled the devel module.

2. I added the the code above to flashvideo.inc and flush the caches.

3. After saving the node with the uploaded video, I got a couple of errors on the screen like this:

The selected file could not be copied, because no file by that name exists. Please check that you supplied the correct filename.

4. Also, I checked the logs and I get a couple of warnings like the ones above, followed by filefield_paths errors like this:

FileField was trying to display the file uploads/originalvideo.mov, but it does not exist.

FileField Paths failed to move file (files/originalvideo.mov) to (files/4/videos/originalvideo.mov).

FileField Paths failed to move file (files//videothumbnail.jpg) to (files/4/videos/videothumbnail.jpg).

However, the original video and the video thumbnail are actually moved to right folder.

Also, I did not get any errors regarding filefield_paths trying to move the .flv file.

Appreciate your help and I'll be happy to help with more testing...

Thanks,

KH

Deciphered’s picture

Hi 3dloco,

It isn't a modification/fix, it's debug code for testing I need done. You should have got a display of information, that's the section of information I am after.

If you're unable to debug as I requested above, I will have to try sime again, or work out an alternative.

Cheers,
Deciphered.

zuzu83’s picture

a solution for FlashVideo ? :)

sime’s picture

This solution at #8 works for the thumbnail. I tried to extend it for the flv converted video file but didn't seem to work though I don't understand why.

(I'm getting a lot of errors from file.inc. The bit that says "Please check that you supplied the correct filename" and basically no source file name is being provided to file_copy(). I tried to track this down but didn't get far at all.)

I also note that flashvideo module can't handle the moved file: #737812: don't assume where the thumb is stored :(

HonorsGrad’s picture

+1

sime’s picture

Status: Active » Postponed

Just to clarify. You cannot fully integrate filefield_paths with flashvideo, unless this issue is fixed:
#737812: don't assume where the thumb is stored

If Filefield_paths moves the video thumbnail or the converted flv, Flashvideo can break.

imDhaval’s picture

Priority: Normal » Critical
Status: Postponed » Active

i am using flashvideo 6.x-1.5 , FileField 6.x-3.7 , FileField Paths 6.x-1.4

myCCK filepath settings:

Original video : files/video/[author-id] --> works fine ( Original video goes to " files/video/[author-id] ")

Converted video : files/video/[author-id] --> Does not work, ( Converted video goes to " files/ ")

Thumbnail : files/video/[author-id] --> Does not work, ( Thumbnail goes to " files/ ")

so plz help me for this critical problem...

a patch might solve this..

Deciphered’s picture

Status: Active » Closed (won't fix)

No longer supporting Drupal 6 issues for this module.