pyTivo Discussion Forum Forum Index pyTivo Discussion Forum
Answers and the development of pyTivo a TiVo transcoding server
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Display order of shares (appears to be somewhat random?)

 
Post new topic   Reply to topic    pyTivo Discussion Forum Forum Index -> Support
 View previous topic :: View next topic  
Author Message
latenighttech



Joined: 02 Apr 2008
Posts: 2

PostPosted: Wed Apr 02, 2008 9:48 am    Post subject: Display order of shares (appears to be somewhat random?) Reply with quote

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
View user's profile Send private message
krkeegan
Site Admin


Joined: 04 Jan 2008
Posts: 412
Location: Los Angeles, CA

PostPosted: Wed Apr 02, 2008 12:17 pm    Post subject: Reply with quote

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
View user's profile Send private message Visit poster's website
reneg



Joined: 04 Jan 2008
Posts: 41

PostPosted: Wed Apr 02, 2008 1:51 pm    Post subject: Reply with quote

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
View user's profile Send private message
krkeegan
Site Admin


Joined: 04 Jan 2008
Posts: 412
Location: Los Angeles, CA

PostPosted: Wed Apr 02, 2008 2:20 pm    Post subject: Reply with quote

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
View user's profile Send private message Visit poster's website
latenighttech



Joined: 02 Apr 2008
Posts: 2

PostPosted: Wed Apr 02, 2008 5:25 pm    Post subject: Reply with quote

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
View user's profile Send private message
krkeegan
Site Admin


Joined: 04 Jan 2008
Posts: 412
Location: Los Angeles, CA

PostPosted: Wed Apr 02, 2008 5:39 pm    Post subject: Reply with quote

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
View user's profile Send private message Visit poster's website
reneg



Joined: 04 Jan 2008
Posts: 41

PostPosted: Thu Apr 03, 2008 5:23 pm    Post subject: Reply with quote

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&amp;Container=$escape($name)</Url>
                <ContentType>$escape($details)</ContentType>
            </Content>
        </Links>
    </Item>
    #end for
Back to top
View user's profile Send private message
krkeegan
Site Admin


Joined: 04 Jan 2008
Posts: 412
Location: Los Angeles, CA

PostPosted: Thu Apr 03, 2008 9:32 pm    Post subject: Reply with quote

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
View user's profile Send private message Visit poster's website
reneg



Joined: 04 Jan 2008
Posts: 41

PostPosted: Fri Apr 04, 2008 7:34 am    Post subject: Reply with quote

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
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    pyTivo Discussion Forum Forum Index -> Support All times are GMT - 8 Hours
Page 1 of 1

 
Jump to:  
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
Site is in NO WAY affiliated with TiVo Inc

Powered by phpBB © 2001, 2005 phpBB Group
phpBB SEO
[ Time: 0.2740s ][ Queries: 13 (0.1446s) ][ Debug on ]