View Single Post
Old 01-21-2013, 09:28 AM   #77
stepk
Groupie
stepk ought to be getting tired of karma fortunes by now.stepk ought to be getting tired of karma fortunes by now.stepk ought to be getting tired of karma fortunes by now.stepk ought to be getting tired of karma fortunes by now.stepk ought to be getting tired of karma fortunes by now.stepk ought to be getting tired of karma fortunes by now.stepk ought to be getting tired of karma fortunes by now.stepk ought to be getting tired of karma fortunes by now.stepk ought to be getting tired of karma fortunes by now.stepk ought to be getting tired of karma fortunes by now.stepk ought to be getting tired of karma fortunes by now.
 
Posts: 165
Karma: 593460
Join Date: Oct 2012
Device: K5 B011 5.3.2.1
parse.sh

Quote:
Originally Posted by twobob View Post
If you jump inside it you can see that it welds items back into the MENU system via Yifan orignal menuable wangle.

So really the question should be: could we implement an autocreated list that does much the same thing. but for our menu. Answer: probably. But since I don't even use HUR... it's not high on my personal list. it would be a case of iterating over "something" and spitting out the right param list. also totally doable.

On the "Nice To Have" List. Okay?
Fine on the NTH list. Just for fun I did jump inside the bit bucket at parse.sh and stopped right there in contemplation. I noticed the statements that parse menu.json; they look very similar and complicated, I think they could be simplified. Can I show an example here?
Spoiler:

Given data
Code:
...
         {"name": "Portrait", "priority": 0, "action": "bin/setorientation.sh", "params": "U"},
...
instead of using the bitbucket code below to grab "action"
Code:
for z in $(cat $j | sed -e 's/[{}]/''/g' \
| awk -v k="text" '{n=split($0,a,","); for (i=1; i<=n; i++) print a[i]}' \
| sed 's/\"\:\"/\|/g;s/[\,]/ /g;s/\"//g'| grep "action" | grep -w " action") 
do
which outputs
Code:
   action: bin/setorientation.sh
you could use
Code:
for z in $(sed -ne 's/^.*"\(action\)"\(\s*:\s*\)"\([^"]\+\)".*$/\1\2\3/p' < $j); do
which outputs - just like the current code, save for an initial space character
Code:
action: bin/setorientation.sh
Similar code could be applied for "params" etc.

Last edited by stepk; 01-21-2013 at 09:44 AM. Reason: make output fully compatible with the format that the current downstream code expects
stepk is offline   Reply With Quote