I hard coded the embed code using the content rebuilder to check the player and it works fine. SmugMug passes a 21 char string consisting of letters and numbers to identify a specific video that their server passes to the player. I need a regex that passes 21 chars with a-z, A-Z and 0-9 allowed in each position. This video ID string is what the user inputs. That string needs to be available in a variable for symbolic substitution into the embed code. Here's an example of the changeable portion of their embed code:
The 21 bold chars are the changeable portion and what the user supplies from SmugMug's embed code. I thus need to build the complete string from user input. Can someone here please give me the regex and syntax for making this available in a variable that I can use to complete the full string. I'm assuming it will look something like:
Express Hosting
"We are the official hosting company of UBB.threads. Ask us about our free migration services to migrate your UBB.threads installation."
#237460 - 06/14/1001:36 PMRe: Adding Support for SmugMug Embedded Video - A ?
[Re: Muniac]
Where user input is substituted for \\2 which I gathered from looking at the youtube example.
The SmugMug ID for the video is always 21 alphanumeric chars (no spaces) so the regex expression for the user input is below:
(\b)([a-zA-Z0-9]{21})(\b)
This wasn't a difficult task but time consuming if you know nothing about little regex details. Figuring out the regex line took the most amount of time. I gathered this is a reincarnation of the old Unix utility GREP. It's now working as expected and anyone else wishing to embed SmugMug video can do so in a couple of minutes. Anyway thanks for the help, advise and guidance on this.
Did I miss any details?
_________________________
I thought I was wrong once. But I was wrong!
there are many ways to do it and you found one that works for you. this is commendable
For the less regex inclined, i recommend regexbuddy or regexmagic tools (not free).. they allow you to play with regexes in various scenarios to test out before turning it loose..
Also, in watching you go thru the hassle of learning the 'how to', it would really be nice to have a more automated way (which i have recommended in the features thread) such as oEmbed.
Smugmug is an oEmbed provider, along with many others like Youtube and Flickr etc... what this API (or really xml specification) provides is a way to ASK a site like smugmug or their ilk what should be the embed code for a supplied video, photo or other resource like a slideshow..
The oEmbed provider then informs the client (ubbthreads in this scenario) what the embed code should be 'automagically'..
Soooo, to take this to a real world use.. this would allow UBB.threads to be simply told that a certain URL is an oEmbed provider, then UBB.threads can take a user inserted URL and turn it into an auto embed with the UBB.threads admin not having to know anything other than to have whitelisted the site..
Wordpress does this now and their list of providers is:
so bottom line, there is no need for custom bbcode.. the user simply pastes a link to the resource (vid, image, slideshow) and it just happens..
that would be what i would like to see for the future..
see oEmbed information for more details. the code that would be needed to be added to bbcode.inc.php would be very minimal (in the handle_url routine for 'magic urls' ) and i have it working on a coupla boards as proof of concept
also, there are many more oEmbed providers than that list shows..
UBB.threads would 'ask' youtube what the embed code might be (note that it changes every so often - rare).. the query (standard) would be: http://www.youtube.com/oembed/?url=http://www.youtube.com/watch?v=vF6PyIML0hI&format=xml
the ubbcode parser grabs it and puts it into the post like so:
note that there is also much more stuff that can be used from the response, like a thumbnail (would make for a MUCH quicker display in a thread, prior to click) etc etc..
final note: peeps that wanna keep the custom bbcode should be allowed to.. no need to kill that off, because it can be used for a LOT more than just embedding vids.. this would just be an OPTION to be used in TANDEM or in LIEU of current stuff
SirDude - Thanks for the kind words and additional insight.
I thought the custom tag editor and inherent threads design provided to handle embed code to be quite solid and easy to use. The fact that I got it working is a testament to that. Like so many things in life, once mastered they seem easy. That's not to say it couldn't be made better but after a point one needs to consider diminishing returns on those efforts. It's often the case one spends 20% of the effort to get 80% of the results and 80% of the effort to finish off that last 20% for a perfect job. Hats off to the perfectionists that go the extra distance to "get it done properly'.
Video is huge on the net and is definitely a growth area. And there are so many players in this market with so many versions of things to deal with it all. I don't know if you remember the video format wars between Betamax and VHS but this needs to be avoided. Do we have bright enough people to create enduring standards in the wake of constantly changing/improving technology?? Sony is way out in front on this with their creative software, codecs and cameras. They are also heavily invested in the broadcast industry which broadens their experience base. If you go back a few years some smart SOB came up with the video NTSC standards that lasted 60 years. We could use a dose of this genius with development tools and software standards. Gates isn't it either. I was thinking more along the style lines of The C Programming Language by Brian Kernighan and Dennis Ritchie.
Getting back to embedded video, it will always require some user input, token, string, etc. That means an expression parser of sorts. If a tool can layer in between the old GREP syntax and create something a tad easier to digest then so much the better. Such a tool allows neophytes like me to save a couple of hours. But then when the day is done developing professional products is usually best left in the hands of the pros. Except in the case of engineers (circa 80s vintage) that write the worst code imaginable.
_________________________
I thought I was wrong once. But I was wrong!
I almost forgot to mention this. The link to my board that contains the new aforementioned embedded video is HERE should anyone be interested. SmugMug compresses a tad less than YouTube. It's working nicely and I'm a happy customer. Enjoy.
_________________________
I thought I was wrong once. But I was wrong!