| 1 | package DCOP::Amarok::Playlist; | ||||||||||||||||||||
| 2 | |||||||||||||||||||||
| 3 | 1 | ▶ | use 5.008001; | ||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 4 | 1 | ▶ | use strict; | ||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 5 | 1 | ▶ | use warnings; | ||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 6 | |||||||||||||||||||||
| 7 | 1 | require DCOP::Amarok; | |||||||||||||||||||
| 8 | |||||||||||||||||||||
| 9 | 1 | our @ISA = qw(DCOP::Amarok); | |||||||||||||||||||
| 10 | |||||||||||||||||||||
| 11 | 1 | our $VERSION = '0.009'; | |||||||||||||||||||
| 12 | |||||||||||||||||||||
| 13 | =head1 NAME | ||||||||||||||||||||
| 14 | |||||||||||||||||||||
| 15 | DCOP::Amarok::Playlist - Perl extension to speak to an amaroK player object via system's DCOP. | ||||||||||||||||||||
| 16 | |||||||||||||||||||||
| 17 | =head1 SYNOPSIS | ||||||||||||||||||||
| 18 | |||||||||||||||||||||
| 19 | use DCOP::Amarok::Playlist; | ||||||||||||||||||||
| 20 | $playlist = DCOP::Amarok::Playlist->new(); | ||||||||||||||||||||
| 21 | |||||||||||||||||||||
| 22 | $playlist->togglePlaylist(); | ||||||||||||||||||||
| 23 | print $playlist->getActiveIndex(); | ||||||||||||||||||||
| 24 | |||||||||||||||||||||
| 25 | =head1 DESCRIPTION | ||||||||||||||||||||
| 26 | |||||||||||||||||||||
| 27 | This module is a quick hack to get an interface between perl and Kde's DCOP, | ||||||||||||||||||||
| 28 | since Kde3.4's perl bindings are disabled. This suite talks to 'dcop'. | ||||||||||||||||||||
| 29 | DCOP::Amarok::Playlist talks directly to the playlist object of amaroK. | ||||||||||||||||||||
| 30 | |||||||||||||||||||||
| 31 | =head1 EXPORT | ||||||||||||||||||||
| 32 | |||||||||||||||||||||
| 33 | None by default. | ||||||||||||||||||||
| 34 | |||||||||||||||||||||
| 35 | =head1 METHODS | ||||||||||||||||||||
| 36 | |||||||||||||||||||||
| 37 | =item new() | ||||||||||||||||||||
| 38 | |||||||||||||||||||||
| 39 | Constructor. No arguments needed. If the program will be run remotely, the | ||||||||||||||||||||
| 40 | need for 'user => "myusername"' arises. | ||||||||||||||||||||
| 41 | |||||||||||||||||||||
| 42 | =cut | ||||||||||||||||||||
| 43 | |||||||||||||||||||||
| 44 | 1 | ▶ | sub new() { | ||||||||||||||||||
|
Subroutine
new: called CC=2 SCAR=7.1
Pod
documented
| |||||||||||||||||||||
| 45 | 1 | my $proto = shift; | |||||||||||||||||||
| 46 | 1 | ▶ | my $class = ref( $proto ) || $proto; | ||||||||||||||||||
|
Condition33%1/3
ref $proto || $proto
MC/DC0%0/2
ref $proto || $proto
ref $proto
$proto
Truth table33%1/3
A || B
A= ref $protoB= $proto
| |||||||||||||||||||||
| 47 | 1 | my %params = @_; | |||||||||||||||||||
| 48 | 1 | my $self = $class->SUPER::new( %params, control => "playlist" ); | |||||||||||||||||||
| 49 | 1 | bless( $self, $class ); | |||||||||||||||||||
| 50 | 1 | return $self; | |||||||||||||||||||
| 51 | } | ||||||||||||||||||||
| 52 | |||||||||||||||||||||
| 53 | =item interfaces() | ||||||||||||||||||||
| 54 | |||||||||||||||||||||
| 55 | Returns a list of the interfaces. | ||||||||||||||||||||
| 56 | |||||||||||||||||||||
| 57 | =cut | ||||||||||||||||||||
| 58 | |||||||||||||||||||||
| 59 | 0 | ▶ | sub interfaces() { | ||||||||||||||||||
|
Subroutine
interfaces: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||
| 60 | 0 | my $self = shift; | |||||||||||||||||||
| 61 | 0 | return $self->run( "interfaces" ); | |||||||||||||||||||
| 62 | } | ||||||||||||||||||||
| 63 | |||||||||||||||||||||
| 64 | =item functions() | ||||||||||||||||||||
| 65 | |||||||||||||||||||||
| 66 | Returns a list of the functions. | ||||||||||||||||||||
| 67 | |||||||||||||||||||||
| 68 | =cut | ||||||||||||||||||||
| 69 | |||||||||||||||||||||
| 70 | 0 | ▶ | sub functions() { | ||||||||||||||||||
|
Subroutine
functions: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||
| 71 | 0 | my $self = shift; | |||||||||||||||||||
| 72 | 0 | return $self->run( "functions" ); | |||||||||||||||||||
| 73 | } | ||||||||||||||||||||
| 74 | |||||||||||||||||||||
| 75 | =item getActiveIndex() | ||||||||||||||||||||
| 76 | |||||||||||||||||||||
| 77 | Returns the number of the active index. | ||||||||||||||||||||
| 78 | |||||||||||||||||||||
| 79 | =cut | ||||||||||||||||||||
| 80 | |||||||||||||||||||||
| 81 | 0 | ▶ | sub getActiveIndex() { | ||||||||||||||||||
|
Subroutine
getActiveIndex: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||
| 82 | 0 | my $self = shift; | |||||||||||||||||||
| 83 | 0 | return $self->run( "getActiveIndex" ); | |||||||||||||||||||
| 84 | } | ||||||||||||||||||||
| 85 | |||||||||||||||||||||
| 86 | =item getTotalTrackCount() | ||||||||||||||||||||
| 87 | |||||||||||||||||||||
| 88 | Returns the total number of tracks in the playlist. | ||||||||||||||||||||
| 89 | |||||||||||||||||||||
| 90 | =cut | ||||||||||||||||||||
| 91 | |||||||||||||||||||||
| 92 | 0 | ▶ | sub getTotalTrackCount() { | ||||||||||||||||||
|
Subroutine
getTotalTrackCount: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||
| 93 | 0 | my $self = shift; | |||||||||||||||||||
| 94 | 0 | return $self->run( "getTotalTrackCount" ); | |||||||||||||||||||
| 95 | } | ||||||||||||||||||||
| 96 | |||||||||||||||||||||
| 97 | =item saveCurrentPlaylist() | ||||||||||||||||||||
| 98 | |||||||||||||||||||||
| 99 | Makes the object save the present list. | ||||||||||||||||||||
| 100 | Returns the path. | ||||||||||||||||||||
| 101 | |||||||||||||||||||||
| 102 | =cut | ||||||||||||||||||||
| 103 | |||||||||||||||||||||
| 104 | 0 | ▶ | sub saveCurrentPlaylist() { | ||||||||||||||||||
|
Subroutine
saveCurrentPlaylist: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||
| 105 | 0 | my $self = shift; | |||||||||||||||||||
| 106 | 0 | return $self->run( "saveCurrentPlaylist" ); | |||||||||||||||||||
| 107 | } | ||||||||||||||||||||
| 108 | |||||||||||||||||||||
| 109 | =item addMedia($URL) | ||||||||||||||||||||
| 110 | |||||||||||||||||||||
| 111 | Adds new media. | ||||||||||||||||||||
| 112 | |||||||||||||||||||||
| 113 | =cut | ||||||||||||||||||||
| 114 | |||||||||||||||||||||
| 115 | 0 | ▶ | sub addMedia() { | ||||||||||||||||||
|
Subroutine
addMedia: not called CC=2 SCAR=17.9
Pod
documented
| |||||||||||||||||||||
| 116 | 0 | my $self = shift; | |||||||||||||||||||
| 117 | 0 | ▶ | while ( @_ ) { | ||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||
| 118 | 0 | $self->run( "addMedia", "$_" ); | |||||||||||||||||||
| 119 | } | ||||||||||||||||||||
| 120 | } | ||||||||||||||||||||
| 121 | |||||||||||||||||||||
| 122 | =item addMediaList() | ||||||||||||||||||||
| 123 | |||||||||||||||||||||
| 124 | Adds new media. | ||||||||||||||||||||
| 125 | |||||||||||||||||||||
| 126 | =cut | ||||||||||||||||||||
| 127 | |||||||||||||||||||||
| 128 | 0 | ▶ | sub addMediaList() { | ||||||||||||||||||
|
Subroutine
addMediaList: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||
| 129 | 0 | my $self = shift; | |||||||||||||||||||
| 130 | 0 | $self->run( "addMediaList", @_ ); | |||||||||||||||||||
| 131 | } | ||||||||||||||||||||
| 132 | |||||||||||||||||||||
| 133 | =item clearPlaylist() | ||||||||||||||||||||
| 134 | |||||||||||||||||||||
| 135 | |||||||||||||||||||||
| 136 | =cut | ||||||||||||||||||||
| 137 | |||||||||||||||||||||
| 138 | 0 | ▶ | sub clearPlaylist() { | ||||||||||||||||||
|
Subroutine
clearPlaylist: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||
| 139 | 0 | my $self = shift; | |||||||||||||||||||
| 140 | 0 | $self->run( "clearPlaylist" ); | |||||||||||||||||||
| 141 | } | ||||||||||||||||||||
| 142 | |||||||||||||||||||||
| 143 | =item playByIndex($index) | ||||||||||||||||||||
| 144 | |||||||||||||||||||||
| 145 | Plays the song in the $index position. | ||||||||||||||||||||
| 146 | |||||||||||||||||||||
| 147 | =cut | ||||||||||||||||||||
| 148 | |||||||||||||||||||||
| 149 | 0 | ▶ | sub playByIndex() { | ||||||||||||||||||
|
Subroutine
playByIndex: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||
| 150 | 0 | my $self = shift; | |||||||||||||||||||
| 151 | 0 | my $index = shift; | |||||||||||||||||||
| 152 | 0 | $self->run( "playByIndex", "$index" ); | |||||||||||||||||||
| 153 | } | ||||||||||||||||||||
| 154 | |||||||||||||||||||||
| 155 | =item playMedia($uri) | ||||||||||||||||||||
| 156 | |||||||||||||||||||||
| 157 | Play a specific object. | ||||||||||||||||||||
| 158 | |||||||||||||||||||||
| 159 | =cut | ||||||||||||||||||||
| 160 | |||||||||||||||||||||
| 161 | 0 | ▶ | sub playMedia() { | ||||||||||||||||||
|
Subroutine
playMedia: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||
| 162 | 0 | my $self = shift; | |||||||||||||||||||
| 163 | 0 | my $url = shift; | |||||||||||||||||||
| 164 | 0 | $self->run( "playMedia", "$url" ); | |||||||||||||||||||
| 165 | } | ||||||||||||||||||||
| 166 | |||||||||||||||||||||
| 167 | =item popupMessage($msg) | ||||||||||||||||||||
| 168 | |||||||||||||||||||||
| 169 | Pops up $msg in screen. | ||||||||||||||||||||
| 170 | TODO: $msg has to escape white spaces with '\'. | ||||||||||||||||||||
| 171 | e.g. "Hi\\\ there"; | ||||||||||||||||||||
| 172 | e.g2. 'I\ am\ here' | ||||||||||||||||||||
| 173 | |||||||||||||||||||||
| 174 | =cut | ||||||||||||||||||||
| 175 | |||||||||||||||||||||
| 176 | 0 | ▶ | sub popupMessage() { | ||||||||||||||||||
|
Subroutine
popupMessage: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||
| 177 | 0 | my $self = shift; | |||||||||||||||||||
| 178 | 0 | my $msg = shift; | |||||||||||||||||||
| 179 | 0 | $self->run( "popupMessage", "$msg" ); | |||||||||||||||||||
| 180 | } | ||||||||||||||||||||
| 181 | |||||||||||||||||||||
| 182 | =item removeCurrentTrack() | ||||||||||||||||||||
| 183 | |||||||||||||||||||||
| 184 | Removes current track from playlist | ||||||||||||||||||||
| 185 | |||||||||||||||||||||
| 186 | =cut | ||||||||||||||||||||
| 187 | |||||||||||||||||||||
| 188 | 0 | ▶ | sub removeCurrentTrack() { | ||||||||||||||||||
|
Subroutine
removeCurrentTrack: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||
| 189 | 0 | my $self = shift; | |||||||||||||||||||
| 190 | 0 | $self->run( "removeCurrentTrack" ); | |||||||||||||||||||
| 191 | } | ||||||||||||||||||||
| 192 | |||||||||||||||||||||
| 193 | =item repopulate() | ||||||||||||||||||||
| 194 | |||||||||||||||||||||
| 195 | Repopulate playlist. | ||||||||||||||||||||
| 196 | |||||||||||||||||||||
| 197 | =cut | ||||||||||||||||||||
| 198 | |||||||||||||||||||||
| 199 | 0 | ▶ | sub repopulate() { | ||||||||||||||||||
|
Subroutine
repopulate: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||
| 200 | 0 | my $self = shift; | |||||||||||||||||||
| 201 | 0 | $self->run( "repopulate" ); | |||||||||||||||||||
| 202 | } | ||||||||||||||||||||
| 203 | |||||||||||||||||||||
| 204 | =item saveM3uRelative($path) | ||||||||||||||||||||
| 205 | |||||||||||||||||||||
| 206 | Saves the M3U file with a relavtive path. | ||||||||||||||||||||
| 207 | |||||||||||||||||||||
| 208 | =cut | ||||||||||||||||||||
| 209 | |||||||||||||||||||||
| 210 | 0 | ▶ | sub saveM3uRelative() { | ||||||||||||||||||
|
Subroutine
saveM3uRelative: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||
| 211 | 0 | my $self = shift; | |||||||||||||||||||
| 212 | 0 | my $path = shift; | |||||||||||||||||||
| 213 | 0 | $self->run( "saveM3u", "$path", "1" ); | |||||||||||||||||||
| 214 | } | ||||||||||||||||||||
| 215 | |||||||||||||||||||||
| 216 | =item saveM3uAbsolute($path) | ||||||||||||||||||||
| 217 | |||||||||||||||||||||
| 218 | Saves the M3U file with an absolut path. | ||||||||||||||||||||
| 219 | |||||||||||||||||||||
| 220 | =cut | ||||||||||||||||||||
| 221 | |||||||||||||||||||||
| 222 | 0 | ▶ | sub saveM3uAbsolute() { | ||||||||||||||||||
|
Subroutine
saveM3uAbsolute: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||
| 223 | 0 | my $self = shift; | |||||||||||||||||||
| 224 | 0 | my $path = shift; | |||||||||||||||||||
| 225 | 0 | $self->run( "saveM3u", "$path", "0" ); | |||||||||||||||||||
| 226 | } | ||||||||||||||||||||
| 227 | |||||||||||||||||||||
| 228 | =item setStopAfterCurrent() | ||||||||||||||||||||
| 229 | |||||||||||||||||||||
| 230 | Enable StopAfterCurrent track. | ||||||||||||||||||||
| 231 | |||||||||||||||||||||
| 232 | =cut | ||||||||||||||||||||
| 233 | |||||||||||||||||||||
| 234 | 0 | ▶ | sub setStopAfterCurrent() { | ||||||||||||||||||
|
Subroutine
setStopAfterCurrent: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||
| 235 | 0 | my $self = shift; | |||||||||||||||||||
| 236 | 0 | $self->run( "setStopAfterCurrent", "1" ); | |||||||||||||||||||
| 237 | } | ||||||||||||||||||||
| 238 | |||||||||||||||||||||
| 239 | =item notStopAfterCurrent() | ||||||||||||||||||||
| 240 | |||||||||||||||||||||
| 241 | Disable StopAfterCurrent track. | ||||||||||||||||||||
| 242 | |||||||||||||||||||||
| 243 | =cut | ||||||||||||||||||||
| 244 | |||||||||||||||||||||
| 245 | 0 | ▶ | sub notStopAfterCurrent() { | ||||||||||||||||||
|
Subroutine
notStopAfterCurrent: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||
| 246 | 0 | my $self = shift; | |||||||||||||||||||
| 247 | 0 | $self->run( "setStopAfterCurrent", "0" ); | |||||||||||||||||||
| 248 | } | ||||||||||||||||||||
| 249 | |||||||||||||||||||||
| 250 | =item shortStatusMessage($msg) | ||||||||||||||||||||
| 251 | |||||||||||||||||||||
| 252 | Display $msg in the status bar. | ||||||||||||||||||||
| 253 | |||||||||||||||||||||
| 254 | =cut | ||||||||||||||||||||
| 255 | |||||||||||||||||||||
| 256 | 0 | ▶ | sub shortStatusMessage() { | ||||||||||||||||||
|
Subroutine
shortStatusMessage: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||
| 257 | 0 | my $self = shift; | |||||||||||||||||||
| 258 | 0 | my $msg = shift; | |||||||||||||||||||
| 259 | 0 | $self->run( "shortStatusMessage", "$msg" ); | |||||||||||||||||||
| 260 | } | ||||||||||||||||||||
| 261 | |||||||||||||||||||||
| 262 | =item shufflePlaylist() | ||||||||||||||||||||
| 263 | |||||||||||||||||||||
| 264 | Shuffle playlist. | ||||||||||||||||||||
| 265 | |||||||||||||||||||||
| 266 | =cut | ||||||||||||||||||||
| 267 | |||||||||||||||||||||
| 268 | 0 | ▶ | sub shufflePlaylist() { | ||||||||||||||||||
|
Subroutine
shufflePlaylist: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||
| 269 | 0 | my $self = shift; | |||||||||||||||||||
| 270 | 0 | $self->run( "shufflePlaylist" ); | |||||||||||||||||||
| 271 | } | ||||||||||||||||||||
| 272 | |||||||||||||||||||||
| 273 | =item togglePlaylist() | ||||||||||||||||||||
| 274 | |||||||||||||||||||||
| 275 | Show/Hide playlist. | ||||||||||||||||||||
| 276 | |||||||||||||||||||||
| 277 | =cut | ||||||||||||||||||||
| 278 | |||||||||||||||||||||
| 279 | 0 | ▶ | sub togglePlaylist() { | ||||||||||||||||||
|
Subroutine
togglePlaylist: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||
| 280 | 0 | my $self = shift; | |||||||||||||||||||
| 281 | 0 | $self->run( "togglePlaylist" ); | |||||||||||||||||||
| 282 | } | ||||||||||||||||||||
| 283 | |||||||||||||||||||||
| 284 | 1 | 1; | |||||||||||||||||||
| 285 | |||||||||||||||||||||
| 286 | __END__ | ||||||||||||||||||||