@@ -204,7 +204,7 @@ def dvr_param_load(dvr_uuid_sel):
204
204
dvr_clone = find_param (dvr_load , 'clone' )
205
205
dvr_storage = find_param (dvr_load , 'storage' )
206
206
xbmcaddon .Addon ().setSetting (id = 'dvrstorage' , value = dvr_storage )
207
- dvr_info_list = ["Name: " + str (dvr_name ), "Enabled: " + str (dvr_enabled ), "Storage: " + str (dvr_storage ), "Days to Keep Recordings: " + str (dvr_keep ), "Duplicate Recording Timer If Error Occurs: " + str (dvr_clone ), "Stream Profile: " + str (dvr_profile ), "Recording File and Folder options" ]
207
+ dvr_info_list = ["Name: " + str (dvr_name ), "Enabled: " + str (dvr_enabled ), "Storage: " + str (dvr_storage ), "Days to Keep Recordings: " + str (dvr_keep ), "Duplicate Recording Timer If Error Occurs: " + str (dvr_clone ), "Stream Profile: " + str (dvr_profile ), "Recording File and Folder options" , "Timeshift Options" ]
208
208
dvr_param_edit (dvr_uuid_sel , dvr_info_list , dvr_keep_key , dvr_keep_val , dvr_name , dvr_enabled , dvr_storage , dvr_keep , dvr_clone , dvr_profile_key , dvr_profile_val , dvr_profile )
209
209
210
210
def dvr_param_edit (dvr_uuid_sel , dvr_info_list , dvr_keep_key , dvr_keep_val , dvr_name , dvr_enabled , dvr_storage , dvr_keep , dvr_clone , dvr_profile_key , dvr_profile_val , dvr_profile ):
@@ -251,6 +251,8 @@ def dvr_param_edit(dvr_uuid_sel, dvr_info_list, dvr_keep_key, dvr_keep_val, dvr_
251
251
param_update = '"profile":' + str (dvr_profile )
252
252
if sel_param == 6 :
253
253
dvr_file_param_load (dvr_uuid_sel )
254
+ if sel_param == 7 :
255
+ time_param_load (dvr_uuid_sel )
254
256
if param_update != "" :
255
257
param_url = 'http://' + tvh_url + ':' + tvh_port + '/api/idnode/save?node={' + param_update + ',"uuid":"' + dvr_uuid_sel + '"}'
256
258
param_save = requests .get (param_url )
@@ -345,6 +347,94 @@ def dvr_file_param_edit(dvr_uuid_sel, dvr_file_info_list, dvr_day_dir, dvr_chann
345
347
param_save = requests .get (param_url )
346
348
dvr_file_param_load (dvr_uuid_sel )
347
349
350
+ def time_param_load (dvr_uuid_sel ):
351
+ time_url = 'http://' + tvh_url + ':' + tvh_port + '/api/timeshift/config/load'
352
+ time_load = requests .get (time_url ).json ()
353
+ time_enabled = find_param (time_load , 'enabled' )
354
+ time_ondemand = find_param (time_load , 'ondemand' )
355
+ time_path = find_param (time_load , 'path' )
356
+ time_max_period = find_param (time_load , 'max_period' )
357
+ time_unlimited_period = find_param (time_load , 'unlimited_period' )
358
+ time_max_size = find_param (time_load , 'max_size' )
359
+ time_ram_size = find_param (time_load , 'ram_size' )
360
+ time_unlimited_size = find_param (time_load , 'unlimited_size' )
361
+ time_ram_only = find_param (time_load , 'ram_only' )
362
+ time_ram_fit = find_param (time_load , 'ram_fit' )
363
+ time_teletext = find_param (time_load , 'teletext' )
364
+ time_info_list = ["Timeshift Enabled: " + str (time_enabled ), "Maximum Time (mins): " + str (time_max_period ), "Storage Path: " + str (time_path ), "Maximum Size (MB): " + str (time_max_size ), "Maximum RAM Size (MB): " + str (time_ram_size ), "RAM Only: " + str (time_ram_only ), "On-demand (no first rewind): " + str (time_ondemand ), "Unlimited Time: " + str (time_unlimited_period ), "Unlimited Size: " + str (time_unlimited_size ), "Fit to RAM (cut rewind): " + str (time_ram_fit ), "Include Teletext: " + str (time_teletext )]
365
+ time_param_edit (dvr_uuid_sel , time_info_list , time_enabled , time_max_period , time_path , time_max_size , time_ram_size , time_ram_only , time_ondemand , time_unlimited_period , time_unlimited_size , time_ram_fit , time_teletext )
366
+
367
+ def time_param_edit (dvr_uuid_sel , time_info_list , time_enabled , time_max_period , time_path , time_max_size , time_ram_size , time_ram_only , time_ondemand , time_unlimited_period , time_unlimited_size , time_ram_fit , time_teletext ):
368
+ sel_param = dialog .select ('Timeshift Options - Select parameter to edit' , list = time_info_list )
369
+ if sel_param < 0 :
370
+ return
371
+ if sel_param >= 0 :
372
+ param_update = ""
373
+ if sel_param == 0 :
374
+ sel_enabled = dialog .select ('Enable/Disable the timeshift function' , list = enabledisable )
375
+ if sel_enabled >= 0 :
376
+ time_enabled = truefalse [sel_enabled ]
377
+ param_update = '"enabled":' + time_enabled
378
+ if sel_param == 1 :
379
+ sel_num = dialog .input ('Set maximum time for buffering (minutes)' , defaultt = str (time_max_period ),type = xbmcgui .INPUT_NUMERIC )
380
+ if sel_num >= 0 :
381
+ time_max_period = sel_num
382
+ param_update = '"max_period":' + str (time_max_period )
383
+ if sel_param == 2 :
384
+ if tvh_url == "127.0.0.1" :
385
+ plugin .open_settings ()
386
+ time_storage_update_tvh = xbmcaddon .Addon ().getSetting ('timestorage' )
387
+ param_update = '"path":"' + str (time_storage_update_tvh ) + '"'
388
+ else :
389
+ dialog .ok ('Tvheadend backend on network location' , 'Your Tvheadend backend is located on a network. Currently Kodi cannot browse network folders.' , 'Please enter the DVR recording location manually.' )
390
+ time_storage_update_tvh = dialog .input ('Edit the timeshift buffer path' , defaultt = time_path ,type = xbmcgui .INPUT_ALPHANUM )
391
+ xbmcaddon .Addon ().setSetting (id = 'timestorage' , value = time_storage_update_tvh )
392
+ param_update = '"path":"' + str (time_storage_update_tvh ) + '"'
393
+ if sel_param == 3 :
394
+ sel_num = dialog .input ('Set maximum storage size for buffering (MB)' , defaultt = str (time_max_size ),type = xbmcgui .INPUT_NUMERIC )
395
+ if sel_num >= 0 :
396
+ time_max_size = sel_num
397
+ param_update = '"max_size":' + str (time_max_size )
398
+ if sel_param == 4 :
399
+ sel_num = dialog .input ('Set maximum RAM size for buffering (MB)' , defaultt = str (time_ram_size ),type = xbmcgui .INPUT_NUMERIC )
400
+ if sel_num >= 0 :
401
+ time_ram_size = sel_num
402
+ param_update = '"ram_size":' + str (time_ram_size )
403
+ if sel_param == 5 :
404
+ sel_enabled = dialog .select ('Enable/Disable to use RAM only' , list = enabledisable )
405
+ if sel_enabled >= 0 :
406
+ time_ram_only = truefalse [sel_enabled ]
407
+ param_update = '"ram_only":' + time_ram_only
408
+ if sel_param == 6 :
409
+ sel_enabled = dialog .select ('Enable/Disable timeshift on-demand (no first rewind)' , list = enabledisable )
410
+ if sel_enabled >= 0 :
411
+ time_ondemand = truefalse [sel_enabled ]
412
+ param_update = '"ondemand":' + time_ondemand
413
+ if sel_param == 7 :
414
+ sel_enabled = dialog .select ('Enable/Disable unlimited time (may cause slowdown)' , list = enabledisable )
415
+ if sel_enabled >= 0 :
416
+ time_unlimited_period = truefalse [sel_enabled ]
417
+ param_update = '"unlimited_period":' + time_unlimited_period
418
+ if sel_param == 8 :
419
+ sel_enabled = dialog .select ('Enable/Disable unlimited size (uses all storage)' , list = enabledisable )
420
+ if sel_enabled >= 0 :
421
+ time_unlimited_size = truefalse [sel_enabled ]
422
+ param_update = '"unlimited_size":' + time_unlimited_size
423
+ if sel_param == 9 :
424
+ sel_enabled = dialog .select ('Enable/Disable fit to RAM (clears oldest buffer)' , list = enabledisable )
425
+ if sel_enabled >= 0 :
426
+ time_ram_fit = truefalse [sel_enabled ]
427
+ param_update = '"ram_fit":' + time_ram_fit
428
+ if sel_param == 5 :
429
+ sel_enabled = dialog .select ('Enable/Disable to include teletext data' , list = enabledisable )
430
+ if sel_enabled >= 0 :
431
+ time_teletext = truefalse [sel_enabled ]
432
+ param_update = '"teletext":' + time_teletext
433
+ if param_update != "" :
434
+ param_url = 'http://' + tvh_url + ':' + tvh_port + '/api/timeshift/config/save?node={' + param_update + '}'
435
+ param_save = requests .get (param_url )
436
+ time_param_load (dvr_uuid_sel )
437
+
348
438
def muxes_load (net_uuid_sel ):
349
439
net_url = 'http://' + tvh_url + ':' + tvh_port + '/api/idnode/load?uuid=' + str (net_uuid_sel )
350
440
net_load = requests .get (net_url ).json ()
0 commit comments