You know, I think I was mistaken about the "bad things." Further testing, ang grepping these prefs out of the server.prefs file:
Code: -------------------- useUnifiedArtistsList: '1' bandInArtists: '' composerInArtists: '' conductorInArtists: '' -------------------- ..yields these settings in the webUI: 27482 ..so not being able to set a nil/undefined value via jsonrpc doesn't seem to be an issue. Here's my generic bash function for setting prefs this way: Code: -------------------- ######################################################################## # slim_server_pref_set_json -- Set a server.pref via post to jsonrpc.js ######################################################################## slim_server_pref_set_json(){ local LPREF_VALUE="$1" local LPREF="$(echo "$LPREF_VALUE" | sed -n -e 's#^\(.*\):.*#\1#p')" local LVALUE="$(echo "$LPREF_VALUE" | sed -n -e "s#^${LPREF}: \(.*\)\$#\1#p")" local LARRAY= if [ ! -z "$LPREF" ]; then # Is the LVALUE an array, empty, ~ or need to be quoted? if [ $(echo "$LVALUE" | grep -c '",') -gt 0 ]; then LVALUE="[${LVALUE}]" elif [ -z "$LVALUE" ]; then LVALUE="\"\"" elif [ ${LVALUE:0:1} = "~" ]; then LVALUE="\"\"" elif [ ${LVALUE:0:1} != "\"" ]; then LVALUE="\"${LVALUE}\"" fi JSONSTR="{\"id\":1,\"method\":\"slim.request\",\"params\":[\"\",[\"pref\",\"${LPREF}\",${LVALUE}]]}" echo "Adding ${LPREF_VALUE} to server prefs." curl --silent -H "Content-Type: application/json" -X POST -d "$JSONSTR" http://localhost:9000/jsonrpc.js >/dev/null 2>&1 # Seems to be necessary so we don't slam the server with too many requests to process.. sleep .25 fi return 0 } -------------------- Call with, e.g.: Code: -------------------- slim_server_pref_set_json "bandInArtists: ~" -------------------- -- or, e.g. -- Code: -------------------- slim_server_pref_set_json 'itemsPerPage: 500' -------------------- ..or for arrays: Code: -------------------- slim_server_pref_set_json 'mediadirs: "/mnt/Media/Dir1","/mnt/Media/Dir1","/mnt/Media/Dir3"' -------------------- +-------------------------------------------------------------------+ |Filename: lms_settings2.jpg | |Download: http://forums.slimdevices.com/attachment.php?attachmentid=27482| +-------------------------------------------------------------------+ ------------------------------------------------------------------------ gharris999's Profile: http://forums.slimdevices.com/member.php?userid=115 View this thread: http://forums.slimdevices.com/showthread.php?t=96666 _______________________________________________ Squeezecenter mailing list Squeezecenter@lists.slimdevices.com http://lists.slimdevices.com/mailman/listinfo/squeezecenter