# pyTivo errors



## Chas_M (Jul 26, 2005)

I have been using cTivo, kmttg, and pyTivo for various tivo show recording purposes. The main reason being that for some weird reason, neither cTivo or kmttg can make a show in Mp4 / H.264 format for my PBS station KERA without getting macro-blocking of the video. This only occurs for the PBS channel and no other channel that I watch.

I had fallen back to using pyTivo to capture the shows from kmttg in .tivo format and then using pyTivo to point the MyMovies file path to point to the folder containing the .tivo files.

Now for some reason, I am getting an error in the running of the script in pyTivo.py. This error shows up as follows - see red text highlight at the end of the script. Does anyone have any suggestions as to what may be causing this error?

What is the latest version of pyTivo and where can I find this files?

```
Last login: Mon Jul 31 19:22:38 on ttys001

/Applications/pyTivo/pyTivo.py ; exit;
iMac:~ Charles_iMac$ /Applications/pyTivo/pyTivo.py ; exit;
INFO:pyTivo:Last modified: Thu Oct 15 10:18:56 2015
INFO:pyTivo:python: 2.7.10
INFO:pyTivo:System: Darwin-16.6.0-x86_64-i386-64bit
INFO:pyTivo.beacon:Scanning for TiVos...
INFO:pyTivo.beacon:Roamio Pro 3TB
INFO:pyTivo.beacon:Roamio Pro 6TB
INFO:pyTivo.beacon:Announcing shares...
INFO:pyTivo.beacon:Registering: MyMovies
INFO:pyTivo:pyTivo is ready.
INFO:pyTivo:192.168.1.114 [31/Jul/2017 19:22:56] "GET /TiVoConnect?Command=QueryContainer&Container=%2F&DoGenres=1 HTTP/1.0" 200 -
INFO:pyTivo:192.168.1.120 [31/Jul/2017 19:22:56] "GET /TiVoConnect?Command=QueryContainer&Container=%2F&DoGenres=1 HTTP/1.0" 200 -
INFO:pyTivo:192.168.1.116 [31/Jul/2017 19:22:56] "GET /TiVoConnect?Command=QueryContainer&Container=%2F&DoGenres=1 HTTP/1.0" 200 -
INFO:pyTivo:192.168.1.116 [31/Jul/2017 19:22:56] "GET /TiVoConnect?Command=QueryContainer&Container=%2F&DoGenres=1 HTTP/1.0" 200 -
INFO:pyTivo:127.0.0.1 [31/Jul/2017 19:23:04] "GET / HTTP/1.1" 200 -
INFO:pyTivo:127.0.0.1 [31/Jul/2017 19:23:13] "GET /TiVoConnect?Command=Settings&Container=Settings HTTP/1.1" 200 -
INFO:pyTivo:127.0.0.1 [31/Jul/2017 19:23:38] "GET /TiVoConnect?Command=QueryContainer&Container=MyMovies&Format=text/html HTTP/1.1" 200 -
INFO:pyTivo.video.video:[31/Jul/2017 19:24:01] Queued "/Users/Charles_iMac/Library/Containers/nz.co.pixeleyes.AutoMounter/Data/Mounts/NASE52E2C(AFP)/AFP/Tivo/Tivo_Default/Tivo dot-tivo output/Midsomer Murders - 3931 (PS).TiVo" for Push to Roamio Pro 3TB
INFO:pyTivo.video.video:[31/Jul/2017 19:24:01] Queued "/Users/Charles_iMac/Library/Containers/nz.co.pixeleyes.AutoMounter/Data/Mounts/NASE52E2C(AFP)/AFP/Tivo/Tivo_Default/Tivo dot-tivo output/Rick Steves Europe - Southeast England (04_01_2017).TiVo" for Push to Roamio Pro 3TB
INFO:pyTivo:127.0.0.1 [31/Jul/2017 19:24:01] "POST /TiVoConnect HTTP/1.1" 200 -
INFO:pyTivo:127.0.0.1 [31/Jul/2017 19:24:06] "GET /TiVoConnect?Command=QueryContainer&Container=MyMovies&Format=text/html HTTP/1.1" 200 -
WARNING:pyTivo.config:tdcat not found
ERROR:pyTivo.video.video:<error>[CODE]badCookie
```
<debug>1</debug><text>Session cannot be authenticated; try login again</text></error>
[/code]


----------



## windracer (Jan 3, 2003)

Maybe you should try Dan203's Easier to use pyTivo.


----------



## Chas_M (Jul 26, 2005)

windracer said:


> Maybe you should try Dan203's Easier to use pyTivo.


Thank you so much. I have just dowloaded the ptTivo_Desktop app and starting to give it a whirl. So far so good.


----------



## Chas_M (Jul 26, 2005)

It's working very well. Also, it's one app rather than a web page that's dependent on a terminal script as in the older pytivo.


----------



## windracer (Jan 3, 2003)

Good to hear!


----------



## Dan203 (Apr 17, 2000)

Glad you like it. Let me know if you have any issues.


----------



## Chas_M (Jul 26, 2005)

Problems with running pyTivo Desktop version 1.6.12

My software configuration iMac running macOS Sierra 10.12.5 with 2.5TB free storage on 3TB Fusion Drive, Java 8 Update 131, NAS with 8TB storage with 2TB free.

After installing pyTivo Desktop everything seemed to be working well. However, when I started to use the app to transfer Tivo shows some weird things started to happen. I removed the app and then reinstalled it but the same problems still occur. I have attached the mist recent log file for your review. These problems seem to be as follows:

From time to time the app when requested to display My Shows will revert to the Settings page. Only using the Activity monitor to force the app to quit followed by a restart will restore sone normal capability.
When attempting to transfer more than one Tivo show, the download queue will only display the first show being queued for download. This occurs with either manuals election of the shows or by clicking on the Download All button.
When any of these conditions occur, no show is transferred to NAS.
From time to time the button in the top left for the Download queue displays a number that is larger than the listing shown in the queue. 
Am I correct in saying that the app does not need to stay in the Mac Dock once it has started and can be closed. It appears that several instances of pyTivo sho up in the Activity Monitor in addition to two instances of pyTivoDesktopTray, one of which is stated to be Not responding. Other processes shown include pyTivoDesktop Helper (2 instances)
When A download transfer is requested it appears that there on the first request, the green box shows up confirming the show being transferred. then sometimes on additional requests, there is a dialog stating there may not be enough disk storage and asking you to confirm the download request.
Compared to the earlier version of plain pyTivo I was using, pyTivo Desktop is much better by presenting the user with just one app to consider rather than a java script and the web page to start the process. I can now see My Tivo recordings on the Tivo TV screen and perform transfers from my NAS.

What is the best forum topic to use to follow pyTivo Desktop topics being discussed?

Not a problem, but a question How can I view .tivo, or decrypted .mp4 shows on the Mac?


----------



## Dan203 (Apr 17, 2000)

Based on the log it looks like the software is having trouble accessing your NAS. Try changing the download folder to a local folder and see if that fixes the issue. If it does then check the settings on your NAS and make sure it's not set to fall asleep after a certain period of inactivity.

On Mac you need to select the "decrypt with tivolibre" option or you wont be able to view the files locally. After that option is checked all downloaded files will be .ts or .mpg. You can use the free VLC media player to play those.


----------



## Chas_M (Jul 26, 2005)

Dan,
Many thanks for the information. I have verified that my QNAP TS453 NAS does not go to sleep. There is a setup dialog box for this function. Many apps that I use have no problems accessing the NAS (Acronis TrueImage backup, Adobe Elements backup of photos, cTivo, pyTivo - old version, kmttg to name a few). I have tried an experiment which in one instance uses the local Mac HD to store the transferred Tivo shows, and in another instance saves the Tivo shows to a folder on the NAS. Logs for these two experiments are attached as 'local_log.txt" and "NAS_log.txt" respectively. My summary comments are at the end of the experiment procedures. I would be very interested to have your comments or those from anyone else.
The procedures used as as follows for each experiment is as follows:
*Local HD show storage (refer to log file Local_log.txt)*.

Disable all pyTivo Desktop processes running on the Mac (pyTivo, pyTivoTray), two instances of each process.
Remove pyTivo Desktop app to trash.
Create a storage folder on the Mac local HD.
Reinstall version 1.6.12.
Install pyTivo Desktop app and define Tivo MAK and storage folder for transferred shows.
In Settings check that select checkbox for Decrypt with TivoLibre. Transport stream enabled by default. Save settings.
Select a Tivo show folder with 4 shows, and click on Download All. Green DL confirmation received for four shows.
After a minute to two select one more show from another folder. Dialog box states there may not eb enough memory - confirm Yes or No. Click on Yes.
Download counter in upper right indicates 5 shows. However DL queue only displays the list of the initial 4 shows selected.
After seeing the progress bar move to completion of first show, the task started to process the second of the four shows, and the 5th selected show was displayed in the DL Queue. DL counter decrements to 4.
Left computer running for several hours to transfer the shows.
On logging in again, all shows had been transferred and the DL counter was not visible. Five entries were displayed in the storage folder on the Mac HD, each with a .Tivo and a .ts file.
Capture the log file.
All five shows were accessible in Tivo Roamio "My Recordings"
However, I noticed that some shows had a strange "^" caret symbol in the file name, i.e., Mars (Recorded Nov 15, 2016, NGCHD-E) (2) (^334_0). This was on most but not all files. What does this symbol mean? What is the meaning of the title parenthetical data, i.e (2) (^334_0)?
This proves that pyTivo Desktop successfully works using a Storage location on the local Mac HD.
*NAS show storage (refer to log file Local_log.txt)
*
The experiment for the NAS storage follows exactly the same procedure as for local HD storage. However the exceptions on processing are noted in *Bold text*.

Disable all pyTivo Desktop processes running on the Mac (pyTivo, pyTivoTray), two instances of each process.
Remove pyTivo Desktop app to trash.
Create a storage folder on the QNAP NAS.
Reinstall version 1.6.12.
Install pyTivo Desktop app and define Tivo MAK and storage folder for transferred shows.
In Settings check that select checkbox for Decrypt with TivoLibre. Transport stream enabled by default. Save settings.
Select a Tivo show folder with 4 shows, and click on Download All. Green DL confirmation received for four shows.
After a minute to two select one more show from another folder. *Received green confirmation of selection.*
Download counter in upper right indicates 5 shows. However DL queue only displays the list of the initial 4 shows selected.
After seeing the progress bar move to completion of first show, the task started to process the second of the four shows, and the 5th selected show was displayed in the DL Queue. DL counter *did not decrement*. *However it was noted that there was an error notice in red text TS Errors detected! 134 packets affected. The 134 started at a low number and steadily increased to the maximum. Two shows were listed in the NAS folder - one completed and another in progress.*
Left computer running for several hours to transfer the shows.
*DL counter display 4. No progress noted in progress bar. Process hung!*
*Capture the log file.*
*Activity monitor show that pyTivoTray is not responding.*
*Only the first show transferred was* accessible in Tivo Roamio "My Recordings"
*This indicates that pyTivo Desktop may have problem working reliably with the QNAP NAS.*
BTW, VLC was able to play any of the completed decrypted shows in any of the storage locations. Thanks for the tip.

My perception of the problem is that pyTivo Desktop is interacting with the NAS in a somewhat different way from other apps that are listed in the first paragraph. It's strange that the listed Apps, including "old" pyTivo when it was working, cTivo, and kmttg, have no problems whatever and can operate reliably time after time over long calendar schedule. Perhaps pyTivo Desktop needs to have a timeout adjusted or a more robust handshake to allow NAS compatibility. The NAS is setup as an AFP device?

You might ask why am I bothering with pyTivo Desktop while cTivo, and kmttg are working reliably? The answer to this question revolves around a video quality issue with the local PBS station - KERA. I was hoping that there may be a better transcoding performed in pyTivo Desktop. It also has a very nice streamlined user interface.

If I download any KERA show using cTivo, pyTivo Desktop, or kmttg with any format other than native .Tivo, including just simple decryption, then a replay on the Tivo Roamio show periodic macro-blocking of the picture about every 10 to 20 seconds but with no degradation of the audio. This anomaly only occurs with the PBS station KERA. All other channels result in excellent playback.

However, if I use kmttg or a web browser interface to just save the show there is no macro-blocking of the video on playback on the Tivo Roamio.
What is going on that's causing the PBS video stream to fail when its processed by any transcoding activity. Another post of mine on Tivo community and GitHub provide many more details of this weird phenomena. It almost looks as if PBS is adding some data in the stream that is not be ing processed correctly during transcoding. It should be noted that if I download just the .Tivo file, another app action called PavTube video Converter will create excellent video quality, i.e. mp4 files without a trace of macro blocking for any of the PBS shows.

What is causing this weird phenomena. I first noticed this for show I had downloaded about 9 months ago. Earlier shows did not exhibit this phenomena!

Charles


----------



## Dan203 (Apr 17, 2000)

So this part of the file "(^334_0)" indicates the number of ts packets effected by errors in the download stream. The _0 is the try. (it's a 0 base index) You can set the options to retry the download X number of times when these errors are detected to try and get a clean download. But the default is to only try once. (hence the 0)

One potential issues another user emailed me about.... you can not use a folder that has a period in it's path. So if the path to your NAS folder has a period in it at all you will get an error like the one in your log. Does the path have a period? I have added a fix for this, but I haven't released a build with that fix yet. So for now you'll have to rename the folder if this is the issue.


----------



## Chas_M (Jul 26, 2005)

NAS folder only has underscores in its name, i.e., pyTivo_Desktop_Recordings . Does this behave the same as a period?

The local Mac HD storage folder name was different, i.e., Tivo - Temp shows .

Thanks for such a quick response.


----------



## Dan203 (Apr 17, 2000)

This applies to the entire path. Is there a period anywhere in the path to the NAS? (I don't know how network paths work on Mac, maybe they all have periods?)


----------



## Chas_M (Jul 26, 2005)

Here are the full paths for local storage and NAS storage:

Local mac HD storage:
/Users/Charles_iMac/Tivo - Temp shows

NAS Storage:
/Users/Charles_iMac/Library/Containers/nz.co.pixeleyes.AutoMounter/Data/Mounts/NASE52E2C(AFP)/AFP/Tivo/pyTivo_Desktop_Recordings

As you can see, the portion of the path "nz.co.pixeleyes.AutoMounter" contains three periods. When will you be releasing the build with the fix for the "period?"

The reason for using AutoMounter is to keep the NAS shares access path active to any Mac app while the Mac is sleeping. In previous versions of Mac OS X, this feature was inherent in the OS without the need for a third party app to keep the NAS connected. 

Quote from Pixeleyes "We wanted our network shares always accessible and ready to use. If you've got a NAS appliance, a server at work, or even shared folders on your other computers, you'll know how annoying it is to keep your shares connected. AutoMounter makes it easy by ensuring your shares are always available. Whenever you change locations, AutoMounter will mount your shares from the available server, and they will appear on your Desktop."

It seems to do the job very well!

BTW, do you have any idea what might be happening with my PBS macro-blocking anomaly?

What language did you use for pyTivo Desktop?


----------



## Dan203 (Apr 17, 2000)

I'll send you a link to a special build.

The macroblocking could be caused by those corrupt TS packets. If the channel is MPEG-2 try downloading as PS instead. It shouldn't have the issue. 

The desktop app is written in javascript/HTML using a technology called Angular. Then packaged as an exe using a package called Electron.


----------



## philt56 (Aug 22, 2008)

I updated in pytivo settings a new location for my recordings, but when I go to My Tivo Recordings on my Roamio, it shows the contents of the previous folder. Does the tivo have to restart in order to see the new location?


----------

