Linux - HOW-TO watch Live TV in XBMC for Linux with Tvheadend, the easy way!

  Thread Rating:
  • 16 Votes - 5 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Post Reply
Ruud Offline
Member
Posts: 90
Joined: Aug 2010
Reputation: 0
Post: #46
Hi,

I noticed that there is a difference in how TVHeadend web interface and XBMX handles the EPG:

webinterface:
Title, Start Duration
'Zender verstrekt geen informatie', 14:00, 4 hrs
'Droomhuis op het platteland', 15:00, 3 hrs (scheduled for recording)
'De grote verbouwing', 16:00, 1 hrs (scheduled for recording)
'Verbouwen en Verkopen', 17:00, 1 hrs
'De grote verhuizing', 18:00, 4 hrs(scheduled for recording)

TV Guide, timeline:
14:00, 'Zender verstrekt geen informatie' >18:00 hrs (with scheduled recording indicator)
18:00, 'De grote verhuizing' > 22:00 hrs (with scheduled recording indicator)

so seperate from the bug / issue mentioned > here <, the XBMC TV guide handles the epg data different and therefore it cannot be used to schedule the programs 'below' the overlapping (and faulty) programs.

'Droomhuis op het Platteland' cannot be scheduled for recording in XBMC as it is not visible in the timeline, in the tvheadend web application it can be scheduled.

hope this is clear and makes sense (it's very early this Sunday morning Wink)
regards,
Ruud

TV server: ClearOS 5.2, HTS Tvheadend git-0664329, IPTV
XBMC Clients (2): Jetway J7F3E Mini-ITX, AMD Geode NX1750, 1GB, Custom Build Case, 2,5" SATA 120GB, GeForce 8500GT (PCI) 256MB, NEC Slot-in DVD, 7" touch screen, 40" Samsung LED (VGA), ATI Remote Wonder (I)
(OS) Environment Clients: Ubuntu Server 10.04, XBMC 11.0 BETA 3, TVHeadend plugin enabled, Skin Confluenza
find quote
opdenkamp Offline
Team-XBMC PVR Developer
Posts: 2,209
Joined: Feb 2009
Reputation: 29
Location: Heerlen, The Netherlands
Post: #47
known issue. fixed in the development tree.

opdenkamp / dushmaniac

xbmc-pvr [Eden-PVR builds] [now included in mainline XBMC, so no more source link here :)]
personal website: [link]

Found a problem with PVR? Report it on Trac, under "PVR - core components". Please attach the full debug log.

If you like my work, please consider donating to me and/or Team XBMC.
find quote
ffreak Offline
Junior Member
Posts: 9
Joined: Jan 2011
Reputation: 0
Post: #48
Hi,
wanted to use this with a new htpc,
now i have the following questions:
1. Is it possible to use Timeshift?
2. Is there a way to start the pc for sheduled recordings or have it to run 24/7 ?

regards
ffreak
find quote
opdenkamp Offline
Team-XBMC PVR Developer
Posts: 2,209
Joined: Feb 2009
Reputation: 29
Location: Heerlen, The Netherlands
Post: #49
1. no, not at the moment.
2. it has to be on when the recording starts. perhaps you could do something with acpi wakeup, but you'll have to figure out how to do that yourself.

opdenkamp / dushmaniac

xbmc-pvr [Eden-PVR builds] [now included in mainline XBMC, so no more source link here :)]
personal website: [link]

Found a problem with PVR? Report it on Trac, under "PVR - core components". Please attach the full debug log.

If you like my work, please consider donating to me and/or Team XBMC.
find quote
Ruud Offline
Member
Posts: 90
Joined: Aug 2010
Reputation: 0
Post: #50
dushmaniac Wrote:known issue. fixed in the development tree.
hummm I almost feel disappointed Laugh , but do not despair... I will find something that wasn't known Big Grin

Any change of an updated master with some of these resolved bugs (and maybe some other 'goodies')...

thanks for all of everybodies hard work!

regards,
Ruud.

TV server: ClearOS 5.2, HTS Tvheadend git-0664329, IPTV
XBMC Clients (2): Jetway J7F3E Mini-ITX, AMD Geode NX1750, 1GB, Custom Build Case, 2,5" SATA 120GB, GeForce 8500GT (PCI) 256MB, NEC Slot-in DVD, 7" touch screen, 40" Samsung LED (VGA), ATI Remote Wonder (I)
(OS) Environment Clients: Ubuntu Server 10.04, XBMC 11.0 BETA 3, TVHeadend plugin enabled, Skin Confluenza
find quote
janumix Offline
Member
Posts: 90
Joined: Jan 2010
Reputation: 0
Location: Cracow, Poland
Post: #51
@ffreak

2. got it working. I'll post a few steps when I back home.

Regards
Janusz
find quote
ffreak Offline
Junior Member
Posts: 9
Joined: Jan 2011
Reputation: 0
Post: #52
@janumix
oh , thank you Big Grin , i was really desperate because of this

regards
ffreak

Edit: One little further question: Is it possible to mod skins like Aeon nox to work with the frontend?
(This post was last modified: 2011-02-01 19:21 by ffreak.)
find quote
J├Ânke Offline
Fan
Posts: 497
Joined: Oct 2009
Reputation: 2
Post: #53
Can anybody tell me how to "right mouse click" with Asrock 330ht remote ? So i can see channel list with out have to stop video (live-tv)
find quote
janumix Offline
Member
Posts: 90
Joined: Jan 2010
Reputation: 0
Location: Cracow, Poland
Post: #54
@ffreak

It works with HTS TVheadend.
Try this:

1. Make sure you motherboard supports ACPI Wakeup
2. Make sure you have correctly working suspend script. In my case it was important to suspend system - not to shutdown it. Here is one I use (/etc/pm/sleep.d/99_htpc.sh):

Code:
#!/bin/sh

# This script uses curl. Install curl using the following command from your terminal apt-get install curl
# This script will restart lirc drivers, Lirc, and XBMC's lirc interperater upon resume.

case "$1" in  
    suspend|hibernate)
           #curl "http://xbmc:123456@127.0.0.1:8080/xbmcCmds/xbmcHttp?command=ExecBuiltIn&parameter=LIRC.Stop"
       service xbmc-live stop
       /etc/init.d/tvheadend stop
       /etc/init.d/lirc stop
       rmmod mantis
       rmmod ivtv
       rmmod nvidia
       ;;
        resume|thaw)
           modprobe nvidia
       modprobe mantis
           modprobe ivtv
       sleep 1
           /etc/init.d/lirc start
           /etc/init.d/tvheadend start
           #remove the comment if the computer automatically sleeps after resume
           #irw & sleep 1; killall irw
       sleep 2
       service xbmc-live start
           #curl "http://xbmc:123456@127.0.0.1:8080/xbmcCmds/xbmcHttp?command=ExecBuiltIn&parameter=LIRC.Start"
           echo "lirc resume script completed!!!" >>/tmp/script.log
           ;;
esac

3. Create new script - the same path i.e. /etc/pm/sleep.d/95_timer.sh

Code:
#!/bin/bash
#
# set ACPI Wakeup alarm
# safe_margin - minutes to start up system before the earliest timer
# script does not check if recording is in progress
#
#

echo 1 > /timer

# bootup system 60 sec. before timer
safe_margin=60

# modyfy if different location for tvheadend dvr/log path
cd ~hts/.hts/tvheadend/dvr/log

######################

start_date=0
stop_date=0

current_date=`date +%s`

for i in $( ls  ); do
   tmp_start=`cat $i | grep '"start":' | cut -f 2 -d " " | cut -f 1 -d ","`
   tmp_stop=`cat $i | grep '"stop":' | cut -f 2 -d " " | cut -f 1 -d ","`

# check for outdated timer
   if [ $((tmp_stop)) -gt $((current_date)) -a $((tmp_start)) -gt $((current_date)) ]; then
  
# take lower value (tmp_start or start_date)
     if [ $((start_date)) -eq 0 -o $((tmp_start)) -lt $((start_date)) ]; then
          start_date=$tmp_start
          stop_date=$tmp_stop
     fi
   fi
done

wake_date=$((start_date-safe_margin))

echo $start_date >> /timer
echo $wake_date >> /timer

# set up waleup alarm
if [ $((start_date)) -ne 0 ]; then
echo 2 >> /timer
  echo 0 > /sys/class/rtc/rtc0/wakealarm
  echo $wake_date > /sys/class/rtc/rtc0/wakealarm
fi

4. Modify/make sure all paths in script below are set up correctly.

Note: I havn't finished it and system does not automaticly shutdown after recording has been finished.

Hope this helps you - regards
Janusz
find quote
DanielBuus Offline
Junior Member
Posts: 39
Joined: Oct 2010
Reputation: 0
Post: #55
Did you ever know that you're my heeeeerooooooooohhhh... You're everything I would like to beeee-ee-eee!

Damn you, I love you so much! This is the most awesome addition to the most awesome media application in existence. THANK YOU!!!!!
find quote
nmcaullay Offline
Member
Posts: 83
Joined: Aug 2010
Reputation: 1
Post: #56
Hi there,

I'm in the process of writing an addon to manage uptime, so that the machine stays on when there is a recording scheduled, and starts up to record.

It's early days, and this is my first python effort... be nice...

It uses the status.xml page, parses the current recordings, and determines when to shutdown/stay awake...

I'd appreciate any feedback...

Code:
import sys
import os
import time, datetime
import commands
#import xbmc
#import xbmcaddon
#import xbmcgui
import urllib2
from xml.dom import minidom

#get actioncodes from keymap.xml
ACTION_PREVIOUS_MENU = 10
ACTION_SELECT_ITEM = 7
TVHEADEND_URL = 'http://localhost:9981/status.xml'
#TVHEADEND_FILE = 'C:\python25\scripts\status-norecording.xml'
WAITBEFORESHUTDOWN = 300
WAKEBEFORERECORDING = 240 #30

hostStatus = 1;

#try:
while True:
   hostStatus = 1
   closestRecordingDateTimeStart = None
   closestRecordingDateTimeEnd = None
   closestRecordingTitle = None
   currentlyRecording = "False"
   difference = None
   UTCTimeDelta = datetime.timedelta(hours=8)
   currentTime = datetime.datetime.now()

   password_mgr = urllib2.HTTPPasswordMgrWithDefaultRealm()
   password_mgr.add_password(None, TVHEADEND_URL, 'xbmc', 'xbmc')
   handler = urllib2.HTTPBasicAuthHandler(password_mgr)
   opener = urllib2.build_opener(handler)
   opener.open(TVHEADEND_URL)
   urllib2.install_opener(opener)
   f = urllib2.urlopen(TVHEADEND_URL)
   link = f.read()
   xmldoc = minidom.parseString(link)
   f.close()

   #xmldoc = minidom.parse(TVHEADEND_FILE)

   subscriptionnode = xmldoc.getElementsByTagName('subscriptions')[0]
   numsubscriptions = subscriptionnode.childNodes[0].data

   if numsubscriptions == "0":
      minutesUntilNextRecording = int(xmldoc.getElementsByTagName('next')[0].childNodes[0].data) - 5
      closestRecordingDateTimeStart = currentTime + datetime.timedelta(minutes=minutesUntilNextRecording)
   elif numsubscriptions != "0":
      for recordingnode in xmldoc.getElementsByTagName('recording'):
         nextRecordingDateTimeStart = datetime.datetime.fromtimestamp(float(recordingnode.getElementsByTagName('start'​)[0].getElementsByTagName('unixtime')[0].childNodes[0].data)) - datetime.timedelta(minutes=5)
         nextRecordingDateTimeStartUTC = nextRecordingDateTimeStart
         nextRecordingDateTimeEnd = datetime.datetime.fromtimestamp(float(recordingnode.getElementsByTagName('stop')​[0].getElementsByTagName('unixtime')[0].childNodes[0].data)) + datetime.timedelta(minutes=15)
         nextRecordingDateTimeEndUTC = nextRecordingDateTimeEnd
         nextRecordingTitle = recordingnode.getElementsByTagName('title')[0].childNodes[0].data

         if nextRecordingDateTimeStartUTC < nextRecordingDateTimeEndUTC:
             if nextRecordingDateTimeStartUTC > currentTime:
                 if currentlyRecording == "False":
                     #print "future recording",nextRecordingTitle
                     if closestRecordingDateTimeStart is None:
                         closestRecordingDateTimeStart = nextRecordingDateTimeStartUTC
                         closestRecordingDateTimeEnd = nextRecordingDateTimeEndUTC
                         closestRecordingTitle = nextRecordingTitle
                     else:
                         if closestRecordingDateTimeStart > nextRecordingDateTimeStartUTC:
                             closestRecordingDateTimeStart = nextRecordingDateTimeStartUTC
                             closestRecordingDateTimeEnd = nextRecordingDateTimeEndUTC
                             closestRecordingTitle = nextRecordingTitle
                 #else:
                     #print "Ignoring", nextRecordingTitle, "as there is a current recording", closestRecordingTitle
             else:
                 if nextRecordingDateTimeEndUTC > currentTime:
                     if currentlyRecording == "False":
                         closestRecordingDateTimeStart = nextRecordingDateTimeStartUTC
                         closestRecordingDateTimeEnd = nextRecordingDateTimeEndUTC
                         closestRecordingTitle = nextRecordingTitle
                         currentlyRecording = "True"
                     else:
                         closestRecordingTitle = closestRecordingTitle + "," + nextRecordingTitle
                         if nextRecordingDateTimeEndUTC > closestRecordingDateTimeEnd:
                             closestRecordingDateTimeStart = nextRecordingDateTimeStartUTC
                             closestRecordingDateTimeEnd = nextRecordingDateTimeEndUTC
                 else:
                     print "completed recording", nextRecordingTitle

   if closestRecordingDateTimeStart is None:
      closestRecordingDateTimeStart = currentTime + datetime.timedelta(hours=4)

   if currentlyRecording == "False":
      difference = closestRecordingDateTimeStart - currentTime
      print "There are", difference.seconds/60, "minutes until next recording"
      # determine if the next recording is > 10 minutes away
      if difference.seconds > WAITBEFORESHUTDOWN:
         wakeupDateTimeUTC = closestRecordingDateTimeStart - datetime.timedelta(seconds=WAKEBEFORERECORDING)
         print "Next recording more than", WAITBEFORESHUTDOWN/60, "minutes away, shutting down with restart in", difference.seconds/60, "minutes, at", wakeupDateTimeUTC + UTCTimeDelta
         wakeupCommand = 'echo 0 > /sys/class/rtc/rtc0/wakealarm'
         commands.getstatusoutput(wakeupCommand)
         print wakeupCommand
         wakeupCommand = 'echo \'' + str(time.mktime(wakeupDateTimeUTC.timetuple())) + '\' > /sys/class/rtc/rtc0/wakealarm'
         commands.getstatusoutput(wakeupCommand)
         print wakeupCommand
         wakeupCommand = '/usr/sbin/pm-suspend'
         #commands.getstatusoutput(wakeupCommand)
         print wakeupCommand
         #hostStatus = 0
   else:
      difference = closestRecordingDateTimeEnd - currentTime
      print "Currently recording", closestRecordingTitle, "for another", difference.seconds/60, "minutes, until", closestRecordingDateTimeEnd + UTCTimeDelta

   time.sleep(60)

   if hostStatus == 0:
      break

#except Exception, e:
#   print 'failed', e, sys.exc_info()[0]
find quote
nmcaullay Offline
Member
Posts: 83
Joined: Aug 2010
Reputation: 1
Post: #57
Hi again,

I'd also appreciate any input that people may have on a seeking/edl problem i'm encountering in MKV files recorded by tvheadend.

http://forum.xbmc.org/showthread.php?tid...+tvheadend

Cheers,

NAthan
find quote
opdenkamp Offline
Team-XBMC PVR Developer
Posts: 2,209
Joined: Feb 2009
Reputation: 29
Location: Heerlen, The Netherlands
Post: #58
@nmcaullay
please create a separate thread for that script in the PVR section.

opdenkamp / dushmaniac

xbmc-pvr [Eden-PVR builds] [now included in mainline XBMC, so no more source link here :)]
personal website: [link]

Found a problem with PVR? Report it on Trac, under "PVR - core components". Please attach the full debug log.

If you like my work, please consider donating to me and/or Team XBMC.
find quote
behaviour Offline
Junior Member
Posts: 21
Joined: Nov 2010
Reputation: 0
Post: #59
Is there a way to view the timeline based on created channel groups instead of all the channels?

Also, is there a way of sorting the channels by name or setting numbers?
find quote
opdenkamp Offline
Team-XBMC PVR Developer
Posts: 2,209
Joined: Feb 2009
Reputation: 29
Location: Heerlen, The Netherlands
Post: #60
afaik that's not implemented in the dialogs yet. there is a sort method in the data structures to sort channels by number.

opdenkamp / dushmaniac

xbmc-pvr [Eden-PVR builds] [now included in mainline XBMC, so no more source link here :)]
personal website: [link]

Found a problem with PVR? Report it on Trac, under "PVR - core components". Please attach the full debug log.

If you like my work, please consider donating to me and/or Team XBMC.
find quote
Post Reply