[media] BBCode tag

New users start here!
Introductions, forum information, rules and guidelines.
Post Reply
User avatar
cools
Armed Police Buttrider
Posts: 12634
Joined: August 17th, 2008, 4:49 pm
Location: Wales, United Kingdom
eBay: hordarian
Initials: CLS

[media] BBCode tag

Post by cools » August 20th, 2018, 12:00 pm

I've installed and enabled the MediaEmbed plugin: https://www.phpbb.com/customise/db/exte ... ediaembed/

This allows automatic conversion of many URLs into an embedded link - supported sites here: https://s9etextformatter.readthedocs.io ... bed/Sites/

So you can now embed stuff just by pasting the link into your post, like SoundCloud:


Twitch:


Twitter:


And of course Youtube:



The existing Youtube bbcode has been disabled to allow this to work and this has broken those existing embeds. I don't see a way of safely converting the old to the new in one hit (there probably is, I just don't see it - the problem I see is with multiple embeds in the same post). There are 5299 embedded Youtube videos in the forum and I don't fancy doing them all individually!
Image

User avatar
yosai
280bpm's too slow
Posts: 3687
Joined: August 17th, 2008, 5:00 pm
Location: London
eBay: yosai

Re: [media] BBCode tag

Post by yosai » August 20th, 2018, 12:16 pm

Nice one. Fullscreen Youtube finally works too! :thumbup:

User avatar
cools
Armed Police Buttrider
Posts: 12634
Joined: August 17th, 2008, 4:49 pm
Location: Wales, United Kingdom
eBay: hordarian
Initials: CLS

Re: [media] BBCode tag

Post by cools » August 20th, 2018, 2:38 pm

I've figured out how to convert the old posts where just one video is embedded.

Code: Select all

update phpbb_posts
set post_text = regexp_replace(post_text,'<YOUTUBE\\b[^>]*>(.*?)<\\/YOUTUBE>',
concat('<YOUTUBE id="'
,substring_index(substring_index(post_text,'<YOUTUBE content="',-1),'"',1)
,'" url="https://www.hasntfiguredouthowtoembedyoutubeproperly.com/watch?v='
,substring_index(substring_index(post_text,'<YOUTUBE content="',-1),'"',1)
,'"><s>[media]</s><URL url="https://www.hasntfiguredouthowtoembedyoutubeproperly.com/watch?v='
,substring_index(substring_index(post_text,'<YOUTUBE content="',-1),'"',1)
,'">https://www.hasntfiguredouthowtoembedyoutubeproperly.com/watch?v='
,substring_index(substring_index(post_text,'<YOUTUBE content="',-1),'"',1)
,'</URL><e>[/media]</e></YOUTUBE>'))
where post_text like '%[youtube]%' and post_text not like '%[youtube]%[youtube]%';
Stumped as to how to do the double/triple/more embed ones though.
Image

User avatar
emphatic
Breastfeeds when required
Posts: 6316
Joined: April 7th, 2009, 4:14 pm
Location: Alingsås, Sweden
eBay: jorgen_sjolander
Initials: JOR

Re: [media] BBCode tag

Post by emphatic » August 20th, 2018, 7:57 pm

This really is something! :awe:

User avatar
nem
Posts: 1488
Joined: August 17th, 2008, 6:59 pm
Location: Finland

Re: [media] BBCode tag

Post by nem » August 21st, 2018, 9:12 am

Awesome. Just tried it out. Great work, cools!

User avatar
FcoBenitez
Posts: 356
Joined: August 18th, 2008, 3:31 am
Location: Chile
eBay: virtuacl
Initials: KBL

Re: [media] BBCode tag

Post by FcoBenitez » August 24th, 2018, 3:00 am

Arcade GIFVs incoming! Great update
2X Sega Aero City

Post Reply