uint64_t timeshift_max_size;
uint64_t timeshift_ram_size;
uint64_t timeshift_ram_segment_size;
+int timeshift_ram_only;
+
+/*
+ * Safe values for RAM configuration
+ */
+static void timeshift_fixup ( void )
+{
+ if (timeshift_ram_only)
+ timeshift_max_size = timeshift_ram_size;
+}
/*
* Intialise global file manager
timeshift_ram_size = 1048576LL * u32;
timeshift_ram_segment_size = timeshift_ram_size / 10;
}
+ if (!htsmsg_get_u32(m, "ram_only", &u32))
+ timeshift_ram_only = u32 ? 1 : 0;
htsmsg_destroy(m);
+ timeshift_fixup();
}
}
{
htsmsg_t *m;
+ timeshift_fixup();
+
m = htsmsg_create_map();
htsmsg_add_u32(m, "enabled", timeshift_enabled);
htsmsg_add_u32(m, "ondemand", timeshift_ondemand);
htsmsg_add_u32(m, "unlimited_size", timeshift_unlimited_size);
htsmsg_add_u32(m, "max_size", timeshift_max_size / 1048576);
htsmsg_add_u32(m, "ram_size", timeshift_ram_size / 1048576);
+ htsmsg_add_u32(m, "ram_only", timeshift_ram_only);
hts_settings_save(m, "timeshift/config");
}
htsmsg_add_u32(m, "timeshift_unlimited_size", timeshift_unlimited_size);
htsmsg_add_u32(m, "timeshift_max_size", timeshift_max_size / 1048576);
htsmsg_add_u32(m, "timeshift_ram_size", timeshift_ram_size / 1048576);
+ htsmsg_add_u32(m, "timeshift_ram_only", timeshift_ram_only);
pthread_mutex_unlock(&global_lock);
out = json_single_record(m, "config");
timeshift_ram_size = atol(str) * 1048576LL;
timeshift_ram_segment_size = timeshift_ram_size / 10;
}
+ timeshift_ram_only = http_arg_get(&hc->hc_req_args, "timeshift_ram_only") ? 1 : 0;
timeshift_save();
pthread_mutex_unlock(&global_lock);
* ***************************************************************/
var confreader = new Ext.data.JsonReader(
- {
+ {
root: 'config'
- },
- [
- 'timeshift_enabled', 'timeshift_ondemand',
- 'timeshift_path',
- 'timeshift_unlimited_period', 'timeshift_max_period',
- 'timeshift_unlimited_size', 'timeshift_max_size',
- 'timeshift_ram_size'
- ]
- );
+ },
+ [
+ 'timeshift_enabled', 'timeshift_ondemand',
+ 'timeshift_path',
+ 'timeshift_unlimited_period', 'timeshift_max_period',
+ 'timeshift_unlimited_size', 'timeshift_max_size',
+ 'timeshift_ram_size', 'timeshift_ram_only'
+ ]
+ );
/* ****************************************************************
* Fields
fieldLabel: 'Max. RAM Size (MB)',
name: 'timeshift_ram_size',
allowBlank: false,
- width: 300
+ width: 250
});
var timeshiftUnlSize = new Ext.form.Checkbox({
width: 300
});
+ var timeshiftRamOnly = new Ext.form.Checkbox({
+ fieldLabel: 'Use only RAM',
+ name: 'timeshift_ram_only',
+ width: 300
+ });
+
/* ****************************************************************
* Events
* ***************************************************************/
});
timeshiftUnlSize.on('check', function(e, c){
- timeshiftMaxSize.setDisabled(c);
+ timeshiftMaxSize.setDisabled(c || timeshiftMaxSize.getValue());
+ });
+
+ timeshiftRamOnly.on('check', function(e, c){
+ timeshiftMaxSize.setDisabled(c || timeshiftUnlSize.getValue());
});
/* ****************************************************************
width: 500,
autoHeight: true,
border: false,
- items : [timeshiftMaxPeriod, timeshiftMaxSize, timeshiftRamSize]
+ items : [timeshiftMaxPeriod, timeshiftMaxSize, timeshiftRamSize]
});
var timeshiftPanelB = new Ext.form.FieldSet({
width: 200,
autoHeight: true,
border: false,
- items : [timeshiftUnlPeriod,timeshiftUnlSize]
+ items : [timeshiftUnlPeriod, timeshiftUnlSize, timeshiftRamOnly]
});
var timeshiftPanel = new Ext.form.FieldSet({
success: function() {
confpanel.enable();
timeshiftMaxPeriod.setDisabled(timeshiftUnlPeriod.getValue());
- timeshiftMaxSize.setDisabled(timeshiftUnlSize.getValue());
+ timeshiftMaxSize.setDisabled(timeshiftUnlSize.getValue() || timeshiftRamOnly.getValue());
}
});
});