[FacebookBridge] Replace 'novideo' with 'media_type'

This replaces the 'novideo' parameter with 'media_type' in order
to filter for specific content types. Currently supported:

- 'all': Returns all posts (default)
- 'video': Returns only posts including videos
- 'novideo': Returns only posts that don't include videos

References #553
This commit is contained in:
logmanoriginal 2017-07-25 16:04:21 +02:00
parent fa2df09b1b
commit 6e4bc341b7

View file

@ -13,11 +13,16 @@ class FacebookBridge extends BridgeAbstract {
'name' => 'Username',
'required' => true
),
'novideo' => array(
'name' => 'No Videos',
'type' => 'checkbox',
'media_type' => array(
'name' => 'Media type',
'type' => 'list',
'required' => false,
'title' => 'Activate to remove posts including (facebook) videos'
'values' => array(
'All' => 'all',
'Video' => 'video',
'No Video' => 'novideo'
),
'defaultValue' => 'all'
)
));
@ -195,10 +200,17 @@ EOD;
}
foreach($posts as $post){
// (optionally) skip posts that include facebook videos
if($this->getInput('novideo') && !empty($post->find('[aria-label=Video]')))
continue;
// Check media type
switch($this->getInput('media_type')){
case 'all': break;
case 'video':
if(empty($post->find('[aria-label=Video]'))) continue 2;
break;
case 'novideo':
if(!empty($post->find('[aria-label=Video]'))) continue 2;
break;
default: break;
}
$item = array();