Hirdetés

Új hozzászólás Aktív témák

  • vargalex

    Topikgazda

    válasz SteveBeard #35810 üzenetére

    Szia!

    A kérdéses részt én így csinálnám meg:

    start_instance() {
    local s="$1"

    section_enabled "$s" || return 1

    config_get device "$s" 'device'
    config_get resolution "$s" 'resolution'
    config_get fps "$s" 'fps'
    config_get www "$s" 'www'
    config_get port "$s" 'port'
    config_get username "$s" 'username'
    config_get password "$s" 'password'

    [ -c "$device" ] || {
    error "device '$device' does not exist"
    return 1
    }

    service_start /usr/bin/mjpg_streamer --input "input_uvc.so \
    --device $device --fps $fps --resolution $resolution" \
    --output "output_http.so --www $www --port $port ${username:+-c $username:$password}"
    }

    Így, ha config-ban van username paraméter, akkor aktiválja az authentikációt, egyébként nem. A teljes config pedig így nézne ki:

    config mjpg-streamer core
    option enabled "1"
    option device "/dev/video0"
    option resolution "640x480"
    option fps "5"
    option www "/www/webcam"
    option port "8080"
    option username "felhasznalo"
    option password "jelszo"

    Szerintem szebb, ha minden ilyen a config-ban marad.

    [ Szerkesztve ]

    Alex

Új hozzászólás Aktív témák