Class: Kodipity::Channel
- Inherits:
-
Object
- Object
- Kodipity::Channel
- Defined in:
- lib/kodipity/models.rb
Instance Attribute Summary collapse
-
#channel_id ⇒ Object
Returns the value of attribute channel_id.
-
#name ⇒ Object
Returns the value of attribute name.
Instance Method Summary collapse
-
#initialize(name, channel_id) ⇒ Channel
constructor
A new instance of Channel.
- #play ⇒ Object
Constructor Details
#initialize(name, channel_id) ⇒ Channel
Returns a new instance of Channel.
47 48 49 50 51 52 53 |
# File 'lib/kodipity/models.rb', line 47 def initialize(name, channel_id) @name = name @channel_id = channel_id @url = 'http://rpi-osmc.lan/jsonrpc' @headers = {"Content-Type" => 'application/json'} @json = {jsonrpc: '2.0', id: 1, method: 'PVR.GetRecordingDetails', params: { properties: ['title','plot','plotoutline','file', 'channel','runtime', 'genre', 'playcount','starttime'] } } end |
Instance Attribute Details
#channel_id ⇒ Object
Returns the value of attribute channel_id.
45 46 47 |
# File 'lib/kodipity/models.rb', line 45 def channel_id @channel_id end |
#name ⇒ Object
Returns the value of attribute name.
45 46 47 |
# File 'lib/kodipity/models.rb', line 45 def name @name end |
Instance Method Details
#play ⇒ Object
55 56 57 58 59 |
# File 'lib/kodipity/models.rb', line 55 def play @json[:method] = 'Player.Open' @json[:params] = { item: { channelid: @channel_id } } HTTParty.post @url, headers: @headers, body: @json.to_json end |