Skip to content

Commit

Permalink
Fix to make sure non numbered tracks arn't loaded when numbered track…
Browse files Browse the repository at this point in the history
…s for that instrument are also available.
  • Loading branch information
mdsitton committed Jan 1, 2016
1 parent 1258298 commit dc6ab76
Showing 1 changed file with 22 additions and 5 deletions.
27 changes: 22 additions & 5 deletions fofix/game/Song.py
Expand Up @@ -2948,16 +2948,33 @@ def loadSong(engine, name, library = DEFAULT_LIBRARY, playbackOnly = False, note

os.chdir(orgpath)


# All song file entries are going to be lists because there is a possibilty
# for the drums of having multiple tracks. This will make things simpler.
for f in songOggFiles:
instName = f.split('.')[0].lower()
if 'drums' in instName:
instName = 'drums'
drumTest = bool( [i for i in songFiles.keys() if 'drums' in i] )
if instName not in songFiles.keys() or drumTest is False:

# Check for numbered audio tracks
isNumbered = re.compile('^.*_\d').match(instName)
if isNumbered:
# take the part of the name before the underscore for the name.
instName = instName.split('_')[0]


# get the number of additional tracks
instReNumbered = re.compile('^{0}_\d'.format(instName))
numCount = len([i for i in songOggFiles if instReNumbered.match(i)])

print f, bool(isNumbered), numCount

# skip non numbered ogg files if there are others that are.
if numCount > 0 and not isNumbered:

print 'Skipped', f
continue

if instName not in songFiles:
songFiles[instName] = []

songFiles[instName].append(engine.resource.fileName(library, name, f))

if 'song' not in songFiles:
Expand Down

0 comments on commit dc6ab76

Please sign in to comment.