Hello Guest, if you are reading this it means you have not registered yet. Please take a second, Click here to register, and in a few simple steps you will be able to enjoy our community and use our OpenViX support section.
Results 1 to 3 of 3

Thread: Cmd Line method of seeing which channel is being viewed on tuner ?

  1. #1

    Title
    Junior Member
    Join Date
    Jul 2016
    Posts
    8
    Thanks
    1
    Thanked 0 Times in 0 Posts

    Question Cmd Line method of seeing which channel is being viewed on tuner ?

    Hi,

    I only recently got my Enigma2 with two DVBS2 tuners, and am very impressed with the Xtrend hw and the whole Enigma2 OS.

    I'm not a linux expert, but am happy working in the cmd line (basically because I'm that old there weren't GUI options available) . To that end I was trying to find out if / how I can determine which channel is currently being received.

    I am not trying to view the channel, nor look to receive a stream, simply to see which channels are being viewed / recorded from the command line.

    If I need to find a frequency or id, then look that up somewhere else to get a channel number, any advise welcome.

    Many thanks

    ABC.

  2. #2
    birdman's Avatar
    Title
    Moderator
    Join Date
    Sep 2014
    Location
    Hitchin, UK
    Posts
    7,800
    Thanks
    237
    Thanked 1,659 Times in 1,307 Posts
    The attached script can be run on an OpenVix box.
    (It can be run on other Linux boxes if you edit the box setting at the top).

    Code:
    #!/bin/sh
    #
    box=127.0.0.1        
    
    # python -m json.tool fails on OpenVix as runpy isn't there.
    # So we do it on long-hand...
    #
    parse_json() {
        python -c '
    import json
    import sys
    
    str = sys.stdin.read()
    kv = json.loads(str)
    print json.dumps(kv, sort_keys=True, indent=0, separators=(",", ":"))
    '
    }
    
    # python will sort the fields...
    #
    wget -qO - http://$box/api/statusinfo | parse_json |
        while read line; do
            case $line in
            *\"currservice_station\":*)
                channel=`echo $line | sed -e 's/.*:\"//' -e s'/\",.*//'`
                ;;
            *\"currservice_name\":*)
                name=`echo $line | sed -e 's/.*:\"//' -e s'/\",.*//'`
                ;;
            *\"inStandby\":*)
                case $line in
                *true*|*True*)  echo "In standby"       ;;
                *)              echo $channel: $name    ;;
                esac
                exit
                ;;
            esac
        done
    MiracleBox Prem Twin HD - 2@DVB-T2 + Xtrend et8000 - 5(incl. 2 different USBs)@DVB-T2[terrestrial - UK Freeview HD, Sandy Heath] - LAN/USB-stick/HDD

  3. The Following 2 Users Say Thank You to birdman For This Useful Post:

    abc4422 (20-07-16),Bangord30 (20-07-16)

  4. #3

    Title
    Junior Member
    Join Date
    Jul 2016
    Posts
    8
    Thanks
    1
    Thanked 0 Times in 0 Posts
    Wow !!

    Excellent, does exactly what I was looking to achieve.

    With the added extra, as it opens up a route to find additional information from the queried URL:- /api/statusinfo

    Many thanks.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
This website uses cookies
We use cookies to store session information to facilitate remembering your login information, to allow you to save website preferences, to personalise content and ads, to provide social media features and to analyse our traffic. We also share information about your use of our site with our social media, advertising and analytics partners.