From a61b15460f66e8835bbf7f49b3566f5bf0d725a7 Mon Sep 17 00:00:00 2001 From: sparklyballs Date: Sun, 14 Aug 2016 12:36:03 +0100 Subject: [PATCH] first save up, sourced from saarg repo --- Dockerfile | 210 ++++++++++++++++++ README.md | 10 + READMETEMPLATE.md | 98 ++++++++ patches/perl-unicode.patch | 11 + .../defaults/7a5edfbe189851e5b1d1df19c93962f0 | 38 ++++ root/defaults/comskip.ini.org | 81 +++++++ root/etc/cont-init.d/30-config | 17 ++ root/etc/services.d/tvheadend/run | 3 + root/usr/bin/tv_grab_file | 55 +++++ root/usr/bin/tv_grab_wg | 63 ++++++ 10 files changed, 586 insertions(+) create mode 100644 Dockerfile create mode 100644 README.md create mode 100644 READMETEMPLATE.md create mode 100644 patches/perl-unicode.patch create mode 100755 root/defaults/7a5edfbe189851e5b1d1df19c93962f0 create mode 100755 root/defaults/comskip.ini.org create mode 100644 root/etc/cont-init.d/30-config create mode 100755 root/etc/services.d/tvheadend/run create mode 100755 root/usr/bin/tv_grab_file create mode 100755 root/usr/bin/tv_grab_wg diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..d122e2f --- /dev/null +++ b/Dockerfile @@ -0,0 +1,210 @@ +FROM lsiobase/alpine +MAINTAINER saarg + +# package version +ARG ARGTABLE_VER="2.13" +ARG TVH_VER="e3e8a797" +ARG UNICODE_VER="2.09" +ARG XMLTV_VER="0.5.67" + +# Environment settings +ENV HOME="/config" + +# copy patches +COPY patches/ /tmp/patches/ + +# install build packages +RUN \ + apk add --no-cache --virtual=build-dependencies \ + autoconf \ + automake \ + cmake \ + coreutils \ + ffmpeg-dev \ + findutils \ + g++ \ + gcc \ + gettext-dev \ + git \ + libhdhomerun-dev \ + libtool \ + libxml2-dev \ + make \ + mercurial \ + openssl-dev \ + patch \ + perl-dev \ + pkgconf \ + sdl-dev \ + uriparser-dev \ + wget \ + zlib-dev && \ + +# add runtime dependencies required in build stage + apk add --no-cache \ + bsd-compat-headers \ + bzip2 \ + curl \ + gzip \ + libcrypto1.0 \ + libcurl \ + libssl1.0 \ + linux-headers \ + openssl \ + perl \ + perl-archive-zip \ + perl-boolean \ + perl-capture-tiny \ + perl-cgi \ + perl-compress-raw-zlib \ + perl-date-manip \ + perl-datetime \ + perl-file-slurp \ + perl-html-parser \ + perl-html-tree \ + perl-http-cookies \ + perl-io \ + perl-io-compress \ + perl-io-html \ + perl-io-stringy \ + perl-json \ + perl-libwww \ + perl-module-build \ + perl-module-pluggable \ + perl-net-ssleay \ + perl-parse-recdescent \ + perl-path-class \ + perl-term-readkey \ + perl-test-exception \ + perl-test-requires \ + perl-xml-parser \ + perl-xml-sax \ + python \ + tar \ + uriparser \ + wget \ + zlib && \ + +# install perl modules + curl -L http://cpanmin.us | perl - App::cpanminus && \ + cpanm HTML::TableExtract && \ + cpanm HTTP::Cache::Transparent && \ + cpanm inc && \ + cpanm IO::Scalar && \ + cpanm IO::Socket::SSL && \ + cpanm Lingua::EN::Numbers::Ordinate && \ + cpanm Lingua::Preferred && \ + cpanm PerlIO::gzip && \ + cpanm SOAP::Lite && \ + cpanm Term::ProgressBar && \ + cpanm Term::ProgressBar && \ + cpanm Unicode::UTF8simple && \ + cpanm version && \ + cpanm WWW::Mechanize && \ + cpanm XML::LibXML && \ + cpanm XML::TreePP && \ + cpanm XML::Twig && \ + cpanm XML::Writer && \ + +# patch and build perl-unicode-string + mkdir -p \ + /tmp/unicode && \ + curl -o \ + /tmp/unicode-src.tar.gz -L \ + "http://search.cpan.org/CPAN/authors/id/G/GA/GAAS/Unicode-String-${UNICODE_VER}.tar.gz" && \ + tar xzf /tmp/unicode-src.tar.gz -C \ + /tmp/unicode --strip-components=1 && \ + cd /tmp/unicode/lib/Unicode && \ + patch -i /tmp/patches/perl-unicode.patch && \ + cd /tmp/unicode && \ + perl Makefile.PL && \ + make && \ + make test && \ + make install && \ + +# build dvb-apps + hg clone http://linuxtv.org/hg/dvb-apps /tmp/dvb-apps && \ + cd /tmp/dvb-apps && \ + make && \ + make install && \ + +# build tvheadend + git clone https://github.com/tvheadend/tvheadend.git /tmp/tvheadend && \ + cd /tmp/tvheadend && \ + git checkout "${TVH_VER}" && \ + ./configure \ + --disable-ffmpeg_static \ + --disable-hdhomerun_static \ + --disable-libfdkaac_static \ + --disable-libmfx_static \ + --disable-libtheora_static \ + --disable-libvorbis_static \ + --disable-libvpx_static \ + --disable-libx264_static \ + --disable-libx265_static \ + --enable-hdhomerun_client \ + --enable-libav \ + --infodir=/usr/share/info \ + --localstatedir=/var \ + --mandir=/usr/share/man \ + --prefix=/usr \ + --sysconfdir=/config && \ + make && \ + make install && \ + +# build XMLTV + curl -o /tmp/xmtltv-src.tar.bz2 -L \ + "http://kent.dl.sourceforge.net/project/xmltv/xmltv/${XMLTV_VER}/xmltv-${XMLTV_VER}.tar.bz2" && \ + tar xf /tmp/xmtltv-src.tar.bz2 -C \ + /tmp --strip-components=1 && \ + cd "/tmp/xmltv-${XMLTV_VER}" && \ + /bin/echo -e "yes" | perl Makefile.PL PREFIX=/usr/ INSTALLDIRS=vendor && \ + make && \ + make test && \ + make install && \ + +# build argtable2 + ARGTABLE_VER1="${ARGTABLE_VER//./-}" && \ + mkdir -p \ + /tmp/argtable && \ + curl -o \ + /tmp/argtable-src.tar.gz -L \ + "https://sourceforge.net/projects/argtable/files/argtable/argtable-${ARGTABLE_VER}/argtable${ARGTABLE_VER1}.tar.gz" && \ + tar xf /tmp/argtable-src.tar.gz -C \ + /tmp/argtable --strip-components=1 && \ + cd /tmp/argtable && \ + ./configure \ + --prefix=/usr && \ + make && \ + make check && \ + make install && \ + +# build comskip + git clone git://github.com/erikkaashoek/Comskip /tmp/comskip && \ + cd /tmp/comskip && \ + ./autogen.sh && \ + ./configure \ + --bindir=/usr/bin \ + --sysconfdir=/config && \ + make && \ + make install && \ + +# install runtime packages + apk add --no-cache \ + ffmpeg \ + ffmpeg-libs \ + libhdhomerun-libs && \ + +# cleanup + apk del --purge \ + build-dependencies && \ + rm -rf \ + /config/.cpanm \ + /tmp/* + +# copy local files +COPY root/ / + +# ports and volumes +EXPOSE 9981 9982 +VOLUME /config /recordings diff --git a/README.md b/README.md new file mode 100644 index 0000000..3c3b631 --- /dev/null +++ b/README.md @@ -0,0 +1,10 @@ +![https://linuxserver.io](https://www.linuxserver.io/wp-content/uploads/2015/06/linuxserver_medium.png) + +## This is a Container in active development by the [LinuxServer.io](https://linuxserver.io) team and is not recommended for use by the general public. + +If you want to comment\contribute on this container , are looking for support on any of our other work , or are curious about us in general, check out the following. + +* [forum.linuxserver.io](https://forum.linuxserver.io) +* [IRC](https://www.linuxserver.io/index.php/irc/) on freenode at `#linuxserver.io` +* [Podcast](https://www.linuxserver.io/index.php/category/podcast/) covers everything to do with getting the most from your Linux Server plus a focus on all things Docker and containerisation! + diff --git a/READMETEMPLATE.md b/READMETEMPLATE.md new file mode 100644 index 0000000..c7fe5ac --- /dev/null +++ b/READMETEMPLATE.md @@ -0,0 +1,98 @@ +![https://linuxserver.io](https://www.linuxserver.io/wp-content/uploads/2015/06/linuxserver_medium.png) + +The [LinuxServer.io](https://linuxserver.io) team brings you another container release featuring auto-update on startup, easy user mapping and community support. Find us for support at: +* [forum.linuxserver.io](https://forum.linuxserver.io) +* [IRC](https://www.linuxserver.io/index.php/irc/) on freenode at `#linuxserver.io` +* [Podcast](https://www.linuxserver.io/index.php/category/podcast/) covers everything to do with getting the most from your Linux Server plus a focus on all things Docker and containerisation! + +# linuxserver/tvheadend-unstable + +[Tvheadend] (https://www.tvheadend.org/) is a TV streaming server and recorder for Linux, FreeBSD and Android supporting DVB-S, DVB-S2, DVB-C, DVB-T, ATSC, ISDB-T, IPTV, SAT>IP and HDHomeRun as input sources. +Tvheadend offers the HTTP (VLC, MPlayer), HTSP (Kodi, Movian) and SAT>IP streaming. +Multiple EPG sources are supported (over-the-air DVB and ATSC including OpenTV DVB extensions, XMLTV, PyXML). + + +## Usage + +``` +docker create \ + --name=tvheadend-unstable \ + -v :/config \ + -e PGID= -e PUID= \ + -p 9981:9981 \ + -p 9982:9982 \ + --device=/dev/dvb + linuxserver/tvheadend-unstable +``` +The --device=/dev/dvb is only needed if you want to pass through a DVB card to the container. If you use IPTV or HDHomeRun you can leave it out. + +**Parameters** + +* `-p 1234` - the port(s) +* `-v /config` - explain what lives here +* `-e PGID` for GroupID - see below for explanation +* `-e PUID` for UserID - see below for explanation + +It is based on alpine linux with s6 overlay, for shell access whilst the container is running do `docker exec -it tvheadend-unstable /bin/bash`. + +### User / Group Identifiers + +Sometimes when using data volumes (`-v` flags) permissions issues can arise between the host OS and the container. We avoid this issue by allowing you to specify the user `PUID` and group `PGID`. Ensure the data volume directory on the host is owned by the same user you specify and it will "just work" ™. + +In this instance `PUID=1001` and `PGID=1001`. To find yours use `id user` as below: + +``` + $ id + uid=1001(dockeruser) gid=1001(dockergroup) groups=1001(dockergroup) +``` + +## Setting up the application + +The first thing to do is to create your admin user as by default everyone is allowed to access tvheadend. Go to Configuration --> Users --> Access Entries and click Add and fill in all the required fields. +Then go to the password tab and click Add and fill in the user name you created in the previous step and enter your password. +Click the (login) button in the top of the webgui and check that your user is configured properly. After you have logged in, deleteor disable the * user. +Then you can start configuring tvheadend with the wizard foun in Configuration --> General --> Base and click Start Wizard. + +**Configuring XMLTV grabber** + +To configure the XMLTV grabber, first check if your grabber is listed in Configuration --> Channel/EPG --> EPG Grabber Modules. If it's listed, you will have to configure the grabber before enabling. +Find the path in the path field of your grabber. We will use the last part. It starts with tv_grab_. Add it after /usr/bin/ in the below command. There should be no space between Usr/bin/ and the part you added. + +``` +docker exec -it -u abc tvheadend-unstable /usr/bin/ --configure +``` + +Now follow the onscreen progress. If you get asked about cache, just accept the default. After you have configured your grabber, you can go back and enable your grabber. + +If you allready have a configuration file, you can add it in the .xmltv folder where you mapped the /config volume. If it's not created, create it. + +**Comskip** +This container comes with Comskip for commercial flagging of recordings. This you have to add in the recording config of tvheadend. +Go to Configuration --> Recording and add the below in the Post-processor command field. + +``` +comskip "%f" +``` + +Now comskip will run after each recording is finished. You will find comskip.ini in the comskip folder of your /config volume mapping. See the [Comskip] (http://www.kaashoek.com/comskip/) homepage for tuning of the ini file. + + +**FFmpeg** + +FFmpeg is installed in /usr/bin/ in case you need to use it with pipe. + +**EPG XML file** + +If you have EPG data in XML format from a supplier, you can drop it in the data folder of your your /config volume mapping. Then choose the XML file grabber in Configuration --> Channel/EPG --> EPG Grabber Modules. +If you use WebGrab+Plus, choose the WebGrab+Plus XML file grabber. The XML file goes in the same path as above. + +For advanced setup of tvheadend, go to [tvheadend.org] (https://www.tvheadend.org) + +## Info + +* Shell access whilst the container is running: `docker exec -it tvheadend-unstable /bin/bash` +* To monitor the logs of the container in realtime: `docker logs -f tvheadend-unstable` + +## Versions + ++ **14.08.2016:** Initial release. diff --git a/patches/perl-unicode.patch b/patches/perl-unicode.patch new file mode 100644 index 0000000..518d8ae --- /dev/null +++ b/patches/perl-unicode.patch @@ -0,0 +1,11 @@ +--- CharName.pm 2005-10-25 20:11:00.000000000 +0200 ++++ CharName.pm.mod 2016-08-12 23:25:51.752348000 +0200 +@@ -77,7 +77,7 @@ + return join("", "HANGUL SYLLABLE ", @s) + } + } +- _init_names() unless defined %NAMES; ++ _init_names() unless %NAMES; + $NAMES{sprintf("%04X",$code)} + } + diff --git a/root/defaults/7a5edfbe189851e5b1d1df19c93962f0 b/root/defaults/7a5edfbe189851e5b1d1df19c93962f0 new file mode 100755 index 0000000..df6ba59 --- /dev/null +++ b/root/defaults/7a5edfbe189851e5b1d1df19c93962f0 @@ -0,0 +1,38 @@ +{ + "enabled": true, + "name": "", + "profile": "22f637a89b4dec0d67e3107ee88ee4c5", + "cache": 2, + "retention-days": 2147483646, + "removal-days": 2147483647, + "clone": true, + "rerecord-errors": 10, + "warm-time": 30, + "pre-extra-time": 0, + "post-extra-time": 0, + "epg-update-window": 86400, + "epg-running": true, + "autorec-maxcount": 0, + "autorec-maxsched": 0, + "storage": "/recordings/", + "storage-mfree": 1000, + "storage-mused": 0, + "file-permissions": "0755", + "charset": "UTF-8", + "tag-files": true, + "skip-commercials": true, + "pathname": "$t/$t -$ e -$ s$n.$x", + "directory-permissions": "0775", + "day-dir": false, + "channel-dir": false, + "title-dir": true, + "channel-in-title": false, + "date-in-title": false, + "time-in-title": false, + "episode-in-title": false, + "subtitle-in-title": false, + "omit-title": false, + "clean-title": false, + "whitespace-in-title": false, + "windows-compatible-filenames": false +} \ No newline at end of file diff --git a/root/defaults/comskip.ini.org b/root/defaults/comskip.ini.org new file mode 100755 index 0000000..1ba6046 --- /dev/null +++ b/root/defaults/comskip.ini.org @@ -0,0 +1,81 @@ +; See comskip.txt in the distribution zip file for many settable parameters, read manual.html, tuning.html and debugwindow.html for how to tune and debug comskip +edl_mode=3 ; the mode specified in the generated edl file, 0=cut, 3=commercial break +mkv_time_offset=30.0 ; offset in seconds, to work around what appears to be an xbmc or ffmpeg bug +always_keep_first_seconds=2 ; xbmc/vdpau has a bug that causes a segfault if we don't keep the start of the stream, I'll fix that when I get a chance +detect_method=255 ;1=black frame, 2=logo, 4=scene change, 8=fuzzy logic, 16=closed captions, 32=aspect ration, 64=silence, 128=cutscenes, 255=all +validate_silence=1 ; Default, set to 0 to force using this clues if selected above. +validate_uniform=1 ; Default, set to 0 to force using this clues (like pure white frames) if blackframe is selected above. +validate_scenechange=1 ; Default, set to 0 to force using this clues if selected above. +verbose=10 ;show a lot of extra info, level 5 is also OK, set to 0 to disable +max_brightness=60 ;frame not black if any pixels checked are greater than this (scale 0 to 255) +test_brightness=40 ;frame not pure black if any pixels checked are greater than this, will check average brightness (scale 0 to 255) +max_avg_brightness=25 ;maximum average brightness for a dim frame to be considered black (scale 0 to 255) 0 means autosetting +max_commercialbreak=600 ;maximum length in seconds to consider a segment a commercial break +min_commercialbreak=25 ;minimum length in seconds to consider a segment a commercial break +max_commercial_size=125 ;maximum time in seconds for a single commercial or multiple commercials if no breaks in between +min_commercial_size=4 ;mimimum time in seconds for a single commercial +min_show_segment_length=250 ; any segment longer than this will be scored towards show. +non_uniformity=500 ; Set to 0 to disable cutpoints based on uniform frames +max_volume=500 ; any frame with sound volume larger than this will not be regarded as black frame +min_silence=12 ; Any deep silence longer than this amount of frames is a possible cutpoint +ticker_tape=0 ; Amount of pixels from bottom to ignore in all processing +logo_at_bottom=0 ; Set to 1 to search only for logo at the lower half of the video, do not combine with subtitle setting +punish=0 ; Compare to average for sum of 1=brightness, 2=uniform 4=volume, 8=silence, 16=schange, set to 0 to disable +punish_threshold=1.3 ; Multiply when amount is above average * punish_threshold +punish_modifier=2 ; When above average * threshold multiply score by this value +intelligent_brightness=0 ; Set to 1 to use a USA specific algorithm to tune some of the settings, not adviced outside the USA +logo_percentile=0.92 ; if more then this amount of logo is found then logo detection will be disabled +logo_threshold=0.775 +punish_no_logo=1 ; Default, set to 0 to avoid show segments without logo to be scored towards commercial +aggressive_logo_rejection=0 +connect_blocks_with_logo=0 ; set to 1 if you want successive blocks with logo on the transition to be regarded as connected, set to 0 to disable +logo_filter=0 ; set the size of the filter to apply to bad logo detection, 4 seems to be a good value. +logo_max_percentage_of_screen=0.9 +subtitles=1 +cut_on_ar_change=1 ; set to 1 if you want to cut also on aspect ratio changes when logo is present, set to 2 to force cuts on aspect ratio changes. set to 0 to disable +delete_show_after_last_commercial=0 ; set to 1 if you want to delete the last block if its a show and after a commercial +delete_show_before_or_after_current=0 ; set to 1 if you want to delete the previous and the next show in the recording, this can lead to the deletion of trailers of next show +delete_block_after_commercial=0 ;set to max size of block in seconds to be discarded, set to 0 to disable +remove_before=0 ; amount of seconds of show to be removed before ALL commercials +remove_after=0 ; amount of seconds of show to be removed after ALL commercials +shrink_logo=0 ; Reduce the duration of the logo with this amount of seconds +after_logo=0 ; set to number of seconds after logo disappears comskip should start to search for silence to insert an additional cutpoint +padding=0 +ms_audio_delay=5 +volume_slip=40 +skip_b_frames=0 ; Set to 1 to force Comskip to skip frames for higher processing speed. +max_repair_size=200 ; Will repair maximum 200 missing MPEG frames in the timeline, set to 0 to disable repairing for players that don't use PTS. +disable_heuristics=4 bit pattern for disabling heuristics, adding 1 disables heristics 1, adding 2 disables heristics 2, adding 4 disables heristics 3, 255 disables all heuristics +delete_logo_file=0 ; set to 1 if you want comskip to tidy up after finishing +output_framearray=0 ; create a big excel file for detailed analysis, set to 0 to disable +output_data=0 ; create a dump of the user data channel, used for CC and XDS (such as V-Chip info). Can be use together with output_framearray to remote debug CC decoding +output_videoredo=0 +output_womble=0 +output_mls=0 ; set to 1 if you want MPeg Video Wizard bookmark file output +output_cuttermaran=0 +output_mpeg2schnitt=0 +output_mpgtx=0 +output_dvrcut=0 +output_zoomplayer_chapter=0 +output_zoomplayer_cutlist=0 +output_edl=0 +output_dvrmstb=0 ; Set to 1 if you're running DVRMS-Toolbox +output_edlx=0 +output_vcf=0 +output_bsplayer=0 +output_btv=0 ; set to 1 if you want Beyond TV chapter cutlist output +output_projectx=0 ; set to 1 if you want ProjectX cutlist output (Xcl) +output_avisynth=0 +output_vdr=1 ; set to 1 if you want XBMC to skipping commercials +output_demux=0 ; set to 1 if you want comskip to demux the mpeg file while scanning +sage_framenumber_bug=0 +sage_minute_bug=0 +live_tv=0 ; set to 1 if you use parallelprocessing and need the output while recording +live_tv_retries=4 ; change to 16 when using live_tv in BTV, used for mpeg PS and TS +dvrms_live_tv_retries=300 ; only used for dvr_ms +standoff=0 ; change to 8000000 when using live_tv in BTV +cuttermaran_options="cut=\"true\" unattended=\"true\" muxResult=\"false\" snapToCutPoints=\"true\" closeApp=\"true\"" +mpeg2schnitt_options="mpeg2schnitt.exe /S /E /R25 /Z %2 %1" +avisynth_options="LoadPlugin(\"MPEG2Dec3.dll\") \nMPEG2Source(\"%s\")\n" +dvrcut_options="dvrcut \"%s.dvr-ms\" \"%s_clean.dvr-ms\" " +windowtitle="Comskip - %s" diff --git a/root/etc/cont-init.d/30-config b/root/etc/cont-init.d/30-config new file mode 100644 index 0000000..139411a --- /dev/null +++ b/root/etc/cont-init.d/30-config @@ -0,0 +1,17 @@ +#!/usr/bin/with-contenv bash + +# make folders +mkdir -p \ + /config/.hts/tvheadend/dvr/config \ + /config/comskip + +# copy config +[[ ! -e /config/.hts/tvheadend/dvr/config/7a5edfbe189851e5b1d1df19c93962f0 ]] && \ + cp /defaults/7a5edfbe189851e5b1d1df19c93962f0 /config/.hts/tvheadend/dvr/config/7a5edfbe189851e5b1d1df19c93962f0 +[[ ! -e /config/comskip/comskip.ini ]] + cp /defaults/comskip.ini.org /config/comskip/comskip.ini + +# permissions +chown -R abc:abc \ + /config \ + /config/.hts diff --git a/root/etc/services.d/tvheadend/run b/root/etc/services.d/tvheadend/run new file mode 100755 index 0000000..c581c72 --- /dev/null +++ b/root/etc/services.d/tvheadend/run @@ -0,0 +1,3 @@ +#!/usr/bin/with-contenv bash +exec \ + s6-setuidgid abc /usr/bin/tvheadend -C diff --git a/root/usr/bin/tv_grab_file b/root/usr/bin/tv_grab_file new file mode 100755 index 0000000..d3e25ea --- /dev/null +++ b/root/usr/bin/tv_grab_file @@ -0,0 +1,55 @@ +#!/bin/bash +dflag= +vflag= +cflag= +if (( $# < 1 )) +then + cat /config/data/*.xml + exit 0 +fi + +for arg +do + delim="" + case "$arg" in + #translate --gnu-long-options to -g (short options) + --description) args="${args}-d ";; + --version) args="${args}-v ";; + --capabilities) args="${args}-c ";; + #pass through anything else + *) [[ "${arg:0:1}" == "-" ]] || delim="\"" + args="${args}${delim}${arg}${delim} ";; + esac +done + +#Reset the positional parameters to the short options +eval set -- $args + +while getopts "dvc" option +do + case $option in + d) dflag=1;; + v) vflag=1;; + c) cflag=1;; + \?) printf "unknown option: -%s\n" $OPTARG + printf "Usage: %s: [--description] [--version] [--capabilities] \n" $(basename $0) + exit 2 + ;; + esac >&2 +done + +if [ "$dflag" ] +then + printf "XML file grabber\n" +fi +if [ "$vflag" ] +then + printf "0.1\n" +fi +if [ "$cflag" ] +then + printf "baseline\n" +fi + +exit 0 + diff --git a/root/usr/bin/tv_grab_wg b/root/usr/bin/tv_grab_wg new file mode 100755 index 0000000..028c699 --- /dev/null +++ b/root/usr/bin/tv_grab_wg @@ -0,0 +1,63 @@ +#!/bin/bash +xmltv_file_location=/config/data/*.xml +dflag= +vflag= +cflag= +qflag= +if (( $# < 1 )) +then + cat "$xmltv_file_location" + exit 0 +fi + +for arg +do + delim="" + case "$arg" in + #translate --gnu-long-options to -g (short options) + --description) args="${args}-d ";; + --version) args="${args}-v ";; + --capabilities) args="${args}-c ";; + --quiet) args="${args}-q ";; + + #pass through anything else + *) [[ "${arg:0:1}" == "-" ]] || delim="\"" + args="${args}${delim}${arg}${delim} ";; + esac +done + +#Reset the positional parameters to the short options +eval set -- $args + +while getopts "dvcq" option +do + case $option in + d) dflag=1;; + v) vflag=1;; + c) cflag=1;; + q) qflag=1;; + \?) printf "unknown option: -%s\n" $OPTARG + printf "Usage: %s: [--description] [--version] [--capabilities] \n" $(basename $0) + exit 2 + ;; + esac >&2 +done + +if [ "$dflag" ] +then + printf "WebGrab+Plus XML file grabber\n" +fi +if [ "$vflag" ] +then + printf "0.2\n" +fi +if [ "$cflag" ] +then + printf "baseline\n" +fi +if [ "$qflag" ] +then + printf "" +fi + +exit 0