Skip to content

Commit

Permalink
Moving more of YouTube into its own plugin
Browse files Browse the repository at this point in the history
  • Loading branch information
ehough committed Oct 1, 2012
1 parent c4a0f30 commit ed65f06
Show file tree
Hide file tree
Showing 44 changed files with 1,786 additions and 681 deletions.
1 change: 1 addition & 0 deletions .gitignore
Expand Up @@ -4,3 +4,4 @@ src/main/assembly/dist
.idea/workspace.xml
vendor
composer.lock
tubepress.php
4 changes: 0 additions & 4 deletions .idea/tubepress.iml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion composer.json 100644 → 100755
Expand Up @@ -23,7 +23,7 @@
"ehough/epilog": "*",
"ehough/fimble": "*",
"ehough/iconic": "*",
"ehough/pulsar": "1.*",
"ehough/pulsar": "*",
"ehough/shortstop": "*",
"ehough/stash": "*",
"ehough/tickertape": "*"
Expand Down
Expand Up @@ -24,17 +24,6 @@
*/
class tubepress_api_const_options_names_GallerySource
{
const YOUTUBE_MOST_DISCUSSED_VALUE = 'most_discussedValue';
const YOUTUBE_MOST_RECENT_VALUE = 'most_recentValue';
const YOUTUBE_MOST_RESPONDED_VALUE = 'most_respondedValue';
const YOUTUBE_FAVORITES_VALUE = 'favoritesValue';
const YOUTUBE_MOST_VIEWED_VALUE = 'most_viewedValue';
const YOUTUBE_PLAYLIST_VALUE = 'playlistValue';
const YOUTUBE_TAG_VALUE = 'tagValue';
const YOUTUBE_TOP_FAVORITES_VALUE = 'youtubeTopFavoritesValue';
const YOUTUBE_TOP_RATED_VALUE = 'top_ratedValue';
const YOUTUBE_USER_VALUE = 'userValue';
const YOUTUBE_FEATURED = 'recently_featured';
const VIMEO_ALBUM_VALUE = 'vimeoAlbumValue';
const VIMEO_APPEARS_IN_VALUE = 'vimeoAppearsInValue';
const VIMEO_CHANNEL_VALUE = 'vimeoChannelValue';
Expand Down
Expand Up @@ -24,17 +24,6 @@
*/
class tubepress_api_const_options_values_GallerySourceValue
{
const YOUTUBE_FAVORITES = 'favorites';
const YOUTUBE_FEATURED = 'recently_featured';
const YOUTUBE_MOST_DISCUSSED = 'most_discussed';
const YOUTUBE_MOST_RECENT = 'most_recent';
const YOUTUBE_MOST_RESPONDED = 'most_responded';
const YOUTUBE_PLAYLIST = 'playlist';
const YOUTUBE_MOST_VIEWED = 'most_viewed';
const YOUTUBE_SEARCH = 'tag';
const YOUTUBE_TOP_FAVORITES = 'youtubeTopFavorites';
const YOUTUBE_TOP_RATED = 'top_rated';
const YOUTUBE_USER = 'user';
const VIMEO_UPLOADEDBY = 'vimeoUploadedBy';
const VIMEO_LIKES = 'vimeoLikes';
const VIMEO_APPEARS_IN = 'vimeoAppearsIn';
Expand Down
Expand Up @@ -47,54 +47,54 @@ protected function buildGalleryUrl($currentPage)

switch ($execContext->get(tubepress_api_const_options_names_Output::GALLERY_SOURCE)) {

case tubepress_api_const_options_values_GallerySourceValue::YOUTUBE_USER:
case tubepress_plugins_youtube_api_const_options_values_GallerySourceValue::YOUTUBE_USER:

$url = 'users/' . $execContext->get(tubepress_api_const_options_names_GallerySource::YOUTUBE_USER_VALUE) . '/uploads';
$url = 'users/' . $execContext->get(tubepress_plugins_youtube_api_const_options_names_GallerySource::YOUTUBE_USER_VALUE) . '/uploads';
break;

case tubepress_api_const_options_values_GallerySourceValue::YOUTUBE_TOP_RATED:
case tubepress_plugins_youtube_api_const_options_values_GallerySourceValue::YOUTUBE_TOP_RATED:

$url = 'standardfeeds/top_rated?time=' . $execContext->get(tubepress_api_const_options_names_GallerySource::YOUTUBE_TOP_RATED_VALUE);
$url = 'standardfeeds/top_rated?time=' . $execContext->get(tubepress_plugins_youtube_api_const_options_names_GallerySource::YOUTUBE_TOP_RATED_VALUE);
break;

case tubepress_api_const_options_values_GallerySourceValue::YOUTUBE_MOST_VIEWED:
case tubepress_plugins_youtube_api_const_options_values_GallerySourceValue::YOUTUBE_MOST_POPULAR:

$url = 'standardfeeds/most_popular?time=' . $execContext->get(tubepress_api_const_options_names_GallerySource::YOUTUBE_MOST_VIEWED_VALUE);
$url = 'standardfeeds/most_popular?time=' . $execContext->get(tubepress_plugins_youtube_api_const_options_names_GallerySource::YOUTUBE_MOST_POPULAR_VALUE);
break;

case tubepress_api_const_options_values_GallerySourceValue::YOUTUBE_PLAYLIST:
case tubepress_plugins_youtube_api_const_options_values_GallerySourceValue::YOUTUBE_PLAYLIST:

$url = 'playlists/' . $execContext->get(tubepress_api_const_options_names_GallerySource::YOUTUBE_PLAYLIST_VALUE);
$url = 'playlists/' . $execContext->get(tubepress_plugins_youtube_api_const_options_names_GallerySource::YOUTUBE_PLAYLIST_VALUE);
break;

case tubepress_api_const_options_values_GallerySourceValue::YOUTUBE_MOST_RESPONDED:
case tubepress_plugins_youtube_api_const_options_values_GallerySourceValue::YOUTUBE_MOST_RESPONDED:

$url = 'standardfeeds/most_responded';
break;

case tubepress_api_const_options_values_GallerySourceValue::YOUTUBE_MOST_RECENT:
case tubepress_plugins_youtube_api_const_options_values_GallerySourceValue::YOUTUBE_MOST_RECENT:

$url = 'standardfeeds/most_recent';
break;

case tubepress_api_const_options_values_GallerySourceValue::YOUTUBE_TOP_FAVORITES:
case tubepress_plugins_youtube_api_const_options_values_GallerySourceValue::YOUTUBE_TOP_FAVORITES:

$url = 'standardfeeds/top_favorites';
break;

case tubepress_api_const_options_values_GallerySourceValue::YOUTUBE_MOST_DISCUSSED:
case tubepress_plugins_youtube_api_const_options_values_GallerySourceValue::YOUTUBE_MOST_DISCUSSED:

$url = 'standardfeeds/most_discussed';
break;

case tubepress_api_const_options_values_GallerySourceValue::YOUTUBE_FAVORITES:
case tubepress_plugins_youtube_api_const_options_values_GallerySourceValue::YOUTUBE_FAVORITES:

$url = 'users/' . $execContext->get(tubepress_api_const_options_names_GallerySource::YOUTUBE_FAVORITES_VALUE) . '/favorites';
$url = 'users/' . $execContext->get(tubepress_plugins_youtube_api_const_options_names_GallerySource::YOUTUBE_FAVORITES_VALUE) . '/favorites';
break;

case tubepress_api_const_options_values_GallerySourceValue::YOUTUBE_SEARCH:
case tubepress_plugins_youtube_api_const_options_values_GallerySourceValue::YOUTUBE_SEARCH:

$tags = $execContext->get(tubepress_api_const_options_names_GallerySource::YOUTUBE_TAG_VALUE);
$tags = $execContext->get(tubepress_plugins_youtube_api_const_options_names_GallerySource::YOUTUBE_TAG_VALUE);
$tags = self::_replaceQuotes($tags);
$tags = urlencode($tags);
$url = "videos?q=$tags";
Expand Down Expand Up @@ -208,7 +208,7 @@ private function _setOrderBy(tubepress_spi_context_ExecutionContext $execContext
}

/* playlist specific stuff */
if ($mode == tubepress_api_const_options_values_GallerySourceValue::YOUTUBE_PLAYLIST) {
if ($mode == tubepress_plugins_youtube_api_const_options_values_GallerySourceValue::YOUTUBE_PLAYLIST) {

if (in_array($order, array(

Expand Down
Expand Up @@ -50,38 +50,38 @@ protected final function getDelegateFormHandlers()
tubepress_api_const_options_names_Output::GALLERY_SOURCE =>
$fieldBuilder->build(tubepress_api_const_options_names_Output::GALLERY_SOURCE, tubepress_impl_options_ui_fields_TextField::FIELD_CLASS_NAME),

tubepress_api_const_options_values_GallerySourceValue::YOUTUBE_FAVORITES =>
$fieldBuilder->build(tubepress_api_const_options_names_GallerySource::YOUTUBE_FAVORITES_VALUE, tubepress_impl_options_ui_fields_TextField::FIELD_CLASS_NAME),
tubepress_plugins_youtube_api_const_options_values_GallerySourceValue::YOUTUBE_FAVORITES =>
$fieldBuilder->build(tubepress_plugins_youtube_api_const_options_names_GallerySource::YOUTUBE_FAVORITES_VALUE, tubepress_impl_options_ui_fields_TextField::FIELD_CLASS_NAME),

tubepress_api_const_options_values_GallerySourceValue::YOUTUBE_FEATURED =>
$fieldBuilder->build(tubepress_api_const_options_names_GallerySource::YOUTUBE_FEATURED, tubepress_impl_options_ui_fields_DropdownField::FIELD_CLASS_NAME),
tubepress_plugins_youtube_api_const_options_values_GallerySourceValue::YOUTUBE_FEATURED =>
$fieldBuilder->build(tubepress_plugins_youtube_api_const_options_names_GallerySource::YOUTUBE_FEATURED_VALUE, tubepress_impl_options_ui_fields_DropdownField::FIELD_CLASS_NAME),

tubepress_api_const_options_values_GallerySourceValue::YOUTUBE_USER =>
$fieldBuilder->build(tubepress_api_const_options_names_GallerySource::YOUTUBE_USER_VALUE, tubepress_impl_options_ui_fields_TextField::FIELD_CLASS_NAME),
tubepress_plugins_youtube_api_const_options_values_GallerySourceValue::YOUTUBE_USER =>
$fieldBuilder->build(tubepress_plugins_youtube_api_const_options_names_GallerySource::YOUTUBE_USER_VALUE, tubepress_impl_options_ui_fields_TextField::FIELD_CLASS_NAME),

tubepress_api_const_options_values_GallerySourceValue::YOUTUBE_PLAYLIST =>
$fieldBuilder->build(tubepress_api_const_options_names_GallerySource::YOUTUBE_PLAYLIST_VALUE, tubepress_impl_options_ui_fields_TextField::FIELD_CLASS_NAME),
tubepress_plugins_youtube_api_const_options_values_GallerySourceValue::YOUTUBE_PLAYLIST =>
$fieldBuilder->build(tubepress_plugins_youtube_api_const_options_names_GallerySource::YOUTUBE_PLAYLIST_VALUE, tubepress_impl_options_ui_fields_TextField::FIELD_CLASS_NAME),

tubepress_api_const_options_values_GallerySourceValue::YOUTUBE_SEARCH =>
$fieldBuilder->build(tubepress_api_const_options_names_GallerySource::YOUTUBE_TAG_VALUE, tubepress_impl_options_ui_fields_TextField::FIELD_CLASS_NAME),
tubepress_plugins_youtube_api_const_options_values_GallerySourceValue::YOUTUBE_SEARCH =>
$fieldBuilder->build(tubepress_plugins_youtube_api_const_options_names_GallerySource::YOUTUBE_TAG_VALUE, tubepress_impl_options_ui_fields_TextField::FIELD_CLASS_NAME),

tubepress_api_const_options_values_GallerySourceValue::YOUTUBE_MOST_VIEWED =>
$fieldBuilder->build(tubepress_api_const_options_names_GallerySource::YOUTUBE_MOST_VIEWED_VALUE, tubepress_impl_options_ui_fields_DropdownField::FIELD_CLASS_NAME),
tubepress_plugins_youtube_api_const_options_values_GallerySourceValue::YOUTUBE_MOST_POPULAR =>
$fieldBuilder->build(tubepress_plugins_youtube_api_const_options_names_GallerySource::YOUTUBE_MOST_POPULAR_VALUE, tubepress_impl_options_ui_fields_DropdownField::FIELD_CLASS_NAME),

tubepress_api_const_options_values_GallerySourceValue::YOUTUBE_TOP_RATED =>
$fieldBuilder->build(tubepress_api_const_options_names_GallerySource::YOUTUBE_TOP_RATED_VALUE, tubepress_impl_options_ui_fields_DropdownField::FIELD_CLASS_NAME),
tubepress_plugins_youtube_api_const_options_values_GallerySourceValue::YOUTUBE_TOP_RATED =>
$fieldBuilder->build(tubepress_plugins_youtube_api_const_options_names_GallerySource::YOUTUBE_TOP_RATED_VALUE, tubepress_impl_options_ui_fields_DropdownField::FIELD_CLASS_NAME),

tubepress_api_const_options_values_GallerySourceValue::YOUTUBE_TOP_FAVORITES =>
$fieldBuilder->build(tubepress_api_const_options_names_GallerySource::YOUTUBE_TOP_FAVORITES_VALUE, tubepress_impl_options_ui_fields_DropdownField::FIELD_CLASS_NAME),
tubepress_plugins_youtube_api_const_options_values_GallerySourceValue::YOUTUBE_TOP_FAVORITES =>
$fieldBuilder->build(tubepress_plugins_youtube_api_const_options_names_GallerySource::YOUTUBE_TOP_FAVORITES_VALUE, tubepress_impl_options_ui_fields_DropdownField::FIELD_CLASS_NAME),

tubepress_api_const_options_values_GallerySourceValue::YOUTUBE_MOST_DISCUSSED =>
$fieldBuilder->build(tubepress_api_const_options_names_GallerySource::YOUTUBE_MOST_DISCUSSED_VALUE, tubepress_impl_options_ui_fields_DropdownField::FIELD_CLASS_NAME),
tubepress_plugins_youtube_api_const_options_values_GallerySourceValue::YOUTUBE_MOST_DISCUSSED =>
$fieldBuilder->build(tubepress_plugins_youtube_api_const_options_names_GallerySource::YOUTUBE_MOST_DISCUSSED_VALUE, tubepress_impl_options_ui_fields_DropdownField::FIELD_CLASS_NAME),

tubepress_api_const_options_values_GallerySourceValue::YOUTUBE_MOST_RECENT =>
$fieldBuilder->build(tubepress_api_const_options_names_GallerySource::YOUTUBE_MOST_RECENT_VALUE, tubepress_impl_options_ui_fields_DropdownField::FIELD_CLASS_NAME),
tubepress_plugins_youtube_api_const_options_values_GallerySourceValue::YOUTUBE_MOST_RECENT =>
$fieldBuilder->build(tubepress_plugins_youtube_api_const_options_names_GallerySource::YOUTUBE_MOST_RECENT_VALUE, tubepress_impl_options_ui_fields_DropdownField::FIELD_CLASS_NAME),

tubepress_api_const_options_values_GallerySourceValue::YOUTUBE_MOST_RESPONDED =>
$fieldBuilder->build(tubepress_api_const_options_names_GallerySource::YOUTUBE_MOST_RESPONDED_VALUE, tubepress_impl_options_ui_fields_DropdownField::FIELD_CLASS_NAME),
tubepress_plugins_youtube_api_const_options_values_GallerySourceValue::YOUTUBE_MOST_RESPONDED =>
$fieldBuilder->build(tubepress_plugins_youtube_api_const_options_names_GallerySource::YOUTUBE_MOST_RESPONDED_VALUE, tubepress_impl_options_ui_fields_DropdownField::FIELD_CLASS_NAME),

tubepress_api_const_options_values_GallerySourceValue::VIMEO_ALBUM =>
$fieldBuilder->build(tubepress_api_const_options_names_GallerySource::VIMEO_ALBUM_VALUE, tubepress_impl_options_ui_fields_TextField::FIELD_CLASS_NAME),
Expand Down
Expand Up @@ -128,9 +128,9 @@ public final function execute(ehough_chaingang_api_Context $context)

default:

$execContext->set(tubepress_api_const_options_names_Output::GALLERY_SOURCE, tubepress_api_const_options_values_GallerySourceValue::YOUTUBE_SEARCH);
$execContext->set(tubepress_api_const_options_names_Output::GALLERY_SOURCE, tubepress_plugins_youtube_api_const_options_values_GallerySourceValue::YOUTUBE_SEARCH);

$result = $execContext->set(tubepress_api_const_options_names_GallerySource::YOUTUBE_TAG_VALUE, $rawSearchTerms);
$result = $execContext->set(tubepress_plugins_youtube_api_const_options_names_GallerySource::YOUTUBE_TAG_VALUE, $rawSearchTerms);

if ($result !== true) {

Expand Down
6 changes: 2 additions & 4 deletions src/main/php/classes/tubepress/spi/provider/VideoProvider.php
Expand Up @@ -64,11 +64,9 @@ function fetchVideoGalleryPage($currentPage);
function fetchSingleVideo($videoId);

/**
* @param string $optionName The TubePress option name.
*
* @return boolean True if this option is applicable to the provider. False otherwise.
* @return array An array of strings, each representing an option name provided by this provider.
*/
function optionIsApplicable($optionName);
function getProvidedOptionNames();

/**
* @param string $playerImplementationName The player implementation name.
Expand Down
3 changes: 3 additions & 0 deletions src/main/php/plugins/addon/vimeo/Vimeo.info
@@ -0,0 +1,3 @@
name = Core YouTube integration
version = 1.0.0
description = Provides TubePress with the ability to work with YouTube
41 changes: 41 additions & 0 deletions src/main/php/plugins/addon/vimeo/Vimeo.php
@@ -0,0 +1,41 @@
<?php
/**
* Copyright 2006 - 2012 Eric D. Hough (http://ehough.com)
*
* This file is part of TubePress (http://tubepress.org)
*
* TubePress is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* TubePress is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with TubePress. If not, see <http://www.gnu.org/licenses/>.
*
*/

/**
* Registers a few extensions to allow TubePress to work with Vimeo.
*/
class tubepress_plugins_vimeo_YouTube
{
public static function registerVimeoListeners()
{
$loader = new ehough_pulsar_SymfonyUniversalClassLoader();
$loader->registerFallbackDirectory(dirname(__FILE__) . '/classes');
$loader->register();

$eventDispatcher = tubepress_impl_patterns_ioc_KernelServiceLocator::getEventDispatcher();

$eventDispatcher->addListener(tubepress_api_const_event_CoreEventNames::BOOT,
array(new tubepress_plugins_vimeo_impl_listeners_VimeoOptionsRegistrar(), 'onBoot'));

}
}

tubepress_plugins_vimeo_YouTube::registerVimeoListeners();

0 comments on commit ed65f06

Please sign in to comment.