More biz to help simfiles make it. Better error reporting service.
authorCameron Ball <c.ball1729@gmail.com>
Mon, 22 Dec 2014 17:53:20 +0000 (01:53 +0800)
committerCameron Ball <c.ball1729@gmail.com>
Mon, 22 Dec 2014 17:53:20 +0000 (01:53 +0800)
Controllers/SimfileController.php
DataAccess/DataMapper/DataMapper.php
DataAccess/DataMapper/Helpers/AbstractPopulationHelper.php
Domain/VOs/StepMania/DanceMode.php
Services/IStatusReporter.php
Services/SimfileParser.php
Services/StatusReporter.php
Services/Uploads/UploadManager.php
Services/ZipParser.php

index 582cfc0..5e83f9f 100644 (file)
@@ -140,7 +140,7 @@ class SimfileController implements IDivineController
             $zipParser->parse($file);\r
 \r
             if(!$zipParser->simfiles()) $this->_statusReporter->error('That zip doesn\'t seem to have any simfiles in it.');\r
-            \r
+\r
             //save the actual zip in the db\r
             $this->findAndAddSmoMirror($file);\r
             $this->_fileRepository->save($file);  \r
index b5217ad..3900522 100644 (file)
@@ -2,6 +2,7 @@
 \r
 namespace DataAccess\DataMapper;\r
 \r
+use Exception;\r
 use Domain\Entities\IDivineEntity;\r
 use DataAccess\IDatabaseFactory;\r
 use DataAccess\DataMapper\IDataMapper;\r
@@ -64,146 +65,160 @@ class DataMapper implements IDataMapper
         \r
     public function save(IDivineEntity $entity)\r
     {\r
-        $queries = AbstractPopulationHelper::generateUpdateSaveQuery($this->_maps, $entity, $entity->getId(), $this->_db);\r
-        $mergeMap = array();\r
-        $flattened = array();\r
+        try {\r
+            $this->_db->beginTransaction();\r
+            $queries = AbstractPopulationHelper::generateUpdateSaveQuery($this->_maps, $entity, $entity->getId(), $this->_db);\r
+            $mergeMap = array();\r
+            $flattened = array();\r
 \r
-        foreach($queries as $index => $query)\r
-        {\r
-            $this_table = $query['table'];\r
-            $this_columns = $query['columns'];\r
-\r
-            \r
-            for($i = $index+1; $i<count($queries); $i++)\r
+            foreach($queries as $index => $query)\r
             {\r
-                if(\r
-                    $queries[$i]['table'] == $this_table &&\r
-                    !array_key_exists($i, $mergeMap) &&\r
-                    !isset($query['id'])) //only merge create queries, updates are fine to run multiple times\r
+                $this_table = $query['table'];\r
+                $this_columns = $query['columns'];\r
+\r
+\r
+                for($i = $index+1; $i<count($queries); $i++)\r
                 {\r
-                    //XXX: This whole biz is tricky. Basically the problem is that when creating a new simfile,\r
-                    //the datamapper spews out a bunch of create queries. When parsing a simfile for example, there can\r
-                    //be huge redundency - it may produce 5 queries that all create the same step artist, for example.\r
-                    //We attempt to flatten equivalent queries. Originally I was basing it purely on the table name or something,\r
-                    //but that is not enough. In the case of steps, it ends up mergin all the steps together, so we need to\r
-                    //check if the arrays are equal as well, which is what this does.\r
-                    if($this_columns === $queries[$i]['columns'])\r
-                    {\r
-                        //need to keep track of what we merged as future queries might reference the old ids.\r
-                        $mergeMap[$i] = $index;\r
-                    }\r
-                    \r
-                    //XXX: Another thing that might happen is we have to create queries running on the same table, but with unique columns.\r
-                    //In this case, we can take the columns of one and put it into the other. Otherwise we create two records when we really\r
-                    //should have only one. An example of this is when a user is created, a query to add the country to users_meta is run,\r
-                    //and then _another_ to add firstname, lastname and user_id. It should really all be done in one query.\r
-                    \r
-                    //Make sure both queries are for the same table, and the both relate back to the main query\r
-                    if($this_table == $queries[$i]['table'] && in_array('%MAIN_QUERY_ID%', $this_columns) && in_array('%MAIN_QUERY_ID%', $queries[$i]['columns']))\r
+                    if(\r
+                        $queries[$i]['table'] == $this_table &&\r
+                        !array_key_exists($i, $mergeMap) &&\r
+                        !isset($query['id'])) //only merge create queries, updates are fine to run multiple times\r
                     {\r
-                        $this_column_names = array_keys($this_columns);\r
-                        $other_column_names = array_keys($queries[$i]['columns']);\r
-                        $combine = true;\r
-                        foreach($this_column_names as $column_name)\r
+                        //XXX: This whole biz is tricky. Basically the problem is that when creating a new simfile,\r
+                        //the datamapper spews out a bunch of create queries. When parsing a simfile for example, there can\r
+                        //be huge redundency - it may produce 5 queries that all create the same step artist, for example.\r
+                        //We attempt to flatten equivalent queries. Originally I was basing it purely on the table name or something,\r
+                        //but that is not enough. In the case of steps, it ends up mergin all the steps together, so we need to\r
+                        //check if the arrays are equal as well, which is what this does.\r
+                        if($this_columns === $queries[$i]['columns'])\r
                         {\r
-                            if($this_columns[$column_name] != '%MAIN_QUERY_ID%' && in_array($column_name, $other_column_names))\r
-                            {\r
-                                $combine = false;\r
-                            }\r
+                            //need to keep track of what we merged as future queries might reference the old ids.\r
+                            $mergeMap[$i] = $index;\r
                         }\r
-                        \r
-                        if($combine)\r
+\r
+                        //XXX: Another thing that might happen is we have to create queries running on the same table, but with unique columns.\r
+                        //In this case, we can take the columns of one and put it into the other. Otherwise we create two records when we really\r
+                        //should have only one. An example of this is when a user is created, a query to add the country to users_meta is run,\r
+                        //and then _another_ to add firstname, lastname and user_id. It should really all be done in one query.\r
+\r
+                        //Make sure both queries are for the same table, and the both relate back to the main query\r
+                        if($this_table == $queries[$i]['table'] && in_array('%MAIN_QUERY_ID%', $this_columns) && in_array('%MAIN_QUERY_ID%', $queries[$i]['columns']))\r
                         {\r
-                            $this_columns = array_merge($this_columns, $queries[$i]['columns']);\r
-                            $mergeMap[$i] = $index;\r
+                            $this_column_names = array_keys($this_columns);\r
+                            $other_column_names = array_keys($queries[$i]['columns']);\r
+                            $combine = true;\r
+                            foreach($this_column_names as $column_name)\r
+                            {\r
+                                if($this_columns[$column_name] != '%MAIN_QUERY_ID%' && in_array($column_name, $other_column_names))\r
+                                {\r
+                                    $combine = false;\r
+                                }\r
+                            }\r
+\r
+                            if($combine)\r
+                            {\r
+                                $this_columns = array_merge($this_columns, $queries[$i]['columns']);\r
+                                $mergeMap[$i] = $index;\r
+                            }\r
                         }\r
                     }\r
                 }\r
+\r
+                if(!array_key_exists($index, $mergeMap)) {\r
+                    $prepared = isset($query['prepared']) ? $query['prepared'] : null;\r
+                    $id = isset($query['id']) ? $query['id'] : null;\r
+\r
+                    $flattened[$index] = array(\r
+                        'columns' => $this_columns,\r
+                        'table' => $this_table,\r
+                        'prepared' => $prepared,\r
+                        'id' => $id\r
+                    );\r
+                }\r
             }\r
-            \r
-            if(!array_key_exists($index, $mergeMap)) {\r
-                $prepared = isset($query['prepared']) ? $query['prepared'] : null;\r
-                $id = isset($query['id']) ? $query['id'] : null;\r
-\r
-                $flattened[$index] = array(\r
-                    'columns' => $this_columns,\r
-                    'table' => $this_table,\r
-                    'prepared' => $prepared,\r
-                    'id' => $id\r
-                );\r
-            }\r
-        }\r
-        \r
-        $queries = array();\r
-                \r
-        foreach($flattened as $index => $info)\r
-        {\r
-            if(isset($info['id']))\r
+\r
+            $queries = array();\r
+\r
+            foreach($flattened as $index => $info)\r
             {\r
-                $query = $info['prepared'];\r
-                $query = substr($query, 0, -2);\r
-                $query .= sprintf(' WHERE id=%u', $info['id']);\r
-            } else {\r
-                $query = sprintf('INSERT INTO %s (%s) VALUES (%s)',\r
-                $info['table'],\r
-                implode(', ', array_keys($info['columns'])),\r
-                implode(', ', $info['columns']));\r
+                if(isset($info['id']))\r
+                {\r
+                    $query = $info['prepared'];\r
+                    $query = substr($query, 0, -2);\r
+                    $query .= sprintf(' WHERE id=%u', $info['id']);\r
+                } else {\r
+                    $query = sprintf('INSERT INTO %s (%s) VALUES (%s)',\r
+                    $info['table'],\r
+                    implode(', ', array_keys($info['columns'])),\r
+                    implode(', ', $info['columns']));\r
+                }\r
+\r
+                $queries[$index] = $query;\r
             }\r
             \r
-            $queries[$index] = $query;\r
-        }\r
+           // if($queries['TYPE'] == AbstractPopulationHelper::QUERY_TYPE_CREATE)\r
+           // {\r
+                $idMap = [];\r
+                foreach($queries as $index => $query)\r
+                {                                \r
+                    $runQuery = true;\r
+                    //originally was preg_quote('%').'(.*?)'.preg_quote('%') but that failed with things like:\r
+                    //...VALUES ('Voyager Full 50%', %INDEX_REF_0%\r
+                    //it picked up ', \r
+                    //so now only find ones with INDEX_REF and double check that MAIN QUERY isn't there.\r
+                    if (preg_match_all('/'.preg_quote('%INDEX_REF_').'(.*?)'.preg_quote('%').'/s', $query, $matches)) {\r
+                        foreach($matches[1] as $index_ref)\r
+                        {\r
+                            //if($index_ref != 'MAIN_QUERY_ID')\r
+                            //if(strpos($query, '%MAIN_QUERY_ID%') === false)\r
+                            //{\r
+                                $index_id = str_replace('INDEX_REF_', '', $index_ref);\r
+                                $query = str_replace('%INDEX_REF_' . $index_id . '%', $idMap['INDEX_REF_' . $index_id], $query);\r
+                            //} else {\r
+                            //    $runQuery = false;\r
+                            //}\r
+                        }\r
+                    }\r
 \r
-       // if($queries['TYPE'] == AbstractPopulationHelper::QUERY_TYPE_CREATE)\r
-       // {\r
-            $idMap = [];\r
-            foreach($queries as $index => $query)\r
-            {                                \r
-                $runQuery = true;\r
-                if (preg_match_all('/'.preg_quote('%').'(.*?)'.preg_quote('%').'/s', $query, $matches)) {\r
-                    foreach($matches[1] as $index_ref)\r
+                    //if we don't need the main query we can run this\r
+                    if(strpos($query, '%MAIN_QUERY_ID%') === false)\r
                     {\r
-                        if($index_ref != 'MAIN_QUERY_ID')\r
-                        {\r
-                            $index_id = str_replace('INDEX_REF_', '', $index_ref);\r
-                            $query = str_replace('%INDEX_REF_' . $index_id . '%', $idMap['INDEX_REF_' . $index_id], $query);\r
-                        } else {\r
-                            $runQuery = false;\r
+                        $statement = $this->_db->prepare($query);\r
+                        $statement->execute();\r
+                        //$refIndex = $index+1; This was being used as the index for idMap below. I have nfi why I was adding 1.\r
+                        $idMap['INDEX_REF_' . $index] = $this->_db->lastInsertId();\r
+\r
+                        foreach($mergeMap as $oldIndex => $mergedIndex) {\r
+                            if($mergedIndex == $index) {\r
+                                $idMap['INDEX_REF_' . $oldIndex] = $idMap['INDEX_REF_' . $index];\r
+                            }\r
                         }\r
+\r
+                        unset($queries[$index]);\r
+                    } else {\r
+                        //update query so that other references are resolved.\r
+                        $queries[$index] = $query;\r
                     }\r
                 }\r
 \r
-                if($runQuery)\r
+                //at this point we have queries left that depend on the main query id\r
+                foreach($queries as $query)\r
                 {\r
+                    $query = str_replace('%MAIN_QUERY_ID%', end($idMap), $query);\r
                     $statement = $this->_db->prepare($query);\r
                     $statement->execute();\r
-                    //$refIndex = $index+1; This was being used as the index for idMap below. I have nfi why I was adding 1.\r
-                    $idMap['INDEX_REF_' . $index] = $this->_db->lastInsertId();\r
-                    \r
-                    foreach($mergeMap as $oldIndex => $mergedIndex) {\r
-                        if($mergedIndex == $index) {\r
-                            $idMap['INDEX_REF_' . $oldIndex] = $idMap['INDEX_REF_' . $index];\r
-                        }\r
-                    }\r
-                    \r
-                    unset($queries[$index]);\r
-                } else {\r
-                    //update query so that other references are resolved.\r
-                    $queries[$index] = $query;\r
                 }\r
-            }\r
+            //}\r
+\r
+            if(!$entity->getId()) $entity->setId(end($idMap));\r
             \r
-            //at this point we have queries left that depend on the main query id\r
-            foreach($queries as $query)\r
-            {\r
-                $query = str_replace('%MAIN_QUERY_ID%', end($idMap), $query);\r
-                $statement = $this->_db->prepare($query);\r
-                $statement->execute();\r
-            }\r
-        //}\r
-        \r
-        if(!$entity->getId()) $entity->setId(end($idMap));\r
-        \r
-        return $entity;\r
+            $this->_db->commit();\r
+            \r
+            return $entity;\r
+        } catch (Exception $e) {\r
+            $this->_db->rollBack();\r
+            throw $e;\r
+        }\r
     }\r
     \r
     //TODO: Implement\r
index a2f1ea6..00a442a 100644 (file)
@@ -373,7 +373,8 @@ class AbstractPopulationHelper
         \r
         foreach($columns as $columnName => $columnValue)\r
         {\r
-            $query .= sprintf('%s="%s" AND ', $columnName, str_replace('"', '\"', $columnValue));\r
+            $columnValue = $db->quote($columnValue);\r
+            $query .= sprintf('%s=%s AND ', $columnName, str_replace('"', '\"', $columnValue));\r
         }\r
         \r
         $query = substr($query, 0, -4);\r
index 34e0309..582b9ca 100644 (file)
@@ -56,6 +56,7 @@ class DanceMode implements IDanceMode
         'techno-double8' => 'Double 8 Panel',\r
         'pnm-five' => 'Five Key',\r
         'pnm-nine' => 'Nine Key',\r
+        'guitar-five' => '5 Fret',\r
         'lights-cabinet' => 'Cabinet Lights'\r
     );\r
     \r
@@ -71,6 +72,7 @@ class DanceMode implements IDanceMode
         'pnm' => 'Pop\'n Music',\r
         'ds3ddx' => 'Dance Station 3DDX',\r
         'kb7' => 'Keybeat',\r
+        'guitar' => 'Guitar Hero',\r
         'lights' => false\r
     );\r
             \r
index 3214a41..b88c70b 100644 (file)
@@ -6,8 +6,9 @@ use Exception;
 
 interface IStatusReporter
 {
-    public function success($message);
-    public function error($message);
+    public function success($message = null);
+    public function error($message = null);
+    public function addMessage($message);
     public static function exception(Exception $exception);
     public function json();
 }
index c56dc6d..374bc17 100644 (file)
@@ -2,13 +2,22 @@
 
 namespace Services;
 
-use Services\ISimfileParser;
 use Exception;
+use Services\ISimfileParser;
+use Services\IStatusReporter;
+
+class InvalidSmFileException extends Exception{}
 
 class SimfileParser implements ISimfileParser
 {
     
     private $_smFileLines;
+    private $_statusReporter;
+    
+    public function __construct(IStatusReporter $statusReporter)
+    {
+        $this->_statusReporter = $statusReporter;
+    }
         
     public function parse($simfileData)
     {
@@ -23,7 +32,7 @@ class SimfileParser implements ISimfileParser
     public function title()
     {
         $title = $this->extractKey('TITLE');
-        if(!$title) throw new Exception ('Invalid SM file. TITLE missing');
+        if(!$title) throw new InvalidSmFileException('Invalid SM file. TITLE missing');
         
         //XXX: UTF8 encode to deal with unusual character that crop up in weeaboo shit.
         return utf8_encode($title);
@@ -65,7 +74,7 @@ class SimfileParser implements ISimfileParser
         if($displayBpm)
         {
             $bpmRange = explode(":",$displayBpm);
-            $bpmRange[1] = @$bpmRange[1] ?: $bpmRange[0];
+            $bpmRange[1] = isset($bpmRange[1]) && is_numeric($bpmRange[1]) ?: $bpmRange[0];
         }
         
         //XXX: Originally I had an else statement for this. But turns out some SM's have * as the display bpm
@@ -105,7 +114,7 @@ class SimfileParser implements ISimfileParser
     public function subtitle()
     {
         $subtitle = $this->extractKey('SUBTITLE');
-        if(!$subtitle) throw new Exception ('Invalid SM file. SUBTITLE missing');
+        if(!$subtitle) return null;
         
         return $subtitle;
     }
@@ -122,14 +131,14 @@ class SimfileParser implements ISimfileParser
             {
                 $noteData = trim(substr($line, $pos + 9));
                 $steps = $this->stepchartFromNoteData($noteData);
-                
+
                 //XXX: Sometimes we get a cabinet lights chart, those return false for getGame.
                 //We don't want to store cabinet lights, so just ignore it.
                 if($steps->getMode()->getGame()) $allSteps[] = $steps;
             }
         }
         
-        if(empty($allSteps)) throw new Exception('Invalid Sm file. NOTES missing');
+        if(empty($allSteps)) throw new InvalidSmFileException('Invalid Sm file. NOTES missing');
         return $allSteps;
     }
     
@@ -139,13 +148,15 @@ class SimfileParser implements ISimfileParser
         return new \Domain\VOs\StepMania\StepChart(
             new \Domain\VOs\StepMania\DanceMode($stepData[0]),
             new \Domain\VOs\StepMania\Difficulty($stepData[2]),
-            empty($stepData[1]) ? null : new \Domain\VOs\StepMania\StepArtist($stepData[1]),
-            $stepData[3]
+            empty($stepData[1]) ? null : new \Domain\VOs\StepMania\StepArtist(utf8_encode($stepData[1])),
+            //XXX: Fuck you whoever made me do this. http://dev.mysql.com/doc/refman/5.5/en/integer-types.html
+            $stepData[3] <= 18446744073709551615 ? $stepData[3] : 9999999999999999999
         );
     }
     
     private function extractKey($key)
     {
+        //Throw regular exception here, this has nothing to do with the SM file.
         if(empty($this->_smFileLines)) throw new Exception('SM file data not set.');
         
         foreach ($this->_smFileLines as $line)
@@ -164,13 +175,18 @@ class SimfileParser implements ISimfileParser
 
         foreach($bpms as $bpm)
         {
-                $bpmMeasure = explode('=', $bpm);
-                $bpmValue = floatval($bpmMeasure[1]);
+            $bpmMeasure = explode('=', $bpm);
+            $bpmValue = floatval($bpmMeasure[1]);
 
-                if(empty($bpmRange['low'])) $bpmRange['low'] = $bpmRange['high'] = $bpmValue;
+            if(empty($bpmRange['low'])) $bpmRange['low'] = $bpmRange['high'] = $bpmValue;
 
+            //XXX: Anything bigger or smaller than this cannot be stored by MySQLs bigint type http://dev.mysql.com/doc/refman/5.5/en/integer-types.html
+            //fuck you if your simfile has bpms this high/low what's wrong with you.
+            if($bpmValue <= 9223372036854775807 && $bpmValue >= -9223372036854775808)
+            {
                 $bpmRange['high'] = ($bpmValue > $bpmRange['high']) ? $bpmValue : $bpmRange['high'];
                 $bpmRange['low'] = ($bpmValue < $bpmRange['low']) ? $bpmValue : $bpmRange['low'];
+            }
         }
         
         return array($bpmRange['low'], $bpmRange['high']);
index 3667c88..32c9481 100644 (file)
@@ -8,7 +8,7 @@ use Services\IStatusReporter;
 
 class StatusReporter implements IStatusReporter
 {
-    private $_message;
+    private $_messages = array();
     private $_type;
     private $_response;
     
@@ -20,9 +20,9 @@ class StatusReporter implements IStatusReporter
         $this->_response = $response;
     }
     
-    public function error($message)
+    public function error($message = null)
     {
-        $this->_message = $message;
+        if($message) $this->addMessage($message);
         $this->_type = self::ERROR;
         $this->_response->setHeader('Content-Type', 'application/json')
                         ->setBody($this->json())
@@ -30,9 +30,9 @@ class StatusReporter implements IStatusReporter
         exit();
     }
     
-    public function success($message)
+    public function success($message = null)
     {
-        $this->_message = $message;
+        if($message) $this->addMessage($message);
         $this->_type = self::SUCCESS;
         $this->_response->setHeader('Content-Type', 'application/json')
                         ->setBody($this->json())
@@ -40,18 +40,27 @@ class StatusReporter implements IStatusReporter
         exit();
     }
     
+    public function addMessage($message)
+    {
+        $this->_messages[] = $message;;
+    }
+    
     //no need to exit here, exceptions stop the program.
     public static function exception(Exception $exception)
     {       
         //we'll be instatic context here so I have to do it this way.
         header('Content-Type: application/json');
-        echo json_encode(array(self::EXCEPTION => $exception->getMessage()));
+        echo json_encode(array(
+            'status' => self::EXCEPTION,
+            'messages' => array($exception->getMessage())));
     }
     
     public function json()
     {
         return json_encode(
-            array($this->_type => $this->_message)
+            array(
+                'status' => $this->_type,
+                'messages' => $this->_messages)
         );
     }
 }
index c1356ae..81a6413 100644 (file)
@@ -26,7 +26,7 @@ class UploadManager implements IUploadManager{
             foreach($_FILES as $file)
             {
                 $this->_files[] = $this->_fileFactory->createInstance(
-                    $file['name'],
+                utf8_encode($file['name']),
                     $file['type'],
                     $file['tmp_name'],
                     $file['size']
index 2fecc25..380a6c4 100644 (file)
@@ -3,6 +3,8 @@
 namespace Services;
 
 use Exception;
+use Domain\Exception\InvalidDifficultyException;
+use Domain\Exception\InvalidDanceModeException;
 use ZipArchive;
 use Services\ISimfileParser;
 use Services\IBannerExtracter;
@@ -11,6 +13,8 @@ use Domain\Entities\StepMania\ISimfileStepByStepBuilder;
 use Domain\Entities\StepMania\IPackStepByStepBuilder;
 use Services\IZipParser;
 use Services\IUserSession;
+use Services\IStatusReporter;
+use Services\InvalidSmFileException;
 
 class ZipParser implements IZipParser
 {
@@ -22,19 +26,22 @@ class ZipParser implements IZipParser
     private $_bannerExtracter;
     private $_userSession;
     private $_file;
+    private $_statusReporter;
     
     public function __construct(
         ISimfileParser $smParser,
         ISimfileStepByStepBuilder $smBuilder,
         IPackStepByStepBuilder $packBuilder,
         IBannerExtracter $bannerExtracter,
-        IUserSession $userSession
+        IUserSession $userSession,
+        IStatusReporter $statusReporter
     ) {
         $this->_smParser = $smParser;
         $this->_smBuilder = $smBuilder;
         $this->_packBuilder = $packBuilder;
         $this->_bannerExtracter = $bannerExtracter;
         $this->_userSession = $userSession;
+        $this->_statusReporter = $statusReporter;
     }
     
     public function parse(IFile $file)
@@ -99,7 +106,26 @@ class ZipParser implements IZipParser
         //or single, but to do that we simply check the number of found sm files. To overcome this
         //first populate the smFiles array with the raw sm data, then apply SmDataToSmClass on each
         //array element. This way the check is accurate and the array gets populated as expected.
-        $this->_smFiles = array_map(array($this, 'SmDataToSmClass'), $this->_smFiles);
+        foreach($this->_smFiles as $index => $data)
+        {
+            try
+            {
+                $this->_smFiles[$index] = $this->SmDataToSmClass($data);
+            } catch(Exception $e) {
+                //Exceptions we care about at this stage
+                if(!$e instanceof InvalidSmFileException && 
+                   !$e instanceof InvalidDanceModeException &&
+                   !$e instanceof InvalidDifficultyException)
+                {
+                    throw $e;
+                }
+
+                //Add to messages.
+                $this->_statusReporter->addMessage($e->getMessage() . ' in ' . $index);
+                unset($this->_smFiles[$index]);
+            }
+        }
+        //$this->_smFiles = array_map(array($this, 'SmDataToSmClass'), $this->_smFiles);
     }
     
     private function packNameFromFiles()
@@ -125,7 +151,7 @@ class ZipParser implements IZipParser
         $parser->parse($smData);
         $banner = $this->_bannerExtracter->extractSongBanner(realpath('../files/StepMania/' . $this->_file->getHash() . '.zip'), $parser->banner());
         $file = $this->isPack() ? null : $this->_file;
-        
+
         return $this->_smBuilder->With_Title($parser->title())
                                 ->With_Artist($parser->artist())
                                 ->With_Uploader($this->_userSession->getCurrentUser()) //obj