You are not logged in.

#1 2009-06-03 20:28:07

Purch
Member
From: Finland
Registered: 2006-02-23
Posts: 229

[REQUEST] tvheadend and showtime

A TV DVR recorder/server. Also the client side showtime.

A nice web page front-end to control recordings and who can contact etc. These should be very easy to use.

http://www.lonelycoder.com/hts/

compile help for showtime
http://trac.lonelycoder.com/hts/browser … ime/README

compile help for tvheadend
http://trac.lonelycoder.com/hts/browser … end/README

Offline

#2 2009-06-05 23:05:47

azleifel
Member
Registered: 2007-10-28
Posts: 486

Re: [REQUEST] tvheadend and showtime

I have been looking for something like tvheadend so I had a go.  I'm sure that they can be improved tongue, but here are the PKGBUILD, install file and rc-script that I made:

PKGBUILD (x86_64 only because that's what I'm running and it is svn because the release version wouldn't compile)

pkgname=hts-tvheadend-svn
pkgver=3035
pkgrel=1
pkgdesc="Combined DVB receiver, Digital Video Recorder and Showtime streaming server for Linux"
arch=(x86_64)
url="http://www.lonelycoder.com/hts/"
license=('GPL3')
depends=()
makedepends=('subversion' 'gzip')
provides=('tvheadend')
install=tvheadend.install
source=(rc-tvheadend)
md5sums=('9f709cde07af64998760fca4ebc51e18')

# Note: _svntrunk URL must end with /tvheadend otherwise the whole
# repository will be checked out, showtime and all
_svntrunk=svn://svn.lonelycoder.com/hts/trunk/tvheadend
_svnmod=tvheadend

build() {
  cd ${srcdir}

  if [ -d ${_svnmod}/.svn ]; then
    (cd ${_svnmod} && svn up -r $pkgver)
  else
    svn co ${_svntrunk} --config-dir ./ -r $pkgver
  fi

  msg "SVN checkout done or server timeout"
  msg "Starting make..."

  rm -rf ${srcdir}/${_svnmod}-build
  cp -r ${_svnmod} ${_svnmod}-build
  cd ${_svnmod}-build

  #
  # BUILD
  #
  ./configure --prefix=/usr --release
  make || return 1

  # Install tvheadend executable
  install -D -m755 build.Linux/tvheadend ${pkgdir}/usr/bin/tvheadend || return 1
  
  # Install rc-script
  install -D -m755 ${srcdir}/rc-tvheadend ${pkgdir}/etc/rc.d/tvheadend || return 1
  
  # Install man page and documents
  install -D -m644 man/tvheadend.1 ${pkgdir}/usr/share/man/man1/tvheadend.1 || return 1
  install -D -m644 README ${pkgdir}/usr/share/doc/hts-tvheadend/README || return 1
  install -D -m644 debian/changelog ${pkgdir}/usr/share/doc/hts-tvheadend/ChangeLog || return 1
  gzip ${pkgdir}/usr/share/doc/hts-tvheadend/ChangeLog || return 1
  
  rm -rf ${srcdir}/${_svnmod}-build
}

tvheadend.install (a good part of which is borrowed from tvheadend's Debian postinst script)

HTS_USER=hts

## arg 1:  the new package version
post_install() {
  if ! getent passwd $HTS_USER >/dev/null; then
    echo '==> tvheadend: Creating daemon user "'$HTS_USER'" with password "'$HTS_USER'"'
    echo "               Use this username and password to log into the tvheadend web"
    echo "               server (http://hostname:9981) when it is running as a daemon"
    useradd -U -G video -m -s /bin/bash $HTS_USER &>/dev/null
    passwd -l $HTS_USER &>/dev/null
  fi
  
  HTS_HOME=`getent passwd $HTS_USER | cut -d':' -f6`

  if [ ! -e ${HTS_HOME}/.hts/tvheadend/superuser ]; then
    mkdir -p ${HTS_HOME}/.hts/tvheadend
    chown ${HTS_USER}:${HTS_USER} ${HTS_HOME}/.hts
    chown ${HTS_USER}:${HTS_USER} ${HTS_HOME}/.hts/tvheadend

    HTS_SUPERUSERCONF="${HTS_HOME}/.hts/tvheadend/superuser"
    rm -f ${HTS_SUPERUSERCONF}
    touch ${HTS_SUPERUSERCONF}
    chmod 600 ${HTS_SUPERUSERCONF}
    chown ${HTS_USER}:${HTS_USER} ${HTS_SUPERUSERCONF}

    echo >>"${HTS_SUPERUSERCONF}" "{"
    echo >>"${HTS_SUPERUSERCONF}" '        "username": "'$HTS_USER'",'
    echo >>"${HTS_SUPERUSERCONF}" '        "password": "'$HTS_USER'"'
    echo >>"${HTS_SUPERUSERCONF}" "}"
  fi
}

## arg 1:  the new package version
## arg 2:  the old package version
post_upgrade() {
  post_install $1
}

# arg 1:  the old package version
post_remove() {
  userdel $HTS_USER &>/dev/null
}

rc-tvheadend

#!/bin/bash

# HTS Tvheadend daemon rc-script
# Last Edited: 05-Jun-09

daemon_name=tvheadend
daemon_args="-f -u hts -g video"
pidfile=/var/run/$daemon_name.pid

. /etc/rc.d/functions
. /etc/rc.conf

PID=`pidof -o %PPID /usr/bin/$daemon_name`

case "$1" in
 start)
   stat_busy "Starting Tvheadend daemon"

   if [ -z "$PID" ]; then
     [ -f ${pidfile} ] && rm -f ${pidfile}
     # RUN
     /usr/bin/$daemon_name $daemon_args
     #
     if [ $? -gt 0 ]; then
       stat_fail
       exit 1
     else
       add_daemon $daemon_name
       stat_done
     fi
   else
     stat_fail
     exit 1
   fi
   ;;

 stop)
   stat_busy "Stopping Tvheadend daemon"

   # KILL
   [ ! -z "$PID" ] && kill $PID &> /dev/null
   #
   if [ $? -gt 0 ]; then
     stat_fail
     exit 1
   else
     rm_daemon $daemon_name
     stat_done
   fi
   ;;

 restart)
   $0 stop
   sleep 3
   $0 start
   ;;
 *)
   echo "usage: $0 {start|stop|restart}"
esac

exit 0

The daemon starts and stops, the web server allows me to log in and it recognises my dvb-t card.  I haven't tried to do anything significant like scanning for channels or scheduling a recording yet.

Offline

#3 2009-06-06 10:00:03

azleifel
Member
Registered: 2007-10-28
Posts: 486

Re: [REQUEST] tvheadend and showtime

Follow-up:  I think that I might like tvheadend but I've given up on showtime.  The current source needed patching in four places to resolve "no return statement in function returning non-void" errors from gcc 4.4, and then when I'd done that I found that it segfaulted immediately after being started because gnome-screensaver was not installed and running.  Maybe it has a setting to turn that requirement off but I didn't bother trying to find out because I'm using Xfce and I don't want to install more parts of gnome than I absolutely have to!

Offline

#4 2009-06-06 13:41:47

Purch
Member
From: Finland
Registered: 2006-02-23
Posts: 229

Re: [REQUEST] tvheadend and showtime

Nice work! I figured that the showtime had probs with gcc 4.4. So I will make a request to the developer for gcc 4.4 patch and solution for disabling gnome-screensaver. Let's see what happens.

I loved the idea of recording tv to a matroska format. Now I have to settle with DVR in server and dvr-sxfe/xbmc in the living room media player.

Offline

#5 2009-06-06 22:37:07

azleifel
Member
Registered: 2007-10-28
Posts: 486

Re: [REQUEST] tvheadend and showtime

Thanks...I've made some improvements in the meantime:

PKGBUILD

pkgname=hts-tvheadend-svn
pkgver=3035
pkgrel=1
pkgdesc="Combined DVB receiver, Digital Video Recorder and Showtime streaming server for Linux"
arch=(x86_64)
url="http://www.lonelycoder.com/hts/"
license=('GPL3')
depends=()
makedepends=('subversion' 'gzip')
install=tvheadend.install
source=(rc-tvheadend)
md5sums=('b5dd2b7b1de6909fbb6f683dcdb23904')

# Note: _svntrunk URL must end with /tvheadend otherwise the whole
# repository will be checked out, showtime and all
_svntrunk=svn://svn.lonelycoder.com/hts/trunk/tvheadend
_svnmod=tvheadend

build() {
  cd ${srcdir}

  if [ -d ${_svnmod}/.svn ]; then
    (cd ${_svnmod} && svn up -r $pkgver)
  else
    svn co ${_svntrunk} --config-dir ./ -r $pkgver
  fi

  msg "SVN checkout done or server timeout"
  msg "Starting make..."

  rm -rf ${srcdir}/${_svnmod}-build
  cp -r ${_svnmod} ${_svnmod}-build
  cd ${_svnmod}-build

  #
  # BUILD
  #
  ./configure --prefix=/usr --release
  make || return 1

  # Install tvheadend
  install -D -m755 build.Linux/tvheadend ${pkgdir}/usr/bin/tvheadend || return 1
  
  # Install rc-script
  install -D -m755 ${srcdir}/rc-tvheadend ${pkgdir}/etc/rc.d/tvheadend || return 1
  
  # Install man page and documents
  install -D -m644 man/tvheadend.1 ${pkgdir}/usr/share/man/man1/tvheadend.1 || return 1
  install -D -m644 README ${pkgdir}/usr/share/doc/hts-tvheadend/README || return 1
  install -D -m644 debian/changelog ${pkgdir}/usr/share/doc/hts-tvheadend/ChangeLog || return 1
  gzip ${pkgdir}/usr/share/doc/hts-tvheadend/ChangeLog || return 1
  
  rm -rf ${srcdir}/${_svnmod}-build
}

tvheadend.install

# tvheadend.install
# Last Edited: 06-Jun-09

HTS_USER=hts

## arg 1:  the new package version
post_install() {
  if ! getent passwd $HTS_USER >/dev/null; then
    echo '==> tvheadend: Creating daemon superuser "'$HTS_USER'" with password "'$HTS_USER'"'
    echo "               Use the superuser identity for first login to the web server"
    echo "               (http://hostname:9981) when tvheadend is running as a daemon"
    useradd -U -G video -m -s /bin/bash $HTS_USER &>/dev/null
    passwd -l $HTS_USER &>/dev/null
  
    HTS_HOME=`getent passwd $HTS_USER | cut -d':' -f6`

    if [ ! -e ${HTS_HOME}/.hts/tvheadend/superuser ]; then
      mkdir -p ${HTS_HOME}/.hts/tvheadend
      chown ${HTS_USER}:${HTS_USER} ${HTS_HOME}/.hts
      chown ${HTS_USER}:${HTS_USER} ${HTS_HOME}/.hts/tvheadend

      HTS_SUPERUSERCONF="${HTS_HOME}/.hts/tvheadend/superuser"
      rm -f ${HTS_SUPERUSERCONF}
      touch ${HTS_SUPERUSERCONF}
      chmod 600 ${HTS_SUPERUSERCONF}
      chown ${HTS_USER}:${HTS_USER} ${HTS_SUPERUSERCONF}

      echo >>"${HTS_SUPERUSERCONF}" "{"
      echo >>"${HTS_SUPERUSERCONF}" '        "username": "'$HTS_USER'",'
      echo >>"${HTS_SUPERUSERCONF}" '        "password": "'$HTS_USER'"'
      echo >>"${HTS_SUPERUSERCONF}" "}"
    fi
  else
    echo '==> tvheadend: User "'$HTS_USER'" already exits.  No changes made during install.'
  fi
}

## arg 1:  the new package version
## arg 2:  the old package version
post_upgrade() {
  post_install $1
}

# arg 1:  the old package version
post_remove() {
  userdel $HTS_USER &>/dev/null
}

rc-tvheadend

#!/bin/bash

# HTS Tvheadend daemon rc-script
# Last Edited: 05-Jun-09

daemon_name=tvheadend
daemon_args="-f -u hts -g video"
pidfile=/var/run/$daemon_name.pid

. /etc/rc.d/functions
. /etc/rc.conf

case "$1" in
 start)
   stat_busy "Starting Tvheadend daemon"
   if [ -z `pidof -o %PPID /usr/bin/$daemon_name` ]; then
     [ -f ${pidfile} ] && rm -f ${pidfile}
     # RUN
     /usr/bin/$daemon_name $daemon_args
     #
     if [ $? -gt 0 ]; then
       stat_fail
       exit 1
     else
       add_daemon $daemon_name
       stat_done
     fi
   else
     stat_fail
     exit 1
   fi
   ;;

 stop)
   stat_busy "Stopping Tvheadend daemon"
   # KILL
   [ -f ${pidfile} ] && kill `cat ${pidfile}` >/dev/null 2>&1
   #
   if [ $? -gt 0 ]; then
     stat_fail
     exit 1
   else
     rm -f ${pidfile}
     rm_daemon $daemon_name
     stat_done
   fi
   ;;

 restart)
   $0 stop
   sleep 3
   $0 start
   ;;
 *)
   echo "usage: $0 {start|stop|restart}"
esac

exit 0

Offline

#6 2009-06-07 09:55:16

azleifel
Member
Registered: 2007-10-28
Posts: 486

Re: [REQUEST] tvheadend and showtime

Oh, and I've found that tvheadend needs a small patch to be able to find xmltv grabbers (if installed using the Arch xmltv package):

xmltv_grabber_path.patch

--- src/xmltv.c    2009-06-06 22:33:01.607964549 +0100
+++ src/xmltv.c.new    2009-06-07 09:14:09.092007267 +0100
@@ -713,6 +713,7 @@
   change =  xmltv_scan_grabbers("/bin");
   change |= xmltv_scan_grabbers("/usr/bin");
   change |= xmltv_scan_grabbers("/usr/local/bin");
+  change |= xmltv_scan_grabbers("/usr/bin/perlbin/vendor");
 
   for(xg = LIST_FIRST(&xmltv_grabbers); xg != NULL; xg = next) {
     next = LIST_NEXT(xg, xg_link);

Offline

#7 2009-06-07 11:41:04

Purch
Member
From: Finland
Registered: 2006-02-23
Posts: 229

Re: [REQUEST] tvheadend and showtime

This is overwhelming. That patch is not required anymore. Grab the latest svn

  LIST_FOREACH(xg, &xmltv_grabbers, xg_link)
    xg->xg_dirty = 1;

  change =  xmltv_scan_grabbers("/bin");
  change |= xmltv_scan_grabbers("/usr/bin");
  change |= xmltv_scan_grabbers("/usr/local/bin");
  // Arch linux puts xmltv grabbers in /usr/bin/perlbin/vendor
  change |= xmltv_scan_grabbers("/usr/bin/perlbin/vendor"); 

  if((path = getenv("PATH")) != NULL) {

I think showtime will compile too, very soon smile

Last edited by Purch (2009-06-07 11:45:27)

Offline

#8 2009-06-07 16:38:02

azleifel
Member
Registered: 2007-10-28
Posts: 486

Re: [REQUEST] tvheadend and showtime

Wow!  I asked about xmltv grabbers on the HTS Development mailing list this morning and Andreas Öman responded that he would make the change.

PS. I've already uploaded the package to AUR (hts-tvheadend-svn).  I'll have to go and update it now!

Offline

#9 2009-06-07 17:02:41

Purch
Member
From: Finland
Registered: 2006-02-23
Posts: 229

Re: [REQUEST] tvheadend and showtime

I compiled showtime with gcc43 package from archvdr ( http://apps.sourceforge.net/trac/archvdr/wiki/ArchVDR ).

--disable-libasound removed alsa errors. I dont remember what they were but they refered to c file.

I get this error

$ showtime
GLW [ERROR]: XSupportsLocale returned false

PKGBUILD

pkgname=hts-showtime-svn
pkgver=3045
pkgrel=1
pkgdesc="Combined DVB receiver, Digital Video Recorder and Showtime
streaming server for Linux"
arch=(i686 x86_64)
url="http://www.lonelycoder.com/hts/"
license=('GPL3')
depends=()
makedepends=('subversion' 'gzip')

# Note: _svntrunk URL must end with /tvheadend otherwise the whole
# repository will be checked out, showtime and all
_svntrunk=svn://svn.lonelycoder.com/hts/trunk/showtime
_svnmod=showtime

build() {
  cd ${srcdir}

  if [ -d ${_svnmod}/.svn ]; then
    (cd ${_svnmod} && svn up -r $pkgver)
  else
    svn co ${_svntrunk} --config-dir ./ -r $pkgver
  fi

  msg "SVN checkout done or server timeout"
  msg "Starting make..."

  rm -rf ${srcdir}/${_svnmod}-build
  cp -r ${_svnmod} ${_svnmod}-build
  cd ${_svnmod}-build
  patch src/xmltv.c < ../xmltv_grabber_path.patch

  #
  # BUILD
  #
  ./configure --prefix=/usr --cc=gcc-4.3 --disable-libasound --release
  make || return 1
  make prefix=${pkgdir}/usr install

}

Offline

#10 2009-06-07 18:27:45

azleifel
Member
Registered: 2007-10-28
Posts: 486

Re: [REQUEST] tvheadend and showtime

That error comes from within showtime.  You could check that you have your locale set up correctly but, really, I wouldn't advise messing about with gcc 4.3.  Here's the PKGBUILD and gcc 4.4 patches that I put together for showtime:

PKGBUILD

pkgname=hts-showtime-svn
pkgver=3045
pkgrel=1
pkgdesc="OpenGL based mediaplayer for Linux"
arch=(x86_64)
url="http://www.lonelycoder.com/hts/"
license=('GPL3')
depends=('libexif' 'libgl' 'mesa' 'alsa-lib')
makedepends=('subversion' 'gzip')
source=(gcc44.patches)
md5sums=('6188955a36bb0b6a37d9ad56f8998b4c')

# Note: _svntrunk URL must end with /showtime otherwise the whole
# repository will be checked out, showtime and all
_svntrunk=svn://svn.lonelycoder.com/hts/trunk/showtime
_svnmod=showtime

build() {
  cd ${srcdir}

  if [ -d ${_svnmod}/.svn ]; then
    (cd ${_svnmod} && svn up -r $pkgver)
  else
    svn co ${_svntrunk} --config-dir ./ -r $pkgver
  fi

  msg "SVN checkout done or server timeout"
  msg "Starting make..."

  rm -rf ${srcdir}/${_svnmod}-build
  cp -r ${_svnmod} ${_svnmod}-build
  cd ${_svnmod}-build

  # Apply patches
  patch -Np0 -i ../gcc44.patches
  
  #
  # BUILD
  #
  ./configure --prefix=/usr --release
  make || return 1

  # Install showtime
  install -D -m755 build.linux/showtime ${pkgdir}/usr/bin/showtime || return 1
  
  # Install man page and documents
  install -D -m644 man/showtime.1 ${pkgdir}/usr/share/man/man1/showtime.1 || return 1
  install -D -m644 README ${pkgdir}/usr/share/doc/hts-showtime/README || return 1
  install -D -m644 debian/changelog ${pkgdir}/usr/share/doc/hts-showtime/ChangeLog || return 1
  gzip ${pkgdir}/usr/share/doc/hts-showtime/ChangeLog || return 1
  
  rm -rf ${srcdir}/${_svnmod}-build
}

gcc44.patches

--- src/callout.c    2009-06-07 18:13:56.952725805 +0100
+++ /home/david/Build/hts-showtime-svn/src/showtime-build/src/callout.c    2009-06-07 18:26:33.069345998 +0100
@@ -126,6 +126,7 @@
       hts_cond_wait(&callout_cond, &callout_mutex);
     }
   }
+  return NULL;
 }


--- src/playqueue.c    2009-06-07 18:13:56.952725805 +0100
+++ /home/david/Build/hts-showtime-svn/src/showtime-build/src/playqueue.c    2009-06-07 18:28:38.605985302 +0100
@@ -375,6 +375,7 @@
 
     hts_mutex_lock(&playqueue_request_mutex);
   }
+  return NULL;
 }


--- src/ui/glw/glw_texture_loader.c    2009-06-07 18:13:56.639796277 +0100
+++ /home/david/Build/hts-showtime-svn/src/showtime-build/src/ui/glw/glw_texture_loader.c    2009-06-07 18:34:46.333005540 +0100
@@ -104,6 +104,7 @@
 
     glw_tex_deref_locked(gr, glt);
   }
+  return NULL;
 }
 

--- src/ui/glw/glw_text_bitmap.c    2009-06-07 18:13:56.643130221 +0100
+++ /home/david/Build/hts-showtime-svn/src/showtime-build/src/ui/glw/glw_text_bitmap.c    2009-06-07 18:40:45.469310067 +0100
@@ -984,6 +984,7 @@
       gtb_set_estimated_size(gr, gtb);
     }
   }
+  return NULL;
 }
 
 /**

Offline

#11 2009-07-22 03:49:56

patstew
Member
Registered: 2008-08-04
Posts: 10

Re: [REQUEST] tvheadend and showtime

Showtime builds if you remove -Werror and -O2 from the CFLAGS in the Makefile. However it doesn't seem to have any functionality, there is only an empty playlist screen and a settings screen with a couple of options. Thanks for the tvheadend PKGBUILDS on aur btw. What are you using to watch things?

EDIT: It does work, you just need to add htsp://ip:9982 to the command line to play anything. I was expecting some kind of button in the application. When you do this you get a list of channels which can be clicked and played, but I can't work out how to do anything else.

Last edited by patstew (2009-07-22 04:17:03)

Offline

#12 2009-07-22 18:21:58

azleifel
Member
Registered: 2007-10-28
Posts: 486

Re: [REQUEST] tvheadend and showtime

Unfortunately, though I can build showtime I cannot get it to start without segfaulting.  In the meantime, I made myself some vdr packages and I'm using vdr exclusively for television watching and recording.

Offline

Board footer

Powered by FluxBB