Hy guys, sory for de english...
>> Well, the issue is checking the disc for a file with an extension of
>> unknown case. The same work that my patch is doing must still be >done,
>> it'd just be nice to move it outside pycdg.py; I do think there's a
>> case-insensitive "find" workalike in Python. I should go look it up >:)
>Ah, gotcha. This is for finding the matching audio file.
in pycdg.py, you have the code that check your audio file, i've
extracted the piece of code below:
"""
# Check there is a matching mp3 or ogg file
validexts = [
'wav', 'wAv', 'waV', 'wAV',
'Wav', 'WAv', 'WaV', 'WAV',
'mp3', 'mP3', 'Mp3', 'MP3',
'ogg', 'oGg', 'ogG', 'oGG',
'Ogg', 'OGg', 'OgG', 'OGG'
]
matched = 0
for ext in validexts:
if (os.path.isfile(self.FileName[:-3] + ext)):
self.SoundFileName = self.FileName[:-3] + ext
matched = 1
"""
You can do this check with a pythonic way:
"""
# Check there is a matching mp3 or ogg file - pythonic way
validexts = ['wav','mp3','ogg']
matched = 0
if (self.FileName[-3:].lower() in validexts):
self.SoundFileName = self.FileName
matched = 1
"""
And i've checked and you don't need the SoundFileName variable, you can
use the FileName variable instead, because they always have the same
value, and if you do this, you can reduce more your code:
"""
# Check there is a matching mp3 or ogg file - pythonic way
validexts = ['wav','mp3','ogg']
matched = 0
matched = (self.FileName[-3:].lower() in validexts)
"""
and in the part of your code that you use the old SoundFileName variable
this will be like:
"""
pygame.mixer.music.load(self.FileName)
"""
I hope this can help you....
And sory again by the english....... I'm Brazilian......
[]s,
Marcel Portela
-------------------------------------------------------
This SF.Net email is sponsored by the JBoss Inc. Get Certified Today
Register for a JBoss Training Course. Free Certification Exam
for All Training Attendees Through End of 2005. For more info visit:
http://ads.osdn.com/?ad_id=7628&alloc_id=16845&op=click
_______________________________________________
Pykaraoke-discuss mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/pykaraoke-discuss