Skip to content

Commit

Permalink
Added GameTrailers
Browse files Browse the repository at this point in the history
  • Loading branch information
JoshyPHP committed Dec 8, 2013
1 parent 477d2ad commit f8e1b35
Show file tree
Hide file tree
Showing 6 changed files with 46 additions and 3 deletions.
5 changes: 5 additions & 0 deletions README.md
Expand Up @@ -81,6 +81,11 @@ Media BB Codes for XenForo, imported from [s9e\TextFormatter](https://github.com
<td>Gamespot</td>
<td>http://www.gamespot.com/destiny/videos/destiny-the-moon-trailer-6415176/<br/>http://www.gamespot.com/events/game-crib-tsm-snapdragon/gamecrib-extras-cooking-with-dan-dinh-6412922/<br/>http://www.gamespot.com/videos/beat-the-pros-pax-prime-2013/2300-6414307/</td>
</tr>
<tr>
<td><code>gametrailers</code></td>
<td>GameTrailers</td>
<td>http://www.gametrailers.com/videos/jz8rt1/tom-clancy-s-the-division-vgx-2013--world-premiere-featurette-<br/>http://www.gametrailers.com/reviews/zalxz0/crimson-dragon-review<br/>http://www.gametrailers.com/full-episodes/zdzfok/pop-fiction-episode-40--jak-ii--sandover-village</td>
</tr>
<tr>
<td><code>gist</code></td>
<td>GitHub Gist</td>
Expand Down
6 changes: 5 additions & 1 deletion build/addon.xml
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<addon addon_id="s9e" title="s9e Media Pack" url="https://github.com/s9e/XenForoMediaBBCodes" version_id="20131204" version_string="201312040" install_callback_class="s9e_MediaBBCodes" install_callback_method="install">
<addon addon_id="s9e" title="s9e Media Pack" url="https://github.com/s9e/XenForoMediaBBCodes" version_id="20131208" version_string="201312080" install_callback_class="s9e_MediaBBCodes" install_callback_method="install">
<bb_code_media_sites>
<site media_site_id="bandcamp" site_title="Bandcamp" site_url="http://bandcamp.com/" match_is_regex="1" supported="1" embed_html_callback_class="s9e_MediaBBCodes" embed_html_callback_method="embed" match_callback_class="s9e_MediaBBCodes" match_callback_method="matchBandcamp">
<match_urls>!(?'id')bandcamp\.com/album/.!
Expand Down Expand Up @@ -59,6 +59,10 @@
<match_urls>!gamespot\.com.*?/(?:events|videos)/.*?-(?'id'\d+)/(?:[#?].*)?$!</match_urls>
<embed_html><![CDATA[<iframe width="640" height="400" src="http://www.gamespot.com/videos/embed/{$id}/" allowfullscreen="" frameborder="0" scrolling="no"></iframe>]]></embed_html>
</site>
<site media_site_id="gametrailers" site_title="GameTrailers" site_url="http://www.gametrailers.com/" match_is_regex="1" supported="1" embed_html_callback_class="s9e_MediaBBCodes" embed_html_callback_method="embed" match_callback_class="s9e_MediaBBCodes" match_callback_method="matchGametrailers">
<match_urls>!(?'id')gametrailers\.com/(?:full-episode|review|video)s/!</match_urls>
<embed_html><![CDATA[<iframe width="512" height="288" src="http://media.mtvnservices.com/embed/{$id}" allowfullscreen="" frameborder="0" scrolling="no"></iframe>]]></embed_html>
</site>
<site media_site_id="gist" site_title="GitHub Gist" site_url="https://gist.github.com/" match_is_regex="1" supported="1" embed_html_callback_class="s9e_MediaBBCodes" embed_html_callback_method="embed">
<match_urls>!gist\.github\.com/(?'id'(?:\w+/)?[0-9]+(?:/[0-9a-f]+)?)!</match_urls>
<embed_html><![CDATA[<script src="https://gist.github.com/{$id}.js"></script>]]></embed_html>
Expand Down
13 changes: 13 additions & 0 deletions build/upload/library/s9e/MediaBBCodes.php
Expand Up @@ -293,6 +293,19 @@ public static function matchDailyshow($url)
return self::match($url, $regexps, $scrapes);
}

public static function matchGametrailers($url)
{
$regexps = array();
$scrapes = array(
array(
'match' => array('!gametrailers\\.com/(?:full-episode|review|video)s/!'),
'extract' => array('!(?\'id\'mgid:arc:(?:episode|video):gametrailers\\.com:[-\\w]+)!')
)
);

return self::match($url, $regexps, $scrapes);
}

public static function renderGrooveshark($vars)
{
$vars += array('playlistid' => null, 'songid' => null);
Expand Down
15 changes: 15 additions & 0 deletions tests/Test.php
Expand Up @@ -90,6 +90,21 @@ public function getMatchCallbackTests()
'http://www.thedailyshow.com/watch/mon-july-16-2012/louis-c-k-',
'mgid:cms:video:thedailyshow.com:416478'
),
array(
'gametrailers',
'http://www.gametrailers.com/videos/jz8rt1/tom-clancy-s-the-division-vgx-2013--world-premiere-featurette',
'mgid:arc:video:gametrailers.com:85dee3c3-60f6-4b80-8124-cf3ebd9d2a6c'
),
array(
'gametrailers',
'http://www.gametrailers.com/reviews/zalxz0/crimson-dragon-review',
'mgid:arc:video:gametrailers.com:31c93ab8-fe77-4db2-bfee-ff37837e6704'
),
array(
'gametrailers',
'http://www.gametrailers.com/full-episodes/zdzfok/pop-fiction-episode-40--jak-ii--sandover-village',
'mgid:arc:episode:gametrailers.com:1e287a4e-b795-4c7f-9d48-1926eafb5740'
),
array(
'grooveshark',
'http://grooveshark.com/playlist/Purity+Ring+Shrines/74854761',
Expand Down
8 changes: 7 additions & 1 deletion www/configure.html

Large diffs are not rendered by default.

0 comments on commit f8e1b35

Please sign in to comment.