Skip to content

Commit

Permalink
Songs should be completely fixed now when selecting parts. SongCache.…
Browse files Browse the repository at this point in the history
…sqlite needs to be deleted and recreated to work properly.
  • Loading branch information
erodozer committed Jun 16, 2011
1 parent c655011 commit ec128ef
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 11 deletions.
17 changes: 8 additions & 9 deletions src/Song.py
Expand Up @@ -206,12 +206,12 @@ class SongInfo(object):
def __init__(self, infoFileName, songLibrary = DEFAULT_LIBRARY):
self.songName = os.path.basename(os.path.dirname(infoFileName))
self.fileName = infoFileName
self.libraryNam = songLibrary[:]
self.libraryNam = songLibrary[:]
self.info = Config.MyConfigParser()
self._partDifficulties = {}
self._parts = None
self._midiStyle = None
self.highScores = {}
self.highScores = {}

self.locked = False

Expand All @@ -226,9 +226,6 @@ def __init__(self, infoFileName, songLibrary = DEFAULT_LIBRARY):
except:
pass

for part in self.getParts():
self.getScores(part)

self.logClassInits = Config.get("game", "log_class_inits")
if self.logClassInits == 1:
Log.debug("SongInfo class init (song.py): " + self.name)
Expand All @@ -253,6 +250,9 @@ def __init__(self, infoFileName, songLibrary = DEFAULT_LIBRARY):
Log.debug("notes-unedited.mid not found, using notes.mid - " + self.name)
self.noteFileName = os.path.join(os.path.dirname(self.fileName), notefile)

for part in self.getParts():
self.getScores(part)

#stump: metadata caching
if Config.get("performance", "cache_song_metadata"):
songhash = hashlib.sha1(open(self.noteFileName, 'rb').read()).hexdigest()
Expand All @@ -277,7 +277,6 @@ def __init__(self, infoFileName, songLibrary = DEFAULT_LIBRARY):
_songDB.execute('DELETE FROM `songinfo` WHERE `hash` = ?', [songhash])

#stump: preload this stuff...
self.getParts()
self.getSections()

#stump: Write this song's info into the cache.
Expand Down Expand Up @@ -458,7 +457,7 @@ def getParts(self):
for part in self._parts:
self._partDifficulties[part.id] = difficulties.values()
return self._parts

def getName(self):
return self._get("name")

Expand Down Expand Up @@ -2798,7 +2797,7 @@ def sequence_name(self, text):
self.useVocalTrack = True
self.partnumber = part
if self.logSections == 1:
tempText2 = name.replace(" ", "_")
tempText2 = text.replace(" ", "_")
break #should only have one instance of an instrument
break #end the searching

Expand Down Expand Up @@ -3272,7 +3271,7 @@ def sequence_name(self, text):

for part in parts.values():
if text in part.trackName:
if part not in self.song.parts:
if part not in self.parts:
if part.id == VOCAL_PART:
self.parts.append(part)
self.nextPart = None
Expand Down
5 changes: 3 additions & 2 deletions src/SongChoosingScene.py
Expand Up @@ -415,7 +415,7 @@ def checkCmdPlay(self):
vocals = []
autoPart = None
for part in info.parts:
if part.id == 4:
if part.id == 4 or part.id == 7:
drums.append(part)
elif part.id == 5:
vocals.append(part)
Expand Down Expand Up @@ -530,6 +530,7 @@ def startGame(self, fromQueue = False): #note this is not refined.
guitars = []
drums = []
vocals = []
print info.parts
for part in info.parts:
if part.id == 4 or part.id == 7:
drums.append(part)
Expand Down Expand Up @@ -638,7 +639,7 @@ def checkParts(self):
drums = []
vocals = []
for part in info.parts:
if part.id == 4:
if part.id == 4 or part.id == 7:
drums.append(part)
elif part.id == 5:
vocals.append(part)
Expand Down

0 comments on commit ec128ef

Please sign in to comment.