chriscollins/php-plex
Composer 安装命令:
composer require chriscollins/php-plex
包简介
A simple PHP library for interacting with the Plex (http://plexapp.com) HTTP Control API. (forked from https://github.com/bonvga/php-plex)
关键字:
README 文档
README
A simple PHP library for interacting with the Plex (http://plexapp.com) HTTP Control API.
Requirements
php-curl simpleXML
What It Does
Allows access to your Plex library so that you can retrieve your shows, seasons, episodes, movies, artists, albums, and tracks in a number of convenient ways.
Has simple commands for playback and navigation and also an interface for playing episodes, movies, and tracks.
What It Does Not Do
Photos have not been implemented yet.
Playback is only implemented at the episode, movies, and track level. The plan is to implement passing a season or album to the application controller and have it play through the entire thing.
Paging has not been implemented for lists of items.
Installation
To install php-plex with Composer just add the following to your 'composer.json' file:
{
require: {
"bonvga/php-flex": "*",
...
}
}
Examples
Set Up
require_once('path/to/Plex.php');
$servers = array(
'shepherd' => array(
'address' => '192.168.11.9'
)
);
$plex = new Plex();
$plex->registerServers($servers);
$server = $plex->getServer('shepherd');
$client = $plex->getClient('zoe');
Get items at the library level
// On deck and recently added items
$server->getLibrary()->getOnDeckItems();
$server->getLibrary()->getRecentlyAddedItems();
// Sections
$server->getLibrary()->getSections();
$server->getLibrary()->getSection('Movies');
$server->getLibrary()->getSection('TV Shows');
$server->getLibrary()->getSection('Music');
Movies
// Lists of movies
$section->getAllMovies();
$section->getUnwatchedMovies();
$section->getRecentlyReleasedMovies();
$section->getRecentlyAddedMovies();
$section->getRecentlyViewedMovies();
$section->getOnDeckMovies();
$section->getMoviesByYear(1983);
$section->getMoviesByDecade(1980);
$section->getMoviesByContentRating('R');
$section->getMoviesByResolution('1080');
$section->getMoviesByFirstCharacter('Q');
// Single movies
// Exact title
$section->getMovie('Heavy Metal in Baghdad');
// Rating key
$section->getMovie(83696);
// Key
$section->getMovie('/library/metadata/83696');
// Collections
$section->getCollections();
$section->getMoviesByCollection(13206);
// Genres
$section->getGenres();
$section->getMoviesByGenre(1252);
// Directors
$section->getDirectors();
$section->getMoviesByDirector(357);
// Actors
$section->getActors();
$section->getMoviesByActor(3903);
// Search
$section->searchMovies('fly');
Shows, seasons, and episodes
// Lists of shows
$section->getAllShows();
$section->getUnwatchedShows();
$section->getShowsByFirstCharacter('Q');
$section->getShowsByYear(1983);
$section->getShowsByContentRating('TV-MA');
// Single shows
// Exact title
$section->getShow('Firefly');
// Rating key
$section->getShow(46585);
// Key
$section->getShow('/library/metadata/46585');
// Lists of episodes
$section->getRecentlyAiredEpisodes();
$section->getRecentlyAddedEpisodes();
$section->getRecentlyViewedEpisodes();
$section->getOnDeckEpisodes();
// Single episodes
// Exact title
$section->getEpisode('Crucifixed');
// Rating key
$section->getEpisode(83780);
// Key
$section->getEpisode('/library/metadata/83780');
// Collections
$section->getCollections();
$section->getShowsByCollection(13205);
// Genres
$section->getGenres();
$section->getShowsByGenre(8196);
// Search
$section->searchShows('fly');
$section->searchEpisodes('fly');
// By show
$show = $showSection->getShow('Peep Show');
$seasons = $show->getSeasons();
$seasonByIndex = $show->getSeason(2);
$seasonByKey = $show->getSeason('/library/metadata/3112');
$seasonByExactTitleMatch = $show->getSeason('Season 2');
$episodes = $seasonByIndex->getEpisodes();
$episodeByIndex = $seasonByIndex->getEpisode(4);
$episodeByKey = $seasonByIndex->getEpisode('/library/metadata/3116');
$episodeByExactTitleMatch = $seasonByIndex->getEpisode('University Challenge');
Artists, albums, and tracks
// Lists of artists
$section->getAllArtists();
// Single artists
// Exact title
$section->getArtist('Acrassicauda');
// Rating key
$section->getArtist(83757);
// Key
$section->getArtist('/library/metadata/83757');
// Collections
$section->getCollections()
$section->getArtistsByCollection(13206);
// Genres
$section->getGenres();
$section->getArtistsByGenre(11644);
// Albums
$section->getAllAlbums();
$section->getAlbumsByDecade(1980);
$section->getAlbumsByYear(1983);
$section->getRecentlyAddedAlbums();
// Single tracks
// Exact title
$section->getTrack('Can\'t Buy Me Love');
// Rating key
$section->getTrack(67962);
// Key
$section->getTrack('/library/metadata/67962');
// Search
$section->searchArtists('fly');
$section->searchTracks('fly');
// By artist
$artist = $artistSection->getArtist('Paolo Nutini');
$albums = $artist->getAlbums();
$albumByKey = $artist->getAlbum('/library/metadata/57718');
$albumByExactTitleMatch = $artist->getAlbum('These Streets');
$tracks = $albumByExactTitleMatch->getTracks();
$trackByIndex = $albumByExactTitleMatch->getTrack(3);
$trackByKey = $albumByExactTitleMatch->getTrack('/library/metadata/57726');
$trackByExactTitleMatch = $albumByExactTitleMatch->getTrack('Rewind');
Item Media Info
$showSection = $library->getSection('TV Shows');
$episode = $showSection->getShow("The Simpsons")
->getSeason(4)
->getEpisode(12);
// Media Info
$media = $episode->getMedia();
$duration = $media->getDuration();
$bitrate = $media->getBitrate();
// File
$file = reset($media->getFiles());
$path = $file->getFile();
$size = $file->getSize();
Playback Controller
$playback = $client->getPlaybackController();
$playback->play();
$playback->pause();
$playback->stop();
$playback->rewind();
$playback->fastForward();
$playback->stepForward();
$playback->bigStepForward();
$playback->stepBack();
$playback->bigStepBack();
$playback->skipNext();
$playback->skipPrevious();
Navigation Controller
$navigation = $client->getNavigationController();
$navigation->moveUp();
$navigation->moveDown();
$navigation->moveLeft();
$navigation->moveRight()
$navigation->pageUp();
$navigation->pageDown();
$navigation->nextLetter();
$navigation->previousLetter();
$navigation->select();
$navigation->back();
$navigation->contextMenu();
$navigation->toggleOSD();
Application Controller
$application = $client->getApplicationController();
$episode = $section
->getShow('It\'s Always Sunny in Philadelphia')
->getSeason(5)
->getEpisode(4);
// Play episode from beginning
$application->playMedia($episode);
// Play epsiode from where it was last stopped
$application->playMedia($episode, $episode->getViewOffset());
// Set voume to half
$application->setVolume(50);
chriscollins/php-plex 适用场景与选型建议
chriscollins/php-plex 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 29 次下载、GitHub Stars 达 0, 最近一次更新时间为 2015 年 03 月 15 日, 在 PHP 生态内属于活跃度较高的组件。
它主要适用于以下技术方向: 「plex」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。
我们在过去多个企业项目中使用过 chriscollins/php-plex 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 chriscollins/php-plex 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
与 chriscollins/php-plex 相关的其它包
同方向 / 同关键字的高下载量 PHP Composer 包推荐,方便对比选型:
统计信息
- 总下载量: 29
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 14
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2015-03-15