Class: XBMC::XBMC

Inherits:
Object show all
Defined in:
lib/ruby-xbmc.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

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

#errorObject

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

#ClearSlideshowObject



326
327
328
# File 'lib/ruby-xbmc.rb', line 326

def ClearSlideshow
    success?(parse(cmd()))
end

#error?Boolean

Returns:

  • (Boolean)


479
480
481
# File 'lib/ruby-xbmc.rb', line 479

def error?
    not error.nil?
end

#ExitObject



384
385
386
# File 'lib/ruby-xbmc.rb', line 384

def Exit
    success?(parse(cmd()))
end

#GetCurrentlyPlayingObject



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

#GetCurrentPlaylistObject



196
197
198
# File 'lib/ruby-xbmc.rb', line 196

def GetCurrentPlaylist
    parse(cmd())
end

#GetCurrentSlideObject



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

#GetGuiDescriptionObject



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

#GetGuiStatusObject



226
227
228
# File 'lib/ruby-xbmc.rb', line 226

def GetGuiStatus
    parse_asdict(cmd())
end

#GetLogLevelObject



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

#GetMovieDetailsObject



230
231
232
# File 'lib/ruby-xbmc.rb', line 230

def GetMovieDetails
    puts "Not implemented"
end

#GetMusicLabelObject



254
255
256
# File 'lib/ruby-xbmc.rb', line 254

def GetMusicLabel
    puts "Not implemented"
end

#GetPercentageObject



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

#GetPlaySpeedObject



250
251
252
# File 'lib/ruby-xbmc.rb', line 250

def GetPlaySpeed
    parse(cmd())
end

#GetRecordStatusObject



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

#GetSlideshowContentsObject



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

#GetThumbFilenameObject



282
283
284
# File 'lib/ruby-xbmc.rb', line 282

def GetThumbFilename
    puts "Not implemented"
end

#GetVideoLabelObject



262
263
264
# File 'lib/ruby-xbmc.rb', line 262

def GetVideoLabel
    puts "Not implemented"
end

#GetVolumeObject



286
287
288
# File 'lib/ruby-xbmc.rb', line 286

def GetVolume
    parse(cmd())
end

#hostObject



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

#MuteObject



330
331
332
# File 'lib/ruby-xbmc.rb', line 330

def Mute
    success?(parse(cmd()))
end

#PauseObject



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

#PlayListNextObject



400
401
402
# File 'lib/ruby-xbmc.rb', line 400

def PlayListNext
    success?(parse(cmd()))
end

#PlayListPrevObject



404
405
406
# File 'lib/ruby-xbmc.rb', line 404

def PlayListPrev
    success?(parse(cmd()))
end

#PlayNextObject



408
409
410
# File 'lib/ruby-xbmc.rb', line 408

def PlayNext
    success?(parse(cmd()))
end

#PlayPrevObject



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

#portObject



491
492
493
# File 'lib/ruby-xbmc.rb', line 491

def port
    @@connection.port
end


483
484
485
# File 'lib/ruby-xbmc.rb', line 483

def print_error
    $stderr.puts "Error: " + @error if @error != nil
end

#QueryMusicDatabaseObject



294
295
296
# File 'lib/ruby-xbmc.rb', line 294

def QueryMusicDatabase
    puts "Not implemented"
end

#QueryVideoDatabaseObject



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

#ResetObject



424
425
426
# File 'lib/ruby-xbmc.rb', line 424

def Reset
    success?(parse(cmd()))
end

#RestartObject



428
429
430
# File 'lib/ruby-xbmc.rb', line 428

def Restart
    success?(parse(cmd()))
end

#RestartAppObject



432
433
434
# File 'lib/ruby-xbmc.rb', line 432

def RestartApp
    success?(parse(cmd()))
end

#RotateObject



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(buttoncode)
    success?(parse(cmd(with_args(buttoncode))))
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

#ShutdownObject



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

#SpinDownHardDiskObject



452
453
454
# File 'lib/ruby-xbmc.rb', line 452

def SpinDownHardDisk
    success?(parse(cmd()))
end

#StopObject



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