Class: KodiClient::Methods::Files
Overview
contains all Kodi Application methods
Constant Summary
collapse
- GET_DIRECTORY =
'Files.GetDirectory'
- GET_FILE_DETAILS =
'Files.GetFileDetails'
- GET_SOURCES =
'Files.GetSources'
- PREPARE_DOWNLOAD =
'Files.PrepareDownload'
- SET_FILE_DETAILS =
'Files.SetFileDetails'
Instance Method Summary
collapse
-
#get_directory(directory, media = Types::Files::Media::FILES, properties = Types::List::ListFieldFiles.all_properties, sort = Types::List::ListSort.new, limits = Types::List::ListLimits.new(0, 50), kodi_id = 1) ⇒ Object
-
#get_file_details(file, media = Types::Files::Media::FILES, properties = Types::List::ListFieldFiles.all_properties, kodi_id = 1) ⇒ Object
-
#get_sources(media = Types::Files::Media::FILES, sort = Types::List::ListSort.new, limits = Types::List::ListLimits.new(0, 50), kodi_id = 1) ⇒ Object
-
#prepare_download(path, kodi_id = 1) ⇒ Object
-
#set_file_details(file, media = Types::Files::Media::VIDEO, play_count = nil, last_played = nil, resume = nil, kodi_id = 1) ⇒ Object
Methods inherited from KodiMethod
#apply_options, #invoke_api
Instance Method Details
#get_directory(directory, media = Types::Files::Media::FILES, properties = Types::List::ListFieldFiles.all_properties, sort = Types::List::ListSort.new, limits = Types::List::ListLimits.new(0, 50), kodi_id = 1) ⇒ Object
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
|
# File 'lib/kodi_client/methods/files.rb', line 14
def get_directory(directory, media = Types::Files::Media::FILES,
properties = Types::List::ListFieldFiles.all_properties,
sort = Types::List::ListSort.new,
limits = Types::List::ListLimits.new(0, 50), kodi_id = 1)
request = KodiRequest.new(kodi_id, GET_DIRECTORY,
{
'directory' => directory,
'media' => media,
'properties' => properties,
'sort' => sort.to_h,
'limits' => limits.to_h
})
json = invoke_api(request)
result = KodiClient::Types::Files::GetDirectoryReturned.create(json['result'])
json['result'] = result
KodiResponse.new(json)
end
|
#get_file_details(file, media = Types::Files::Media::FILES, properties = Types::List::ListFieldFiles.all_properties, kodi_id = 1) ⇒ Object
#get_sources(media = Types::Files::Media::FILES, sort = Types::List::ListSort.new, limits = Types::List::ListLimits.new(0, 50), kodi_id = 1) ⇒ Object
#prepare_download(path, kodi_id = 1) ⇒ Object
#set_file_details(file, media = Types::Files::Media::VIDEO, play_count = nil, last_played = nil, resume = nil, kodi_id = 1) ⇒ Object
69
70
71
72
73
74
75
76
77
78
|
# File 'lib/kodi_client/methods/files.rb', line 69
def set_file_details(file, media = Types::Files::Media::VIDEO, play_count = nil, last_played = nil,
resume = nil, kodi_id = 1)
params = { 'file' => file, 'media' => media}
params['playcount'] = play_count unless play_count.nil?
params['lastplayed'] = last_played unless last_played.nil?
params['resume'] = resume unless resume.nil?
request = KodiRequest.new(kodi_id, SET_FILE_DETAILS, params)
json = invoke_api(request)
KodiResponse.new(json)
end
|