[Solved] Question about recordings in progress for a script

  • Hi.


    I would like to know how can I make a conditional sentence to know if there are some recording in progress. Like:


    Code
    If (Recording in progress)??? then;
       do things
    else
       do else things
    fi


    It is to prevent an unmount of an external hard disk in order to check it, when a recording is in progress (I schelule recordings in an external 5Tb hard disk).


    Thanks and regards.
    Javier B.

    VDR 1: Intel NUC6i5SYK || SSD 128Gb M.2 2242 ADATA PREMIER || External HD: W.D. Elements 5 Tb || RAM: 4 Gb KINGSTON HYPERX IMPACT − DDR4 || Remote compatible Microsoft Media Center || 3 tuners pctv nanoStick || easyVdr 3.0
    VDR 2: Xtreamer Ultra || HD 2 Tb || RAM: 4 Gb || Remote compatible Microsoft Media Center || 3 tuners pctv nanoStick || yaVdr 0.6
    VDR 3: Siemens Gigaset M740 AV + HD Western Digital "My Book Essential-2, 1Tb" (6 partitions ext2) || VDR-NG-EM 0.6 Pro - Rev 844

    Einmal editiert, zuletzt von jbjbjb ()

  • The following code uses dbus2vdr to extract the start of the current resp. next timer as a unix time stamp and compares it to the current unix time. If the timer_start timestamp is less than the current time (and not zero), a recording must be running otherwise it will start in the future.


    Code
    timer_start=$(vdr-dbus-send /Timers timer.Next | grep -m1 -Po "(?<=\suint64\s).*")
    now=$(date +%s)
    timediff=$(($timer_start - $now))
    if [ $timediff -lt 0 ] && [ $timer_start -gt 0 ]; then
          echo "recording in progress"
    elif [ $timediff -lt 1800 ]; then  # less than 30 Minutes to the next timer
        echo "timer pending in $((timediff / 60)) Minutes"
    else
        echo "no active recording"
    fi

    yaVDR-Dokumentation (Ceterum censeo enchiridia esse lectitanda.)

  • Hi (sorry Bad englisch ;) )


    Code
    svdrpsend next
    
    
    220 vdrserver SVDRP VideoDiskRecorder 2.2.0; Tue Dec  6 17:02:04 2016; UTF-8
    250 2 Tue Dec  6 17:25:00 2016
    221 vdrserver closing connection
    root@vdrserver:~#


    If the time in line 2 is in the furure, no recording is Running ;)

    Gruß Patrick


    [size=8]* Meine NeverEndingProjects ;) *


    vectra --- glasslike ---

  • Thanks so much.


    Regards.
    Javier B.

    VDR 1: Intel NUC6i5SYK || SSD 128Gb M.2 2242 ADATA PREMIER || External HD: W.D. Elements 5 Tb || RAM: 4 Gb KINGSTON HYPERX IMPACT − DDR4 || Remote compatible Microsoft Media Center || 3 tuners pctv nanoStick || easyVdr 3.0
    VDR 2: Xtreamer Ultra || HD 2 Tb || RAM: 4 Gb || Remote compatible Microsoft Media Center || 3 tuners pctv nanoStick || yaVdr 0.6
    VDR 3: Siemens Gigaset M740 AV + HD Western Digital "My Book Essential-2, 1Tb" (6 partitions ext2) || VDR-NG-EM 0.6 Pro - Rev 844

  • Thanks all of you.


    As I do not have dbus2vdr installed (I need the script for an installation of easyVDR 3 I have in a NUC6) I will take the command proposed by vectra130 and the way I am going to calculate the next [recording/recording in progres] with this command:


    Code
    NEXT_TIMER=$(svdrpsend next | grep -hi "250" | awk '{print $3 " " $4 " " $5 " " $6 " " $7}')
    NEXT_TIMER_UTC=$(date -d "$NEXT_TIMER" +%s)


    I checked it and it works fine. With the script proposed by seahawk1986 I can end the script I need.


    Thanks again and regards.


    Javier B.

    VDR 1: Intel NUC6i5SYK || SSD 128Gb M.2 2242 ADATA PREMIER || External HD: W.D. Elements 5 Tb || RAM: 4 Gb KINGSTON HYPERX IMPACT − DDR4 || Remote compatible Microsoft Media Center || 3 tuners pctv nanoStick || easyVdr 3.0
    VDR 2: Xtreamer Ultra || HD 2 Tb || RAM: 4 Gb || Remote compatible Microsoft Media Center || 3 tuners pctv nanoStick || yaVdr 0.6
    VDR 3: Siemens Gigaset M740 AV + HD Western Digital "My Book Essential-2, 1Tb" (6 partitions ext2) || VDR-NG-EM 0.6 Pro - Rev 844

    2 Mal editiert, zuletzt von jbjbjb ()

Jetzt mitmachen!

Sie haben noch kein Benutzerkonto auf unserer Seite? Registrieren Sie sich kostenlos und nehmen Sie an unserer Community teil!