Previous Thread
Next Thread
Print Thread
Hop To
Joined: Aug 2006
Posts: 28
Newbie
Newbie
Joined: Aug 2006
Posts: 28
Hello All,

I've been a user of your BBS software for some years now going back to early UBB. Great product and stellar small business operation which I like to support. Keep up the good work.

I'd like to add support for SmugMug embedded video. Looking at the file tags.php, it contains to video tags, markup and regex. I assume I can add an additional array instance (#4) there with new video tag and the embed code that SmugMug provides to embed its videos into HTML pages. Using mass copy of a previous instance with appropriate adjustments for SmugMug I can hopefully update tags.php.

I gather the install PHP script builds the SQL table for these tags by running tags.php and the process is table driven from then on. So the video drop down menu reads from this table and will include any new rows added. My question is about updating the table on an already installed BBS. I'm assuming I can't just run the tags.php script owing to certain things the calling install script sets up ahead of time.

If someone could weigh in on this with some guidance that would be very helpful. Would like not to puke the SQL database. Whence I get this running I'd be more than happy to pass back the updated tags.php for inclusion into your next release for those wishing to embed SmugMug videos. Thanks in advance for any assistance provided.


Best - Scott
Joined: Apr 2007
Posts: 3,940
Likes: 1
SD Offline
Former Developer
Former Developer
Joined: Apr 2007
Posts: 3,940
Likes: 1
you don't have to DB dive or code dive..

we put in an admin section in the control panel -- content tools -- custom tag editor, when it was adopted for 7.3..

you are correct in your finding out what flows out from the admin cpanel, but no need to do it the hard way wink

Joined: Dec 2003
Posts: 6,629
Likes: 85
Joined: Dec 2003
Posts: 6,629
Likes: 85
If I understand you correctly you want to add a posting tag for smugmug.
Depending on what version you have but in the current version that would be a regex code at:
Control Panel ยป Content Rebuilder-tab-Custom tag editor.


Blue Man Group
There is no such thing as stupid questions. Just stupid answers
Joined: Aug 2006
Posts: 28
Newbie
Newbie
Joined: Aug 2006
Posts: 28
Sirdude - Thanks and I understand about the embedded tools included with threads. This would essentially allow me to add a new row to the table ubbt_BBCODE without wading through excessive details.

Ruben - Thanks also. Yes I want to add a posting tag for SmugMug. I'm on threads 7.4.1 and will revisit the admin tools provided.

Let me play with this and see if I can enable the new posting tag. If the lights go out in Seattle I've pushed the wrong button(s).

Thanks to both of you for the quick reply. Be back with more questions or hopefully a success story.


Best - Scott
Joined: Apr 2007
Posts: 3,940
Likes: 1
SD Offline
Former Developer
Former Developer
Joined: Apr 2007
Posts: 3,940
Likes: 1
no probs.. i wrote a tutorial on how to add a gametrailers tag to give peeps some 'behind the scenes' of how to approach it..

Linky Poo

if you are interested smile

Joined: Aug 2006
Posts: 28
Newbie
Newbie
Joined: Aug 2006
Posts: 28
I assume my version falls below the addition of the custom tag editor. I've got DB tools and this will allow me to add a row to ubbt_BBCODE??

Thanks


Best - Scott
Joined: Dec 2003
Posts: 6,629
Likes: 85
Joined: Dec 2003
Posts: 6,629
Likes: 85
Humm.
The change log states:
Quote
7.3 Feature: Added a Custom tag editor that allows admins to add new tags for their board: Tags can be video tags like youtube, google video, yahoo video or can be other things that they might find useful. The admin control panel editor allows both import and export of tags, so sharing amongst UBBT admins can be done very easily. No need to edit code, since it's all done from the admin cpanel.

So the option should be there.

Last edited by Ruben; 06/13/2010 2:26 PM.

Blue Man Group
There is no such thing as stupid questions. Just stupid answers
Joined: Apr 2007
Posts: 3,940
Likes: 1
SD Offline
Former Developer
Former Developer
Joined: Apr 2007
Posts: 3,940
Likes: 1
yep it should be there.. not DB tools, but CONTENT REBUILDER wink

Joined: Dec 2003
Posts: 6,629
Likes: 85
Joined: Dec 2003
Posts: 6,629
Likes: 85
Maybe I was dreaming but I thought that is the path I posted.
Maybe that version is in a slightly different location.
Oh well another beer and off to till the garden.


Blue Man Group
There is no such thing as stupid questions. Just stupid answers
Joined: Aug 2006
Posts: 28
Newbie
Newbie
Joined: Aug 2006
Posts: 28
Ruben & Sirdude - Yes it is there as subtle as a train wreck right in content rebuilder right in front of my eyes. It appears I'm the one influenced with too many beers but I can't claim that as the excuse. Your knowledge and experience were never in question. Let me play a bit and I'll be back. Thanks.


Best - Scott
Joined: Aug 2006
Posts: 28
Newbie
Newbie
Joined: Aug 2006
Posts: 28
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.


Best - Scott
Joined: Aug 2006
Posts: 28
Newbie
Newbie
Joined: Aug 2006
Posts: 28
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?


Best - Scott
Joined: Apr 2007
Posts: 3,940
Likes: 1
SD Offline
Former Developer
Former Developer
Joined: Apr 2007
Posts: 3,940
Likes: 1
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:

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

Joined: Aug 2006
Posts: 28
Newbie
Newbie
Joined: Aug 2006
Posts: 28
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.


Best - Scott
Joined: Aug 2006
Posts: 28
Newbie
Newbie
Joined: Aug 2006
Posts: 28
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.


Best - Scott

Link Copied to Clipboard
ShoutChat
Comment Guidelines: Do post respectful and insightful comments. Don't flame, hate, spam.
Recent Topics
Profile avatar storage settings
by SenecaFlyer - 12/05/2024 1:24 PM
Not allowing attachment over 2m
by ehill - 12/03/2024 3:16 PM
New Admin Here
by SenecaFlyer - 12/02/2024 4:14 PM
Who's Online Now
2 members (Ruben, SenecaFlyer), 929 guests, and 67 robots.
Key: Admin, Global Mod, Mod
Random Gallery Image
Latest Gallery Images
Los Angeles
Los Angeles
by isaac, August 6
3D Creations
3D Creations
by JAISP, December 30
Artistic structures
Artistic structures
by isaac, August 29
Stones
Stones
by isaac, August 19
Powered by UBB.threads™ PHP Forum Software 8.0.1
(Snapshot build 20240918)