Since this group has been designated for some technical discussion, I'm going to put out 2 questions for y'all that I haven't been able to get solved on irc or the forums. Probably because I just need to explain it better.
I'm working on a stream player module for general release, and one of the things that I need to do is let users select the content field that their video filenames will be input to. I am looking for the best way to write this. Here's what I need it to accomplish:
- Select field name from a drop down of all available fields
- be able to take that value and apply it to a node object
So to explain the second part, let's say my field that stores my video filename is called 'field_video_file_name'
When I am using that with a node object, I call it by $node->field_video_file_name[0]['value']
Thus far, I have tried to accomplish this by the following:
<?php
$fields = array_keys(content_fields($field_name));
$form['stream_player_get_filename_field'] = array(
'#type' => 'select',
'#title' => t('Choose the field that holds your streaming filename'),
'#options' => $fields,
'#default_value' => variable_get('stream_player_get_filename_field', ''),
'#description' => t("Go to the help section of this module for more information")
);
?>but while it prints out the correct field names and all, I can't use this result with a node object properly. I would greatly appreciate any advice.
My second question pertains to adding a configuration option for additional php processing. Again, I need this module to be dynamic enough to support all kinds of configuration, and one of the things i know is that some places will have some automation in place for uploading/encoding videos. So some stations may store their videos on a server where every video is in it's own folder that is created based on the video name and production date, for example. So I would need to allow them to put in some additional php processing for this that can then be applied. I don't really understand how to go about doing this. Let's say they have 10 lines of code that use substr and other php functions to dynamically extract what they need.Or maybe they have their own function that has to get a node id passed to it or something. This one might be way over my head, but if anyone has pointers or examples I could check out, I'd appreciate it. I was looking at the block module initially but just got way too confused on how to do it.
anyway, i'd love any suggestions on either of these final issues i'm trying to nail down.
Comments
I'll see your 2 questions
I'll see your 2 questions and raise you a few more...
When you say "it prints out the correct field names and all" are you referring to outputting the configuration setting with a print_r somewhere? So you see it, but when when you try to reference that string it doesn't work? and hard coding the same thing in the php works?
For part 2, when would a node have a filename, but not the rest of the path in a field? What would you be able to do with that? At DOM, our node paths look like...
/4d/35/the_groove_zone_32_videos.flv
/mnt/DOMRAID1/archive/4d/35/the_groove_zone_32_videos.m2p
We'd like to move away from that so it would be easier to find videos in the file system, but I'm not sure what we'd be able to do with just the file name. Is the logic that if all the videos are in the same directory, that could be changed in one place if they were moved to a new server/path? Seems like storing the full path with the node makes more sense. It is much easier to parse the filename from the full path if/when that's needed than try to recalculate the hash in DOM's case.
Let's ignore the DOM has example and look at a different one. Let's say a location decides to add a (Red Eye 5/ Wowza/Flash) streaming server to allow deep linking into videos like what YouTube enabled last week, the path for that is actually going to be a full URL to the streaming server. It seems like that functionality is going to work really well with the clickable agenda functionality you've been working on.
What's the downside of expecting nodes to store the full path?
in terms of your second
in terms of your second question, my module is assuming a full url. By that i mean, there are a bunch of other configuration options that include (remember that for now this is just quicktime, am still hoping on dom working out the flash side):
-Stream server base url (example: rtsp://stream.mystreamserver.com)
- optional port (example: :554)
- optional additional directory (example: videos/)
- file extension (at present .mp4 and .mov are supported)
- then i want to add in the optional php code for additional processing (which can address the issue of an automated input as well that may need to be reduced through php to get the part of the filename we want)
so that with these config options you would end up with this for example: rtsp://stream.mystreamserver.com:554/videos/
then, this module assumes you have a program/video content type of some kind but doesn't put restrictions on which content type it has to be. That's why I want it to let the user pick a field. At present this is written with an automated master control set up that would send in a filename like yours does, but it would work just fine through manual entry, too. so whatever field you choose, it then knows to look there.
the rest of the module auto builds the full url and does things like auto apply thumbnails and poster images if they exist, etc. so the final url, based on selecting the field, would be:
rtsp://stream.mystreamserver.com:554/videos/video1.mp4
for part 1 of your question, i'm saying i have a configuration option that is a select drop-down. In that select drop down are all the content fields available in the system. i need that choice to then be able to be applied to the node object.
i can return a string just fine like 'field_myfield', but I don't know how I can then get that to work within a node object. So if variable_get('stream_player_get_filename_field', '') = 'field_myfield'
then how can I reference that within a node call?
In other words, I can't do $node->variable_get('stream_player_get_filename_field', '')[0]['value']
SWFTools
Is there a reason why you aren't using SWFTools, and writing the node with the media, and other related content?
I still haven't found a media type that I can't play with JW Media Player, but as needed, you could also create your own player plugin for SWFTools and integrate it pretty easily.
Since we're all pretty much non-commercial here, there shouldn't be any license restrictions with JW.
Pretty easy to build playlists (nice for multi-part episodes), and text captioning works pretty well, although the XML structure can be a bear.
Pretty simple to pass the Flash vars, and simple to integrate a streaming server location which is different from the main Drupal host - would solve the TCP port issue.