[DEV] Auto Video Embed v.0.0.2 (en) (update)

DEV-Area for phpBB 3.0.x

[DEV] Auto Video Embed v.0.0.2 (en) (update)

Postby 4seven » Mon 8. Mar 2010, 02:41 | Userzeit: +1.00 / Mo 8. Mär 2010, 02:41

[DEV] Auto Video Embed

MOD-Title: Auto Video Embed
MOD-Version: 0.0.2
MOD-Author: 4seven

Credits: Marc Reichelt for EMFF-Player
Credits: Jeroen Wing for JW Player

Requests:
http://www.phpbb.com/community/viewtopi ... p=12129575
http://www.phpbb.com/community/viewtopi ... p=12135145
http://www.phpbb.com/community/viewtopi ... p=11879555
https://www.phpbb.de/community/viewtopi ... 0#p1166200

MOD-Description: This Mod makes it possible to embed videos from popular video-sites by simply posting a link

phpBB-Version: phpBB 3.0.x
phpBB-Languages: multilingual
phpBB-Styles: all Styles

Demo: http://4seven.bplaced.net/phpbb3/viewtopic.php?f=11&t=283

Image (follows)

Download:
Auto_Video_Embed_v.0.0.2.zip
(4.66 KiB) Downloaded 486 times

Features:
- insert portal-videos by just posting a link
- insert flv-videos and mp3 by just posting a link
- enable /disable video-sites
- easy install (only 2 edits)
- xhtml 1.0 strict

Current Provided Video Portals:
- clipfish
- dailymotion
- gametrailers
- googlevideo
- megavideo
- metacafe
- myspace
- myvideo
- veoh
- vimeo
- yahoo
- youtube

Other Provided Formats:
- flv
- mp3

The right Syntax to Embed:
Code: Select all
http://www.clipfish.de/video/3272443/darth-vader-tanzt
http://www.dailymotion.com/video/xbf4y7_revenge-seoyeun-lee_creation
http://www.myflvsite.com/video/yourchosenfile.flv
http://www.gametrailers.com/video/jay-z-vs-dj-hero/62888
http://video.google.com/videoplay?docid=8135690990081075324&ei=_E6US5PKEoen-AbLyPnYAg&q=test#
http://www.megavideo.com/?v=DK2AZWPO
http://www.metacafe.com/watch/4282595/new_peugeot
http://www.mymusicsite.com/audio/yourchosenfile.mp3
http://vids.myspace.com/index.cfm?fuseaction=vids.individual&videoid=4517474
http://www.myvideo.de/watch/6735176/the_nanny_hehe_ur_geil_xDDDDDDDDDDDDDD
http://www.veoh.com/browse/videos/category/movies_horror/watch/e9150
http://www.vimeo.com/9325052
http://video.yahoo.com/watch/6897444/17936899
http://www.youtube.com/watch?v=TyLV4lxMc1g&feature=popular


New in v.0.0.2:
- fixing some missing xhtml 1.0 strict errors
- flv-player added (to insert flv by posting a flv-link)
for video-sites, that dont provide xhtml 1.0 strict object-syntax
demo: http://4seven.bplaced.net/phpbb3/viewtopic.php?p=1092#p1092
- mp3-player added (to insert mp3 by posting a mp3-link)
demo: http://4seven.bplaced.net/phpbb3/viewtopic.php?p=1094#p1094

fix #1 v.0.0.2 (in current package yet)
- now flv- and mp3-code work with prime-links in post-preview
- works without prime-links also
http://www.phpbb.com/community/viewtopi ... #p12359285

fix #2 v.0.0.2 (in current package yet)
- broken preview, if more than one video-link is added (fixed)
- broken preview, if a html-link is added after a video-link (fixed)
hint: add a html-link (without [url] tags) always after the video-link(s), not between (unfixed)

open
auto_video_embed_post.php

find all
Code: Select all
#U                


replace all with
Code: Select all
#is                

fix #3 for all who have installed this snippet:
http://www.phpbb.com/kb/article/links-o ... w-windows/

Auto_Video_Embed_v.0.0.2_Special_Version.zip
(4.31 KiB) Downloaded 189 times


Example to modify and transform a existing BBCode to Auto Video Embed
viewtopic.php?p=1348#p1348

Requests:
- set mod off (per user setting > ucp) bcs. if user have low bandwidth: http://www.phpbb.com/community/viewtopi ... #p12320835
- optional link under video: http://www.phpbb.com/community/viewtopi ... #p12320835
User avatar
4seven
Administrator
 
Posts: 427
 
Last 3 Topics:
Tabmenu Test
[Snippet] Avatar Ev...
[DEV] Zero and X-P...
 
Joined:
Sun 13. Jan 2008, 23:44
 
Letzter Login:
Mon 1. Aug 2022, 16:40
 
Posted:
Mon 8. Mar 2010, 02:41 +1.00
Userzeit: Mo 8. Mär 2010, 02:41

Re: [DEV] Auto Video Embed v.0.0.1 (en)

Postby 4seven » Sat 13. Mar 2010, 03:54 | Userzeit: +1.00 / Mo 8. Mär 2010, 02:41

Install Instruction Auto Video Embed v.0.0.2

1 Download Package

2 Copy

root/mediaplayer/*.* > mediaplayer/*.*
root/includes/auto_video_embed_post.php > includes/auto_video_embed_post.php
root/includes/auto_video_embed_view.php > includes/auto_video_embed_view.php

3 Open

posting.php

Find

Code: Select all
    if (!sizeof($error))
    {  


After Add

Code: Select all
// Auto Video Embed / 4seven / 2010    
 include($phpbb_root_path . 'includes/auto_video_embed_post.' . $phpEx);
// Auto Video Embed / 4seven / 2010          


4 Open

viewtopic.php

Find

Code: Select all
    // Parse the message and subject
    $message = censor_text($row['post_text']);  


After Add

Code: Select all
// Auto Video Embed / 4seven / 2010    
 include($phpbb_root_path . 'includes/auto_video_embed_view.' . $phpEx);
// Auto Video Embed / 4seven / 2010                   


5 Edit in

auto_video_embed_post.php
auto_video_embed_view.php

the Config Area, so u only have the desired Video-Portals

Code: Select all
// ---------------- CONFIG ---------------
// change true to false to switch off
$clipfish     false;
$dailymotion  false;
$flv          false;
$gametrailers false;
$googlevideo  false;
$megavideo    false;
$metacafe     false;
$mp3          false;
$myspace      false;
$myvideo      false;
$veoh         false;
$vimeo        false;
$yahoo        false;
$youtube      true;
// ---------------- CONFIG ---------------          


6 Clear all Board- and Browser-Caches
User avatar
4seven
Administrator
 
Posts: 427
 
Last 3 Topics:
Tabmenu Test
[Snippet] Avatar Ev...
[DEV] Zero and X-P...
 
Joined:
Sun 13. Jan 2008, 23:44
 
Letzter Login:
Mon 1. Aug 2022, 16:40
 
Posted:
Sat 13. Mar 2010, 03:54 +1.00
Userzeit: Mo 8. Mär 2010, 02:41

Re: [DEV] Auto Video Embed v.0.0.2 (en) (update)

Postby 4seven » Wed 17. Mar 2010, 22:55 | Userzeit: +1.00 / Mo 8. Mär 2010, 02:41

Example to modify and transform a existing BBCode to Auto Video Embed



Instruction - collecting informations

The very important thing is to find the unique usable syntax of this bbcode

bbcode
Code: Select all
[TUTV]{TEXT}[/TUTV]  


replacement
Code: Select all
<object width="425" height="350"><param name="movie" value="http://tu.tv/tutvweb.swf?kpt={TEXT}"></param><param name="wmode" value="transparent"></param><embed src="http://tu.tv/tutvweb.swf?kpt={TEXT}" type="application/x-shockwave-flash" wmode="transparent" width="425" height="350"></embed></object>  


aha, here it is: {TEXT}

which also shows us the important part in html-replacement http://tu.tv/tutvweb.swf?kpt={TEXT}

nothing else matters at this time.

now we have to find out the important embed part.

there he is: http://tu.tv/tutvweb.swf?kpt=aHR0cDovL3d3dy50dS50di92aWRlb3Njb2RpL3QvZS90ZWxldHViYmllcy1wdXRvLmZsdg==&xtp=1025292

in this example the "real" browser-link is not usable (like in youtube), bcs. it contains nothing we can use to embed
Code: Select all
http://tu.tv/videos/teletubbies-puto


now we have all information we need ;-)



Instruction - name the portal-variable

first find in both files:
auto_video_embed_post.php
auto_video_embed_view.php

Code: Select all
$myvideo      = false;  


after add (bcs. of alphabetical-order)

Code: Select all
$tutv         = false;  




Instruction - the main code-transform

1. enter the given portal-variable ($tutv)
2. find a distinctive link part (except http://) which stands alone and have no interruption between (here we take tu.tv/tutvweb.swf?kpt=)
3. mask all /, & and ? with \ in '#search_part#' of preg_replace and transform {TEXT} with (.*?)
4. take the html-replacement to the , 'replace_part' in preg_replace and notice like (.*?) interact with its dual $1 ($2 if it interact with a second (.*?) etc.)

auto_video_embed_post.php
if (($tutv) && (strpos($preview_message, 'tu.tv/tutvweb.swf?kpt=') !== false)){
$preview_message = preg_replace('#<a class="postlink" href="http:\/\/tu.tv\/tutvweb.swf\?kpt=(.*?)">(.*?)<\/a>#U', '<object width="425" height="350"><param name="movie" value="http://tu.tv/tutvweb.swf?kpt=$1"></param><param name="wmode" value="transparent"></param><embed src="http://tu.tv/tutvweb.swf?kpt=$1" type="application/x-shockwave-flash" wmode="transparent" width="425" height="350"></embed></object>', $preview_message);}


auto_video_embed_view.php
if (($tutv) && (strpos($message, 'tu.tv/tutvweb.swf?kpt=') !== false)){
$message = preg_replace('#<a class="postlink" href="http:\/\/tu.tv\/tutvweb.swf\?kpt=(.*?)">(.*?)<\/a>#U', '<object width="425" height="350"><param name="movie" value="http://tu.tv/tutvweb.swf?kpt=$1"></param><param name="wmode" value="transparent"></param><embed src="http://tu.tv/tutvweb.swf?kpt=$1" type="application/x-shockwave-flash" wmode="transparent" width="425" height="350"></embed></object>', $message);}


the framework is (in brief exceptions) still the same

- follow the syntax in this example
- the '#search_part#' is still the same, except other link or embed-part.
- the part , 'replace_part' is the normal html-replacement (the difference is the transform from {TEXT} to $1 (if a (.*?) have the first position in '#search_part#')).
- take a look at the other codes in original-files (may youtube) where the url-link is directly usable to transform and learn a bit from those integrated "examples".
User avatar
4seven
Administrator
 
Posts: 427
 
Last 3 Topics:
Tabmenu Test
[Snippet] Avatar Ev...
[DEV] Zero and X-P...
 
Joined:
Sun 13. Jan 2008, 23:44
 
Letzter Login:
Mon 1. Aug 2022, 16:40
 
Posted:
Wed 17. Mar 2010, 22:55 +1.00
Userzeit: Mo 8. Mär 2010, 02:41


Return to [DEV] Mods for 3.0.x



Who is online

Users browsing this forum: No registered users and 13 guests

cron