Skip to content

Commit

Permalink
Merge pull request #100 from iMattPro/updates
Browse files Browse the repository at this point in the history
Add and update media sites in our collection
  • Loading branch information
iMattPro committed Aug 26, 2023
2 parents 60d33d4 + 4845b57 commit 2e46ca8
Show file tree
Hide file tree
Showing 9 changed files with 47 additions and 43 deletions.
2 changes: 1 addition & 1 deletion acp/main_module.php
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ public function main($id, $mode)
$this->tpl_name = 'acp_phpbb_mediaembed_' . $mode;

// Set the page title for our ACP page
$this->page_title = $acp_controller->get_page_title($mode);
$this->page_title = 'ACP_MEDIA_' . strtoupper($mode);

$form_key = 'phpbb/mediaembed';
add_form_key($form_key);
Expand Down
2 changes: 1 addition & 1 deletion adm/style/acp_phpbb_mediaembed_settings.html
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ <h1>{{ lang('ACP_MEDIA_SETTINGS') }}</h1>
</dl>
<dl>
<dt><label for="media_embed_max_width">{{ lang('ACP_MEDIA_MAX_WIDTH') ~ lang('COLON') }}</label><br /><span>{{ lang('ACP_MEDIA_MAX_WIDTH_EXPLAIN') }}</span></dt>
<dd><textarea id="media_embed_max_width" name="media_embed_max_width" rows="8" cols="40" style="width: 50%;">{{ S_MEDIA_EMBED_MAX_WIDTHS }}</textarea></dd>
<dd><textarea id="media_embed_max_width" name="media_embed_max_width" rows="8" cols="40" style="width: 50%;" placeholder="twitter:100%&#10;youtube:80%&#10;funnyordie:480px">{{ S_MEDIA_EMBED_MAX_WIDTHS }}</textarea></dd>
</dl>
</fieldset>
<fieldset class="submit-buttons">
Expand Down
28 changes: 28 additions & 0 deletions collection/sites/applemusic.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
name: "Apple Music"
host: music.apple.com
example: https://music.apple.com/us/album/taking-flight/1681148980?i=1681148982
extract:
- "!//music.apple.com/(?'country'[a-z]{2})/playlist/(?'plname'[\\w\\d\\-%A-F]+)/(?'plid'pl\\.[\\w\\d-]+)!"
- "!//music.apple.com/(?'country'[a-z]{2})/album/(?'artist'[\\w\\d\\-%A-F]+)/(?'aid'\\d+)!"
- "!//music.apple.com/(?'country'[a-z]{2})/album/(?'artist'[\\w\\d\\-%A-F]+)/(?'aid'\\d+)\\?i\\=(?'tid'\\d+)!"
- "!//geo.music.apple.com/(?'country'[a-z]{2})/album/(?'artist'[\\w\\d\\-%A-F]+)/(?'aid'\\d+)\\?i\\=(?'tid'\\d+)!"
choose:
when:
test: '@plid'
iframe:
width: "100%"
height: "450"
src: //embed.music.apple.com/{@country}/playlist/{@plname}/{@plid}
otherwise:
choose:
when:
test: '@tid'
iframe:
width: "100%"
height: "175"
src: //embed.music.apple.com/{@country}/album/{@artist}/{@aid}?i={@tid}&l={@country}
otherwise:
iframe:
width: "100%"
height: "450"
src: //embed.music.apple.com/{@country}/album/{@artist}/{@aid}
6 changes: 6 additions & 0 deletions collection/sites/kick.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
name: Kick
host: kick.com
example: https://kick.com/xQc
extract: "!//kick.com/(?'id'\\w+)!"
iframe:
src: //player.kick.com/{@id}
11 changes: 11 additions & 0 deletions collection/sites/twitter.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
name: Twitter
host: ["twitter.com","x.com"]
example: ["https://twitter.com/IJasonAlexander/statuses/526635414338023424","https://mobile.twitter.com/DerekTVShow/status/463372588690202624","https://twitter.com/#!/IJasonAlexander/status/526635414338023424"]
extract: "@(?:twitter|x)\\.com/(?:#!/|i/)?\\w+/(?:status(?:es)?|tweet)/(?'id'\\d+)@"
iframe:
data-s9e-livepreview-ignore-attrs: "style"
onload: "let c=new MessageChannel;c.port1.onmessage=e=>this.style.height=e.data+'px';this.contentWindow.postMessage('s9e:init','*',[c.port2])"
width: "550"
height: "273"
allow: "autoplay *"
src: https://s9e.github.io/iframe/2/twitter.min.html#<xsl:value-of select="@id"/><xsl:if test="$MEDIAEMBED_THEME='dark'">#theme=dark</xsl:if>
11 changes: 0 additions & 11 deletions controller/acp_controller.php
Original file line number Diff line number Diff line change
Expand Up @@ -89,17 +89,6 @@ public function set_page_url($u_action)
$this->u_action = $u_action;
}

/**
* Get ACP page title for module
*
* @param string $mode
* @return string Language string for ACP module
*/
public function get_page_title($mode)
{
return $this->language->lang('ACP_MEDIA_' . strtoupper($mode));
}

/**
* Add settings template vars to the form
*/
Expand Down
8 changes: 0 additions & 8 deletions controller/acp_controller_interface.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,14 +22,6 @@ interface acp_controller_interface
*/
public function set_page_url($u_action);

/**
* Get ACP page title for module
*
* @param string $mode
* @return string Language string for ACP module
*/
public function get_page_title($mode);

/**
* Add settings template vars to the form
*/
Expand Down
17 changes: 0 additions & 17 deletions tests/acp/acp_controller_test.php
Original file line number Diff line number Diff line change
Expand Up @@ -119,23 +119,6 @@ public function get_controller()
return $controller;
}

public function get_page_title_data()
{
return [
['settings', 'ACP_MEDIA_SETTINGS'],
['manage', 'ACP_MEDIA_MANAGE'],
];
}

/**
* @dataProvider get_page_title_data
*/
public function test_get_page_title($mode, $expected)
{
$controller = $this->get_controller();
self::assertEquals($controller->get_page_title($mode), $this->language->lang($expected));
}

public function test_display_settings()
{
$this->config_text->expects(self::once())
Expand Down
5 changes: 0 additions & 5 deletions tests/acp/acp_module_test.php
Original file line number Diff line number Diff line change
Expand Up @@ -159,11 +159,6 @@ public function test_main_module($action, $mode, $expected)
->expects(self::once())
->method('set_page_url');

$this->acp_controller
->expects(self::once())
->method('get_page_title')
->with($mode);

$this->acp_controller
->expects(self::$valid_form ? self::once() : self::never())
->method("{$action}_$mode")
Expand Down

0 comments on commit 2e46ca8

Please sign in to comment.