forked from poiru/foo-cad
-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add cover extraction
- Loading branch information
Showing
174 changed files
with
36,989 additions
and
156 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
#include "PlusCover.h" | ||
#include "Cover.h" | ||
|
||
using namespace std; | ||
|
||
PlusCover::PlusCover() | ||
{ | ||
WCHAR buffer[MAX_PATH]; | ||
GetTempPath(MAX_PATH, buffer); | ||
GetTempFileName(buffer, L"jpg", 0, buffer); | ||
m_TempPath = buffer; | ||
m_TempPath = m_TempPath.substr(0, m_TempPath.rfind(L'.') + 1) + L"jpg"; | ||
MoveFile(buffer, m_TempPath.c_str()); | ||
} | ||
|
||
PlusCover::~PlusCover() | ||
{ | ||
DeleteFile(m_TempPath.c_str()); | ||
} | ||
|
||
wstring PlusCover::GetCover(wstring FilePath) | ||
{ | ||
if (!GenCover(FilePath)) | ||
if (!SearchCover(FilePath)) | ||
return wstring(); | ||
return m_TempPath; | ||
} | ||
|
||
unsigned int PlusCover::GenCover(wstring FilePath) | ||
{ | ||
TagLib::FileRef fr(FilePath.c_str(), false); | ||
if (!fr.isNull() && CCover::GetEmbedded(fr, m_TempPath)) | ||
{ | ||
return m_TempPath.length(); | ||
} | ||
else | ||
{ | ||
return 0; | ||
} | ||
return 0; | ||
} | ||
|
||
bool PlusCover::SearchCover(wstring FilePath) | ||
{ | ||
wstring folder = FilePath.substr(0, FilePath.rfind(L"\\") + 1); | ||
return CCover::GetLocal(L"cover", folder, m_TempPath); | ||
} |
Oops, something went wrong.