MythTV Backend Scheduler

Tell us your most wanted features from QNAP products.

Re: MythTV Backend Scheduler

Postby 321liftoff » Wed Feb 29, 2012 3:35 pm

@ybot
I reverted to 3.5.1 Build 1002T, and the make process seems to be going much smoother for QT. I'm about 30 minutes into it now (of about 12 hours?), and it seems that I've gotten past the "qthread_unix.cpp" file which was throwing the GLib errors before. I'll update any progress, but, for the time being, at least we know that something is different in firmware 3.5.2 which breaks the build process as written in the howto.

Update: 12 hours later, successful make install for QT! Now on to mythtv. So a word of warning...stay with firmware 3.5.1 for QT to compile seamlessly.
321liftoff
Know my way around
 
Posts: 142
Joined: Sat Oct 22, 2011 6:54 pm
NAS Model: TS-219P+

Re: MythTV Backend Scheduler

Postby 321liftoff » Thu Mar 01, 2012 11:40 am

Following the howto and getting this error:
Code: Select all
 # patch < configure.patch
patching file configure
patch: **** malformed patch at line 11: @@ -2277,8 +2277,8 @@

To make the configure.patch file, I ran nano configure.patch from within the mythtv-0.24.1 source directory and pasted all the text within the first box with "--- configure Tue Sep 13 22:04:01 2011" at the top. Am I doing something obviously wrong?
321liftoff
Know my way around
 
Posts: 142
Joined: Sat Oct 22, 2011 6:54 pm
NAS Model: TS-219P+

Re: MythTV Backend Scheduler

Postby nkh » Thu Mar 01, 2012 1:58 pm

321liftoff wrote:Following the howto and getting this error:
Code: Select all
 # patch < configure.patch
patching file configure
patch: **** malformed patch at line 11: @@ -2277,8 +2277,8 @@

To make the configure.patch file, I ran nano configure.patch from within the mythtv-0.24.1 source directory and pasted all the text within the first box with "--- configure Tue Sep 13 22:04:01 2011" at the top. Am I doing something obviously wrong?


I ran into the same problem, I just applied the changes manually.
nkh
Starting out
 
Posts: 17
Joined: Wed Jan 13, 2010 5:17 am
Location: Denmark
NAS Model: TS-401T

Re: MythTV Backend Scheduler

Postby KCarterSr » Thu Mar 01, 2012 11:34 pm

AARRRRGGG!!!!!

This "No fonts" issue is driving me crazy! Anyone made any success with this?
KCarterSr
New here
 
Posts: 2
Joined: Sun Jul 03, 2011 5:37 am
NAS Model: TS-119P+

Re: MythTV Backend Scheduler

Postby 321liftoff » Fri Mar 02, 2012 11:29 pm

It seems that the wiki HowTo is a bit out of date from some info from this forum (such as vinsanity's patch for libs/libmythui/mythxdisplay.cpp or FourG's recent post). May anyone update the wiki, or should we wait for ybot or someone else to validate the changes before being posted on the wiki?

EDIT: I went ahead and updated the wiki howto to show the latest patches that integrate into the source code without errors. For the newbie linux users like me, I tried to put more explicit steps on how to combing the five different patches into one file and implement at once.
Last edited by 321liftoff on Sat Mar 03, 2012 1:21 pm, edited 1 time in total.
321liftoff
Know my way around
 
Posts: 142
Joined: Sat Oct 22, 2011 6:54 pm
NAS Model: TS-219P+

Re: MythTV Backend Scheduler

Postby 321liftoff » Mon Mar 05, 2012 8:52 pm

Finally am able to run mythbackend!

I had squares instead of letters also. From within the mythtv source, I ran the following two commands:
Code: Select all
cp -r themes/ /opt/share/mythtv/
cp -r themes/fonts /opt/share/mythtv/fonts

and I now get this message:
Code: Select all
MythFontProperties, Error: Failed to load 'Liberation Sans', got 'FreeSans' instead
and the letters are showing up!

Hope it works for you also...
321liftoff
Know my way around
 
Posts: 142
Joined: Sat Oct 22, 2011 6:54 pm
NAS Model: TS-219P+

Re: MythTV Backend Scheduler

Postby 321liftoff » Wed Mar 07, 2012 2:24 pm

I didn't have any initial luck with using the autorun.sh idea on the wiki. Another approach I'm trying is to make the MythTV install look like a QPKG, so it starts at boot and I can enable/disable from the web interface. I followed the thread here for a manual QPKG instance. Here was my entry appended to /etc/config/qpkg.conf:
Code: Select all
[MythTV]
Name = MythTV
Version = 0.24.1
Enable = TRUE
QPKG_File = Manual install
Date = 2012-03-06
Shell = /share/MD0_DATA/.qpkg/MythTV/MythTV.sh
Install_Path = /share/MD0_DATA/.qpkg/MythTV
Author = MythTV

Then I added a MythTV.sh script in the qpkg path specified above. I borrowed heavily from the TVHeadend QPKG for a template start/stop/restart script. Here's what I came up with:
Code: Select all
#!/bin/sh

CONF=/etc/config/qpkg.conf
QPKG_NAME="MythTV"
QPKG_DIR=$(/sbin/getcfg $QPKG_NAME Install_Path -d "" -f $CONF)
QPKG_SCRIPT=$(/sbin/getcfg $QPKG_NAME Shell -d "" -f $CONF)
QPKG_LOGFILE="${QPKG_DIR}/${QPKG_NAME}.log"
 

function check_process_running() {
   # Check if process is already running (ARM version)
   PROCESS_RUNNING=0
   for pid in $(/bin/pidof mythbackend); do
      # Try to find if the process is MythTV
      /bin/grep -q "mythbackend" /proc/$pid/cmdline
      if [ $? == 0 ]; then
         # Process found, save PID and exit loop
         PROCESS_RUNNING=$pid
         return 0
      fi
   done

   # Process not found
   return 1
}
function writelog_info() {
   # Write a message on the QNAP log
   /sbin/write_log "$1" 4
}
function writelog_warning() {
   # Write a message on the QNAP log
   /sbin/write_log "$1" 2
}

case "$1" in
 start)
    ENABLED=$(/sbin/getcfg $QPKG_NAME Enable -u -d FALSE -f $CONF)
    if [ "$ENABLED" != "TRUE" ]; then
        /bin/echo "$QPKG_NAME is disabled."
        exit 1
    fi

   # Check if process is already running
   check_process_running
   if [ $? = 0 ]; then
      /bin/echo "$QPKG_NAME is already running!"
      exit 1
   fi

        # Start logging
   exec > $QPKG_LOGFILE 2>&1

   # Start MythTV
   /bin/grep -q "/opt/lib" /etc/ld.so.conf
   if [ $? != 0 ]; then
      echo "/opt/lib" >> /etc/ld.so.conf
      /sbin/ldconfig
   fi

   export HOME=/root
   /share/MD0_DATA/.qpkg/Optware/bin/mythbackend &
   /bin/echo "MythTV Backend started."
   writelog_info "MythTV Backend started."
    ;;

 stop)
     # Stop the process
   check_process_running
   if [ $? != 0 ]; then
      /bin/echo "$QPKG_NAME is NOT running!"
      exit 1
      fi

   # Start logging
   exec > $QPKG_LOGFILE 2>&1

   # Kill the process
   /bin/kill -15 $PROCESS_RUNNING
   /bin/sleep 3
    ;;
 restart)
    $0 stop
    $0 start
    ;;

   showlog)
   # Print the current MythTV logfile
   /bin/echo "MythTV QPKG log created: $(/bin/date -r $QPKG_LOGFILE)"
   /bin/cat $QPKG_LOGFILE
   ;;

  status)
   # Check if MythTV is running or not
   check_process_running
   if [ $? = 0 ]; then
      /bin/echo "MythTV status: RUNNING."
      exit 0
   else
      /bin/echo "MythTV status: STOPPED."
      exit 1
   fi
   ;;

  *)
    /bin/echo "MythTV QPKG"
    /bin/echo "Usage: $0 {start|stop|restart|status|showlog}"
    exit 1
    ;;
esac

exit 0


Good news is that the script works well for doing Enable/Disable from the webpage :D , but isn't working so well for loading on boot. Here is the output when enabling the QPKG after boot, which works.
Code: Select all
MythTV Backend started.
QIconvCodec::convertFromUnicode: using Latin-1 for conversion, iconv failed for BOM: Bad file descriptor
QIconvCodec::convertFromUnicode: using Latin-1 for conversion, iconv_open failed
QIconvCodec::convertToUnicode: using Latin-1 for conversion, iconv_open failed
2012-03-07 01:21:34.269 mythbackend version:  [v0.24.1] www.mythtv.org
2012-03-07 01:21:34.271 Using runtime prefix = /opt
2012-03-07 01:21:34.282 Using configuration directory = /root/.mythtv
2012-03-07 01:21:34.284 Unable to read configuration file mysql.txt
2012-03-07 01:21:34.285 Empty LocalHostName.
2012-03-07 01:21:34.285 Using localhost value of ParrisNAS
2012-03-07 01:21:34.459 New DB connection, total: 1
2012-03-07 01:21:34.563 Connected to database 'mythconverg' at host: localhost
2012-03-07 01:21:34.727 Closing DB connection named 'DBManager0'
2012-03-07 01:21:34.730 Connected to database 'mythconverg' at host: localhost
2012-03-07 01:21:34.761 Current locale en_US
2012-03-07 01:21:34.772 Reading locale defaults from /opt/share/mythtv//locales/en_us.xml
2012-03-07 01:21:34.890 Current MythTV Schema Version (DBSchemaVer): 1264
2012-03-07 01:21:34.947 ThreadPool:HTTP: Initial 1, Max 25, Timeout 60000
2012-03-07 01:21:35.053 Enabling Upnpmedia rebuild thread.
2012-03-07 01:21:36.327 MythBackend: Starting up as the master server.
2012-03-07 01:21:36.404 New DB connection, total: 2
2012-03-07 01:21:36.406 Connected to database 'mythconverg' at host: localhost
2012-03-07 01:21:36.527 New DB connection, total: 3
2012-03-07 01:21:36.532 Connected to database 'mythconverg' at host: localhost
2012-03-07 01:21:37.139 New DB scheduler connection
2012-03-07 01:21:37.141 Connected to database 'mythconverg' at host: localhost
2012-03-07 01:21:37.210 Main::Registering HttpStatus Extension
2012-03-07 01:21:37.211 Enabled verbose msgs:  important general
2012-03-07 01:21:37.280 AutoExpire: CalcParams(): Max required Free Space: 0.0 GB w/freq: 15 min
QIconvCodec::convertFromUnicode: using Latin-1 for conversion, iconv failed for BOM: Bad file descriptor
2012-03-07 01:21:40.232 Reschedule requested for id -1.
2012-03-07 01:21:40.630 Scheduled 0 items in 0.4 = 0.12 match + 0.27 place
2012-03-07 01:21:40.665 Seem to be woken up by USER
QIconvCodec::convertFromUnicode: using Latin-1 for conversion, iconv failed for BOM: Bad file descriptor
2012-03-07 01:21:45.077 UPnpMedia: BuildMediaMap - no VideoStartupDir set,  skipping scan.

and here is the response when it tries to load automatically on boot:
Code: Select all
QIconvCodec::convertFromUnicode: using Latin-1 for conversion, iconv failed for BOM: Bad file descriptor
QIconvCodec::convertFromUnicode: using Latin-1 for conversion, iconv_open failed
QIconvCodec::convertToUnicode: using Latin-1 for conversion, iconv_open failed
2012-03-07 01:17:04.244 mythbackend version:  [v0.24.1] www.mythtv.org
2012-03-07 01:17:04.246 Using runtime prefix = /opt
2012-03-07 01:17:04.247 Using configuration directory = /root/.mythtv
2012-03-07 01:17:04.368 Unable to read configuration file mysql.txt
2012-03-07 01:17:04.369 Empty LocalHostName.
2012-03-07 01:17:04.369 Using localhost value of ParrisNAS
2012-03-07 01:17:05.000 New DB connection, total: 1
2012-03-07 01:17:05.030 Unable to connect to database!
2012-03-07 01:17:05.030 Driver error was [1/2002]:
QMYSQL: Unable to connect
Database error was:
Can't connect to local MySQL server through socket '/tmp/mysql.sock' (2)

...................................................................
2012-03-07 01:17:07.131 UPnPautoconf() - No UPnP backends found
2012-03-07 01:17:07.132 No UPnP backends found

No UPnP backends found

Would you like to configure the database connection now? [no]
[console is not interactive, using default 'no']
2012-03-07 01:17:07.132 Deleting UPnP client...
2012-03-07 01:17:08.171 Failed to init MythContext.

Any thoughts? I'm thinking that mysql is not fully loaded prior to the mythtv trying to run. If that's the case, how can I make sure mysql is good before loading mythtv?
321liftoff
Know my way around
 
Posts: 142
Joined: Sat Oct 22, 2011 6:54 pm
NAS Model: TS-219P+

Re: MythTV Backend Scheduler

Postby nkh » Wed Mar 07, 2012 11:07 pm

321liftoff wrote:Any thoughts? I'm thinking that mysql is not fully loaded prior to the mythtv trying to run. If that's the case, how can I make sure mysql is good before loading mythtv?

That would be my guess too! Maybe you could try to introduce a 1 min delay in the script with sleep? I assume it doesn't really matter if the backend is up one or two minutes after the NAS has rebooted, the delay just have to be big enough to ensure MySql has time to get up and running.

Other than that it looks like a nice script :) I'll try it on my box later!
nkh
Starting out
 
Posts: 17
Joined: Wed Jan 13, 2010 5:17 am
Location: Denmark
NAS Model: TS-401T

Re: MythTV Backend Scheduler

Postby 321liftoff » Thu Mar 08, 2012 9:23 am

Thanks for the suggestion! Adding "sleep 60" prior to loading mythbackend did the trick. Maybe a shorter time will work also? I didn't add that originally because I was thinking that adding a sleep statement in the script would prevent other processes from being run during the boot process, but the mysql process must not be serial to the mythbackend qpkg. I guess the lesson is to always try! :D
321liftoff
Know my way around
 
Posts: 142
Joined: Sat Oct 22, 2011 6:54 pm
NAS Model: TS-219P+

Re: MythTV Backend Scheduler

Postby jimmer.74 » Thu Mar 08, 2012 9:42 pm

Hi Guys,

I'm still following the thread with interest. I still cannot compile qt using the pineview 64-bit toolchain, so am stuck at this basic 1st step (for anyone interested, it gets as far as including the mysql stuff and then craps out)! It sounds like some progress is being made towards people making their own qpkgs in order to control the backend via the web interface. I would dearly love it if someone could publish an i686 qpkg for all necessary libs, mythbackend, etc so that I can test it on my x86_64 qnap.

Also, has any progress been made on installing mythweb? This is essential IMHO. I often schedule recordings on the move via my phone+mythweb at the moment - so this feature is a deal-breaker for me....

Regards,

Jim
jimmer.74
Starting out
 
Posts: 10
Joined: Mon Sep 26, 2011 4:28 pm
NAS Model: TS-659 Pro II

Re: MythTV Backend Scheduler

Postby 321liftoff » Thu Mar 08, 2012 10:56 pm

I'm giving mythweb a try, and not having much luck.

UPDATE: It's working well now. See this thread... 8)
321liftoff
Know my way around
 
Posts: 142
Joined: Sat Oct 22, 2011 6:54 pm
NAS Model: TS-219P+

Re: MythTV Backend Scheduler

Postby xtv » Sun Mar 18, 2012 9:36 pm

321liftoff wrote:UPDATE: It's working well now.


Are its functionalities similar to TVHeadend? (which btw is excellent).

Thanks.
xtv
Know my way around
 
Posts: 141
Joined: Mon May 03, 2010 6:21 pm
NAS Model: TS-459 Pro

Re: MythTV Backend Scheduler

Postby 321liftoff » Mon Mar 19, 2012 1:47 am

The MythWeb enables for MythTV all the functions that the web interface for TVHeadend does. I don't have much experience on either TVHeadend or MythTV, but from initial glance, MythTV seems to be more feature rich, such as prioritizing recordings and having more smarts when scheduling recordings.
321liftoff
Know my way around
 
Posts: 142
Joined: Sat Oct 22, 2011 6:54 pm
NAS Model: TS-219P+

Re: MythTV Backend Scheduler

Postby xtv » Mon Mar 19, 2012 2:38 am

Nice.

Any chance for a QPKG?
xtv
Know my way around
 
Posts: 141
Joined: Mon May 03, 2010 6:21 pm
NAS Model: TS-459 Pro

Re: Re: MythTV Backend Scheduler

Postby bry » Mon Mar 19, 2012 4:28 am

xtv wrote:Nice.

Any chance for a QPKG?

+1 for a possible qpkg.
TS-639 Pro | 6x1.5TB | Raid 6 | 5495.47 GB | 3.6.0 build 0210T
Gallery 3.0 | Sickbeard | Sabnzbd | Headphones | SubSonic | CouchPotato | phpMyAdmin
QNAPs sold and configured: 2x219P | 1x659
User avatar
bry
Getting the hang of things
 
Posts: 97
Joined: Sun Jan 31, 2010 12:05 am
Location: NY
NAS Model: TS-509 Pro

PreviousNext

Return to Features Wanted

Who is online

Users browsing this forum: No registered users and 2 guests