• This forum has been archived. New threads and replies may not be made. All add-ons/resources that are active should be migrated to the Resource Manager. See this thread for more information.

[Add More Video Sites] BB Code Media

Is it possible to use PCRE to create a match url for this? http://diversifiedsound.podomatic.com/entry/2011-12-01T16_15_09-08_00.
sdfsddfgb.webp

Desperately seeking an option for this too as I have a DJ site that uses Pod-O-Matic heavily. What is the actual source file the parses the {$id} ? Maybe I can hack to accept {$idx} ?? Should we request this as a feature or has it already been requested?

Hacking away wont be needed :)
___________________________
This media site will be added to THIS addon upon the next update.


Download and extract the attached zip and upload the library folder to your forum root.


Add a new media site


Media Site ID: podomatic
________________________________________
Site Title: Podomatic
________________________________________
Site URL: http://www.podomatic.com/
________________________________________
Match URLs: #(?P<id>[a-z0-9-_.]+podomatic\.com/entry/[0-9-_]+T[0-9-_]+)#si
________________________________________
Embed HTML: <See HTML Callback>
________________________________________
Regular Expression Matching: Use 'Match URLs' as PCRE regular expressions [ Checked ]
________________________________________
Embed HTML Callback: MediaSites_Podomatic::buildEmbed


For reference this is the embed callback:
PHP:
<?php
//Template courtesy of Jake Bunce
class MediaSites_Podomatic
{
    public static function buildEmbed($mediaKey, array $site)
    {
        // CAPTURE WEB PAGE
        $pageHtml = file_get_contents( 'http://' . $mediaKey );

        // ISOLATE THE PARAMS THAT ARE NEEDED FROM THE PAGE
        if(preg_match('#<meta\scontent=\'http\://(?P<subd>[a-z0-9-_.]+)\.podomatic\.com/entry/(?P<pentry>[a-z0-9-_]+)\'\sproperty=\'og:url\'#si', $pageHtml, $match))
        
        {
            // DEFINE GENERIC EMBED HTML WITH REPLACEMENT VARIABLES __MEDIAKEY1__ and __MEDIAKEY2__
            $embedHtml = '<iframe height="85px" width="440px" frameborder="0" marginheight="0" marginwidth="0" scrolling="no" src="http://__MEDIAKEY1__.podomatic.com/embed/frame/posting/__MEDIAKEY2__?json_url=http%3A%2F%2F__MEDIAKEY1__.podomatic.com%2Fentry%2Fembed_params%2F__MEDIAKEY2__%3Fcolor%3D43bee7%26autoPlay%3Dfalse%26width%3D440%26height%3D85"></iframe>';
    
            $finalHtml = str_replace(array('__MEDIAKEY1__', '__MEDIAKEY2__'), array($match['subd'], $match['pentry']), $embedHtml);
            return $finalHtml;
        }

        // RETURN NOTHING IF NO MATCH
        else return '';
    }
}
 

Attachments

This media site will be added to THIS addon upon the next update.

Yuppers along with about 5 more that I just finished...however, I am going to try to get at least 10 in before pushing an update.
 
Can you try to add playlist.com?
PM me one of your playlist's full embed code with the following options set on that popup window
...

Player Configuration

How do you want your playlist to look and feel?

Autostart? NO ← this will make your playlist play automatically when people go to your page
Random/Shuffle NO ← makes your playlist play randomly instead of in order (shuffle)
Custom Skin? NO ← lets you put your own custom image in your playlist! (what's this?)
 
Many thanks EQnoble! Trying it out right now!!! (y)

View attachment 22644



Hacking away wont be needed :)
___________________________
This media site will be added to THIS addon upon the next update.


Download and extract the attached zip and upload the library folder to your forum root.


Add a new media site


Media Site ID: podomatic
________________________________________
Site Title: Podomatic
________________________________________
Site URL: http://www.podomatic.com/
________________________________________
Match URLs: #(?P<id>http://[a-z0-9-_.]+\.podomatic\.com/entry/[0-9-_]+T[0-9-_]+)#si
________________________________________
Embed HTML: <See HTML Callback>
________________________________________
Regular Expression Matching: Use 'Match URLs' as PCRE regular expressions [ Checked ]
________________________________________
Embed HTML Callback: MediaSites_Podomatic::buildEmbed


For reference this is the embed callback:
PHP:
<?php
//Template courtesy of Jake Bunce
class MediaSites_Podomatic
{
    public static function buildEmbed($mediaKey, array $site)
    {
        // CAPTURE WEB PAGE
        $pageHtml = file_get_contents( $mediaKey );
 
            // ISOLATE THE PARAMS THAT ARE NEEDED FROM THE PAGE
        if(preg_match('#<param name=\'movie\' value=\'http://(?P<bbmovie>[a-z0-9-_.]+\.com/swf/joeplayer_v18c\.swf)\'></param>\s<param\sname=\'flashvars\'\svalue=\'(?P<bbflashvars>[a-z0-9-=&%._]+)%3Fauto#si', $pageHtml, $match))
 
        {
            // DEFINE GENERIC EMBED HTML WITH REPLACEMENT VARIABLES __MEDIAKEY1__  and __MEDIAKEY2__
            $embedHtml = '<object width="40" height="85">
            <param name="movie" value="http://__MEDIAKEY1__"></param>
            <param name="flashvars" value="__MEDIAKEY2__%3Fcolor%3D43bee7%26autoPlay%3Dfalse%26width%3D440%26height%3D85"></param>
            <param name="flashvars" value="__MEDIAKEY2__%3Fcolor%3D43bee7%26autoPlay%3Dfalse%26width%3D440%26height%3D85"></param>
            <param name="allowFullScreen" value="true"></param>
            <param name="allowscriptaccess" value="always"></param>
            <embed src="http://__MEDIAKEY1__" flashvars="__MEDIAKEY2__%3Fcolor%3D43bee7%26autoPlay%3Dfalse%26width%3D440%26height%3D85" type="application/x-shockwave-flash" allowscriptaccess="always" allowfullscreen="true" width="440" height="85">
            </embed>
            </object>';
 
            // MAKE THE REPLACEMENTS
            $finalHtml = str_replace(array('__MEDIAKEY1__', '__MEDIAKEY2__'), array($match['bbmovie'], $match['bbflashvars']), $embedHtml);
     
            // RETURN THE FINISHED HTML
            return $finalHtml;
        }
 
        // RETURN NOTHING IF NO MATCH
        return '';
    }
}
 
Excuse, did not restrain. But what for to use ' str_replace ' there where it was possible to collect initially simply a line without necessity of changeover?
The tendency anywhere and everywhere to use strstr and analogs in what good does not result. And then start to be surprised, why the forum slowly works.
Here an example of profiling of open a thread with one post. Pay attention to a red square in the bottom of a picture.
 
For videos on NBC.com:

Media Site ID: nbc
________________________________________
Site Title: NBC
________________________________________
Site URL: http://www.nbc.com
________________________________________
Match URLs: #nbc\.com/[a-z-0-9-]+/video/[a-z-0-9-]+/(?P<id>[0-9]+)$#siU
________________________________________
Embed HTML:
Code:
<iframe id="NBC Video Widget" width="512" height="347" src="http://www.nbc.com/assets/video/widget/widget.html?vid={$id}" frameborder="0"></iframe>
________________________________________
Regular Expression Matching: Use 'Match URLs' as PCRE regular expressions [ Checked ]
________________________________________
 
as requested
Soundcloud <HTML5>

1. Download and extract the soundcloud.zip file then upload the library folder to your forum root

2. Create new media site with the following information.



Media Site ID: soundcloud
________________________________________
Site Title: SoundCloud
________________________________________
Site URL: http://soundcloud.com/
________________________________________
Match URLs: #soundcloud\.com/(?P<id>([a-z0-9-_]+/[a-z0-9-_]+/[a-z0-9-_]+)|[a-z0-9-_]+/[a-z0-9-_]+)#si
________________________________________
Embed HTML: <See HTML Callback>
________________________________________
Regular Expression Matching: Use 'Match URLs' as PCRE regular expressions [ Checked ]
________________________________________
Embed HTML Callback: MediaSites_Soundcloud::buildEmbed


For reference this is the embed callback:
PHP:
<?php
class MediaSites_Soundcloud
{
    public static function buildEmbed($mediaKey, array $site)
    {
        $pageHtml = file_get_contents('http://soundcloud.com/' . $mediaKey );
 
        if(preg_match('#<meta.+player.swf\?url=.+tracks%2F(?P<scid>[0-9]+)#si', $pageHtml, $match))
        {
        $embedHtml = '<iframe width="100%" height="166" class="html5player" scrolling="no" frameborder="no" src="http://w.soundcloud.com/player/?url=http%3A%2F%2Fapi.soundcloud.com%2Ftracks%2F__MEDIAKEY__&show_artwork=true"></iframe>';
            $finalHtml = str_replace('__MEDIAKEY__', $match['scid'], $embedHtml);
            return $finalHtml;
        }
        elseif(preg_match('#<meta.+player.swf\?url=.+playlists%2F(?P<scid>[0-9]+)#si', $pageHtml, $match))
        {
            $embedHtml = '<iframe width="100%" height="450" class="html5player" scrolling="no" frameborder="no" src="http://w.soundcloud.com/player/?url=http%3A%2F%2Fapi.soundcloud.com%2Fplaylists%2F__MEDIAKEY__&show_artwork=true"></iframe>';
            $finalHtml = str_replace('__MEDIAKEY__', $match['scid'], $embedHtml);
            return $finalHtml;
        }
        elseif(preg_match('#<meta.+player.swf\?url=.+users%2F(?P<scid>[0-9]+)#si', $pageHtml, $match))
        {
            $embedHtml = '<iframe width="100%" height="450" class="html5player" scrolling="no" frameborder="no" src="http://w.soundcloud.com/player/?url=http%3A%2F%2Fapi.soundcloud.com%2Fusers%2F__MEDIAKEY__&show_artwork=true"></iframe>';
            $finalHtml = str_replace('__MEDIAKEY__', $match['scid'], $embedHtml);
            return $finalHtml;
        }
        else return '<a href="http://soundcloud.com/' . $mediaKey . '">http://soundcloud.com/' . $mediaKey . '</a>';
    }
}

(this should catch all pages with a share button otherwise it should just post the link...if you find any errors please msg me.)

Edit: Fix applied re-download zip
 

Attachments

Okay! Not working for the following URL I guess since it contains numbers in the first ID?

http://bgchck1960.podomatic.com/entry/2011-12-16T16_59_50-08_00

Please advise!

Media Site ID: podomatic
________________________________________
Site Title: Podomatic
________________________________________
Site URL: http://www.podomatic.com/
________________________________________
Match URLs: #(?P<id>http://[a-z0-9-_.]+\.podomatic\.com/entry/[0-9-_]+T[0-9-_]+)#si
________________________________________
Embed HTML: <See HTML Callback>
________________________________________
Regular Expression Matching: Use 'Match URLs' as PCRE regular expressions [ Checked ]
________________________________________
Embed HTML Callback: MediaSites_Podomatic::buildEmbed


For reference this is the embed callback:
PHP:
<?php
//Template courtesy of Jake Bunce
class MediaSites_Podomatic
{
    public static function buildEmbed($mediaKey, array $site)
    {
        // CAPTURE WEB PAGE
        $pageHtml = file_get_contents( $mediaKey );
 
            // ISOLATE THE PARAMS THAT ARE NEEDED FROM THE PAGE
        if(preg_match('#<param name=\'movie\' value=\'http://(?P<bbmovie>[a-z0-9-_.]+\.com/swf/joeplayer_v18c\.swf)\'></param>\s<param\sname=\'flashvars\'\svalue=\'(?P<bbflashvars>[a-z0-9-=&%._]+)%3Fauto#si', $pageHtml, $match))
 
        {
            // DEFINE GENERIC EMBED HTML WITH REPLACEMENT VARIABLES __MEDIAKEY1__  and __MEDIAKEY2__
            $embedHtml = '<object width="40" height="85">
            <param name="movie" value="http://__MEDIAKEY1__"></param>
            <param name="flashvars" value="__MEDIAKEY2__%3Fcolor%3D43bee7%26autoPlay%3Dfalse%26width%3D440%26height%3D85"></param>
            <param name="flashvars" value="__MEDIAKEY2__%3Fcolor%3D43bee7%26autoPlay%3Dfalse%26width%3D440%26height%3D85"></param>
            <param name="allowFullScreen" value="true"></param>
            <param name="allowscriptaccess" value="always"></param>
            <embed src="http://__MEDIAKEY1__" flashvars="__MEDIAKEY2__%3Fcolor%3D43bee7%26autoPlay%3Dfalse%26width%3D440%26height%3D85" type="application/x-shockwave-flash" allowscriptaccess="always" allowfullscreen="true" width="440" height="85">
            </embed>
            </object>';
 
            // MAKE THE REPLACEMENTS
            $finalHtml = str_replace(array('__MEDIAKEY1__', '__MEDIAKEY2__'), array($match['bbmovie'], $match['bbflashvars']), $embedHtml);
   
            // RETURN THE FINISHED HTML
            return $finalHtml;
        }
 
        // RETURN NOTHING IF NO MATCH
        return '';
    }
}
 
I think the problem is here:

Code:
if(preg_match('#<param name=\'movie\' value=\'http://(?P<bbmovie>[a-z0-9-_.]+\.com/swf/joeplayer_v18c\.swf)\'></param>\s<param\sname=\'flashvars\'\svalue=\'(?P<bbflashvars>[a-z0-9-=&%._]+)%3Fauto#si', $pageHtml, $match))

I made it return the $mediakey and the script outputs it correctly but the 'preg_match' seems to be failing on user ID's that are 10 characters. I have one that has 9 characters and it works fine.
 
Okay! I figured it out. It seems some pages on PodOmatic render the <iframe> object and others the embeded <object> that the 'preg_match' is looking for. Here's a REAL hacky solution and I'm sure you guys can clean it up. I made it look for the actual <iframe> source and that has all the values needed but I think that's not even needed since all that is really needed is the username and the file ID. I was able to take apart the $mediaKey to provide this since the values are there.

But one question, when the media is quoted how does one prevent the [media] bb tags from getting added to the quote?

Code:
<?php
//Template courtesy of Jake Bunce
class MediaSites_Podomatic
{
    public static function buildEmbed($mediaKey, array $site)
    {
        // CAPTURE WEB PAGE
        $id2 = substr($mediaKey, -25);
        $replaceValues = array("http://" , ".podomatic.com/entry/" . $id2);
        $id1 = str_replace($replaceValues, "", $mediaKey);
        //$pageHtml = file_get_contents( $mediaKey );
        $pageURL = 'http://'.$id1.'.podomatic.com/embed/frame/posting/'.$id2.'?json_url=http%3A%2F%2F'.$id1.'.podomatic.com%2Fentry%2Fembed_params%2F'.$id2.'%3FautoPlay%3Dtrue%26facebook%3Dfalse%26height%3D85%26minicast%3Dfalse%26permalink%3Dtrue%26rtmp%3D1%26width%3D580';
        $pageHtml = file_get_contents($pageURL);
 
            // ISOLATE THE PARAMS THAT ARE NEEDED FROM THE PAGE
        //if(preg_match('#<param name=\'movie\' value=\'http://(?P<bbmovie>[a-z0-9-_.]+\.com/swf/joeplayer_v18c\.swf)\'></param>\s<param\sname=\'flashvars\'\svalue=\'(?P<bbflashvars>[a-z0-9-=&%._]+)%3Fauto#si', $pageHtml, $match))
          if(preg_match('#<param name=\'flashvars\' value=\'(?P<bbflashvars>[a-z0-9-=&%._]+)#si', $pageHtml, $match))
        {
            // DEFINE GENERIC EMBED HTML WITH REPLACEMENT VARIABLES __MEDIAKEY1__  and __MEDIAKEY2__
            $embedHtml = '<object width="580" height="85">
            <param name="wmode" value="transparent" />
            <param name="movie" value="http://'.$id1.'.podomatic.com/swf/joeplayer_v18c.swf"></param>
            <param name="flashvars" value="minicast=false&amp;jsonLocation=http%3A%2F%2F'.$id1.'.podomatic.com%2Fentry%2Fembed_params%2F'.$id2.'%3FautoPlay%3Dfalse%26facebook%3Dfalse%26height%3D85%26minicast%3Dfalse%26permalink%3Dtrue%26rtmp%3D1%26width%3D580"></param>
            <param name="allowFullScreen" value="true"></param>
            <param name="allowscriptaccess" value="always"></param>
            <embed src="http://'.$id1.'.podomatic.com/swf/joeplayer_v18c.swf" flashvars="minicast=false&amp;jsonLocation=http%3A%2F%2F'.$id1.'.podomatic.com%2Fentry%2Fembed_params%2F'.$id2.'%3FautoPlay%3Dfalse%26facebook%3Dfalse%26height%3D85%26minicast%3Dfalse%26permalink%3Dtrue%26rtmp%3D1%26width%3D580" type="application/x-shockwave-flash" allowscriptaccess="always" allowfullscreen="true" width="580" height="85">
            </embed>
            </object>';
 
            // MAKE THE REPLACEMENTS
            $finalHtml = str_replace(array('__MEDIAKEY1__', '__MEDIAKEY2__'), array($match['bbmovie'], $match['bbflashvars']), $embedHtml);
 
            // RETURN THE FINISHED HTML
            return $finalHtml;
        }
 
        // RETURN NOTHING IF NO MATCH
        return '';
    }
}
 
Just wait a lil bit, I will have it fixed (at some point today), I believe it is because of changes they are making to the site, nevertheless like I said I am working on it right now. (actually I am lying right there...I am drinking coffee & thinking of what I should be doing first.)

See the issue is this...it looks like at one point every page used to be shared with object embed and now they are adding the iframe player which is great and all...but I had caught while checking this same thing yesterday, about 15-20 urls whos embed code was different and actually the html we are scraping with this media site is a bit different so it wont return anything on some because it actually isn't going to match anything on some pages.
_____

More than likely I am going to have to remake it more like the soundcloud definition with more processing in the php as well as something else I have been thinking about....just so you know though...the regex catches that url that you posted quite fine...
PHP:
preg_match_all #(?P<id>http://[a-z0-9-_.]+\.podomatic\.com/entry/[0-9-_]+T[0-9-_]+)#si
 
    [0]=> array
        [0]=>http://bgchck1960.podomatic.com/entry/2011-12-16T16_59_50-08_00
    [id]=> array
        [0]=>http://bgchck1960.podomatic.com/entry/2011-12-16T16_59_50-08_00
    [1]=> array
        [0]=>http://bgchck1960.podomatic.com/entry/2011-12-16T16_59_50-08_00
The reason it was returning an empty post was because of the html that had the actual info you needed for the embed, was coded differently than other pages, this making the preg_match that is used in processing the html for the embed info ...well... not match anything:)

I have tested a few things out as well and think I have the solution to this....
 
Ok! Thanks much for your help EQ!!! And yeah, all your code was working as intended. But PodOmatic was returning varying results as we have determined.
 
I think I got it....
Updated: THIS POST

Make sure to change the match urls field to what the new one is (small change) and to download and use the new file in the attachment of that post.

I think they all work, I haven't stumped it yet.
 
Top Bottom