Gamer125 / fofix

Automatically exported from code.google.com/p/fofix
0 stars 0 forks source link

Song.py, getSections: song practice sections not retrieved #1165

Open GoogleCodeExporter opened 8 years ago

GoogleCodeExporter commented 8 years ago
in SVN r2038, the getSections function is broken and does not retrieve the
song sections properly.

See the following patch to fix the issue:

===================================================================
--- src/Song.py (revision 2038)
+++ src/Song.py (working copy)
@@ -948,7 +948,14 @@
       return self._sections
     # See which sections are available
     try:
-      noteFileName = self.noteFileName
+      # FB: bugfix r2038: SongInfo has no property noteFileName 
+      #     The SongInfo should have a reference back to the Song
+      #     in order to retrieve the proper noteFileName.
+      #     This might not be easy to do, as the Song might not have
+      #     determined the file name yet.
+      #     Here is a cheap little hack in the meantime.
+      #noteFileName = self.noteFileName
+      noteFileName = self.fileName[0:-8] + "notes.mid"
       Log.debug("Retrieving sections from: " + noteFileName)
       info = MidiSectionReader()
       midiIn = midi.MidiInFile(info, noteFileName)
@@ -963,15 +970,19 @@

         #MFH - only log if enabled
         Log.warn("Song.py: Using auto-generated note count sections...")
-        if self.logSections == 1:
-          Log.debug("Practice sections: " + str(self._sections))
+        # FB: bugfix r2038: logSections does not exists.
+        #     the exception thrown clears out all sections found
+        #if self.logSections == 1:
+        Log.debug("Practice sections: " + str(self._sections))

       else:
         self._sections.insert(0,["0:00 -> Start", 0.0])

         #MFH - only log if enabled
-        if self.logSections == 1:
-          Log.debug("Practice sections: " + str(self._sections))
+        # FB: bugfix r2038: logSections does not exists.
+        #     the exception thrown clears out all sections found
+        # if self.logSections == 1:
+        Log.debug("Practice sections: " + str(self._sections))

     except Exception, e:
       Log.warn("Song.py: Unable to retrieve section names for practice
mode selection: %s" % e)

Original issue reported on code.google.com by felix.uwe.bertram@gmail.com on 31 Mar 2010 at 2:22

GoogleCodeExporter commented 8 years ago
Bumping priority and adding Review label.

Original comment by fuzio...@gmail.com on 1 Sep 2010 at 1:27

GoogleCodeExporter commented 8 years ago
Confirmed, but the provided patch needs work (shouldn't override user settings, 
etc)

Original comment by fuzio...@gmail.com on 2 Sep 2010 at 3:46