示例#1
0
 def QueryAudio(self, origin, currentextension, afi):
     # we don't modify any of these
     if afi.format in ("MIDI", "QCP", "PMD"):
         for k, n in self.RINGTONE_LIMITS.items():
             setattr(afi, k, n)
         return currentextension, afi
     d = self.RINGTONE_LIMITS.copy()
     d['format'] = 'QCP'
     return ('qcp', fileinfo.AudioFileInfo(afi, **d))
示例#2
0
 def QueryAudio(self, origin, currentextension, afi):
     # we don't modify any of these
     if afi.format in ("MIDI", "QCP", "PMD"):
         return currentextension, afi
     # examine mp3
     if afi.format=="MP3":
         if afi.channels==1 and 8<=afi.bitrate<=64 and 16000<=afi.samplerate<=22050:
             return currentextension, afi
     # convert it
     return ("mp3", fileinfo.AudioFileInfo(afi, **{'format': 'MP3', 'channels': 1, 'bitrate': 48, 'samplerate': 44100}))
示例#3
0
 def QueryAudio(self, origin, currentextension, afi):
     _max_size=self.RINGTONE_LIMITS['MAXSIZE']
     setattr(afi, 'MAXSIZE', _max_size)
     # we don't modify any of these
     if afi.format in ("MIDI", "QCP", "PMD", "WMA"):
         return currentextension, afi
     # examine mp3
     if afi.format=="MP3":
         if afi.channels==1 and 8<=afi.bitrate<=64 and 16000<=afi.samplerate<=22050:
             return currentextension, afi
     # convert it
     return ("mp3", fileinfo.AudioFileInfo(afi, **{'format': 'MP3',
                                                   'channels': 2,
                                                   'bitrate': 48,
                                                   'samplerate': 44100,
                                                   'MAXSIZE': _max_size }))