Work at SourceForge, help us to make it a better place! We have an immediate need for a Support Technician in our San Francisco or Denver office.

Close

call external scripts

Help
Aesir
2010-08-13
2013-04-25
  • 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:
    http://www.lundman.net/wiki/index.php/Llink:Live_TV
    (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">
      <type>VIDEO_ITEM</type>
      <mime_type>video/x-mpeg</mime_type>

      <transcode enabled="true">
        <ext>mpg</ext>
        <mime_type>video/mpeg</mime_type>

        <transcoder>external</transcoder>
        <external_cmd>/path/to/external/app %in% %out%</external_cmd>
      </transcode>
    </file>

     
  • 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" ]
    do
        log "file exists"
        sleep 5;
    done
    log "kill process"
    PID=$(pgrep -fl "$2" | grep ffmpeg | cut -f1 -d ' ' )
    kill $PID