Class: XBMC::XBMC
Instance Attribute Summary collapse
-
#error ⇒ Object
Returns the value of attribute error.
Instance Method Summary collapse
-
#Action(code) ⇒ Object
Commands that Generate Actions.
-
#AddToPlayList(media, playlist = nil, mask = nil, recursive = true) ⇒ Object
Commands that Modify Settings.
- #AddToSlideshow(media, mask = "[pictures]", recursive = true) ⇒ Object
- #ClearPlayList(playlist = nil) ⇒ Object
- #ClearSlideshow ⇒ Object
- #error? ⇒ Boolean
- #Exit ⇒ Object
- #GetCurrentlyPlaying ⇒ Object
- #GetCurrentPlaylist ⇒ Object
- #GetCurrentSlide ⇒ Object
- #GetDirectory(directory, mask = " ", showdate = false) ⇒ Object
- #GetGuiDescription ⇒ Object
- #GetGuiSetting(type, name) ⇒ Object
- #GetGuiStatus ⇒ Object
- #GetLogLevel ⇒ Object
-
#GetMediaLocation(type, path = nil, showdate = false) ⇒ Object
XBMC API Commands that Retrieve Information.
- #GetMovieDetails ⇒ Object
- #GetMusicLabel ⇒ Object
- #GetPercentage ⇒ Object
- #GetPlaylistContents(playlist = nil) ⇒ Object
- #GetPlaylistLength(playlist = nil) ⇒ Object
- #GetPlaylistSong(position = nil) ⇒ Object
- #GetPlaySpeed ⇒ Object
- #GetRecordStatus ⇒ Object
- #GetShares(type) ⇒ Object
- #GetSlideshowContents ⇒ Object
- #GetSystemInfo(*args) ⇒ Object
- #GetSystemInfoByName(*args) ⇒ Object
- #GetTagFromFilename(fullpath) ⇒ Object
- #GetThumbFilename ⇒ Object
- #GetVideoLabel ⇒ Object
- #GetVolume ⇒ Object
- #host ⇒ Object
-
#initialize(host, port = nil, user = nil, pass = nil) ⇒ XBMC
constructor
END XBMC API.
- #KeyRepeat(rate) ⇒ Object
- #Move(deltaX, deltaY) ⇒ Object
- #Mute ⇒ Object
- #Pause ⇒ Object
- #PlayFile(filename, playlist = nil) ⇒ Object
- #PlayListNext ⇒ Object
- #PlayListPrev ⇒ Object
- #PlayNext ⇒ Object
- #PlayPrev ⇒ Object
- #PlaySlideshow(directory = nil, recursive = true) ⇒ Object
- #port ⇒ Object
- #print_error ⇒ Object
- #QueryMusicDatabase ⇒ Object
- #QueryVideoDatabase ⇒ Object
- #RemoveFromPlaylist(item, playlist = nil) ⇒ Object
- #Reset ⇒ Object
- #Restart ⇒ Object
- #RestartApp ⇒ Object
- #Rotate ⇒ Object
- #SeekPercentage(percentage) ⇒ Object
- #SeekPercentageRelative(percentage) ⇒ Object
- #SendKey(buttoncode) ⇒ Object
- #SetAutoGetPictureThumbs(boolean = true) ⇒ Object
- #SetCurrentPlaylist(playlist) ⇒ Object
- #SetGUISetting(type, name, value) ⇒ Object
- #SetLogLevel(level) ⇒ Object
- #SetPlaylistSong(position) ⇒ Object
- #SetPlaySpeed(speed) ⇒ Object
- #SetVolume(volume) ⇒ Object
- #ShowPicture(filename) ⇒ Object
- #Shutdown ⇒ Object
- #SlideshowSelect(filename) ⇒ Object
- #SpinDownHardDisk ⇒ Object
- #Stop ⇒ Object
- #TakeScreenshot(width = 300, height = 200, quality = 90, rotation = 0, download = true, filename = "xbmc-screen.jpg", flash = true, imgtag = false) ⇒ Object
- #Zoom(zoom) ⇒ Object
Constructor Details
#initialize(host, port = nil, user = nil, pass = nil) ⇒ XBMC
END XBMC API
475 476 477 |
# File 'lib/ruby-xbmc.rb', line 475 def initialize(host, port=nil, user=nil, pass=nil) @@connection = Connection.new(host, port, user, pass) end |
Instance Attribute Details
#error ⇒ Object
Returns the value of attribute error.
180 181 182 |
# File 'lib/ruby-xbmc.rb', line 180 def error @error end |
Instance Method Details
#Action(code) ⇒ Object
Commands that Generate Actions
380 381 382 |
# File 'lib/ruby-xbmc.rb', line 380 def Action(code) # Sends a raw Action ID (see key.h) success?(parse(cmd(with_args(code)))) end |
#AddToPlayList(media, playlist = nil, mask = nil, recursive = true) ⇒ Object
Commands that Modify Settings
304 305 306 307 308 309 310 311 |
# File 'lib/ruby-xbmc.rb', line 304 def AddToPlayList(media, playlist=nil, mask=nil, recursive=true) if(recursive == true) recursive = 1 else recursive = 0 end success?(parse(cmd(with_args(media, playlist, mask, recursive)))) end |
#AddToSlideshow(media, mask = "[pictures]", recursive = true) ⇒ Object
313 314 315 316 317 318 319 320 |
# File 'lib/ruby-xbmc.rb', line 313 def AddToSlideshow(media, mask="[pictures]", recursive=true) if(recursive == true) recursive = 1 else recursive = 0 end success?(parse(cmd(with_args(media, mask, recursive)))) end |
#ClearPlayList(playlist = nil) ⇒ Object
322 323 324 |
# File 'lib/ruby-xbmc.rb', line 322 def ClearPlayList(playlist=nil) success?(parse(cmd(with_args(playlist)))) end |
#ClearSlideshow ⇒ Object
326 327 328 |
# File 'lib/ruby-xbmc.rb', line 326 def ClearSlideshow success?(parse(cmd())) end |
#error? ⇒ Boolean
479 480 481 |
# File 'lib/ruby-xbmc.rb', line 479 def error? not error.nil? end |
#Exit ⇒ Object
384 385 386 |
# File 'lib/ruby-xbmc.rb', line 384 def Exit success?(parse(cmd())) end |
#GetCurrentlyPlaying ⇒ Object
200 201 202 203 204 |
# File 'lib/ruby-xbmc.rb', line 200 def GetCurrentlyPlaying song = parse_asdict(cmd()) return nil if(song.length <= 1) song end |
#GetCurrentPlaylist ⇒ Object
196 197 198 |
# File 'lib/ruby-xbmc.rb', line 196 def GetCurrentPlaylist parse(cmd()) end |
#GetCurrentSlide ⇒ Object
206 207 208 |
# File 'lib/ruby-xbmc.rb', line 206 def GetCurrentSlide parse(cmd()) end |
#GetDirectory(directory, mask = " ", showdate = false) ⇒ Object
210 211 212 213 214 215 216 |
# File 'lib/ruby-xbmc.rb', line 210 def GetDirectory(directory, mask=" ", showdate=false) if(showdate) parse_asdictlist(cmd(with_args(directory, mask, 1)), ["path", "date"]) else parse_aslist(cmd(with_args(directory, mask))) end end |
#GetGuiDescription ⇒ Object
218 219 220 |
# File 'lib/ruby-xbmc.rb', line 218 def GetGuiDescription parse_asdict(cmd()) end |
#GetGuiSetting(type, name) ⇒ Object
222 223 224 |
# File 'lib/ruby-xbmc.rb', line 222 def GetGuiSetting(type, name) parse(cmd(with_args(type, name))) end |
#GetGuiStatus ⇒ Object
226 227 228 |
# File 'lib/ruby-xbmc.rb', line 226 def GetGuiStatus parse_asdict(cmd()) end |
#GetLogLevel ⇒ Object
290 291 292 |
# File 'lib/ruby-xbmc.rb', line 290 def GetLogLevel parse(cmd()) end |
#GetMediaLocation(type, path = nil, showdate = false) ⇒ Object
XBMC API Commands that Retrieve Information
184 185 186 187 188 189 190 |
# File 'lib/ruby-xbmc.rb', line 184 def GetMediaLocation(type, path=nil, showdate=false) if(showdate) parse_asdictlist(cmd(with_args(type, path, "showdate")), ["name", "path", "type", "date"]) else parse_asdictlist(cmd(with_args(type, path)), ["name", "path", "type"]) end end |
#GetMovieDetails ⇒ Object
230 231 232 |
# File 'lib/ruby-xbmc.rb', line 230 def GetMovieDetails puts "Not implemented" end |
#GetMusicLabel ⇒ Object
254 255 256 |
# File 'lib/ruby-xbmc.rb', line 254 def GetMusicLabel puts "Not implemented" end |
#GetPercentage ⇒ Object
234 235 236 |
# File 'lib/ruby-xbmc.rb', line 234 def GetPercentage parse(cmd()) end |
#GetPlaylistContents(playlist = nil) ⇒ Object
238 239 240 |
# File 'lib/ruby-xbmc.rb', line 238 def GetPlaylistContents(playlist=nil) parse_aslist(cmd(with_args(playlist))) end |
#GetPlaylistLength(playlist = nil) ⇒ Object
242 243 244 |
# File 'lib/ruby-xbmc.rb', line 242 def GetPlaylistLength(playlist=nil) parse(cmd(with_args(playlist))) end |
#GetPlaylistSong(position = nil) ⇒ Object
246 247 248 |
# File 'lib/ruby-xbmc.rb', line 246 def GetPlaylistSong(position=nil) parse(cmd(with_args(position))) end |
#GetPlaySpeed ⇒ Object
250 251 252 |
# File 'lib/ruby-xbmc.rb', line 250 def GetPlaySpeed parse(cmd()) end |
#GetRecordStatus ⇒ Object
258 259 260 |
# File 'lib/ruby-xbmc.rb', line 258 def GetRecordStatus puts "Not implemented" end |
#GetShares(type) ⇒ Object
192 193 194 |
# File 'lib/ruby-xbmc.rb', line 192 def GetShares(type) parse_asdictlist(cmd(with_args(type)), ["name", "path"]) end |
#GetSlideshowContents ⇒ Object
266 267 268 |
# File 'lib/ruby-xbmc.rb', line 266 def GetSlideshowContents parse_aslist(cmd()) end |
#GetSystemInfo(*args) ⇒ Object
270 271 272 |
# File 'lib/ruby-xbmc.rb', line 270 def GetSystemInfo(*args) parse_aslist(cmd(with_args(args))) end |
#GetSystemInfoByName(*args) ⇒ Object
274 275 276 |
# File 'lib/ruby-xbmc.rb', line 274 def GetSystemInfoByName(*args) parse_aslist(cmd(with_args(args))) end |
#GetTagFromFilename(fullpath) ⇒ Object
278 279 280 |
# File 'lib/ruby-xbmc.rb', line 278 def GetTagFromFilename(fullpath) parse_asdict(cmd(with_args(fullpath))) end |
#GetThumbFilename ⇒ Object
282 283 284 |
# File 'lib/ruby-xbmc.rb', line 282 def GetThumbFilename puts "Not implemented" end |
#GetVideoLabel ⇒ Object
262 263 264 |
# File 'lib/ruby-xbmc.rb', line 262 def GetVideoLabel puts "Not implemented" end |
#GetVolume ⇒ Object
286 287 288 |
# File 'lib/ruby-xbmc.rb', line 286 def GetVolume parse(cmd()) end |
#host ⇒ Object
487 488 489 |
# File 'lib/ruby-xbmc.rb', line 487 def host @@connection.host end |
#KeyRepeat(rate) ⇒ Object
388 389 390 |
# File 'lib/ruby-xbmc.rb', line 388 def KeyRepeat(rate) success?(parse(cmd(with_args(rate)))) end |
#Move(deltaX, deltaY) ⇒ Object
392 393 394 |
# File 'lib/ruby-xbmc.rb', line 392 def Move(deltaX, deltaY) success?(parse(cmd(with_args(deltaX, deltaY)))) end |
#Mute ⇒ Object
330 331 332 |
# File 'lib/ruby-xbmc.rb', line 330 def Mute success?(parse(cmd())) end |
#Pause ⇒ Object
396 397 398 |
# File 'lib/ruby-xbmc.rb', line 396 def Pause success?(parse(cmd())) end |
#PlayFile(filename, playlist = nil) ⇒ Object
420 421 422 |
# File 'lib/ruby-xbmc.rb', line 420 def PlayFile(filename, playlist=nil) success?(parse(cmd(with_args(filename, playlist)))) end |
#PlayListNext ⇒ Object
400 401 402 |
# File 'lib/ruby-xbmc.rb', line 400 def PlayListNext success?(parse(cmd())) end |
#PlayListPrev ⇒ Object
404 405 406 |
# File 'lib/ruby-xbmc.rb', line 404 def PlayListPrev success?(parse(cmd())) end |
#PlayNext ⇒ Object
408 409 410 |
# File 'lib/ruby-xbmc.rb', line 408 def PlayNext success?(parse(cmd())) end |
#PlayPrev ⇒ Object
412 413 414 |
# File 'lib/ruby-xbmc.rb', line 412 def PlayPrev success?(parse(cmd())) end |
#PlaySlideshow(directory = nil, recursive = true) ⇒ Object
416 417 418 |
# File 'lib/ruby-xbmc.rb', line 416 def PlaySlideshow(directory=nil, recursive=true) success?(parse(cmd(with_args(directory, recursive)))) end |
#port ⇒ Object
491 492 493 |
# File 'lib/ruby-xbmc.rb', line 491 def port @@connection.port end |
#print_error ⇒ Object
483 484 485 |
# File 'lib/ruby-xbmc.rb', line 483 def print_error $stderr.puts "Error: " + @error if @error != nil end |
#QueryMusicDatabase ⇒ Object
294 295 296 |
# File 'lib/ruby-xbmc.rb', line 294 def QueryMusicDatabase puts "Not implemented" end |
#QueryVideoDatabase ⇒ Object
298 299 300 |
# File 'lib/ruby-xbmc.rb', line 298 def QueryVideoDatabase puts "Not implemented" end |
#RemoveFromPlaylist(item, playlist = nil) ⇒ Object
334 335 336 |
# File 'lib/ruby-xbmc.rb', line 334 def RemoveFromPlaylist(item, playlist=nil) success?(parse(cmd(with_args(item, playlist)))) end |
#Reset ⇒ Object
424 425 426 |
# File 'lib/ruby-xbmc.rb', line 424 def Reset success?(parse(cmd())) end |
#Restart ⇒ Object
428 429 430 |
# File 'lib/ruby-xbmc.rb', line 428 def Restart success?(parse(cmd())) end |
#RestartApp ⇒ Object
432 433 434 |
# File 'lib/ruby-xbmc.rb', line 432 def RestartApp success?(parse(cmd())) end |
#Rotate ⇒ Object
436 437 438 |
# File 'lib/ruby-xbmc.rb', line 436 def Rotate success?(parse(cmd())) end |
#SeekPercentage(percentage) ⇒ Object
338 339 340 |
# File 'lib/ruby-xbmc.rb', line 338 def SeekPercentage(percentage) success?(parse(cmd(with_args(percentage)))) end |
#SeekPercentageRelative(percentage) ⇒ Object
342 343 344 |
# File 'lib/ruby-xbmc.rb', line 342 def SeekPercentageRelative(percentage) success?(parse(cmd(with_args(percentage)))) end |
#SendKey(buttoncode) ⇒ Object
440 441 442 |
# File 'lib/ruby-xbmc.rb', line 440 def SendKey() success?(parse(cmd(with_args()))) end |
#SetAutoGetPictureThumbs(boolean = true) ⇒ Object
374 375 376 |
# File 'lib/ruby-xbmc.rb', line 374 def SetAutoGetPictureThumbs(boolean=true) success?(parse(cmd(with_args(boolean)))) end |
#SetCurrentPlaylist(playlist) ⇒ Object
346 347 348 |
# File 'lib/ruby-xbmc.rb', line 346 def SetCurrentPlaylist(playlist) success?(parse(cmd(with_args(playlist)))) end |
#SetGUISetting(type, name, value) ⇒ Object
350 351 352 |
# File 'lib/ruby-xbmc.rb', line 350 def SetGUISetting(type, name, value) success?(parse(cmd(with_args(type, name, value)))) end |
#SetLogLevel(level) ⇒ Object
370 371 372 |
# File 'lib/ruby-xbmc.rb', line 370 def SetLogLevel(level) success?(parse(cmd(with_args(level)))) end |
#SetPlaylistSong(position) ⇒ Object
354 355 356 |
# File 'lib/ruby-xbmc.rb', line 354 def SetPlaylistSong(position) success?(parse(cmd(with_args(position)))) end |
#SetPlaySpeed(speed) ⇒ Object
358 359 360 |
# File 'lib/ruby-xbmc.rb', line 358 def SetPlaySpeed(speed) success?(parse(cmd(with_args(speed)))) end |
#SetVolume(volume) ⇒ Object
366 367 368 |
# File 'lib/ruby-xbmc.rb', line 366 def SetVolume(volume) success?(parse(cmd(with_args(volume)))) end |
#ShowPicture(filename) ⇒ Object
444 445 446 |
# File 'lib/ruby-xbmc.rb', line 444 def ShowPicture(filename) success?(parse(cmd(with_args(filename)))) end |
#Shutdown ⇒ Object
448 449 450 |
# File 'lib/ruby-xbmc.rb', line 448 def Shutdown success?(parse(cmd())) end |
#SlideshowSelect(filename) ⇒ Object
362 363 364 |
# File 'lib/ruby-xbmc.rb', line 362 def SlideshowSelect(filename) success?(parse(cmd(with_args(filename)))) end |
#SpinDownHardDisk ⇒ Object
452 453 454 |
# File 'lib/ruby-xbmc.rb', line 452 def SpinDownHardDisk success?(parse(cmd())) end |
#Stop ⇒ Object
456 457 458 |
# File 'lib/ruby-xbmc.rb', line 456 def Stop success?(parse(cmd())) end |
#TakeScreenshot(width = 300, height = 200, quality = 90, rotation = 0, download = true, filename = "xbmc-screen.jpg", flash = true, imgtag = false) ⇒ Object
460 461 462 463 464 465 466 467 |
# File 'lib/ruby-xbmc.rb', line 460 def TakeScreenshot(width=300, height=200, quality=90, rotation=0, download=true, filename="xbmc-screen.jpg", flash=true, imgtag=false) if(imgtag) imgtag = "imgtag" else imgtag = nil end parse(cmd(with_args(filename, flash, rotation, width, height, quality, download, imgtag))) end |
#Zoom(zoom) ⇒ Object
469 470 471 |
# File 'lib/ruby-xbmc.rb', line 469 def Zoom(zoom) success?(parse(cmd(with_args(zoom)))) end |