GithubHelp home page GithubHelp logo

awesome-media's Introduction

AwesomeMedia

Extensible MediaProvider management script that can query several provider such as Youtube/dailymotion/vimeo and return a list of normalized results.

#Installation ##Composer Add the AwesomeMedia library to your composer.json file's require field

{
    "require" : {
        "ghaliano/AwesomeMedia" : "dev-master"
    }
}

#How to use? ##Client configuration This is a typical configuration used on the demo https://github.com/ghaliano/awesome-media/blob/master/Demo/config.php

<?php
$youtubeConfig = [
    'developer_key' => null
];    
    
$dailymotionConfig = [
    'api_key' => null, 
    'secret_key'=> null
];

$vimeoConfig = [
    'api_key' => null, 
    'secret_key'=> null, 
    'access_token' => null
];

$soundcloudConfig = [
    'api_key' => '',
    'secret_key' => '',
    'login' => '',
    'password' => ''
];

##Single provider

<?php
$loader = require '../vendor/autoload.php';
require 'config_dev.php';
use MediaGateway\ProviderClientFactory;
use MediaGateway\Provider\YoutubeProvider;
$youtubeProvider = new YoutubeProvider(
    ProviderClientFactory::create('youtube', $youtubeConfig)
);
$query = new \MediaGateway\Query();
$query->setTerm('kittens')->setLimit(10);
 
$result = $youtubeProvider->search($query);
print '<pre>';
print_r($result);

##Multiple provider The component use a Chain class to manipulate mutiple providers like one

<?php
$loader = require '../vendor/autoload.php';
require 'config_dev.php';
use MediaGateway\Provider\ProviderChain;
use MediaGateway\ProviderClientFactory;
use MediaGateway\Provider\YoutubeProvider;
use MediaGateway\Provider\VimeoProvider;
use MediaGateway\Provider\DailymotionProvider;
use MediaGateway\Provider\SoundcloudProvider;
use MediaGateway\Provider\FlickrProvider;
$providerChain = new ProviderChain();

$providerChain->addProviders([
    new YoutubeProvider(new MediaGateway\Client\YoutubeClient($youtubeConfig)),
    new VimeoProvider(new MediaGateway\Client\VimeoClient($vimeoConfig)),
    new DailymotionProvider(new MediaGateway\Client\DailymotionClient($dailymotionConfig)),
    new SoundcloudProvider(new MediaGateway\Client\SoundcloudClient($soundcloudConfig)),
    new FlickrProvider(new MediaGateway\Client\FlickrClient($flickerConfig))
]);

$query = new \MediaGateway\Query();
$query->setTerm('kittens')->setLimit(10);
$result = $providerChain->search($query);
print '<pre>';
print_r($result);

Demo

https://github.com/ghaliano/awesome-media/blob/master/Demo/demo.php

TODO

  • Only Search Future is now available: Adding more future (Upload/remove/update MEdia)
  • DATA formating can be in a separate class for each provider
  • Adding other Media type (only video provider are now implemented)
  • Adding test !!!

awesome-media's People

Contributors

ghaliano avatar richtermeister avatar pborreli avatar

Watchers

James Cloos avatar Karim Miladi avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.