Skip to content
This repository was archived by the owner on Jun 9, 2023. It is now read-only.

Commit e345799

Browse files
committed
Added the playback controller and updated the README.
1 parent 978a82f commit e345799

File tree

3 files changed

+187
-1
lines changed

3 files changed

+187
-1
lines changed

Client/Controller/Playback.php

Lines changed: 171 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,171 @@
1+
<?php
2+
3+
/**
4+
* Plex Client Playback Controller
5+
*
6+
* @category php-plex
7+
* @package Plex_Client
8+
* @subpackage Plex_Client_Controller
9+
* @author <[email protected]> Nick Bartkowiak
10+
* @copyright (c) 2012 Nick Bartkowiak
11+
* @license http://www.gnu.org/licenses/gpl-3.0.html GNU Public Licence (GPLv3)
12+
* @version 0.0.1
13+
*
14+
* This file is part of php-plex.
15+
*
16+
* php-plex is free software: you can redistribute it and/or modify
17+
* it under the terms of the GNU General Public License as published by
18+
* the Free Software Foundation, either version 3 of the License, or
19+
* (at your option) any later version.
20+
*
21+
* php-plex is distributed in the hope that it will be useful,
22+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
23+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
24+
* GNU General Public License for more details.
25+
*/
26+
27+
/**
28+
* Represents a Plex client on the network.
29+
*
30+
* @category php-plex
31+
* @package Plex_Client
32+
* @subpackage Plex_Client_Controller
33+
* @author <[email protected]> Nick Bartkowiak
34+
* @copyright (c) 2012 Nick Bartkowiak
35+
* @license http://www.gnu.org/licenses/gpl-3.0.html GNU Public Licence (GPLv3)
36+
* @version 0.0.1
37+
*/
38+
class Plex_Client_Controller_Playback extends Plex_Client_ControllerAbstract
39+
{
40+
/**
41+
* Executes the play command.
42+
*
43+
* @uses Plex_Client_ControllerAbstract::executeCommand()
44+
*
45+
* @return void
46+
*/
47+
public function play()
48+
{
49+
$this->executeCommand();
50+
}
51+
52+
/**
53+
* Executes the pause command.
54+
*
55+
* @uses Plex_Client_ControllerAbstract::executeCommand()
56+
*
57+
* @return void
58+
*/
59+
public function pause()
60+
{
61+
$this->executeCommand();
62+
}
63+
64+
/**
65+
* Executes the stop command.
66+
*
67+
* @uses Plex_Client_ControllerAbstract::executeCommand()
68+
*
69+
* @return void
70+
*/
71+
public function stop()
72+
{
73+
$this->executeCommand();
74+
}
75+
76+
/**
77+
* Executes the rewind command.
78+
*
79+
* @uses Plex_Client_ControllerAbstract::executeCommand()
80+
*
81+
* @return void
82+
*/
83+
public function rewind()
84+
{
85+
$this->executeCommand();
86+
}
87+
88+
/**
89+
* Executes the fast forward command.
90+
*
91+
* @uses Plex_Client_ControllerAbstract::executeCommand()
92+
*
93+
* @return void
94+
*/
95+
public function fastForward()
96+
{
97+
$this->executeCommand();
98+
}
99+
100+
/**
101+
* Executes the step forward command.
102+
*
103+
* @uses Plex_Client_ControllerAbstract::executeCommand()
104+
*
105+
* @return void
106+
*/
107+
public function stepForward()
108+
{
109+
$this->executeCommand();
110+
}
111+
112+
/**
113+
* Executes the big step forward command.
114+
*
115+
* @uses Plex_Client_ControllerAbstract::executeCommand()
116+
*
117+
* @return void
118+
*/
119+
public function bigStepForward()
120+
{
121+
$this->executeCommand();
122+
}
123+
124+
/**
125+
* Executes the step back command.
126+
*
127+
* @uses Plex_Client_ControllerAbstract::executeCommand()
128+
*
129+
* @return void
130+
*/
131+
public function stepBack()
132+
{
133+
$this->executeCommand();
134+
}
135+
136+
/**
137+
* Executes the big step back command.
138+
*
139+
* @uses Plex_Client_ControllerAbstract::executeCommand()
140+
*
141+
* @return void
142+
*/
143+
public function bigStepBack()
144+
{
145+
$this->executeCommand();
146+
}
147+
148+
/**
149+
* Executes the skip next command.
150+
*
151+
* @uses Plex_Client_ControllerAbstract::executeCommand()
152+
*
153+
* @return void
154+
*/
155+
public function skipNext()
156+
{
157+
$this->executeCommand();
158+
}
159+
160+
/**
161+
* Executes the skip previous command.
162+
*
163+
* @uses Plex_Client_ControllerAbstract::executeCommand()
164+
*
165+
* @return void
166+
*/
167+
public function skipPrevious()
168+
{
169+
$this->executeCommand();
170+
}
171+
}

Client/ControllerAbstract.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<?php
22

33
/**
4-
* Plex Client Controller Abstract
4+
* Plex Client Controller
55
*
66
* @category php-plex
77
* @package Plex_Client

README.md

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -186,3 +186,18 @@ Artists, albums, and tracks
186186
$trackByIndex = $albumByExactTitleMatch->getTrack(3);
187187
$trackByKey = $albumByExactTitleMatch->getTrack('/library/metadata/57726');
188188
$trackByExactTitleMatch = $albumByExactTitleMatch->getTrack('Rewind');
189+
190+
Playback controller
191+
192+
$playback = $client->getPlaybackController();
193+
$playback->play();
194+
$playback->pause();
195+
$playback->stop();
196+
$playback->rewind();
197+
$playback->fastForward();
198+
$playback->stepForward();
199+
$playback->bigStepForward();
200+
$playback->stepBack();
201+
$playback->bigStepBack();
202+
$playback->skipNext();
203+
$playback->skipPrevious();

0 commit comments

Comments
 (0)