|
| Author |
Message |
latenighttech
Joined: 02 Apr 2008 Posts: 2
|
Posted: Wed Apr 02, 2008 9:48 am Post subject: Display order of shares (appears to be somewhat random?) |
|
|
I'm a VERY happy user of pyTivo, running "KRKeegan's fork" (pyTivo-v2008.03.28 ) with subfolder hack enabled. Something that's been perplexing me for some time, and I've not found any references to this issue on any of the discussion boards (however please forgive me if this is an "old" issue and I just missed it) ... how is the display order of shares on the NPL determined, and can I influence it? I would have expected they would just be displayed the way I have them ordered in my pyTivo.conf file, but it seems to have a mind of it's own. It appears to select them almost alphabetically by the drive letter and path, but that's not totally consistent either. Is there a way to force pyTivo to display my shares in the order I desire?
Thx! |
|
| Back to top |
|
 |
krkeegan Site Admin

Joined: 04 Jan 2008 Posts: 412 Location: Los Angeles, CA
|
Posted: Wed Apr 02, 2008 12:17 pm Post subject: |
|
|
No it is pretty random. From memory I think it is controlled by a dict variable in python. The sorting of Dict variables in python is notoriously random. (I am sure it is influenced by something, but the output at least appears random).
I would be willing to add an enhancement to sort the shares, the question is how to do it.
Sorting options:
1. It would probably be fairly easy to make it alphabetical.
2. Sorting it in the same order as the conf file might be more difficult. The configuration module doesn't seem to store the settings in any particular order. Thus there is no real way to sort things from the admin plugin.
3. Add another setting to the shares which influences their sort order. i.e. sort_order = 1 This seems a little ridiculous.
I think alphabetical makes the most sense, but I am not sure it provides the result ppl are looking for. |
|
| Back to top |
|
 |
reneg
Joined: 04 Jan 2008 Posts: 41
|
Posted: Wed Apr 02, 2008 1:51 pm Post subject: |
|
|
| Alphabetically would make the most sense to me, but I don't think it will help if there is more than one instance of pyTivo running. At that point, it's up to the Tivo to display the various shares that it sees. |
|
| Back to top |
|
 |
krkeegan Site Admin

Joined: 04 Jan 2008 Posts: 412 Location: Los Angeles, CA
|
Posted: Wed Apr 02, 2008 2:20 pm Post subject: |
|
|
| reneg wrote: | Alphabetically would make the most sense to me, but I don't think it will help if there is more than one instance of pyTivo running. At that point, it's up to the Tivo to display the various shares that it sees. | Yes that cannot be fixed AFAIK. |
|
| Back to top |
|
 |
latenighttech
Joined: 02 Apr 2008 Posts: 2
|
Posted: Wed Apr 02, 2008 5:25 pm Post subject: |
|
|
Thanks for the responses. In my case, I have only one instance of pyTivo running, so I'm not concerned about the multi-pyTivo randomness. Honestly, if "option 2" (order listed in config file) won't work, my preference would still be "option 3" (even though it may seem overkill) so that I can explicitly set the order to my liking. Or perhaps default to alphabetic (so at least it wouldn't be random), then provide an override for "experts" where one could explicitly set the display order. I have quite a few shares and would like to logically group them and not have to depend on giving them alpha-sort titles to get them to display the way I like.
But, beggars can't be choosers ... I appreciate the support to do something to make it more predictable, then I can work around whatever solution turns out to be.
Thanks! |
|
| Back to top |
|
 |
krkeegan Site Admin

Joined: 04 Jan 2008 Posts: 412 Location: Los Angeles, CA
|
Posted: Wed Apr 02, 2008 5:39 pm Post subject: |
|
|
| Ok let me ponder over the possibility of sorting based on the order in the pyTivo.conf file. Sometimes I come up with good ideas while I sleep. |
|
| Back to top |
|
 |
reneg
Joined: 04 Jan 2008 Posts: 41
|
Posted: Thu Apr 03, 2008 5:23 pm Post subject: |
|
|
May not be pretty, but this works on my system:
In httpserver.py in root_container, added the 5 lines after t = Template
| Code: |
t = Template(file=os.path.join(SCRIPTDIR, 'templates',
'root_container.tmpl'))
shares = sorted(tsncontainers.keys())
content = []
for x in shares:
content.append(tsncontainers[x]['content_type'])
t.tempcontainer = zip(shares,content)
t.containers = tsncontainers
|
and in root_container.tmpl, changed the for loop as follows:
| Code: |
#for $name, $details in $tempcontainer
<Item>
<Details>
<Title>$escape($name)</Title>
<ContentType>$escape($details)</ContentType>
<SourceFormat>x-container/folder</SourceFormat>
</Details>
<Links>
<Content>
<Url>/TiVoConnect?Command=QueryContainer&Container=$escape($name)</Url>
<ContentType>$escape($details)</ContentType>
</Content>
</Links>
</Item>
#end for
|
|
|
| Back to top |
|
 |
krkeegan Site Admin

Joined: 04 Jan 2008 Posts: 412 Location: Los Angeles, CA
|
Posted: Thu Apr 03, 2008 9:32 pm Post subject: |
|
|
Wait this only sorts alphabetically??
Yeah that is pretty easy to accomplish. It is the sort by order in pytivo.conf that has me more stumped. |
|
| Back to top |
|
 |
reneg
Joined: 04 Jan 2008 Posts: 41
|
Posted: Fri Apr 04, 2008 7:34 am Post subject: |
|
|
Yes, it is alphabetical. Option 1 is simple and it makes my NPL esthetically pleasing with the 12 shares that I have defined.
I think option 2 is more trouble than it's worth. You would have to rework getShares in config.py. Processing sections in the conf file in order would imply that ConfigParser returns sections in a certain order or you would have to figure out another way to specify ordering. |
|
| Back to top |
|
 |
|