Random play from Comma seperated list

eblues - October 8, 2008 - 22:35
Project:Video Filter
Version:6.x-2.4
Component:Miscellaneous
Category:bug report
Priority:normal
Assigned:Unassigned
Status:closed
Description

Has anyone had success with the random play feature. I seem to only get the first video in the list using the documented format as below:

[video:http://www.youtube.com/watch?v=uN1qUeId1,http://www.youtube.com/watch?v=uN1qUeId2]

#1

elanghout - February 4, 2009 - 14:40

I moved the code below (in video_filter.module):

// Pick random out of multiple sources separated by ','
if (strstr($video['source'], ',')) {
$sources = explode(',', $video['source']);
$random = array_rand($sources, 1);
$video['source'] = $sources[$random];
}

to just below:

function video_filter_process($text, $format = -1) {

if (preg_match_all('/\[video(\:(.+))?( .+)?\]/isU', $text, $matches_code)) {

foreach ($matches_code[0] as $ci => $code) {

$video = array(
'source' => $matches_code[2][$ci],
'width' => variable_get('video_filter_width_'.$format, 400),
'height' => variable_get('video_filter_height_'.$format, 400),
'autoplay' => variable_get('video_filter_autoplay_'.$format, 0),
);

And that works!

#2

blackdog - March 16, 2009 - 10:28
Category:support request» bug report

@elanghout - could you create a proper patch of this please?

#3

blackdog - March 17, 2009 - 21:57
Status:active» fixed

Committed attached patch. Thanks elanghout.

AttachmentSize
318773_video_filter_random.patch 1.36 KB

#4

FirstPersonShow... - March 19, 2009 - 11:52

I've not got shell access to my webhosting provider, so I downloaded the video_filter.module file and deleted the lines mentioned and added the ones you show as well. But I get the error:

Parse error: syntax error, unexpected T_ELSE in modules/video_filter/video_filter.module on line 162

?

cheers,
Kevin

#5

blackdog - March 19, 2009 - 11:59

That's odd. Can you try the -dev version that's listed on the project page?

#6

System Message - April 2, 2009 - 12:00
Status:fixed» closed

Automatically closed -- issue fixed for 2 weeks with no activity.

 
 

Drupal is a registered trademark of Dries Buytaert.