Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[idea] ni2http sorted services list #30

Open
jpuigs opened this issue Jan 11, 2019 · 6 comments
Open

[idea] ni2http sorted services list #30

jpuigs opened this issue Jan 11, 2019 · 6 comments

Comments

@jpuigs
Copy link
Contributor

jpuigs commented Jan 11, 2019

would it be possible , in ni2http --list option, to get the services list sorted by subchannel ID ?

wget http://192.168.0.16:8001/1:0:1:46:0:1:30300F:0:0:0: -q -O- | ts2na -p 1061 -s 12 | na2ni | ni2http --list
WARN:  Forward error correction (FEC) disabled (NOT COMPILED)
INFO:  Using pid: 0x0425 (1061)
INFO:  E1 Sync found at bit: 222, inverted: yes
DEBUG: seek: B:27, b:6
DEBUG: pre-readed output 15 frames (4 bytes left):
DEBUG: MULTIFRAME FILLING: 207
INFO:  ETI Sync found at pos: 0
INFO:  ETI Multiframe sync found at blockId: 20
.BBC National DAB (0xce15)
 0 : BBC Radio 4Extra (0xc22c) Pri subch=12 start=774 CUs= 58 PL=uep 3 bitrate=80
 1 : BBC Radio 1Xtra  (0xc22a) Pri subch=10 start=582 CUs= 96 PL=uep 3 bitrate=128
 2 : BBC AsianNetwork (0xc236) Pri subch= 7 start=486 CUs= 48 PL=uep 3 bitrate=64
 3 : BBC WorldService (0xc238) Pri subch= 9 start=534 CUs= 48 PL=uep 3 bitrate=64
 4 : BBC Radio 1      (0xc221) Pri subch= 1 start=  0 CUs= 96 PL=uep 3 bitrate=128
 5 : BBC Radio 2      (0xc222) Pri subch= 2 start= 96 CUs= 96 PL=uep 3 bitrate=128
 6 : BBC Radio 3      (0xc223) Pri subch= 3 start=192 CUs=140 PL=uep 3 bitrate=192
 7 : BBC Radio 4      (0xc224) Pri subch= 4 start=332 CUs= 96 PL=uep 3 bitrate=128
 8 : BBC Radio 5 Live (0xc225) Pri subch= 5 start=428 CUs= 58 PL=uep 3 bitrate=80
 9 : BBC Radio 6Music (0xc22b) Pri subch=11 start=678 CUs= 96 PL=uep 3 bitrate=128

in order to get this...

0 : BBC Radio 1      (0xc221) Pri subch= 1 start=  0 CUs= 96 PL=uep 3 bitrate=128
1 : BBC Radio 2      (0xc222) Pri subch= 2 start= 96 CUs= 96 PL=uep 3 bitrate=128
2 : BBC Radio 3      (0xc223) Pri subch= 3 start=192 CUs=140 PL=uep 3 bitrate=192
3 : BBC Radio 4      (0xc224) Pri subch= 4 start=332 CUs= 96 PL=uep 3 bitrate=128
4 : BBC Radio 5 Live (0xc225) Pri subch= 5 start=428 CUs= 58 PL=uep 3 bitrate=80
5 : BBC AsianNetwork (0xc236) Pri subch= 7 start=486 CUs= 48 PL=uep 3 bitrate=64
6 : BBC WorldService (0xc238) Pri subch= 9 start=534 CUs= 48 PL=uep 3 bitrate=64
7 : BBC Radio 1Xtra  (0xc22a) Pri subch=10 start=582 CUs= 96 PL=uep 3 bitrate=128
8 : BBC Radio 6Music (0xc22b) Pri subch=11 start=678 CUs= 96 PL=uep 3 bitrate=128
9 : BBC Radio 4Extra (0xc22c) Pri subch=12 start=774 CUs= 58 PL=uep 3 bitrate=80
@andimik
Copy link
Collaborator

andimik commented Jan 11, 2019

Better would be sorted by start CU.

@jpuigs
Copy link
Contributor Author

jpuigs commented Jan 11, 2019

.. or by name.....
In order to suit everybody's wishes,:
-- list -> current situation
-- list i -> sorted by Subch ID
-- list c -> sorted by start CU
-- list n -> sorted by name
-- list s -> sorted by service ID
....

@andimik
Copy link
Collaborator

andimik commented Jan 16, 2019

The code is open source. You could basically do it yourself. Even I did it (and I am not a programmer, just a normal user)

Change https://github.com/piratfm/eti-tools/blob/master/wfficproc.c by separating the fields by a semicolon (which I hope it's not used for service labels) and remove unnecessary text and spaces and numbers, for instance start=%3d to ;%d; to have a number, not a text.

Then output the ni2http --list to a file by piping it with ni2http --list 2> file.txt (Remark: > does not work as this is the stderr output), delete the 1st row and then process it with awk and sort.

I can post the detailled solution later, but I will not change the code here.

And you can change line 186 in https://github.com/piratfm/eti-tools/blob/master/wfficproc.c#L186

from
int i = 0;
to
int i = 1;

that the 1st service begins with 1, not with 0.

0 : BBC Radio 1 (0xc221) Pri subch= 1 start= 0 CUs= 96 PL=uep 3 bitrate=128

Of course you have to re-compile it by make in the eti-tools folder.

@jpuigs
Copy link
Contributor Author

jpuigs commented Jan 16, 2019

line 186 was the 1st thing I changed :-)
I tried to sort inside wffic.c , but my knownledge of c++ is very very limited, and I didn't success.
Each line has 3 elements, Label name, sid, and "rest". so it had to be sorted all of them.
I had no problems with sid and "rest", but label name was problematic, and I don't know why.
I used classic sort procedure , compare one element with next one, and if it's bigger the first one, then swap with second one.
If you could post code, it'll be good.

@andimik
Copy link
Collaborator

andimik commented Jan 16, 2019

output.txt

$ cat output.txt | sed 's/Pri subch=\|start=\|CUs=\|bitrate=\|PL=//g' > output_new.txt

sort by label:
$ cat ./output_new.txt | sed '1d' | sort -t ";" -k2

sort by SId:
$ cat ./output_new.txt | sed '1d' | sort -t ";" -k3

sort by subch (note, you have to specify it as number)
$ cat ./output_new.txt | sed '1d' | sort -t ";" -nk4

sort by start CU (specified as number)
$ cat ./output_new.txt | sed '1d' | sort -t ";" -nk5

sort by used CUs (specified as number)
$ cat ./output_new.txt | sed '1d' | sort -t ";" -nk6

sort by protection level
$ cat ./output_new.txt | sed '1d' | sort -t ";" -k7

sort by bitrate (as number)
$ cat ./output_new.txt | sed '1d' | sort -t ";" -nk8

sort by DAB/DAB+
$ cat ./output_new.txt | sed '1d' | sort -t ";" -k9

wfficproc.zip

You could then save this as alias so that you don't need to re-type them.

@jpuigs
Copy link
Contributor Author

jpuigs commented Jan 17, 2019

Thank's. I'll try.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants