You are not logged in.
For anyone with better knowledge of conky i have the basics worked out but need help cleaning it up. The recording information is listed in the activities area.This is displayed in terminal, what I would like to show is the show name and progress but cleanly.
<?xml version="1.0" encoding="UTF-8"?>
<MediaContainer size="1">
<Activity uuid="bfc2e9f3-70dd-40ce-b651-e89930bc9adf" type="grabber.grab" cancellable="1" userID="1" title="Recording" subtitle="Tennis - Third Round" progress="30">
<Context deviceID="1" itemKey="/tv.plex.providers.epg.onconnect:4/metadata/com%2Egracenote%2Eonconnect%3A%2F%2Fepisode%2FEP029126510003" itemMediaIndex="0" subscriptionID="6" />
</Activity>
</MediaContainer>These 2 lines show if there are any shows being watched and or recorded I have a wintv-quad-hd and it will show a 4 if all tuners are working.
Watching ${execi 2 curl -sH "X-Plex-Token:yourtokenhere" http://127.0.0.1:32400/status/sessions | grep "size" | cut -f2 -d'"'}Recording ${execi 2 curl -sH "X-Plex-Token:yourtokenhere" http://127.0.0.1:32400/activities | grep "size" | cut -f2 -d'"'}This next line are where I need the cleanup.Also note if 2 or more tuners are being use every 3rd line has this info so `sed -n '3p' '6p' etc.
${execi 2 curl -sH "X-Plex-Token:yourtokenhere" http://127.0.0.1:32400/activities | sed -n '3p'|cut -c 130- }this line shows as this
Tennis - Third Round" progress="39">I would like to remove the "" and the word progress=
here is a screenshot of what is showing so far.![]()
Last edited by blisbell (2018-06-03 02:41:57)
Offline
You can extract the data from xml with xmlstarlet
xmlstarlet sel -t -m "//Activity" -v '@title' -o ": " -v '@subtitle' -o " (" -v '@progress' -o '%)' -nl| alias CUTF='LANG=en_XX.UTF-8@POSIX ' | alias ENGLISH='LANG=C.UTF-8 ' |
Offline
ok that cleans it up one more newbie question for the sed -n '3p' I have 4 lines in my conky, if all 4 tuners are recording how would i use this to switch lines? I have 3p 6p 9p 12p. I need it to read every 3rd line.
Reading the user guide for xmlstarlet now.
Offline
You should be able to parse the whole xml file with xmlstarlet without any sed or cut. Theoretically the command should give you all activities with one activity per line.
-t # define template
-m "//Activity" # select Activity nodes with XPATH
-v '@title' # inside an activity node, print the attribute title (XPATH)
-o ": " # print separator string
-v '@subtitle' # print the subtitle attribute (XPATH)
-o " (" # print separator string
-v '@progress' # print progress attribute (XPATH)
-o '%)' # print separator
-nl # print new linecurl .../activities | xmlstarlet ... -nlEdit: As for sed, that command is "{start}~{step}p", you can find it in the sed manpage and with a web search like "sed nth line"
Last edited by progandy (2018-06-02 19:05:18)
| alias CUTF='LANG=en_XX.UTF-8@POSIX ' | alias ENGLISH='LANG=C.UTF-8 ' |
Offline
ok got to read up on this. thanksfor the pointers
Offline