Site Links
Home
Features
Documentation
Pricing & Order
Members Area
Support Options
UBBDev.com
UBBWiki.com
Who's Online
1 registered (57-Vette), 51 Guests and 13 Spiders online.
Key: Admin, Global Mod, Mod
Featured Member
Registered: 04/09/11
Posts: 140
Top Posters (30 Days)
Ruben 50
DennyP 24
Gizmo 23
Dunny 15
SteveS 13
AllenAyres 12
dbremer 10
SD 10
drkknght00 9
doug 8
Latest Photos
OK Corral Shoot Out
Testing
Basildon Train Station
Basildon Town Centre looking from the rounderbout
Basildon Town Square
Page 2 of 2 < 1 2
Topic Options
#237449 - 06/13/10 06:44 PM Re: Adding Support for SmugMug Embedded Video - A ? [Re: Muniac]
Muniac Offline
stranger
Registered: 08/10/06
Posts: 9
Loc: Livingston, TX
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:

"s=ZT0xJmk9ODY1OTU0NjQyJms9WTk5ZU4mYT05NzcwNTk0X1FrckZaJnU9TXVuaWFj"

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:

"s=ZT0xJmk9OD$uservarmYT05NzcwNTk0X1FrckZaJnU9TXVuaWFj"

Many thanks.
_________________________
I thought I was wrong once. But I was wrong!
Top
Express Hosting
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/10 01:36 PM Re: Adding Support for SmugMug Embedded Video - A ? [Re: Muniac]
Muniac Offline
stranger
Registered: 08/10/06
Posts: 9
Loc: Livingston, TX
Ok I played with this a bit last night and got it dialed. The modified parm line in the embed code looks like this:

"s=ZT0xJmk9OD\\2mYT05NzcwNTk0X1FrckZaJnU9TXVuaWFj"

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!
Top
#237474 - 06/14/10 05:35 PM Re: Adding Support for SmugMug Embedded Video - A ? [Re: Muniac]
SD Offline
Registered: 04/19/07
Posts: 4056
Loc: SoCal, USA
Good job banging it out!

there are many ways to do it and you found one that works for you. this is commendable wink

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:

Click to reveal..
Php Code:
 $this->providers = apply_filters( 'oembed_providers', array(
			'#http://(www\.)?youtube.com/watch.*#i'		 => array( 'http://www.youtube.com/oembed',			true  ),
			'http://youtu.be/*'							 => array( 'http://www.youtube.com/oembed',			false ),
			'http://blip.tv/file/*'						 => array( 'http://blip.tv/oembed/',				   false ),
			'#http://(www\.)?vimeo\.com/.*#i'			   => array( 'http://www.vimeo.com/api/oembed.{format}', true  ),
			'#http://(www\.)?dailymotion\.com/.*#i'		 => array( 'http://www.dailymotion.com/api/oembed',	true  ),
			'#http://(www\.)?flickr\.com/.*#i'			  => array( 'http://www.flickr.com/services/oembed/',   true  ),
			'#http://(.+)?smugmug\.com/.*#i'				=> array( 'http://api.smugmug.com/services/oembed/',  true  ),
			'#http://(www\.)?hulu\.com/watch/.*#i'		  => array( 'http://www.hulu.com/api/oembed.{format}',  true  ),
			'#http://(www\.)?viddler\.com/.*#i'			 => array( 'http://lab.viddler.com/services/oembed/',  true  ),
			'http://qik.com/*'							  => array( 'http://qik.com/api/oembed.{format}',	   false ),
			'http://revision3.com/*'						=> array( 'http://revision3.com/api/oembed/',		 false ),
			'http://i*.photobucket.com/albums/*'			=> array( 'http://photobucket.com/oembed',			false ),
			'http://gi*.photobucket.com/groups/*'		   => array( 'http://photobucket.com/oembed',			false ),
			'#http://(www\.)?scribd\.com/.*#i'			  => array( 'http://www.scribd.com/services/oembed',	true  ),
			'http://wordpress.tv/*'						 => array( 'http://wordpress.tv/oembed/',			  false ),
			'#http://(answers|surveys)\.polldaddy.com/.*#i' => array( 'http://polldaddy.com/oembed/',			 true  ),
			'#http://(www\.)?funnyordie\.com/videos/.*#i'   => array( 'http://www.funnyordie.com/oembed',		 true  ),
		) ); 




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 smile

also, there are many more oEmbed providers than that list shows..

so take youtube as an example.. http://www.youtube.com/watch?v=vF6PyIML0hI is a link to a video..

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

youtube answers with xml (or json)

Code:
<oembed>
<provider_url>http://www.youtube.com/</provider_url>

<title>New York Lottery Sweet Million "Bunnies"</title>

&#8722;
<html>
<object width="480" height="295">
<param name="movie" value="http://www.youtube.com/v/vF6PyIML0hI&fs=1"></param>
<param name="allowFullScreen" value="true"></param>
<param name="allowscriptaccess" value="always"></param>
<embed src="http://www.youtube.com/v/vF6PyIML0hI&fs=1" 
type="application/x-shockwave-flash" 
width="480" height="295" 
allowscriptaccess="always" 
allowfullscreen="true"></embed></object>
</html>
<author_name>born4kicks</author_name>
<height>295</height>
<thumbnail_width>480</thumbnail_width>
<width>480</width>
<version>1.0</version>
<author_url>http://www.youtube.com/user/born4kicks</author_url>
<provider_name>YouTube</provider_name>
<thumbnail_url>http://i3.ytimg.com/vi/vF6PyIML0hI/hqdefault.jpg</thumbnail_url>
<type>video</type>
<thumbnail_height>360</thumbnail_height>
</oembed>


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.. wink

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 wink
_________________________

Threads tutorials . Threads & Wordpress experts . UBB resume

If I you, click this link as to why
Top
#237479 - 06/14/10 11:41 PM Re: Adding Support for SmugMug Embedded Video - A ? [Re: SD]
Muniac Offline
stranger
Registered: 08/10/06
Posts: 9
Loc: Livingston, TX
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!
Top
#237485 - 06/15/10 11:45 AM Re: Adding Support for SmugMug Embedded Video - A ? [Re: Muniac]
Muniac Offline
stranger
Registered: 08/10/06
Posts: 9
Loc: Livingston, TX
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!
Top
Page 2 of 2 < 1 2



Moderator:  AllenAyres, Harold, Ian, Ron M 
Shout Box

Today's Birthdays
No Birthdays
Recent Topics
Temporary Password email not being received
by
05/24/12 10:02 PM
Ability to "like" individual posts (not Facebook "likes)
by doug
05/23/12 09:03 AM
Island Permissions
by ThreadsUser
05/22/12 03:03 PM
streaming video
by prkrgrp
05/20/12 07:02 PM
New Posts Corrupted? Can someone help?
by PianoWorld
05/19/12 09:41 AM
Forum Stats
10492 Members
36 Forums
33842 Topics
181709 Posts

Max Online: 978 @ 06/24/07 11:19 PM
Random Image