Changeset 1252


Ignore:
Timestamp:
01/02/07 17:13:33 (13 years ago)
Author:
jukka
Message:

Fixed #1055, spent 1.5h.

Location:
trunk
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/FieldsWidgets.py

    r1242 r1252  
    3131from Acquisition import aq_base 
    3232from mp3tool import get_length 
    33 from datetime import time 
    3433 
    3534from types import ListType, TupleType, StringType, UnicodeType, InstanceType 
     
    10321031 
    10331032    def getLength(self, piece): 
    1034         as_time=time(second=piece.getLength()) 
    1035         return {'hour':as_time.hour,'minute':as_time.minute,'second':as_time.second} 
    1036              
     1033        as_time=piece.getLength() 
     1034        return {'hour':as_time/3600,'minute':(as_time % 3600)/60,'second':as_time % 60}             
    10371035 
    10381036 
     
    10861084    def getLength(self, instance): 
    10871085        i = aq_base(instance) 
    1088         if not shasattr(i, '_mp3length'):            
    1089             instance._mp3length=time(second=get_length(str(instance))) 
    1090         return {'hour':instance._mp3length.hour,'minute':instance._mp3length.minute,'second':instance._mp3length.second,'isoformat':instance._mp3length.isoformat()} 
     1086        file = AudioField.get(self,instance) 
     1087        if not shasattr(i, '_mp3length'): 
     1088                instance._mp3length=get_length(str(file)) 
     1089        print instance._mp3length 
     1090        if instance._mp3length==0: 
     1091                instance._mp3length=get_length(str(file)) 
     1092        return {'hour':instance._mp3length/3600,'minute':(instance._mp3length % 3600)/60,'second':instance._mp3length % 60} 
    10911093             
    10921094    def set(self, instance, value, **kwargs): 
     
    10951097        file=self.get(instance) 
    10961098        if self.getContentType(instance).startswith('audio/'): 
    1097             instance._mp3length=time(second=get_length(str(file))) 
     1099            instance._mp3length=get_length(str(file)) 
    10981100        elif str(file)!='': 
    10991101            FileField.set(self, instance, "DELETE_FILE", **kwargs) 
  • trunk/SectionFolder.py

    r1241 r1252  
    477477            uniques = pc.uniqueValuesFor(index_type)             
    478478        elif browse_type=='active_people': 
    479             people = pc.searchResults(portal_type='MemberFolder') 
     479            people = search_results 
    480480            uniques = [x.id for x in people] 
    481481        elif browse_type=='active_groups': 
    482             groups = pc.searchResults(portal_type='GroupBlog') 
     482            groups = search_results 
    483483            uniques = [x.id for x in groups] 
    484484 
  • trunk/mp3tool.py

    r820 r1252  
    6969    mp3.datasize = mp3.file.tell() 
    7070    mp3.file.seek(0, 0) 
     71    mp3.seconds=0 
    7172 
    7273    if True:    #(scantype == SCAN_FULL): 
  • trunk/skins/lemill/macros_audioplayer.pt

    r1242 r1252  
    1616    <tal:lengthies tal:define="length python:field.getLength(piece);"> 
    1717        <span i18n:translate="audio_length">Audio clip length:</span> 
    18         <span tal:condition="length/hour"><tal:hour replace="length/hour"/>:</span><span tal:replace="length/minute"/>:<span tal:replace="length/second"/><br/> 
     18<span tal:condition="length/hour"><tal:hour replace="length/hour"/>:</span><span tal:replace="python:'%02d' % length['minute']"/>:<span tal:replace="python:'%02d' % length['second']"/><br/> 
    1919    </tal:lengthies> 
    2020    <object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" width="300" height="20" 
     
    5050<p tal:define="length python:field.getLength(here);"> 
    5151<span i18n:translate="audio_length">Audio clip length:</span> 
    52 <span tal:condition="length/hour"><tal:hour replace="length/hour"/>:</span><span tal:replace="length/minute"/>:<span tal:replace="length/second"/> 
     52<span tal:condition="length/hour"><tal:hour replace="length/hour"/>:</span><span tal:replace="python:'%02d' % length['minute']"/>:<span tal:replace="python:'%02d' % length['second']"/> 
    5353</p> 
    5454 
Note: See TracChangeset for help on using the changeset viewer.