call external scripts

  • Aesir

    Aesir - 2010-08-13

    Is there a way in FUPPES to call an external command (ie. a bash script)  upon selecting a specific file type?
    Something similar to the solution explained here:
    (Note: llink is a upnp server from lundman that allows such behaviour, but has several drawbacks for non NMT devices)

    it could be useful in a lot of ways for streaming and transcoding dvb, sat channels or even remote sources (youtube, megavideo etc.)

    I'm using freenas 7.1 (fuppes v.0. 660)

  • Meekys

    Meekys - 2010-08-15

    The example below might work if in the correct location of the configuration.
    Basically, any file with a tv extension would run the application "/path/to/external/app" with the first parameter as the tv file, and the output as an mpg file (fuppes would use /tmp/fuppes/0.mpg by default in this instance), which it then read by fuppes and streamed to the media client.
    So if your external application/bash script can write to a file, fuppes should be able to use it.

    <file ext="tv">

      <transcode enabled="true">

        <external_cmd>/path/to/external/app %in% %out%</external_cmd>

  • Aesir

    Aesir - 2010-08-18

    It works. Thank you very much.

    An additional note: fuppes does not kill the external app when stop streaming (but it delete the temp file), so it's up to you.
    I've made this little script for the purpose. it waits and kills the process when the file is deleted (by fuppes).

    /usr/local/bin/ffmpeg -i "$URL" -f mp3 $2 &
    log "FFMPEG Executed"
    sleep 10;
    while [ -f "$2" ]
        log "file exists"
        sleep 5;
    log "kill process"
    PID=$(pgrep -fl "$2" | grep ffmpeg | cut -f1 -d ' ' )
    kill $PID

Log in to post a comment.