ExpressionEngine CMS
Open, Free, Amazing

Thread

This is an archived forum and the content is probably no longer relevant, but is provided here for posterity.

The active forums are here.

Encoding.com video conversion integration and file manager syncing

May 22, 2012 11:17am

Subscribe [1]
  • #1 / May 22, 2012 11:17am

    Mindvolt

    14 posts

    Hi,

    I have a site that allows users to upload video. The videos are uploaded through a safecracker form to a queued field and stored in a specific directory. I am using a service from Encoding.com to watch that folder and convert new files when they’re added. Encoding.com returns the converted file to my server and sends an xml response to a custom php script. My php script then finds the entry in the database that contains that file and adds the new file to the regular video field for output in a viewable entry. However when I try to the view the entry EE will not output the file url in the template until the directory is synced in the file manager. I’ve tried adding the new file using a hard-coded url value and a {filedir_x)value and neither makes a difference. IN fact if I hard code the url it will not work after syncing either.

    How can I go about fixing this? I’ve done some checking and there doesn’t seem to be any easy way to call file manager sync programmatically.

  • #2 / May 23, 2012 12:06pm

    Dan Decker

    7338 posts

    Hi Mindvolt,

    Sounds like an interesting workflow you’ve put together!

    I’ve done some checking and there doesn’t seem to be any easy way to call file manager sync programmatically.

    Have you considered having the encoded videos stored in a folder that is not also an Upload Destination? You could then edit the entry with a hardcoded URI and it wouldn’t be affected by a file sync operation.

    Let me know what you think!

    Cheers,

  • #3 / May 23, 2012 12:10pm

    Mindvolt

    14 posts

    Good idea Dan. I hadn’t considered that because the video entries are on a channel that houses other CMS managed videos as well so I was just having them delivered back to the associated upload directory for that field. I’ll give it a try and let you know if that works.

    Thanks,

    Josh

  • #4 / May 23, 2012 4:28pm

    Mindvolt

    14 posts

    Dan,

    I’ve tested it having Encoding.com return the videos to a directory not managed by EE file manager, but EE is still not outputing the urls in the templates. I’ve checked the database is storing the correct url and I can access the url directly. Any idea why it will not output from EE? If I insert a file into the same field from the control panel it works fine, so I know there’s nothing wrong with my field/channel/template setup.

    Also if I view the entry in the control panel the image (generated from the video) does not display a thumbnail, it shows a missing image icon. I’m guessing this is because the image is not an EE managed file and EE has not yet generated a thumbnail?

    Thanks.

  • #5 / May 30, 2012 12:22pm

    Mindvolt

    14 posts

    I’ve tested this further, if I create a text input field and have the returning script store the url there it outputs it fine. So in a template side by side I have a file field and text input field both with the same hard-coded url value. The text input field outputs the value but the file field does not.

    So is EE doing some sort of check such that it cannot output values from a file field that do not match files in the file manager’s current file list?

    Using the text input field will solve the issue for now, but I’d really not like to have duplicate fields in the channel just to get around the file syncing issue.

  • #6 / May 30, 2012 4:53pm

    Dan Decker

    7338 posts

    Hi Mindvolt,

    I’m glad we are on a path to a solution, even though not yet perfect!

    So is EE doing some sort of check such that it cannot output values from a file field that do not match files in the file manager’s current file list?

    Indeed, the URL as part of the File Field likely isn’t working because ExpressionEngine can’t find a corresponding entry in exp_files to match the content of the field.

    You could try adding or updating the value for your returned encode in exp_files as part of the process. That may solve the dual field conundrum and the sync issue.

    Cheers,

.(JavaScript must be enabled to view this email address)

ExpressionEngine News!

#eecms, #events, #releases