Search the Community
Showing results for tags 'influx'.
-
UserName + NowPlayingItem.Name for InfluxDB and Grafana
plittlefield posted a topic in Developer API
Hello Folks, After the success of getting a count of the current NowPlayingItem entries in the Sessions API, I am now trying to get a list of the Users and what they are currently playing - then send that to my InfluxDB to show in my Grafana server. I am nearly there with this command line, but cannot quite get it so that JQ only shows those session users who are actually playing something... wget -q -O - "http://localhost:8096/emby/Sessions?api_key=3469exxxxxxxxxxxxxxx201ef3f" | jq -M '.[].UserName, .[].NowPlayingItem.Name' will show me the following... null "Paul" "Tracey" "Sam" "Tom" "Katie" null "The Secret of the Unicorn (1)" null null null null ...which is every possible user. In the above example, only user "Paul" is actually playing ""The Secret of the Unicorn (1)". If I add the JQ options to now show 'nulls'... wget -q -O - "http://localhost:8096/emby/Sessions?api_key=3469exxxxxxxxxxxxxxx201ef3f" | jq -M '.[].UserName, .[].NowPlayingItem.Name | select(. != null)' then I can get it to this output... "Paul" "Tracey" "Sam" "Tom" "Katie" "The Secret of the Unicorn (1)" ...which is correct but still shows me users that are not playing anything at that time! Does anyone have knowledge of JSON and JQ or the API so that I can just get a list of those users that are playing an item now. I would be happy with this output... "Paul" "The Secret of the Unicorn (1)" ...or even better - turn it in to a key + value pair like this... { "Paul": "The Secret of the Unicorn (1)" } ...so that I can send that to a bash script and then to my InfluxDB. Thanks in advance! Regards, Paully