Page 2 of 2 FirstFirst 12
Results 11 to 17 of 17

Thread: Script Files

  1. #11
    Join Date
    May 2006
    Location
    Canada
    Posts
    29,168
    Ok going back to your question your docker volume statement is probably something like

    --volume /mnt/appdata/NextPVR/Config:/config \

    but the file is the same and you need to configure it as if it is running in docker, unaware of the host environment.

    Martin

  2. #12
    Join Date
    Jan 2012
    Location
    Waikato, NZ
    Posts
    85
    Win Server: ASRock P67 Pro3 B3, i5 2500K 4.0Ghz, 16GB, Nvidia GT430 HDMI, Win 10 Pro 64bit, Win-TV Quad HD, Win-TV Nova-T USB.
    UnRaid NAS Server: Gigabyte i7 2600 3.4Ghz, 16GB, S3 Trio VGA PCI Video, DVB LibreElec for DVB-T tuner drivers, Hauppage Win-TV 2210 Dual DVB-T.
    Win Client: Intel NUC i3 Broadwell, 4GB Ram, 128GB SSD, Win 10 Pro 64bit.
    Linux Client: Raspberry Pi 3+, OSMC + Kodi

  3. #13
    Join Date
    Aug 2016
    Location
    Davis, CA
    Posts
    34
    I have installed NextPVR on Ubuntu 18.04 using the deb installer. I set up my devices and epg and have recorded a couple programs. I am still learning and I am having trouble understanding where to put the script files. Also, are the variables the same as in Windows environment eg %1 is filename - the full path and file name of the recording file. I am trying to do a PostProcessing.sh file to run comskip when a recording ends.

    I have /var/opt/nextpvr/scripts/ or /opt/nextpvr/system/data/scripts as possible locations for PostProcessing.sh.

    I could not find the referenced location below
    "It'll look for a .NPVR-data/scripts/PostProcessing.sh file on Linux. You can add similar login in there. "

    Thanks,

    Craig

  4. #14
    Join Date
    May 2006
    Location
    Canada
    Posts
    29,168
    It is /var/opt/nextpvr/scripts and variables are the same but you have to compile and install comskip. The script needs chmod +x too.

    Martin
    Last edited by mvallevand; 2019-09-17 at 06:48 AM.

  5. #15
    Join Date
    Jan 2012
    Location
    Waikato, NZ
    Posts
    85
    The variables are the same as Martin said, but it is quite a learning experience if you are converting from Windows batch file to Linux shell format. In batch, the variables begin with %, in shell they begin with $.
    Here's an exerpt from one I have written for transcoding a file to a compressed format.

    #!/bin/bash
    # --------------------------
    # PostProcessing.sh
    # D.Little
    # Version 12c - use acc instead of libvo_aacenc for newer version of ffmpeg
    # Version 100 - 1st Linux shell translation from Windows batch file script
    # dated 17/08/2019
    # --------------------------

    # Log the program being processed by this script
    echo $(date "+%d/%m/%Y %T") - $3 - PostProcessing.bat invoked on $1 recorded channel $2 on tuner $4 >>/config/logs/processing.log

    workdir=$(dirname "$1")
    source_name=$(basename "$1")
    file_name=${source_name%%.ts}
    short_name=${file_name:2:4}
    filesize=$(wc -c <"$1")
    newfile="$workdir/$file_name"

    echo $(date "+%d/%m/%Y %T") - $3 - creating "$newfile" >>/config/logs/processing.log
    /usr/bin/ffmpeg -y -i "$1" -b:v 2000k -deinterlace -map 0:0 -map 0:1 -c:a aac -ar 48000 -async 48000 "$newfile"

    newsize=$(wc -c <"$newfile")

    # --------- Test outputs - Temporary coding ---------
    echo $1 - full file and path >>/config/logs/processing.log
    echo $workdir - workdir >>/config/logs/processing.log
    echo $source_name - source_name >>/config/logs/processing.log
    echo $file_name - file_name >>/config/logs/processing.log
    echo $short_name - short_name >>/config/logs/processing.log
    echo "$workdir/$file_name" - dir and file_name >>/config/logs/processing.log
    echo $filesize - source bytes >>/config/logs/processing.log
    # -------- END of Debug --------------
    Note that:
    - Linux is case sensitive with paths and file names whereas Windows is not.
    - Putting the variables inside double quotes, e.g. file_name_and_path="$1" ensures any spaces contained in the path and filenames are handled correctly.
    - If you edit scripts from a Windows PC, use Notepad++ and set it to Linux linefeed mode so that the end of each line does not get an unwanted carriage return and causes execution errors.
    - As Martin stated, a newly created .sh file has to be made executable with the chmod +x command to change the file permission.
    Win Server: ASRock P67 Pro3 B3, i5 2500K 4.0Ghz, 16GB, Nvidia GT430 HDMI, Win 10 Pro 64bit, Win-TV Quad HD, Win-TV Nova-T USB.
    UnRaid NAS Server: Gigabyte i7 2600 3.4Ghz, 16GB, S3 Trio VGA PCI Video, DVB LibreElec for DVB-T tuner drivers, Hauppage Win-TV 2210 Dual DVB-T.
    Win Client: Intel NUC i3 Broadwell, 4GB Ram, 128GB SSD, Win 10 Pro 64bit.
    Linux Client: Raspberry Pi 3+, OSMC + Kodi

  6. #16
    Join Date
    Aug 2016
    Location
    Davis, CA
    Posts
    34
    Quote Originally Posted by mvallevand View Post
    It is /var/opt/nextpvr/scripts and variables are the same but you have to compile and install comskip. The script needs chmod +x too.

    Martin
    Thanks Martin,

    I have compiled and installed comskip previously. However, I had non chmod +x the PostProcessing.sh file. PostProcessing.sh is now working running comskip for commercial detection and creating logs.

    Thanks for all your help,

    Craig

  7. #17
    Join Date
    Aug 2016
    Location
    Davis, CA
    Posts
    34
    Thanks Vintdiesel,

    I learned about %1 becoming $1 while setting up TVheadend previously but I appreciate the help.

    Craig

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •