Page 1 of 1

[script] output current ip address to virtual usb as file

Posted: Sun Aug 20, 2017 9:11 pm
by beatfreak
if your TV is configured with DHCP to get its IP-address you have to look i your DHCP-Servers lease table to find the current IP of it.
the following init script creates an empty mp3 file in your virtual usb drive whose name is the current IP

Code: Select all

# cat /mtd_rwcommon/SamyGO/etc/init.d/99_98_touch_my_ip.init 
SpoilerShow

Code: Select all

#!/bin/busybox sh
#
#
. /dtv/SGO.env

case $1 in
    start)
        IP=`ifconfig eth0 |grep inet |cut -c -36`
        IP=`echo $IP |sed -e 's/ /_/g'`
        IP=`echo $IP |sed -e 's/:/_/g'`
        touch $MOUNT_PATH/debug/$IP.mp3
        ;;
    stop)
        rm -r $MOUNT_PATH/debug
        ;;
    restart)
        $0 stop && $0 start || exit 1
        ;;
    status)
        ls -l $MOUNT_PATH/debug
        ;;
    *)
    echo "Usage: $0 {start|stop|restart|status}" 1>&2
    exit 0
    ;;
esac
ToDo: deal with IPv6

Re: [script] output current ip address to virtual usb as file

Posted: Sun Aug 20, 2017 9:53 pm
by zoelechat
I tried to play mp3 in Winamp, not works :cry:

Re: [script] output current ip address to virtual usb as file

Posted: Sun Aug 20, 2017 10:00 pm
by beatfreak
beatfreak wrote:
Sun Aug 20, 2017 9:11 pm
creates an empty mp3 file
its not a bug, its a feature! (:

you think creating a folder instead of mp3 file will be more user-proof?
or generate playable mp3 with tts-engine?

Re: [script] output current ip address to virtual usb as file

Posted: Sun Aug 20, 2017 10:57 pm
by zoelechat
Nah, just wanted to liven things up a bit ;)

Re: [script] output current ip address to virtual usb as file

Posted: Mon Aug 21, 2017 12:10 am
by beatfreak
maybe there is a way to create a still empty but valid mp3 file
or find any already existing mp3 file in firmware image and copy that to a tmpfs location
and put even more info in id3 tags that should be viewable with media player

Re: [script] output current ip address to virtual usb as file

Posted: Fri Oct 27, 2017 5:51 pm
by beatfreak
script updated, some fixes
looking for testers on other Series