 |
pyTivo Discussion Forum Answers and the development of pyTivo a TiVo transcoding server
|
|
| Author |
Message |
smack000
Joined: 05 Feb 2008 Posts: 10
|
Posted: Tue Feb 05, 2008 5:19 am Post subject: Fixed problem with subfolders.. How to submit code? |
|
|
Hi everyone,
I was having the problems others are having. Namely that when you navigate to one subfolder, going to another shows the original's contents.
I found the source of the problem - that pyTivo wasn't attaching a UniqueId tag To TivoContainer/Details or TivoContainer/Item/Details
I have a fix on my machine that works perfectly and was wondering the best way to share this fix with others. I'm not familiar with submitting to open source projects or anything.
Here's a diff of the two files to fix it:
C:\Program Files\pyTivo\plugins\video>diff video.py F:\Junk\SubFoldersBranch-01-04-08\plugins/video/video.py
1c1
< import transcode, os, socket, re, zlib
---
> import transcode, os, socket, re
334d333
< video['small_path'] = subcname + '/' + video['name']
348d346
< t.crc = zlib.crc32
350d347
<
C:\Program Files\pyTivo\plugins\video\templates>diff container.tmpl F:\Junk\SubFoldersBranch-01-04-08\plugins/video/templates/container.tmpl
10d9
< <UniqueId>$crc($name)</UniqueId>
19d17
< <UniqueId>$crc($video.small_path)</UniqueId> |
|
| Back to top |
|
 |
wmcbrine

Joined: 04 Jan 2008 Posts: 2009 Location: Maryland
|
Posted: Tue Feb 05, 2008 7:35 am Post subject: |
|
|
OK:
1. Judging by the pathname, you're patching a version that's a month old. You should get the latest version, see if you still have the problem, and if you do, then post.
2. A Unified or Context diff would be better, so we can more easily tell where the changes are. Also, you're diffing in the wrong direction (new to old -- should be old to new). Other than that, you've submitted it just by posting it here; the only other thing to include might be your name for the credits.
3. At first I was excited, because I thought you might have found a way around need for the "hack83" subfolders branch code. But then I saw that this apparently still depends on that (no?); in which case, I'm not clear when it would be needed. The problem of having the old folder's contents appear in the new one is the entire issue that the subfolders branch is intended to address; and for me, it does so. _________________ My pyTivo fork . My page |
|
| Back to top |
|
 |
TreborPugly
Joined: 05 Jan 2008 Posts: 55
|
Posted: Tue Feb 05, 2008 2:56 pm Post subject: Re: Fixed problem with subfolders.. How to submit code? |
|
|
| smack000 wrote: | Hi everyone,
I was having the problems others are having. Namely that when you navigate to one subfolder, going to another shows the original's contents.
|
This is the historic "8.3" problem, for which there's been the subfolder hack. With the hack turned on, this problem doesn't occur, but the hack can cause your Tivo to crash.
Do you have a fix that works on the main branch, without using the subfolders hack?
So if you were getting the wrong listing, then you didn't have the hack turned on, even if you were using the "sub folders" branch.
Finally, if you have a version of code that allows navigation of sub folders, doesn't get stuck with a particular listing for all subfolders, and doesn't crash the Tivo, I for one don't care about where it fits into the version support. Zip that directory up and send it to me!  |
|
| Back to top |
|
 |
smack000
Joined: 05 Feb 2008 Posts: 10
|
Posted: Tue Feb 05, 2008 3:01 pm Post subject: Re: Fixed problem with subfolders.. How to submit code? |
|
|
| TreborPugly wrote: | | smack000 wrote: | Hi everyone,
I was having the problems others are having. Namely that when you navigate to one subfolder, going to another shows the original's contents.
|
This is the historic "8.3" problem, for which there's been the subfolder hack. With the hack turned on, this problem doesn't occur, but the hack can cause your Tivo to crash.
Do you have a fix that works on the main branch, without using the subfolders hack?
So if you were getting the wrong listing, then you didn't have the hack turned on, even if you were using the "sub folders" branch.
Finally, if you have a version of code that allows navigation of sub folders, doesn't get stuck with a particular listing for all subfolders, and doesn't crash the Tivo, I for one don't care about where it fits into the version support. Zip that directory up and send it to me!  |
I'll try to get you guys the changes "legit." How do I use git to get the main branch? I was about to get wmcbrine's branch, but if I try:
git clone git://repo.or.cz/pyTivo.git
I get errors about no head revision. Or if there's a version I should just download and work from, that's fine too. |
|
| Back to top |
|
 |
smack000
Joined: 05 Feb 2008 Posts: 10
|
Posted: Tue Feb 05, 2008 3:05 pm Post subject: Re: Fixed problem with subfolders.. How to submit code? |
|
|
| TreborPugly wrote: |
So if you were getting the wrong listing, then you didn't have the hack turned on, even if you were using the "sub folders" branch.
|
Would I have had to turn the hack on specifically. I just started running it with pretty much the default config, except for changing my videos path. |
|
| Back to top |
|
 |
smack000
Joined: 05 Feb 2008 Posts: 10
|
Posted: Tue Feb 05, 2008 3:10 pm Post subject: |
|
|
| wmcbrine wrote: | OK:
1. Judging by the pathname, you're patching a version that's a month old. You should get the latest version, see if you still have the problem, and if you do, then post.
2. A Unified or Context diff would be better, so we can more easily tell where the changes are. Also, you're diffing in the wrong direction (new to old -- should be old to new). Other than that, you've submitted it just by posting it here; the only other thing to include might be your name for the credits.
3. At first I was excited, because I thought you might have found a way around need for the "hack83" subfolders branch code. But then I saw that this apparently still depends on that (no?); in which case, I'm not clear when it would be needed. The problem of having the old folder's contents appear in the new one is the entire issue that the subfolders branch is intended to address; and for me, it does so. |
Well the subfolders branch did nothing for me, then I made my fixes, and the subfolders branch started working. Maybe it's a Series3 thing?
My fix makes perfect sense to me. Since no item has a "UniqueId," the Tivo is just initializing this field to 0 for every item. When it goes to one folder, it caches the folder contents based on the unique id. If the unique id is always 0, then folders will all show up the same. |
|
| Back to top |
|
 |
wmcbrine

Joined: 04 Jan 2008 Posts: 2009 Location: Maryland
|
Posted: Tue Feb 05, 2008 3:28 pm Post subject: Re: Fixed problem with subfolders.. How to submit code? |
|
|
| smack000 wrote: | I'll try to get you guys the changes "legit." How do I use git to get the main branch? I was about to get wmcbrine's branch, but if I try:
git clone git://repo.or.cz/pyTivo.git
I get errors about no head revision. |
Yes, armooo removed his original trunk. (Don't ask why; we don't know.) Try:
git clone git://repo.or.cz/pyTivo/wmcbrine.git
I tentatively tried to use your patch with my master branch, but it didn't work. I'd love it if it did, since it's so much simpler than the current subfolders hack.
| Quote: | Would I have had to turn the hack on specifically. |
Yes. Originally it was automatic with the subfolders branch, but then KRKeegan (author of the subfolders hack) changed it to require "hack83 = True" in the "Server" section of the config file, in hopes of getting it integrated with armooo's trunk. (To clarify: AFAIK, it was always togglable via "hack83"; he just changed the default from True to False.) _________________ My pyTivo fork . My page |
|
| Back to top |
|
 |
smack000
Joined: 05 Feb 2008 Posts: 10
|
Posted: Tue Feb 05, 2008 3:53 pm Post subject: Re: Fixed problem with subfolders.. How to submit code? |
|
|
| wmcbrine wrote: |
| Quote: | Would I have had to turn the hack on specifically. |
Yes. Originally it was automatic with the subfolders branch, but then KRKeegan (author of the subfolders hack) changed it to require "hack83 = True" in the "Server" section of the config file, in hopes of getting it integrated with armooo's trunk. (To clarify: AFAIK, it was always togglable via "hack83"; he just changed the default from True to False.) |
Ok, well I never turned it on. I'll try it with your branch when I get home tonight, and failing that I'll try it with the last released version of the main branch. |
|
| Back to top |
|
 |
TreborPugly
Joined: 05 Jan 2008 Posts: 55
|
|
| Back to top |
|
 |
smack000
Joined: 05 Feb 2008 Posts: 10
|
Posted: Wed Feb 06, 2008 1:40 am Post subject: Re: Fixed problem with subfolders.. How to submit code? |
|
|
| wmcbrine wrote: | git clone git://repo.or.cz/pyTivo/wmcbrine.git
I tentatively tried to use your patch with my master branch, but it didn't work. I'd love it if it did, since it's so much simpler than the current subfolders hack. |
I just applied my patch against yours and it worked on my TivoHD. I verified that it didn't work with yours then did with my changes.
Here is a context diff for the two files, plugins/video/video.py and plugins/video/templates/container.tmpl
Note that I still can't go more than 2 levels deep. Here are the contextual diffs from the wmcbrine tree:
| Code: |
*** video.py Tue Feb 5 19:03:35 2008
--- F:\Work\pyTivo\mine2\plugins\video\video.py Tue Feb 5 19:10:35 2008
***************
*** 1,4 ****
! import transcode, os, socket, re, urllib
from Cheetah.Template import Template
from plugin import Plugin, quote, unquote
from urlparse import urlparse
--- 1,4 ----
! import transcode, os, socket, re, urllib, zlib
from Cheetah.Template import Template
from plugin import Plugin, quote, unquote
from urlparse import urlparse
***************
*** 158,163 ****
--- 158,164 ----
video['part_path'] = file.replace(local_base_path, '', 1)
video['title'] = os.path.split(file)[1]
video['is_dir'] = self.__isdir(file)
+ video['small_path'] = subcname + '/' + video['name']
if not video['is_dir']:
video['valid'] = transcode.supported_format(file)
if video['valid']:
***************
*** 174,179 ****
--- 175,181 ----
t.start = start
t.videos = videos
t.quote = quote
+ t.crc = zlib.crc32
t.escape = escape
handler.wfile.write(t)
|
| Code: |
*** container.tmpl Tue Feb 5 19:03:35 2008
--- F:\Work\pyTivo\mine2\plugins\video\templates\container.tmpl Tue Feb 5 19:11:30 2008
***************
*** 7,12 ****
--- 7,13 ----
<ContentType>x-container/tivo-videos</ContentType>
<SourceFormat>x-container/folder</SourceFormat>
<TotalItems>$total</TotalItems>
+ <UniqueId>$crc($name)</UniqueId>
</Details>
#for $video in $videos
#if $video.is_dir
***************
*** 15,20 ****
--- 16,22 ----
<Title>$escape($video.title)</Title>
<ContentType>x-container/folder</ContentType>
<SourceFormat>x-tivo-container/tivo-dvr</SourceFormat>
+ <UniqueId>$crc($video.small_path)</UniqueId>
</Details>
<Links>
<Content>
|
Lemme know if this works for others. Name's Jack Mathews if it does and you feel like putting me in the credits  |
|
| Back to top |
|
 |
windracer

Joined: 04 Jan 2008 Posts: 219 Location: St. Pete, FL
|
Posted: Wed Feb 06, 2008 2:23 am Post subject: |
|
|
smack000's changes worked for me on the master branch (and no hack83 in my config): my subfolders worked perfectly with one exception (and I think that's because in my recent re-org I went below the two folder limit).
Nice!
edit: confirmed. I re-org'ed my sub-folders again to stay within the 2 level limit and everything seems to working perfectly using the master branch and smack000's mod. _________________ pyTiVo on Ubuntu 11.10 (Oneiric) |
|
| Back to top |
|
 |
wmcbrine

Joined: 04 Jan 2008 Posts: 2009 Location: Maryland
|
Posted: Wed Feb 06, 2008 3:28 am Post subject: |
|
|
I'll be damned, it works. I must've been misapplying it earlier. Awesome!
I've added the changes to my repo. _________________ My pyTivo fork . My page |
|
| Back to top |
|
 |
wmcbrine

Joined: 04 Jan 2008 Posts: 2009 Location: Maryland
|
Posted: Wed Feb 06, 2008 4:36 am Post subject: |
|
|
OK, so this doesn't quite obsolete hack83, because of the two-level limitation. But it does work together with hack83, and makes it work better, since the Tivo makes the correct request most of the time. This probably will allow hack83 to be simplified; I'll have to study that.
My congratulations and thanks again to smack000. _________________ My pyTivo fork . My page |
|
| Back to top |
|
 |
smack000
Joined: 05 Feb 2008 Posts: 10
|
Posted: Wed Feb 06, 2008 5:55 am Post subject: |
|
|
| wmcbrine wrote: | OK, so this doesn't quite obsolete hack83, because of the two-level limitation. But it does work together with hack83, and makes it work better, since the Tivo makes the correct request most of the time. This probably will allow hack83 to be simplified; I'll have to study that.
My congratulations and thanks again to smack000. |
I'm curious - what's the root of the 2-level limitation? Is the URL too long? |
|
| Back to top |
|
 |
krkeegan Site Admin

Joined: 04 Jan 2008 Posts: 458 Location: Los Angeles, CA
|
Posted: Wed Feb 06, 2008 6:20 am Post subject: |
|
|
Hmm, this is very interesting. It would be nice if this could be used to create a better solution to the hack83 option. I really haven't had time to look at it carefully to truly understand why it works but I am interested.
What does this line do?:
| Code: | video['small_path'] = subcname + '/' + video['name'] |
It appears to set a variable that is never used?
Edit: Ahh I see it is used in the template to generate the GUID
Kevin |
|
| Back to top |
|
 |
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum You cannot attach files in this forum You can download files in this forum
|
|