LinHES Forums
http://forums.linhes.org/

Command line to get the next show to be recorded
http://forums.linhes.org/viewtopic.php?f=11&t=18685
Page 1 of 1

Author:  infinitenothing [ Sat Aug 02, 2008 11:35 pm ]
Post subject:  Command line to get the next show to be recorded

Hi, I'm not sure how challenging this is. From a command line, I'd like to get the title of the next recording.

It might be as simple as some command I'm not familiar with. Or it might require querying a database. I'm certainly willing to do some of the leg work and research if someone wants to give me a hint.

Author:  nigelpearson [ Sun Aug 03, 2008 3:38 am ]
Post subject: 

Soemthing like:
Code:
mythbackend --printsched | head -19 | tail -1 | cut -c 1-38

Author:  tjc [ Sun Aug 03, 2008 8:07 am ]
Post subject: 

I'm afraid that there is no simple answer. The idle.sh script has code to solve a related problem and in verbose mode it prints out the information so you might want to look into that. Unfortunately --printsched gives you a truncated title and also shows potential recordings (schedule matches) which aren't going to be recorded because they've already been recorded or will be recorded later or conflict with something else or ... It _does_ provide an indicator that you can use to tell if something will actually be recorded, but for the full title and subtitle you'll need to go to the DB tables.

Author:  graysky [ Sun Aug 03, 2008 8:23 am ]
Post subject: 

I know this isn't what you asked and may not be a relevant solution for you, but if you have mythweb enabled, browse to the backend status link in your web browser:
Code:
http://IP_of_Mythtv_master_backend/mythweb/status


It will display a very nice summary page including the next 10 shows to be recorded among other useful data.

If you're sshing into your mythtv box from outside the LAN and you don't have your http accessible outside the LAN, I wonder what that page would look like displayed via lynx? In theory, that would allow you to see the info you're seeking in the ssh window:
Code:
$ lynx localhost/mythweb/status

Author:  mjl [ Sun Aug 03, 2008 4:44 pm ]
Post subject: 

Hi,
Quote:
$ lynx localhost/mythweb/status

Gives me:
401 Authorization Required

Authorization Required

This server could not verify that you are authorized to access the
document requested. Either you supplied the wrong credentials (e.g.,
bad password), or your browser doesn't understand how to supply the
credentials required.

I think it is the later as it doesn't ask for any login using lynx. Tried as localhost and by ip with same results.

Mike

Author:  graysky [ Sun Aug 03, 2008 6:08 pm ]
Post subject: 

I'm not near it now, but I think there's an -auth switch you can pass to the server that will allow this. See the lynx manpage:

Code:
$ man lynx

Author:  goofee [ Sun Aug 03, 2008 9:29 pm ]
Post subject: 

I use the upcoming recordings scrip from the wiki email tricks page http://www.knoppmythwiki.org/index.php?page=EmailTricks
It returns the next 10 scheduled to record. Might do what your looking for.
Code:
#!/bin/bash
lynx -dump http://localhost:6544 | sed -n '/^Schedule$/,/^Job\ Queue$/p' | sed  '/^Schedule$\|^Job\ Queue$/d' > /usr/src/sendemail/upcoming.txt
perl /usr/bin/sendEmail.pl -f <sender@email> -t <destination@email> -u "Upcoming Shows" -s <sender@email> -o message-file=/usr/src/sendemail/upcoming.txt

Author:  Too Many Secrets [ Sun Aug 03, 2008 9:59 pm ]
Post subject: 

goofee wrote:
I use the upcoming recordings scrip from the wiki email tricks page http://www.knoppmythwiki.org/index.php?page=EmailTricks
It returns the next 10 scheduled to record. Might do what your looking for.
Code:
#!/bin/bash
lynx -dump http://localhost:6544 | sed -n '/^Schedule$/,/^Job\ Queue$/p' | sed  '/^Schedule$\|^Job\ Queue$/d' > /usr/src/sendemail/upcoming.txt
perl /usr/bin/sendEmail.pl -f <sender@email> -t <destination@email> -u "Upcoming Shows" -s <sender@email> -o message-file=/usr/src/sendemail/upcoming.txt


Yep, I use that every day to get an email with all kinds of goodies.

Author:  infinitenothing [ Sat Aug 09, 2008 4:18 pm ]
Post subject: 

nigelpearson wrote:
Soemthing like:
Code:
mythbackend --printsched | head -19 | tail -1 | cut -c 1-38


Nifty! What are the flags? (S C I T N). T seems to be the recording frequency. N seems to indicate if it was previously recorded?


Quote:
http://IP_of_Mythtv_master_backend/mythweb/status


Also nifty

Author:  tjc [ Sat Aug 09, 2008 4:58 pm ]
Post subject: 

The column under the 'N' (column 70) is what you need to looks at.

Anything with a number 1-9 will be recorded on the corresponding device.
'R' means that you've still got a recording of that.
'P' means previously recorded and deleted.
'E' means an earlier showing will be recorded.
'C' means that the recording will be skipped due to a conflict.

Author:  fra [ Thu Oct 30, 2008 1:11 pm ]
Post subject: 

tjc wrote:
The column under the 'N' (column 70) is what you need to looks at.

Anything with a number 1-9 will be recorded on the corresponding device.
'R' means that you've still got a recording of that.
'P' means previously recorded and deleted.
'E' means an earlier showing will be recorded.
'C' means that the recording will be skipped due to a conflict.


how is the output of mythbackend -printsched tabulated?
i'm thinking of something like:

Code:
mythbackend --printsched | awk -F'\t' '/print list start/,/print list end/{if ($9 >= 1 && $9 <= 9 || $9 == "N") print $4"\t"$5"\t"$1}'


where 9 (in $9) is the number of the column where the value of N appears and 1,4,5 are where the title, day, and time appear. this should work if the list is tabulated with tabs as delimiters.... (i'm at work right now and can't test it on the machine!)

Author:  tjc [ Thu Oct 30, 2008 7:54 pm ]
Post subject: 

Sorry that won't work. You need to do it by character column ranges as in the example.

Author:  fra [ Thu Oct 30, 2008 9:49 pm ]
Post subject: 

tjc wrote:
Sorry that won't work. You need to do it by character column ranges as in the example.


yeah, i realized that once i tried it...

Author:  mythedoff [ Fri Oct 31, 2008 11:33 am ]
Post subject: 

Here's what I use in a motd script.

Code:
mythbackend --printsched 2> /dev/null | sed -n '/list\ start/,/list\ end/p' | egrep -v "print|^Title" | cut -c -70 | grep -G [0-9]$ | cut -c -43,44-58


to /etc/profile add:
Code:
/usr/local/bin/motdxtra.sh


create /usr/local/bin/motdxtra.sh script and a make executable:
Code:
#! /bin/bash
#/usr/local/bin/motdxtra.sh

echo ""
lynx -dump http://localhost:6544 | sed -n '/^Encoder\ status$/,/^Schedule$/p' | sed  '/^Schedule$/d'
lynx -dump http://localhost:6544 | sed 20q | sed -n '/profile\.$/{g;1!p;};h' | tail -n 1 | sed 's/   This recording will start in /   The next recording starts in /' | sed 's/ using.*$//'

echo ""
echo "Next five shows to be recorded:"
echo ""
mythbackend --printsched 2> /dev/null | sed -n '/list\ start/,/list\ end/p' | egrep -v "print|^Title" | cut -c -70 | grep -G [0-9]$ | cut -c -43,44-58 | head -5
echo ""


Output should look something like:

su - mythtv

Encoder status

Encoder 3 is local on mythtv2 and is not recording.
Encoder 4 is local on mythtv2 and is not recording.
Encoder 8 is remote on mythtvfe1 (currently not connected).
Encoder 9 is remote on mythtvfe1 (currently not connected).
Encoder 10 is remote on mythtvfe1 (currently not connected).

The next recording starts in 3 hours and 39 minutes

Next five shows to be recorded:

Hardball With Chris Matthews 35 MSNBC 31 14:00-15:00
Countdown With Keith Olbermann 35 MSNBC 31 17:00-18:00
20/20 4 KOMO 31 22:00-23:00
Good Eats 65 FOODP 31 23:00-23:30
Late Show With David Letterman 7 KIRO 31 23:36-00:38

===
Obviously I have something wrong with my encoders, been playing with a vid camera which I added to a new card instead of composite on existing card, I think. I'll the cards and re-add.

===

Edit: the output from the script lost it formatting.

Page 1 of 1 All times are UTC - 6 hours
Powered by phpBB® Forum Software © phpBB Group
http://www.phpbb.com/