Opendigitalradio / dablin

DAB/DAB+ receiver for Linux (including ETI-NI and EDI AF playback)
GNU General Public License v3.0
123 stars 27 forks source link

[Feature request] DAB live source power on/off button #48

Closed npm-sdr closed 5 years ago

npm-sdr commented 5 years ago

Hi,

I'd like to have a power on/off button to stop and start the live source application such that when off, the DAB live source application is stopped (via SIGINT) in order to power down the underlying SDR hardware without having to close DABLin application. Is this something that is relatively easy to add?

Kind regards, Niro.

basicmaster commented 5 years ago

Hi Niro,

it requires some changes, but is not that difficult. A hotkey (e.g. Ctrl + Del) definitely works. Another question is how to achieve the same just via mouse. A right-click on the channel combo box could be possible; I have to check. With MacOS, this is equivalent to clicking and holding a certain key at the same time, right?

npm-sdr commented 5 years ago

Hi Stefan,

macOS mouse has right click, just click on the right hand side of the mouse or 2-finger soft-click on the touchpad is a right-click.

Niro.

On Mon, 17 Jun 2019 at 21:17, Stefan Pöschel notifications@github.com wrote:

Hi Niro,

it requires some changes, but is not that difficult. A hotkey (e.g. Ctrl + Del) definitely works. Another question is how to achieve the same just via mouse. A right-click on the channel combo box could be possible; I have to check. With MacOS, this is equivalent to clicking and holding a certain key at the same time, right?

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/Opendigitalradio/dablin/issues/48?email_source=notifications&email_token=AIAUHM7ACSSWV4PK7B4I2MTP27WL5A5CNFSM4HYZUV62YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGODX4KLUY#issuecomment-502834643, or mute the thread https://github.com/notifications/unsubscribe-auth/AIAUHM6H4XNPR23VX2L7CZLP27WL5ANCNFSM4HYZUV6Q .

jpuigs commented 5 years ago

Hi, I'd like to have a power on/off button to stop and start the live source application

I'd add instead of an ON/OFF button, a start/stop/pause button, because some people use this great program to receive SAT DAB/+ feeds, or play recorded ETI files, so in this case (playing) when file comes to and end it'd be good to have a play button to start playing it again, instead of having to do it in terminal comandline. A 'loop' button then would be incredible…. but don't ask him for too many things at a time :-)

jpuigs commented 5 years ago

( The Play / Stop button could behave like power ON / OFF on live USB device transmissions as Niro asked )

npm-sdr commented 5 years ago

A Play/Stop button to perform power ON/OFF on the live source would work me.

Regards, Niro.

basicmaster commented 5 years ago

I just added a stop button that stops decoding the current channel. Does that work for you?

npm-sdr commented 5 years ago

Hi Stefan,

I've just tried it and it works fine - i.e. stops the SDR, then starts agains when a channel is reselected. One slight annoying thing is that it deselects the Channel and the Service. Is there a way to prevent this?

Niro.

jpuigs commented 5 years ago

Hi, I've tried using live satellite feed, and it isn't enabled. ($ curl http://192.168.0.16:5237/tsniv2nilive/1:0:2:998:526c:55e:dde0000:0:0:0:/4105 | dablin_gtk -I )

Does it work only on USB device ?

image

basicmaster commented 5 years ago

@npm-sdr: Indeed it currently just stops the playback of the current channel, that's it. But this resuming is a good idea; I will check how to implement this.

@jpuigs: This is currently only implemented with DAB live sources (-d option), as they allow to kill/restart the source by DABlin. In case of your curl cmdline, DABlin is not able to kill/restart it, as it only reads the data. So curl would continue to capture then anyway.

A quick fix here would be to just write a short script that only calls curl e.g. like this:

#!/bin/bash
curl http://192.168.0.16:5237/tsniv2nilive/1:0:2:998:526c:55e:dde0000:0:0:0:/4105

And to specify this script via -d at the DABlin cmdline. If you want to use multiple satellite muxes this way, it could make sense to write a more complex script, to be able to switch between that channels directly within DABlin.

jpuigs commented 5 years ago

A quick fix here would be to just write a short script that only calls curl e.g. like this:

!/bin/bash

curl http://192.168.0.16:5237/tsniv2nilive/1:0:2:998:526c:55e:dde0000:0:0:0:/4105 And to specify this script via -d at the DABlin cmdline. If you want to use multiple satellite muxes this way, it could make sense to write a more complex script, to be able to switch between that channels directly within DABlin.

That would be GREAT, to have all 17 muxes selected directly, and no need to kill each time and copy/paste urls to switch to another one.

basicmaster commented 5 years ago

@npm-sdr: The recent changes now implement a resume function; the hotkey was therefore changed to Ctrl + Space, as it is no longer a "one-way" function only.

jpuigs commented 5 years ago

Just tested and it works using SAT-feeds (http) too ! Thanks. As ypu told me, I did a script and call it using -d parameter, and I can stop and restart easily.

If you want to use multiple satellite muxes this way, it could make sense to write a more complex script, to be able to switch between that channels directly within DABlin.

How Could I do it ?

andimik commented 5 years ago

I guess you just mean those multiple muxes on the same transponder.

npm-sdr commented 5 years ago

Hi Stefan, this works a treat for me now. Many thanks for implementing the stop/resume feature.

Regards, Niro.

jpuigs commented 5 years ago

I guess you just mean those multiple muxes on the same transponder.

The difference among all muxes, either they are on same transponder or not, is just a URL: Look , they are transponder-grouped (9 , 3 ,2, 1, 1, 1)

http://192.168.0.16:5237/fedi2etilive/1:0:1:65:1:65:460000:0:0:0:/101/239.132.1.50/5004 SWR BW S http://192.168.0.16:5237/fedi2etilive/1:0:1:65:1:65:460000:0:0:0:/101/239.132.1.51/5004 SWR BW N http://192.168.0.16:5237/fedi2etilive/1:0:1:65:1:65:460000:0:0:0:/101/239.132.1.52/5004 SWR RP http://192.168.0.16:5237/fedi2etilive/1:0:1:65:1:65:460000:0:0:0:/101/239.16.242.11/60011 Oberfranken http://192.168.0.16:5237/fedi2etilive/1:0:1:65:1:65:460000:0:0:0:/101/239.16.242.13/60013 Unterfranken http://192.168.0.16:5237/fedi2etilive/1:0:1:65:1:65:460000:0:0:0:/101/239.16.242.15/60015 Obb/Schw http://192.168.0.16:5237/fedi2etilive/1:0:1:65:1:65:460000:0:0:0:/101/239.16.242.16/60016 Niederbayern http://192.168.0.16:5237/fedi2etilive/1:0:1:65:1:65:460000:0:0:0:/101/239.16.242.17/60017 Bayern http://192.168.0.16:5237/fedi2etilive/1:0:1:65:1:65:460000:0:0:0:/101/239.192.254.200/10000 hr Radio

http://192.168.0.16:5237/ts2nalive/1:0:1:46:0:1:30300F:0:0:0:/1061/12 BBC National DAB
http://192.168.0.16:5237/ts2nalive/1:0:1:3C:0:1:30300F:0:0:0:/1062/12 D1 National http://192.168.0.16:5237/ts2nalive/1:0:1:50:0:1:30300F:0:0:0:/1063/12 SDL National

http://192.168.0.16:5237/tsniv2nilive/1:0:2:998:526c:55e:dde0000:0:0:0:/4105 DAB Italia http://192.168.0.16:5237/tsniv2nilive/1:0:2:999:526c:55e:dde0000:0:0:0:/4106 #EuroDab Italia

http://192.168.0.14:5237/ts2nalive/1:0:1:C83:FA:C8:DDE0000:0:0:0:/1000/0 DAB+ RAI

http://192.168.0.16:5237/ts2nilive/1:0:64:1:464E:0:1A4AAC9:0:0:0:/1068/0 TRT DAB+

http://192.168.0.16:5237/tsniv2nilive/1:0:1:4:1:212C:1860000:0:0:0:/1010 ERT DAB

andimik commented 5 years ago

I know of course ;-)

jpuigs commented 5 years ago

I've written them ,because there are other ways to get them, this the "compact" way, one URL per ETI stream.

F.I. The ETI BBC stream can be received this way too: wget http://192.168.0.16:8001/1:0:1:46:0:1:30300F:0:0:0: -O- -q | ts2na -p 1061 -s 12 | na2ni or curl http://192.168.0.16:5237/ts2nalive/1:0:1:46:0:1:30300F:0:0:0:/1061/12

because dabstreamer when receive requests on port 5237, uses ts2nalive this way:

elif tool == "ts2nalive":
        _, sref, pid, ofst = parameters
        cmd = "wget http://127.0.0.1:8001/%s -q -O- | ts2na -p %s -s %s | na2ni" % (sref, pid, ofst)
basicmaster commented 5 years ago

How Could I do it ?

You could try a script like the following (here tested with channel 8A):

#!/bin/bash
case $1 in
195936000)  # 8A
    curl http://192.168.0.16:5237/tsniv2nilive/1:0:2:998:526c:55e:dde0000:0:0:0:/4105
    ;;
esac

Just copy/paste the three lines per channel for additional ensembles. However when I tested the script, curl wasn't really killed on channel change, so this might work or not...

Hi Stefan, this works a treat for me now. Many thanks for implementing the stop/resume feature.

Thanks! As the original issue is addressed, I close the issue here.

jpuigs commented 5 years ago

You could try a script like the following (here tested with channel 8A):

!/bin/bash

case $1 in 195936000) # 8A curl http://192.168.0.16:5237/tsniv2nilive/1:0:2:998:526c:55e:dde0000:0:0:0:/4105 ;; esac Just copy/paste the three lines per channel for additional ensembles. However when I tested the script, curl wasn't really killed on channel change, so this might work or not...

I've tested and it works. When changing from on stream to another, I've noticed it works better adding a sleep 0.5 before curl. I've created 3 ensembles, and switching from one to another works.

It appears this error (curl failed writing) , but it works.

SDLOutput: silence started...
DAB-SAT.sh: no process found
ETISource: error killing dab2eti
curl: (23) Failed writing body (2636 != 14924)
ETIPlayer: playing nothing
SDLOutput: audio closed
ETISource: playing from channel 5A (174928 kHz) via dab2eti (gain: auto)
basicmaster commented 5 years ago

The DAB-SAT.sh: no process found is a bit strange...do you get this everytime you change the channel?

jpuigs commented 5 years ago

Yes, everytime I change MUX (change curl), and everytime I stop MUX. I'm currently using cygwin.

DAB-SAT.sh is:

#!/bin/bash
case $1 in
174928000)  # 5A DAB Italia
    sleep 0.5
    curl http://192.168.0.16:5237/tsniv2nilive/1:0:2:998:526c:55e:dde0000:0:0:0:/4105
    ;;

176640000)  # 5B EuroDAB
    sleep 0.5
    curl http://192.168.0.16:5237/tsniv2nilive/1:0:2:999:526c:55e:dde0000:0:0:0:/4106
    ;;

178352000)  # 5C BBC DAB
    sleep 0.5
    curl http://192.168.0.16:5237/ts2nalive/1:0:1:46:0:1:30300F:0:0:0:/1061/12
    ;;

esac
jpuigs commented 5 years ago

I know of course ;-)

Sorry, I didn't notice you were whi wrote it. I though it was Stefan.

jpuigs commented 5 years ago

I've managed to have all SAT muxes instead of DAB channels. Modifying tools.cpp......

const dab_channels_t dab_channels {
    { "BBC Nat.",  174928},
    { "D1 Nat.",  176640},
    { "SDL Nat.",  178352},

    { "DAB Italia",  180064},
    { "EuroDAB It.",  181936},
    { "RAI DAB+",  183648},

    { "TRT DAB+",  185360},

    { "ERT DAB+",  187072},

    { "SWR BW S",  188928},
    { "SWR BW N",  190640},
    { "SWR RP",  192352},
    { "Oberfranken",  194064},
    { "Unterfranken",  195936},
    { "Obb/Schw",  197648},
    { "Niederbayern",  199360},
    { "Bayern",  201072},
    { "hr Radio",  202928},
};

Look....

image

image

andimik commented 5 years ago

This is a very nice idea! Cool

basicmaster commented 5 years ago

Modifying tools.cpp......

This is not really the intention of the built-in channel list, but if it works for you - OK :-)