Implemented Cue Sheet splitter thread. Basic Cue Sheet import should work now, but only uncompressed Wave/PCM files are supported.

This commit is contained in:
LoRd_MuldeR 2011-05-15 01:45:27 +02:00
parent 564cad5047
commit 55b5393768
26 changed files with 1046 additions and 120 deletions

View File

@ -280,6 +280,7 @@ del "$(TargetDir)imageformats\q???d4.dll"
<ClCompile Include="src\PlaylistImporter.cpp" /> <ClCompile Include="src\PlaylistImporter.cpp" />
<ClCompile Include="src\Registry_Decoder.cpp" /> <ClCompile Include="src\Registry_Decoder.cpp" />
<ClCompile Include="src\ShellIntegration.cpp" /> <ClCompile Include="src\ShellIntegration.cpp" />
<ClCompile Include="src\Thread_CueSplitter.cpp" />
<ClCompile Include="src\Thread_DiskObserver.cpp" /> <ClCompile Include="src\Thread_DiskObserver.cpp" />
<ClCompile Include="src\Thread_FileAnalyzer.cpp" /> <ClCompile Include="src\Thread_FileAnalyzer.cpp" />
<ClCompile Include="src\Thread_Initialization.cpp" /> <ClCompile Include="src\Thread_Initialization.cpp" />
@ -314,6 +315,7 @@ del "$(TargetDir)imageformats\q???d4.dll"
<ClCompile Include="tmp\MOC_Model_Progress.cpp" /> <ClCompile Include="tmp\MOC_Model_Progress.cpp" />
<ClCompile Include="tmp\MOC_Registry_Decoder.cpp" /> <ClCompile Include="tmp\MOC_Registry_Decoder.cpp" />
<ClCompile Include="tmp\MOC_ShellIntegration.cpp" /> <ClCompile Include="tmp\MOC_ShellIntegration.cpp" />
<ClCompile Include="tmp\MOC_Thread_CueSplitter.cpp" />
<ClCompile Include="tmp\MOC_Thread_DiskObserver.cpp" /> <ClCompile Include="tmp\MOC_Thread_DiskObserver.cpp" />
<ClCompile Include="tmp\MOC_Thread_FileAnalyzer.cpp" /> <ClCompile Include="tmp\MOC_Thread_FileAnalyzer.cpp" />
<ClCompile Include="tmp\MOC_Thread_Initialization.cpp" /> <ClCompile Include="tmp\MOC_Thread_Initialization.cpp" />
@ -364,6 +366,17 @@ del "$(TargetDir)imageformats\q???d4.dll"
<Outputs Condition="'$(Configuration)|$(Platform)'=='Release_Static|Win32'">$(SolutionDir)tmp\MOC_%(Filename).cpp;%(Outputs)</Outputs> <Outputs Condition="'$(Configuration)|$(Platform)'=='Release_Static|Win32'">$(SolutionDir)tmp\MOC_%(Filename).cpp;%(Outputs)</Outputs>
<Outputs Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(SolutionDir)tmp\MOC_%(Filename).cpp;%(Outputs)</Outputs> <Outputs Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(SolutionDir)tmp\MOC_%(Filename).cpp;%(Outputs)</Outputs>
</CustomBuild> </CustomBuild>
<CustomBuild Include="src\Thread_CueSplitter.h">
<Command Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">"$(QTDIR)\bin\moc.exe" -o "$(SolutionDir)tmp\MOC_%(Filename).cpp" "%(FullPath)"</Command>
<Command Condition="'$(Configuration)|$(Platform)'=='Release_Static|Win32'">"$(QTDIR)\bin\moc.exe" -o "$(SolutionDir)tmp\MOC_%(Filename).cpp" "%(FullPath)"</Command>
<Command Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">"$(QTDIR)\bin\moc.exe" -o "$(SolutionDir)tmp\MOC_%(Filename).cpp" "%(FullPath)"</Command>
<Message Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">MOC "$(SolutionDir)tmp\MOC_%(Filename).cpp"</Message>
<Message Condition="'$(Configuration)|$(Platform)'=='Release_Static|Win32'">MOC "$(SolutionDir)tmp\MOC_%(Filename).cpp"</Message>
<Message Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">MOC "$(SolutionDir)tmp\MOC_%(Filename).cpp"</Message>
<Outputs Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(SolutionDir)tmp\MOC_%(Filename).cpp;%(Outputs)</Outputs>
<Outputs Condition="'$(Configuration)|$(Platform)'=='Release_Static|Win32'">$(SolutionDir)tmp\MOC_%(Filename).cpp;%(Outputs)</Outputs>
<Outputs Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(SolutionDir)tmp\MOC_%(Filename).cpp;%(Outputs)</Outputs>
</CustomBuild>
<ClInclude Include="tmp\UIC_CueSheetImport.h" /> <ClInclude Include="tmp\UIC_CueSheetImport.h" />
<ClInclude Include="tmp\UIC_DropBox.h" /> <ClInclude Include="tmp\UIC_DropBox.h" />
<ClInclude Include="tmp\UIC_LogViewDialog.h" /> <ClInclude Include="tmp\UIC_LogViewDialog.h" />

View File

@ -301,6 +301,12 @@
<ClCompile Include="tmp\MOC_Model_CueSheet.cpp"> <ClCompile Include="tmp\MOC_Model_CueSheet.cpp">
<Filter>Generated Files\MOC</Filter> <Filter>Generated Files\MOC</Filter>
</ClCompile> </ClCompile>
<ClCompile Include="src\Thread_CueSplitter.cpp">
<Filter>Source Files\Threads</Filter>
</ClCompile>
<ClCompile Include="tmp\MOC_Thread_CueSplitter.cpp">
<Filter>Generated Files\MOC</Filter>
</ClCompile>
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<ClInclude Include="src\Config.h"> <ClInclude Include="src\Config.h">
@ -569,6 +575,9 @@
<CustomBuild Include="src\Model_CueSheet.h"> <CustomBuild Include="src\Model_CueSheet.h">
<Filter>Header Files\Models</Filter> <Filter>Header Files\Models</Filter>
</CustomBuild> </CustomBuild>
<CustomBuild Include="src\Thread_CueSplitter.h">
<Filter>Header Files\Threads</Filter>
</CustomBuild>
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<None Include="res\MainIcon.ico" /> <None Include="res\MainIcon.ico" />

View File

@ -19,6 +19,7 @@ a:visited { color: #0000EE; }
<a name="4.02"></a>Changes between v4.01 and v4.02:<br><ul> <a name="4.02"></a>Changes between v4.01 and v4.02:<br><ul>
<li>Upgraded build environment to Microsoft Visual Studio 2010 <li>Upgraded build environment to Microsoft Visual Studio 2010
<li>Dropping support for Windows 2000 and for Windows XP RTM/SP1, Windows XP needs SP2 or SP3 now! <li>Dropping support for Windows 2000 and for Windows XP RTM/SP1, Windows XP needs SP2 or SP3 now!
<li>Added Cue Sheet import wizard, only uncompressed Wave/PCM files are suppported at the moment
<li>Added ATSC A/52 (AC-3) encoding support, based on Aften encoder v0.0.8+ (Git Master) <li>Added ATSC A/52 (AC-3) encoding support, based on Aften encoder v0.0.8+ (Git Master)
<li>Added one new translation: Korean <li>Added one new translation: Korean
<li>Added a method to use custom tools instead of the "built-in" ones (see <a href="FAQ.html#3d6684e9" target="_blank">FAQ doc</a> for details) <li>Added a method to use custom tools instead of the "built-in" ones (see <a href="FAQ.html#3d6684e9" target="_blank">FAQ doc</a> for details)

View File

@ -257,18 +257,6 @@
<source>An unknown error has occured!</source> <source>An unknown error has occured!</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
<message>
<source>The file could not be opened for reading!</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>The file does not look like a valid Cue Sheet disc image file!</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Could not find a supported audio track in the Cue Sheet!</source>
<translation type="unfinished"></translation>
</message>
<message> <message>
<source>Failed to load the Cue Sheet file:</source> <source>Failed to load the Cue Sheet file:</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
@ -277,6 +265,62 @@
<source>Cue Sheet Error</source> <source>Cue Sheet Error</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
<message>
<source>The specified file could not be found!</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>The file could not be opened for reading. Make sure you have the required rights!</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>The provided file does not look like a valid Cue Sheet disc image file!</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Could not find any supported audio track in the Cue Sheet image!</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Note that LameXP can not handle &quot;binary&quot; Cue Sheet images.</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>The selected Cue Sheet file contains inconsistent information. Take care!</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Choose Output Directory</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>LameXP</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Error: The selected output directory is not writable!</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Low Diskspace Warning</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>There are less than %1 GB of free diskspace available in the selected output directory.</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>It is highly recommend to free up more diskspace before proceeding with the import!</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Analyzing file(s), please wait...</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Splitting file(s), please wait...</source>
<translation type="unfinished"></translation>
</message>
</context> </context>
<context> <context>
<name>CueSheetImport</name> <name>CueSheetImport</name>
@ -296,6 +340,14 @@
<source>Discard</source> <source>Discard</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
<message>
<source>Existing Source File</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Missing Source File (Tracks will be skipped!)</source>
<translation type="unfinished"></translation>
</message>
</context> </context>
<context> <context>
<name>CueSheetModel</name> <name>CueSheetModel</name>
@ -327,6 +379,10 @@
<source>Unknown Title</source> <source>Unknown Title</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
<message>
<source>Duration</source>
<translation type="unfinished"></translation>
</message>
</context> </context>
<context> <context>
<name>DecoderRegistry</name> <name>DecoderRegistry</name>

View File

@ -257,18 +257,6 @@
<source>An unknown error has occured!</source> <source>An unknown error has occured!</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
<message>
<source>The file could not be opened for reading!</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>The file does not look like a valid Cue Sheet disc image file!</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Could not find a supported audio track in the Cue Sheet!</source>
<translation type="unfinished"></translation>
</message>
<message> <message>
<source>Failed to load the Cue Sheet file:</source> <source>Failed to load the Cue Sheet file:</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
@ -277,6 +265,62 @@
<source>Cue Sheet Error</source> <source>Cue Sheet Error</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
<message>
<source>The specified file could not be found!</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>The file could not be opened for reading. Make sure you have the required rights!</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>The provided file does not look like a valid Cue Sheet disc image file!</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Could not find any supported audio track in the Cue Sheet image!</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Note that LameXP can not handle &quot;binary&quot; Cue Sheet images.</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>The selected Cue Sheet file contains inconsistent information. Take care!</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Choose Output Directory</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>LameXP</source>
<translation type="unfinished">LameXP</translation>
</message>
<message>
<source>Error: The selected output directory is not writable!</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Low Diskspace Warning</source>
<translation type="unfinished">Warnung: Wenig freier Festplattenspeicher</translation>
</message>
<message>
<source>There are less than %1 GB of free diskspace available in the selected output directory.</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>It is highly recommend to free up more diskspace before proceeding with the import!</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Analyzing file(s), please wait...</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Splitting file(s), please wait...</source>
<translation type="unfinished"></translation>
</message>
</context> </context>
<context> <context>
<name>CueSheetImport</name> <name>CueSheetImport</name>
@ -296,6 +340,14 @@
<source>Discard</source> <source>Discard</source>
<translation type="unfinished">Schließen</translation> <translation type="unfinished">Schließen</translation>
</message> </message>
<message>
<source>Existing Source File</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Missing Source File (Tracks will be skipped!)</source>
<translation type="unfinished"></translation>
</message>
</context> </context>
<context> <context>
<name>CueSheetModel</name> <name>CueSheetModel</name>
@ -327,6 +379,10 @@
<source>Unknown Title</source> <source>Unknown Title</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
<message>
<source>Duration</source>
<translation type="unfinished">Dauer</translation>
</message>
</context> </context>
<context> <context>
<name>DecoderRegistry</name> <name>DecoderRegistry</name>

View File

@ -257,18 +257,6 @@
<source>An unknown error has occured!</source> <source>An unknown error has occured!</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
<message>
<source>The file could not be opened for reading!</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>The file does not look like a valid Cue Sheet disc image file!</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Could not find a supported audio track in the Cue Sheet!</source>
<translation type="unfinished"></translation>
</message>
<message> <message>
<source>Failed to load the Cue Sheet file:</source> <source>Failed to load the Cue Sheet file:</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
@ -277,6 +265,62 @@
<source>Cue Sheet Error</source> <source>Cue Sheet Error</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
<message>
<source>The specified file could not be found!</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>The file could not be opened for reading. Make sure you have the required rights!</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>The provided file does not look like a valid Cue Sheet disc image file!</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Could not find any supported audio track in the Cue Sheet image!</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Note that LameXP can not handle &quot;binary&quot; Cue Sheet images.</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>The selected Cue Sheet file contains inconsistent information. Take care!</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Choose Output Directory</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>LameXP</source>
<translation type="unfinished">LameXP</translation>
</message>
<message>
<source>Error: The selected output directory is not writable!</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Low Diskspace Warning</source>
<translation type="unfinished">Alerta de poco espacio en disco</translation>
</message>
<message>
<source>There are less than %1 GB of free diskspace available in the selected output directory.</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>It is highly recommend to free up more diskspace before proceeding with the import!</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Analyzing file(s), please wait...</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Splitting file(s), please wait...</source>
<translation type="unfinished"></translation>
</message>
</context> </context>
<context> <context>
<name>CueSheetImport</name> <name>CueSheetImport</name>
@ -296,6 +340,14 @@
<source>Discard</source> <source>Discard</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
<message>
<source>Existing Source File</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Missing Source File (Tracks will be skipped!)</source>
<translation type="unfinished"></translation>
</message>
</context> </context>
<context> <context>
<name>CueSheetModel</name> <name>CueSheetModel</name>
@ -327,6 +379,10 @@
<source>Unknown Title</source> <source>Unknown Title</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
<message>
<source>Duration</source>
<translation type="unfinished">Duración</translation>
</message>
</context> </context>
<context> <context>
<name>DecoderRegistry</name> <name>DecoderRegistry</name>

View File

@ -261,18 +261,6 @@
<source>An unknown error has occured!</source> <source>An unknown error has occured!</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
<message>
<source>The file could not be opened for reading!</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>The file does not look like a valid Cue Sheet disc image file!</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Could not find a supported audio track in the Cue Sheet!</source>
<translation type="unfinished"></translation>
</message>
<message> <message>
<source>Failed to load the Cue Sheet file:</source> <source>Failed to load the Cue Sheet file:</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
@ -281,6 +269,62 @@
<source>Cue Sheet Error</source> <source>Cue Sheet Error</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
<message>
<source>The specified file could not be found!</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>The file could not be opened for reading. Make sure you have the required rights!</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>The provided file does not look like a valid Cue Sheet disc image file!</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Could not find any supported audio track in the Cue Sheet image!</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Note that LameXP can not handle &quot;binary&quot; Cue Sheet images.</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>The selected Cue Sheet file contains inconsistent information. Take care!</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Choose Output Directory</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>LameXP</source>
<translation type="unfinished">LameXP</translation>
</message>
<message>
<source>Error: The selected output directory is not writable!</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Low Diskspace Warning</source>
<translation type="unfinished">Avertissement d&apos;espace disque faible</translation>
</message>
<message>
<source>There are less than %1 GB of free diskspace available in the selected output directory.</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>It is highly recommend to free up more diskspace before proceeding with the import!</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Analyzing file(s), please wait...</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Splitting file(s), please wait...</source>
<translation type="unfinished"></translation>
</message>
</context> </context>
<context> <context>
<name>CueSheetImport</name> <name>CueSheetImport</name>
@ -300,6 +344,14 @@
<source>Discard</source> <source>Discard</source>
<translation type="unfinished">Abandonner</translation> <translation type="unfinished">Abandonner</translation>
</message> </message>
<message>
<source>Existing Source File</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Missing Source File (Tracks will be skipped!)</source>
<translation type="unfinished"></translation>
</message>
</context> </context>
<context> <context>
<name>CueSheetModel</name> <name>CueSheetModel</name>
@ -331,6 +383,10 @@
<source>Unknown Title</source> <source>Unknown Title</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
<message>
<source>Duration</source>
<translation type="unfinished">Durée</translation>
</message>
</context> </context>
<context> <context>
<name>DecoderRegistry</name> <name>DecoderRegistry</name>

View File

@ -257,18 +257,6 @@
<source>An unknown error has occured!</source> <source>An unknown error has occured!</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
<message>
<source>The file could not be opened for reading!</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>The file does not look like a valid Cue Sheet disc image file!</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Could not find a supported audio track in the Cue Sheet!</source>
<translation type="unfinished"></translation>
</message>
<message> <message>
<source>Failed to load the Cue Sheet file:</source> <source>Failed to load the Cue Sheet file:</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
@ -277,6 +265,62 @@
<source>Cue Sheet Error</source> <source>Cue Sheet Error</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
<message>
<source>The specified file could not be found!</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>The file could not be opened for reading. Make sure you have the required rights!</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>The provided file does not look like a valid Cue Sheet disc image file!</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Could not find any supported audio track in the Cue Sheet image!</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Note that LameXP can not handle &quot;binary&quot; Cue Sheet images.</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>The selected Cue Sheet file contains inconsistent information. Take care!</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Choose Output Directory</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>LameXP</source>
<translation type="unfinished">LameXP</translation>
</message>
<message>
<source>Error: The selected output directory is not writable!</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Low Diskspace Warning</source>
<translation type="unfinished">Attenzione: Poco spazio su disco</translation>
</message>
<message>
<source>There are less than %1 GB of free diskspace available in the selected output directory.</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>It is highly recommend to free up more diskspace before proceeding with the import!</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Analyzing file(s), please wait...</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Splitting file(s), please wait...</source>
<translation type="unfinished"></translation>
</message>
</context> </context>
<context> <context>
<name>CueSheetImport</name> <name>CueSheetImport</name>
@ -296,6 +340,14 @@
<source>Discard</source> <source>Discard</source>
<translation type="unfinished">Annulla</translation> <translation type="unfinished">Annulla</translation>
</message> </message>
<message>
<source>Existing Source File</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Missing Source File (Tracks will be skipped!)</source>
<translation type="unfinished"></translation>
</message>
</context> </context>
<context> <context>
<name>CueSheetModel</name> <name>CueSheetModel</name>
@ -327,6 +379,10 @@
<source>Unknown Title</source> <source>Unknown Title</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
<message>
<source>Duration</source>
<translation type="unfinished">Durata</translation>
</message>
</context> </context>
<context> <context>
<name>DecoderRegistry</name> <name>DecoderRegistry</name>

View File

@ -257,18 +257,6 @@
<source>An unknown error has occured!</source> <source>An unknown error has occured!</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
<message>
<source>The file could not be opened for reading!</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>The file does not look like a valid Cue Sheet disc image file!</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Could not find a supported audio track in the Cue Sheet!</source>
<translation type="unfinished"></translation>
</message>
<message> <message>
<source>Failed to load the Cue Sheet file:</source> <source>Failed to load the Cue Sheet file:</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
@ -277,6 +265,62 @@
<source>Cue Sheet Error</source> <source>Cue Sheet Error</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
<message>
<source>The specified file could not be found!</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>The file could not be opened for reading. Make sure you have the required rights!</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>The provided file does not look like a valid Cue Sheet disc image file!</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Could not find any supported audio track in the Cue Sheet image!</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Note that LameXP can not handle &quot;binary&quot; Cue Sheet images.</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>The selected Cue Sheet file contains inconsistent information. Take care!</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Choose Output Directory</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>LameXP</source>
<translation type="unfinished">LameXP</translation>
</message>
<message>
<source>Error: The selected output directory is not writable!</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Low Diskspace Warning</source>
<translation type="unfinished"> </translation>
</message>
<message>
<source>There are less than %1 GB of free diskspace available in the selected output directory.</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>It is highly recommend to free up more diskspace before proceeding with the import!</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Analyzing file(s), please wait...</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Splitting file(s), please wait...</source>
<translation type="unfinished"></translation>
</message>
</context> </context>
<context> <context>
<name>CueSheetImport</name> <name>CueSheetImport</name>
@ -296,6 +340,14 @@
<source>Discard</source> <source>Discard</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
<message>
<source>Existing Source File</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Missing Source File (Tracks will be skipped!)</source>
<translation type="unfinished"></translation>
</message>
</context> </context>
<context> <context>
<name>CueSheetModel</name> <name>CueSheetModel</name>
@ -327,6 +379,10 @@
<source>Unknown Title</source> <source>Unknown Title</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
<message>
<source>Duration</source>
<translation type="unfinished"></translation>
</message>
</context> </context>
<context> <context>
<name>DecoderRegistry</name> <name>DecoderRegistry</name>

View File

@ -257,18 +257,6 @@
<source>An unknown error has occured!</source> <source>An unknown error has occured!</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
<message>
<source>The file could not be opened for reading!</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>The file does not look like a valid Cue Sheet disc image file!</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Could not find a supported audio track in the Cue Sheet!</source>
<translation type="unfinished"></translation>
</message>
<message> <message>
<source>Failed to load the Cue Sheet file:</source> <source>Failed to load the Cue Sheet file:</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
@ -277,6 +265,62 @@
<source>Cue Sheet Error</source> <source>Cue Sheet Error</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
<message>
<source>The specified file could not be found!</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>The file could not be opened for reading. Make sure you have the required rights!</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>The provided file does not look like a valid Cue Sheet disc image file!</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Could not find any supported audio track in the Cue Sheet image!</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Note that LameXP can not handle &quot;binary&quot; Cue Sheet images.</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>The selected Cue Sheet file contains inconsistent information. Take care!</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Choose Output Directory</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>LameXP</source>
<translation type="unfinished">LameXP</translation>
</message>
<message>
<source>Error: The selected output directory is not writable!</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Low Diskspace Warning</source>
<translation type="unfinished">Предупреждение: Мало свободного места на диске</translation>
</message>
<message>
<source>There are less than %1 GB of free diskspace available in the selected output directory.</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>It is highly recommend to free up more diskspace before proceeding with the import!</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Analyzing file(s), please wait...</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Splitting file(s), please wait...</source>
<translation type="unfinished"></translation>
</message>
</context> </context>
<context> <context>
<name>CueSheetImport</name> <name>CueSheetImport</name>
@ -296,6 +340,14 @@
<source>Discard</source> <source>Discard</source>
<translation type="unfinished">Отменить</translation> <translation type="unfinished">Отменить</translation>
</message> </message>
<message>
<source>Existing Source File</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Missing Source File (Tracks will be skipped!)</source>
<translation type="unfinished"></translation>
</message>
</context> </context>
<context> <context>
<name>CueSheetModel</name> <name>CueSheetModel</name>
@ -327,6 +379,10 @@
<source>Unknown Title</source> <source>Unknown Title</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
<message>
<source>Duration</source>
<translation type="unfinished">Длителность</translation>
</message>
</context> </context>
<context> <context>
<name>DecoderRegistry</name> <name>DecoderRegistry</name>

View File

@ -257,18 +257,6 @@
<source>An unknown error has occured!</source> <source>An unknown error has occured!</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
<message>
<source>The file could not be opened for reading!</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>The file does not look like a valid Cue Sheet disc image file!</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Could not find a supported audio track in the Cue Sheet!</source>
<translation type="unfinished"></translation>
</message>
<message> <message>
<source>Failed to load the Cue Sheet file:</source> <source>Failed to load the Cue Sheet file:</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
@ -277,6 +265,62 @@
<source>Cue Sheet Error</source> <source>Cue Sheet Error</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
<message>
<source>The specified file could not be found!</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>The file could not be opened for reading. Make sure you have the required rights!</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>The provided file does not look like a valid Cue Sheet disc image file!</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Could not find any supported audio track in the Cue Sheet image!</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Note that LameXP can not handle &quot;binary&quot; Cue Sheet images.</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>The selected Cue Sheet file contains inconsistent information. Take care!</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Choose Output Directory</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>LameXP</source>
<translation type="unfinished">LameXP</translation>
</message>
<message>
<source>Error: The selected output directory is not writable!</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Low Diskspace Warning</source>
<translation type="unfinished">Попередження про те, що недостатньо місця на диску</translation>
</message>
<message>
<source>There are less than %1 GB of free diskspace available in the selected output directory.</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>It is highly recommend to free up more diskspace before proceeding with the import!</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Analyzing file(s), please wait...</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Splitting file(s), please wait...</source>
<translation type="unfinished"></translation>
</message>
</context> </context>
<context> <context>
<name>CueSheetImport</name> <name>CueSheetImport</name>
@ -296,6 +340,14 @@
<source>Discard</source> <source>Discard</source>
<translation type="unfinished">Відмінити</translation> <translation type="unfinished">Відмінити</translation>
</message> </message>
<message>
<source>Existing Source File</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Missing Source File (Tracks will be skipped!)</source>
<translation type="unfinished"></translation>
</message>
</context> </context>
<context> <context>
<name>CueSheetModel</name> <name>CueSheetModel</name>
@ -327,6 +379,10 @@
<source>Unknown Title</source> <source>Unknown Title</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
<message>
<source>Duration</source>
<translation type="unfinished">Тривалість</translation>
</message>
</context> </context>
<context> <context>
<name>DecoderRegistry</name> <name>DecoderRegistry</name>

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@ -29,8 +29,8 @@
#define VER_LAMEXP_MINOR_HI 0 #define VER_LAMEXP_MINOR_HI 0
#define VER_LAMEXP_MINOR_LO 2 #define VER_LAMEXP_MINOR_LO 2
#define VER_LAMEXP_TYPE Alpha #define VER_LAMEXP_TYPE Alpha
#define VER_LAMEXP_PATCH 14 #define VER_LAMEXP_PATCH 15
#define VER_LAMEXP_BUILD 515 #define VER_LAMEXP_BUILD 520
/////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////
// Tools versions // Tools versions

View File

@ -24,8 +24,11 @@
#include "Global.h" #include "Global.h"
#include "Model_CueSheet.h" #include "Model_CueSheet.h"
#include "Model_AudioFile.h" #include "Model_AudioFile.h"
#include "Model_FileList.h"
#include "Dialog_WorkingBanner.h" #include "Dialog_WorkingBanner.h"
#include "Thread_FileAnalyzer.h" #include "Thread_FileAnalyzer.h"
#include "Thread_CueSplitter.h"
#include "LockedFile.h"
#include <QFileInfo> #include <QFileInfo>
#include <QMessageBox> #include <QMessageBox>
@ -40,9 +43,11 @@
// Constructor & Destructor // Constructor & Destructor
//////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////
CueImportDialog::CueImportDialog(QWidget *parent) CueImportDialog::CueImportDialog(QWidget *parent, FileListModel *fileList, const QString &cueFile)
: :
QDialog(parent) QDialog(parent),
m_cueFileName(cueFile),
m_fileList(fileList)
{ {
//Init the dialog, from the .ui file //Init the dialog, from the .ui file
setupUi(this); setupUi(this);
@ -90,26 +95,33 @@ void CueImportDialog::showEvent(QShowEvent *event)
// Slots // Slots
//////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////
int CueImportDialog::exec(const QString &cueFile) int CueImportDialog::exec(void)
{ {
WorkingBanner *progress = new WorkingBanner(dynamic_cast<QWidget*>(parent())); WorkingBanner *progress = new WorkingBanner(dynamic_cast<QWidget*>(parent()));
progress->show(tr("Loading Cue Sheet file, please be patient...")); progress->show(tr("Loading Cue Sheet file, please be patient..."));
QFileInfo cueFileInfo(cueFile); QFileInfo cueFileInfo(m_cueFileName);
m_outputDir = QFileInfo(cueFile).canonicalPath(); QDir outputDir(cueFileInfo.canonicalPath());
m_outputDir = outputDir.canonicalPath();
setWindowTitle(QString("%1: %2").arg(windowTitle().split(":", QString::SkipEmptyParts).first().trimmed(), cueFileInfo.fileName())); setWindowTitle(QString("%1: %2").arg(windowTitle().split(":", QString::SkipEmptyParts).first().trimmed(), cueFileInfo.fileName()));
if(!cueFileInfo.exists() || !cueFileInfo.isFile() || m_outputDir.isEmpty()) if(!cueFileInfo.exists() || !cueFileInfo.isFile() || m_outputDir.isEmpty())
{ {
QString text = QString("<nobr>%1</nobr><br><nobr>%2</nobr><br><br><nobr>%3</nobr>").arg(tr("Failed to load the Cue Sheet file:"), QDir::toNativeSeparators(cueFile), tr("The specified file could not be found!")).replace("-", "&minus;"); QString text = QString("<nobr>%1</nobr><br><nobr>%2</nobr><br><br><nobr>%3</nobr>").arg(tr("Failed to load the Cue Sheet file:"), QDir::toNativeSeparators(m_cueFileName), tr("The specified file could not be found!")).replace("-", "&minus;");
QMessageBox::warning(progress, tr("Cue Sheet Error"), text); QMessageBox::warning(progress, tr("Cue Sheet Error"), text);
progress->close(); progress->close();
LAMEXP_DELETE(progress); LAMEXP_DELETE(progress);
return CueSheetModel::ErrorIOFailure; return CueSheetModel::ErrorIOFailure;
} }
int iResult = m_model->loadCueSheet(cueFile, QApplication::instance()); outputDir.mkdir(cueFileInfo.completeBaseName());
if(outputDir.cd(cueFileInfo.completeBaseName()))
{
m_outputDir = outputDir.canonicalPath();
}
int iResult = m_model->loadCueSheet(m_cueFileName, QApplication::instance());
if(iResult != CueSheetModel::ErrorSuccess) if(iResult != CueSheetModel::ErrorSuccess)
{ {
QString errorMsg = tr("An unknown error has occured!"); QString errorMsg = tr("An unknown error has occured!");
@ -130,7 +142,7 @@ int CueImportDialog::exec(const QString &cueFile)
break; break;
} }
QString text = QString("<nobr>%1</nobr><br><nobr>%2</nobr><br><br><nobr>%3</nobr>").arg(tr("Failed to load the Cue Sheet file:"), QDir::toNativeSeparators(cueFile), errorMsg).replace("-", "&minus;"); QString text = QString("<nobr>%1</nobr><br><nobr>%2</nobr><br><br><nobr>%3</nobr>").arg(tr("Failed to load the Cue Sheet file:"), QDir::toNativeSeparators(m_cueFileName), errorMsg).replace("-", "&minus;");
QMessageBox::warning(progress, tr("Cue Sheet Error"), text); QMessageBox::warning(progress, tr("Cue Sheet Error"), text);
progress->close(); progress->close();
LAMEXP_DELETE(progress); LAMEXP_DELETE(progress);
@ -184,31 +196,51 @@ void CueImportDialog::importButtonClicked(void)
} }
importCueSheet(); importCueSheet();
accept();
} }
void CueImportDialog::analyzedFile(const AudioFileModel &file) void CueImportDialog::analyzedFile(const AudioFileModel &file)
{ {
qWarning("Received results for: %s", file.filePath().toLatin1().constData()); qDebug("Received result: <%s> <%s/%s>", file.filePath().toLatin1().constData(), file.formatContainerType().toLatin1().constData(), file.formatAudioType().toLatin1().constData());
m_fileInfo.insert(file.filePath(), file); m_fileInfo << file;
} }
//////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////
// Private FUnctions // Private Functions
//////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////
void CueImportDialog::importCueSheet(void) void CueImportDialog::importCueSheet(void)
{ {
QStringList files; QStringList files;
int nFiles = m_model->getFileCount();
//Fetch all files that are referenced in the Cue Sheet //Fetch all files that are referenced in the Cue Sheet and lock them
int nFiles = m_model->getFileCount();
for(int i = 0; i < nFiles; i++) for(int i = 0; i < nFiles; i++)
{ {
files << m_model->getFileName(i); QString temp = m_model->getFileName(i);
try
{
m_locks << new LockedFile(temp);
}
catch(char *err)
{
qWarning("Failed to lock file: %s", err);
continue;
}
files << temp;
} }
//Analyze all source files //Analyze all source files
analyzeFiles(files); analyzeFiles(files);
//Now split files according to Cue Sheet
splitFiles();
//Release locks
while(!m_locks.isEmpty())
{
delete m_locks.takeFirst();
}
} }
void CueImportDialog::analyzeFiles(QStringList &files) void CueImportDialog::analyzeFiles(QStringList &files)
@ -217,10 +249,54 @@ void CueImportDialog::analyzeFiles(QStringList &files)
WorkingBanner *progress = new WorkingBanner(dynamic_cast<QWidget*>(parent())); WorkingBanner *progress = new WorkingBanner(dynamic_cast<QWidget*>(parent()));
FileAnalyzer *analyzer = new FileAnalyzer(files); FileAnalyzer *analyzer = new FileAnalyzer(files);
connect(analyzer, SIGNAL(fileSelected(QString)), progress, SLOT(setText(QString)), Qt::QueuedConnection); connect(analyzer, SIGNAL(fileSelected(QString)), progress, SLOT(setText(QString)), Qt::QueuedConnection);
connect(analyzer, SIGNAL(fileAnalyzed(AudioFileModel)), this, SLOT(analyzedFile(AudioFileModel)), Qt::QueuedConnection); connect(analyzer, SIGNAL(fileAnalyzed(AudioFileModel)), this, SLOT(analyzedFile(AudioFileModel)), Qt::QueuedConnection);
progress->show(tr("Adding file(s), please wait..."), analyzer); progress->show(tr("Analyzing file(s), please wait..."), analyzer);
progress->close(); progress->close();
LAMEXP_DELETE(progress); LAMEXP_DELETE(progress);
} }
void CueImportDialog::splitFiles(void)
{
WorkingBanner *progress = new WorkingBanner(this);
CueSplitter *splitter = new CueSplitter(m_outputDir, QFileInfo(m_cueFileName).completeBaseName().replace(".", " ").left(42).trimmed(), m_fileInfo);
connect(splitter, SIGNAL(fileSelected(QString)), progress, SLOT(setText(QString)), Qt::QueuedConnection);
connect(splitter, SIGNAL(fileSplit(AudioFileModel)), m_fileList, SLOT(addFile(AudioFileModel)), Qt::QueuedConnection);
int nFiles = m_model->getFileCount();
for(int i = 0; i < nFiles; i++)
{
QString currentFileName = m_model->getFileName(i);
int nTracks = m_model->getTrackCount(i);
for(int j = 0; j < nTracks; j++)
{
int trackNo = m_model->getTrackNo(i, j);
double startIndex = std::numeric_limits<double>::quiet_NaN();
double duration = std::numeric_limits<double>::quiet_NaN();
m_model->getTrackIndex(i, j, &startIndex, &duration);
AudioFileModel metaInfo(QString().sprintf("cue://File%02d/Track%02d", i, j));
metaInfo.setFileName(m_model->getTrackTitle(i, j));
metaInfo.setFileArtist(m_model->getTrackPerformer(i, j));
try
{
splitter->addTrack(trackNo, currentFileName, startIndex, duration, metaInfo);
}
catch(char *err)
{
qWarning("Failed to add track #%02d: %s", trackNo, err);
}
}
}
progress->show(tr("Splitting file(s), please wait..."), splitter);
progress->close();
LAMEXP_DELETE(splitter);
LAMEXP_DELETE(progress);
}

View File

@ -27,16 +27,18 @@
#include "Model_AudioFile.h" #include "Model_AudioFile.h"
class CueSheetModel; class CueSheetModel;
class LockedFile;
class FileListModel;
class CueImportDialog : public QDialog, private Ui::CueSheetImport class CueImportDialog : public QDialog, private Ui::CueSheetImport
{ {
Q_OBJECT Q_OBJECT
public: public:
CueImportDialog(QWidget *parent); CueImportDialog(QWidget *parent, FileListModel *fileList, const QString &cueFile);
~CueImportDialog(void); ~CueImportDialog(void);
int exec(const QString &cueFile); int exec(void);
protected: protected:
void CueImportDialog::showEvent(QShowEvent *event); void CueImportDialog::showEvent(QShowEvent *event);
@ -50,8 +52,13 @@ private slots:
private: private:
void importCueSheet(void); void importCueSheet(void);
void analyzeFiles(QStringList &files); void analyzeFiles(QStringList &files);
void CueImportDialog::splitFiles(void);
CueSheetModel *m_model; CueSheetModel *m_model;
QMap<QString, AudioFileModel> m_fileInfo; FileListModel *m_fileList;
QList<LockedFile*> m_locks;
QList<AudioFileModel> m_fileInfo;
QString m_cueFileName;
QString m_outputDir; QString m_outputDir;
}; };

View File

@ -2571,8 +2571,8 @@ void MainWindow::importCueSheetActionTriggered(bool checked)
QString selectedCueFile = QFileDialog::getOpenFileName(this, tr("Open Cue Sheet"), QString(), QString("%1 (*.cue)").arg(tr("Cue Sheet File"))); QString selectedCueFile = QFileDialog::getOpenFileName(this, tr("Open Cue Sheet"), QString(), QString("%1 (*.cue)").arg(tr("Cue Sheet File")));
if(!selectedCueFile.isEmpty()) if(!selectedCueFile.isEmpty())
{ {
CueImportDialog *cueImporter = new CueImportDialog(this); CueImportDialog *cueImporter = new CueImportDialog(this, m_fileListModel, selectedCueFile);
cueImporter->exec(selectedCueFile); cueImporter->exec();
LAMEXP_DELETE(cueImporter); LAMEXP_DELETE(cueImporter);
} }
) )

View File

@ -346,6 +346,20 @@ int CueSheetModel::getTrackCount(int fileIndex)
return m_files.at(fileIndex)->trackCount(); return m_files.at(fileIndex)->trackCount();
} }
int CueSheetModel::getTrackNo(int fileIndex, int trackIndex)
{
if(fileIndex >= 0 && fileIndex < m_files.count())
{
CueSheetFile *currentFile = m_files.at(fileIndex);
if(trackIndex >= 0 && trackIndex < currentFile->trackCount())
{
return currentFile->track(trackIndex)->trackNo();
}
}
return -1;
}
void CueSheetModel::getTrackIndex(int fileIndex, int trackIndex, double *startIndex, double *duration) void CueSheetModel::getTrackIndex(int fileIndex, int trackIndex, double *startIndex, double *duration)
{ {
*startIndex = std::numeric_limits<double>::quiet_NaN(); *startIndex = std::numeric_limits<double>::quiet_NaN();
@ -363,6 +377,34 @@ void CueSheetModel::getTrackIndex(int fileIndex, int trackIndex, double *startIn
} }
} }
QString CueSheetModel::getTrackPerformer(int fileIndex, int trackIndex)
{
if(fileIndex >= 0 && fileIndex < m_files.count())
{
CueSheetFile *currentFile = m_files.at(fileIndex);
if(trackIndex >= 0 && trackIndex < currentFile->trackCount())
{
CueSheetTrack *currentTrack = currentFile->track(trackIndex);
return currentTrack->performer();
}
}
return QString();
}
QString CueSheetModel::getTrackTitle(int fileIndex, int trackIndex)
{
if(fileIndex >= 0 && fileIndex < m_files.count())
{
CueSheetFile *currentFile = m_files.at(fileIndex);
if(trackIndex >= 0 && trackIndex < currentFile->trackCount())
{
CueSheetTrack *currentTrack = currentFile->track(trackIndex);
return currentTrack->title();
}
}
return QString();
}
//////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////
// Cue Sheet Parser // Cue Sheet Parser
//////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////
@ -624,6 +666,7 @@ int CueSheetModel::parseCueFile(QFile &cueFile, const QDir &baseDir, QCoreApplic
//Sanity check of track numbers //Sanity check of track numbers
if(nFiles > 0) if(nFiles > 0)
{ {
int previousTrackNo = -1;
bool trackNo[100]; bool trackNo[100];
for(int i = 0; i < 100; i++) for(int i = 0; i < 100; i++)
{ {
@ -640,7 +683,7 @@ int CueSheetModel::parseCueFile(QFile &cueFile, const QDir &baseDir, QCoreApplic
int nTracks = currentFile->trackCount(); int nTracks = currentFile->trackCount();
if(nTracks > 1) if(nTracks > 1)
{ {
for(int j = 1; j < nTracks; j++) for(int j = 0; j < nTracks; j++)
{ {
int currentTrackNo = currentFile->track(j)->trackNo(); int currentTrackNo = currentFile->track(j)->trackNo();
if(currentTrackNo > 99) if(currentTrackNo > 99)
@ -648,12 +691,18 @@ int CueSheetModel::parseCueFile(QFile &cueFile, const QDir &baseDir, QCoreApplic
qWarning("Track #%02d is invalid (maximum is 99), Cue Sheet is inconsistent!", currentTrackNo); qWarning("Track #%02d is invalid (maximum is 99), Cue Sheet is inconsistent!", currentTrackNo);
return ErrorInconsistent; return ErrorInconsistent;
} }
if(currentTrackNo <= previousTrackNo)
{
qWarning("Non-increasing track numbers, Cue Sheet is inconsistent!", currentTrackNo);
return ErrorInconsistent;
}
if(trackNo[currentTrackNo]) if(trackNo[currentTrackNo])
{ {
qWarning("Track #%02d exists multiple times, Cue Sheet is inconsistent!", currentTrackNo); qWarning("Track #%02d exists multiple times, Cue Sheet is inconsistent!", currentTrackNo);
return ErrorInconsistent; return ErrorInconsistent;
} }
trackNo[currentTrackNo] = true; trackNo[currentTrackNo] = true;
previousTrackNo = currentTrackNo;
} }
} }
} }

View File

@ -61,7 +61,10 @@ public:
int CueSheetModel::getFileCount(void); int CueSheetModel::getFileCount(void);
QString getFileName(int fileIndex); QString getFileName(int fileIndex);
int getTrackCount(int fileIndex); int getTrackCount(int fileIndex);
int getTrackNo(int fileIndex, int trackIndex);
void getTrackIndex(int fileIndex, int trackIndex, double *startIndex, double *duration); void getTrackIndex(int fileIndex, int trackIndex, double *startIndex, double *duration);
QString getTrackPerformer(int fileIndex, int trackIndex);
QString getTrackTitle(int fileIndex, int trackIndex);
//Cue Sheet functions //Cue Sheet functions
int loadCueSheet(const QString &cueFile, QCoreApplication *application = NULL); int loadCueSheet(const QString &cueFile, QCoreApplication *application = NULL);

253
src/Thread_CueSplitter.cpp Normal file
View File

@ -0,0 +1,253 @@
///////////////////////////////////////////////////////////////////////////////
// LameXP - Audio Encoder Front-End
// Copyright (C) 2004-2011 LoRd_MuldeR <MuldeR2@GMX.de>
//
// This program is free software; you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation; either version 2 of the License, or
// (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License along
// with this program; if not, write to the Free Software Foundation, Inc.,
// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
//
// http://www.gnu.org/licenses/gpl-2.0.txt
///////////////////////////////////////////////////////////////////////////////
#include "Thread_CueSplitter.h"
#include "Global.h"
#include "LockedFile.h"
#include "Model_AudioFile.h"
#include "PlaylistImporter.h"
#include <QDir>
#include <QFileInfo>
#include <QProcess>
#include <QDate>
#include <QTime>
#include <QDebug>
#include <math.h>
////////////////////////////////////////////////////////////
// Constructor
////////////////////////////////////////////////////////////
CueSplitter::CueSplitter(const QString &outputDir, const QString &baseName, const QList<AudioFileModel> &inputFiles)
:
m_outputDir(outputDir),
m_baseName(baseName),
m_soxBin(lamexp_lookup_tool("sox.exe"))
{
if(m_soxBin.isEmpty())
{
qFatal("Invalid path to SoX binary. Tool not initialized properly.");
}
qDebug("\n[CueSplitter::CueSplitter]");
int nInputFiles = inputFiles.count();
for(int i = 0; i < nInputFiles; i++)
{
m_inputFiles.insert(inputFiles[i].filePath(), inputFiles[i]);
qDebug("%02d <%s>", i, inputFiles[i].filePath());
}
qDebug("All input files added.");
m_bSuccess = false;
}
////////////////////////////////////////////////////////////
// Thread Main
////////////////////////////////////////////////////////////
void CueSplitter::run()
{
m_bSuccess = false;
m_abortFlag = false;
int nTracks = min(min(min(m_trackFile.count(), m_trackNo.count()), min(m_trackOffset.count(), m_trackLength.count())), m_trackMetaInfo.count());
if(!QDir(m_outputDir).exists())
{
qWarning("Output directory \"%s\" does not exist!", m_outputDir.toUtf8().constData());
return;
}
for(int i = 0; i < nTracks; i++)
{
QString outputFile = QString("%1/%2 - Track %3.wav").arg(m_outputDir, m_baseName, QString().sprintf("%02d", m_trackNo.at(i)));
for(int n = 2; QFileInfo(outputFile).exists(); n++)
{
outputFile = QString("%1/%2 - Track %3 (%4).wav").arg(m_outputDir, m_baseName, QString().sprintf("%02d", m_trackNo.at(i)), QString::number(n));
}
emit fileSelected(QFileInfo(outputFile).fileName());
splitFile(outputFile, m_trackNo.at(i), m_trackFile.at(i), m_trackOffset.at(i), m_trackLength.at(i), m_trackMetaInfo.at(i));
}
qDebug("All files were split.\n");
m_bSuccess = true;
}
void CueSplitter::addTrack(const int trackNo, const QString &file, const double offset, const double length, const AudioFileModel &metaInfo)
{
if(m_inputFiles.contains(file))
{
m_trackFile << file;
m_trackNo << trackNo;
m_trackOffset << offset;
m_trackLength << length;
m_trackMetaInfo << metaInfo;
}
else
{
throw "Unknown input file!";
}
}
////////////////////////////////////////////////////////////
// Privtae Functions
////////////////////////////////////////////////////////////
void CueSplitter::splitFile(const QString &output, const int trackNo, const QString &file, const double offset, const double length, const AudioFileModel &metaInfo)
{
qDebug("\n[Track %02d]", trackNo);
qDebug("File: <%s>", file.toUtf8().constData());
qDebug("Offset: %f", offset);
qDebug("Length: %f", length);
qDebug("Artist: <%s>", metaInfo.fileArtist().toUtf8().constData());
qDebug("Title: <%s>", metaInfo.fileName().toUtf8().constData());
QRegExp regExp("In:(\\d+)(\\.\\d+)*%");
QString baseName = QFileInfo(output).fileName();
if(!m_inputFiles.contains(file))
{
qWarning("Unknown input file, skipping!");
return;
}
AudioFileModel &inputFileInfo = m_inputFiles[file];
if(inputFileInfo.formatContainerType().compare("Wave", Qt::CaseInsensitive) || inputFileInfo.formatAudioType().compare("PCM", Qt::CaseInsensitive))
{
qWarning("Sorry, only Wave/PCM files are supported at this time!");
return;
}
QStringList args;
args << "-S" << "-V3";
args << "--guard" << "--temp" << ".";
args << QDir::toNativeSeparators(file);
args << QDir::toNativeSeparators(output);
args << "trim";
args << indexToString(offset);
if((length != std::numeric_limits<double>::quiet_NaN()) && (length != std::numeric_limits<double>::infinity()))
{
args << indexToString(length);
}
QProcess process;
process.setProcessChannelMode(QProcess::MergedChannels);
process.setReadChannel(QProcess::StandardOutput);
process.setWorkingDirectory(m_outputDir);
process.start(m_soxBin, args);
if(!process.waitForStarted())
{
qWarning("SoX process failed to create!");
qWarning("Error message: \"%s\"\n", process.errorString().toLatin1().constData());
process.kill();
process.waitForFinished(-1);
return;
}
while(process.state() != QProcess::NotRunning)
{
if(m_abortFlag)
{
process.kill();
break;
}
process.waitForReadyRead();
if(!process.bytesAvailable() && process.state() == QProcess::Running)
{
process.kill();
qWarning("SoX process timed out <-- killing!");
break;
}
while(process.bytesAvailable() > 0)
{
QByteArray line = process.readLine();
QString text = QString::fromUtf8(line.constData()).simplified();
if(regExp.lastIndexIn(text) >= 0)
{
bool ok = false;
int progress = regExp.cap(1).toInt(&ok);
if(ok)
{
emit fileSelected(QString("%1 [%2%]").arg(baseName, QString::number(progress)));
}
}
}
}
if(process.state() != QProcess::NotRunning)
{
process.kill();
process.waitForFinished(-1);
}
if(process.exitStatus() != QProcess::NormalExit || QFileInfo(output).size() == 0)
{
qWarning("Splitting has failed!");
return;
}
AudioFileModel outFileInfo(metaInfo);
outFileInfo.setFilePath(output);
outFileInfo.setFormatContainerType(inputFileInfo.formatContainerType());
outFileInfo.setFormatAudioType(inputFileInfo.formatAudioType());
outFileInfo.setFileDuration(static_cast<unsigned int>(abs(length)));
emit fileSplit(outFileInfo);
}
QString CueSplitter::indexToString(const double index) const
{
if(index == std::numeric_limits<double>::quiet_NaN() || index == std::numeric_limits<double>::infinity() || index < 0.0)
{
return QString();
}
int temp = static_cast<int>(index * 1000.0);
int msec = temp % 1000;
int secs = temp / 1000;
if(secs >= 3600)
{
return QString().sprintf("%d:%02d:%02d.%03d", min(99, secs / 3600), min(59, (secs % 3600) / 60), min(59, (secs % 3600) % 60), min(99, msec));
}
else if(secs >= 60)
{
return QString().sprintf("%d:%02d.%03d", min(99, secs / 60), min(59, secs % 60), min(99, msec));
}
else
{
return QString().sprintf("%d.%03d", min(59, secs % 60), min(99, msec));
}
}
////////////////////////////////////////////////////////////
// EVENTS
////////////////////////////////////////////////////////////
/*NONE*/

67
src/Thread_CueSplitter.h Normal file
View File

@ -0,0 +1,67 @@
///////////////////////////////////////////////////////////////////////////////
// LameXP - Audio Encoder Front-End
// Copyright (C) 2004-2011 LoRd_MuldeR <MuldeR2@GMX.de>
//
// This program is free software; you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation; either version 2 of the License, or
// (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License along
// with this program; if not, write to the Free Software Foundation, Inc.,
// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
//
// http://www.gnu.org/licenses/gpl-2.0.txt
///////////////////////////////////////////////////////////////////////////////
#pragma once
#include <QThread>
#include <QStringList>
#include <QMap>
class AudioFileModel;
class QFile;
class QDir;
class QFileInfo;
////////////////////////////////////////////////////////////
// Splash Thread
////////////////////////////////////////////////////////////
class CueSplitter: public QThread
{
Q_OBJECT
public:
CueSplitter(const QString &outputDir, const QString &baseName, const QList<AudioFileModel> &inputFiles);
void run();
bool getSuccess(void) { return !isRunning() && m_bSuccess; }
void addTrack(const int trackNo, const QString &file, const double offset, const double length, const AudioFileModel &metaInfo);
signals:
void fileSelected(const QString &fileName);
void fileSplit(const AudioFileModel &file);
private:
void splitFile(const QString &output, const int trackNo, const QString &file, const double offset, const double length, const AudioFileModel &metaInfo);
QString indexToString(const double index) const;
const QString m_soxBin;
const QString m_outputDir;
const QString m_baseName;
bool m_bSuccess;
volatile bool m_abortFlag;
QMap<QString,AudioFileModel> m_inputFiles;
QList<QString> m_trackFile;
QList<int> m_trackNo;
QList<double> m_trackOffset;
QList<double> m_trackLength;
QList<AudioFileModel> m_trackMetaInfo;
};