diff --git a/foo_cad/foo_cad.vcxproj b/foo_cad/foo_cad.vcxproj
deleted file mode 100644
index 3c65d64..0000000
--- a/foo_cad/foo_cad.vcxproj
+++ /dev/null
@@ -1,114 +0,0 @@
-
-
-
-
- Debug
- Win32
-
-
- Release
- Win32
-
-
-
- {CC272D9D-8B6A-43D0-AA2E-9F46B0D07C38}
- Win32Proj
- foo_cad
-
-
-
- DynamicLibrary
- true
- Unicode
- v110_xp
-
-
- DynamicLibrary
- false
- true
- Unicode
- v110_xp
-
-
-
-
-
-
-
-
-
-
-
-
- true
-
-
- false
-
-
-
-
-
- Level3
- Disabled
- WIN32;_DEBUG;_WINDOWS;_USRDLL;FOO_CAD_EXPORTS;%(PreprocessorDefinitions)
- MultiThreadedDebug
-
-
- Windows
- true
- ..\..\shared\
- shared.lib;Shlwapi.lib;%(AdditionalDependencies)
-
-
-
-
- Level3
-
-
- MaxSpeed
- true
- true
- WIN32;NDEBUG;_WINDOWS;_USRDLL;FOO_CAD_EXPORTS;%(PreprocessorDefinitions)
- MultiThreaded
- false
- false
- false
-
-
- Windows
- false
- true
- true
- ..\..\shared\
- shared.lib;Shlwapi.lib;%(AdditionalDependencies)
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- {71ad2674-065b-48f5-b8b0-e1f9d3892081}
-
-
- {ee47764e-a202-4f85-a767-abdab4aff35f}
-
-
- {e8091321-d79d-4575-86ef-064ea1a4a20d}
-
-
- {ebfffb4e-261d-44d3-b89c-957b31a0bf9c}
-
-
-
-
-
-
\ No newline at end of file
diff --git a/foo_cad/foo_cad.vcxproj.filters b/foo_cad/foo_cad.vcxproj.filters
deleted file mode 100644
index 4f40454..0000000
--- a/foo_cad/foo_cad.vcxproj.filters
+++ /dev/null
@@ -1,35 +0,0 @@
-
-
-
-
- {4FC737F1-C7A5-4376-A066-2A32D752A2FF}
- cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx
-
-
- {93995380-89BD-4b04-88EB-625FBE52EBFB}
- h;hpp;hxx;hm;inl;inc;xsd
-
-
- {67DA6AB6-F800-4c08-8B7A-83BB121AAD01}
- rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms
-
-
-
-
- Source Files
-
-
-
-
- Header Files
-
-
- Header Files
-
-
-
-
- Resource Files
-
-
-
\ No newline at end of file
diff --git a/foo_cad.sln b/foo_cad_plus.sln
similarity index 60%
rename from foo_cad.sln
rename to foo_cad_plus.sln
index 16f251b..4c694e2 100644
--- a/foo_cad.sln
+++ b/foo_cad_plus.sln
@@ -1,7 +1,9 @@

-Microsoft Visual Studio Solution File, Format Version 11.00
-# Visual Studio 2010
-Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "foo_cad", "foo_cad\foo_cad.vcxproj", "{CC272D9D-8B6A-43D0-AA2E-9F46B0D07C38}"
+Microsoft Visual Studio Solution File, Format Version 12.00
+# Visual Studio 14
+VisualStudioVersion = 14.0.23107.0
+MinimumVisualStudioVersion = 10.0.40219.1
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "foo_cad_plus", "foo_cad_plus\foo_cad_plus.vcxproj", "{CC272D9D-8B6A-43D0-AA2E-9F46B0D07C38}"
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "foobar2000_component_client", "..\foobar2000_component_client\foobar2000_component_client.vcxproj", "{71AD2674-065B-48F5-B8B0-E1F9D3892081}"
EndProject
@@ -14,29 +16,49 @@ EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Win32 = Debug|Win32
+ Debug|x64 = Debug|x64
Release|Win32 = Release|Win32
+ Release|x64 = Release|x64
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{CC272D9D-8B6A-43D0-AA2E-9F46B0D07C38}.Debug|Win32.ActiveCfg = Debug|Win32
{CC272D9D-8B6A-43D0-AA2E-9F46B0D07C38}.Debug|Win32.Build.0 = Debug|Win32
+ {CC272D9D-8B6A-43D0-AA2E-9F46B0D07C38}.Debug|x64.ActiveCfg = Debug|Win32
{CC272D9D-8B6A-43D0-AA2E-9F46B0D07C38}.Release|Win32.ActiveCfg = Release|Win32
{CC272D9D-8B6A-43D0-AA2E-9F46B0D07C38}.Release|Win32.Build.0 = Release|Win32
+ {CC272D9D-8B6A-43D0-AA2E-9F46B0D07C38}.Release|x64.ActiveCfg = Release|Win32
{71AD2674-065B-48F5-B8B0-E1F9D3892081}.Debug|Win32.ActiveCfg = Debug|Win32
{71AD2674-065B-48F5-B8B0-E1F9D3892081}.Debug|Win32.Build.0 = Debug|Win32
+ {71AD2674-065B-48F5-B8B0-E1F9D3892081}.Debug|x64.ActiveCfg = Debug|x64
+ {71AD2674-065B-48F5-B8B0-E1F9D3892081}.Debug|x64.Build.0 = Debug|x64
{71AD2674-065B-48F5-B8B0-E1F9D3892081}.Release|Win32.ActiveCfg = Release|Win32
{71AD2674-065B-48F5-B8B0-E1F9D3892081}.Release|Win32.Build.0 = Release|Win32
+ {71AD2674-065B-48F5-B8B0-E1F9D3892081}.Release|x64.ActiveCfg = Release|x64
+ {71AD2674-065B-48F5-B8B0-E1F9D3892081}.Release|x64.Build.0 = Release|x64
{E8091321-D79D-4575-86EF-064EA1A4A20D}.Debug|Win32.ActiveCfg = Debug|Win32
{E8091321-D79D-4575-86EF-064EA1A4A20D}.Debug|Win32.Build.0 = Debug|Win32
+ {E8091321-D79D-4575-86EF-064EA1A4A20D}.Debug|x64.ActiveCfg = Debug|x64
+ {E8091321-D79D-4575-86EF-064EA1A4A20D}.Debug|x64.Build.0 = Debug|x64
{E8091321-D79D-4575-86EF-064EA1A4A20D}.Release|Win32.ActiveCfg = Release|Win32
{E8091321-D79D-4575-86EF-064EA1A4A20D}.Release|Win32.Build.0 = Release|Win32
+ {E8091321-D79D-4575-86EF-064EA1A4A20D}.Release|x64.ActiveCfg = Release|x64
+ {E8091321-D79D-4575-86EF-064EA1A4A20D}.Release|x64.Build.0 = Release|x64
{EBFFFB4E-261D-44D3-B89C-957B31A0BF9C}.Debug|Win32.ActiveCfg = Debug|Win32
{EBFFFB4E-261D-44D3-B89C-957B31A0BF9C}.Debug|Win32.Build.0 = Debug|Win32
+ {EBFFFB4E-261D-44D3-B89C-957B31A0BF9C}.Debug|x64.ActiveCfg = Debug|x64
+ {EBFFFB4E-261D-44D3-B89C-957B31A0BF9C}.Debug|x64.Build.0 = Debug|x64
{EBFFFB4E-261D-44D3-B89C-957B31A0BF9C}.Release|Win32.ActiveCfg = Release|Win32
{EBFFFB4E-261D-44D3-B89C-957B31A0BF9C}.Release|Win32.Build.0 = Release|Win32
+ {EBFFFB4E-261D-44D3-B89C-957B31A0BF9C}.Release|x64.ActiveCfg = Release|x64
+ {EBFFFB4E-261D-44D3-B89C-957B31A0BF9C}.Release|x64.Build.0 = Release|x64
{EE47764E-A202-4F85-A767-ABDAB4AFF35F}.Debug|Win32.ActiveCfg = Debug|Win32
{EE47764E-A202-4F85-A767-ABDAB4AFF35F}.Debug|Win32.Build.0 = Debug|Win32
+ {EE47764E-A202-4F85-A767-ABDAB4AFF35F}.Debug|x64.ActiveCfg = Debug|x64
+ {EE47764E-A202-4F85-A767-ABDAB4AFF35F}.Debug|x64.Build.0 = Debug|x64
{EE47764E-A202-4F85-A767-ABDAB4AFF35F}.Release|Win32.ActiveCfg = Release|Win32
{EE47764E-A202-4F85-A767-ABDAB4AFF35F}.Release|Win32.Build.0 = Release|Win32
+ {EE47764E-A202-4F85-A767-ABDAB4AFF35F}.Release|x64.ActiveCfg = Release|x64
+ {EE47764E-A202-4F85-A767-ABDAB4AFF35F}.Release|x64.Build.0 = Release|x64
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
diff --git a/foo_cad/Plugin.cpp b/foo_cad_plus/Plugin.cpp
similarity index 87%
rename from foo_cad/Plugin.cpp
rename to foo_cad_plus/Plugin.cpp
index 7113722..ee2161f 100644
--- a/foo_cad/Plugin.cpp
+++ b/foo_cad_plus/Plugin.cpp
@@ -1,5 +1,6 @@
/*
Copyright (C) 2012 Birunthan Mohanathas
+ 2015 RangerCD
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License as published
@@ -19,6 +20,12 @@
#include "cad_sdk.h"
#include "Plugin.h"
+#include "PlusMsg.h"
+#include "PlusCover.h"
+#include
+
+using namespace std;
+
const GUID ORDER_DEFAULT = { 0xBFC61179, 0x49AD, 0x4E95, { 0x8D, 0x60, 0xA2, 0x27, 0x06, 0x48, 0x55, 0x05 } }; // {BFC61179-49AD-4E95-8D60-A22706485505}
const GUID ORDER_REPEAT = { 0x4BF4B280, 0x0BB4, 0x4DD0, { 0x8E, 0x84, 0x37, 0xC3, 0x20, 0x9C, 0x3D, 0xA2 } }; // {4BF4B280-0BB4-4DD0-8E84-37C3209C3DA2}
const GUID ORDER_REPEAT_PLAYLIST = { 0x681CC6EA, 0x60AE, 0x4BF9, { 0x91, 0x3B, 0xBB, 0x5F, 0x4E, 0x86, 0x4F, 0x2A } }; // {681CC6EA-60AE-4BF9-913B-BB5F4E864F2A}
@@ -29,20 +36,24 @@ const GUID ORDER_SHUFFLE_ALBUMS = { 0x499E0B08, 0xC887, 0x48C1, { 0x9C, 0xCA, 0x
const GUID ORDER_SHUFFLE_DIRECTORIES = { 0x83C37600, 0xD725, 0x4727, { 0xB5, 0x3C, 0xBD, 0xEF, 0xFE, 0x5F, 0x8D, 0xC7 } }; // {83C37600-D725-4727-B53C-BDEFFE5F8DC7}
DECLARE_COMPONENT_VERSION(
- "CD Art Display",
- "1.0.3",
- "© 2013 - Birunthan Mohanathas");
+ "CD Art Display Plus",
+ "1.1.0",
+ "? 2013 - Birunthan Mohanathas, 2015 - RangerCD");
static initquit_factory_t foo_interface;
foo_cad::foo_cad() :
m_window(),
- m_cad_window()
+ m_cad_window(),
+ //Plus
+ m_pCover(NULL),
+ m_bCoverRequired(false)
{
}
foo_cad::~foo_cad()
{
+ if (m_pCover) delete m_pCover;
}
void foo_cad::on_init()
@@ -162,6 +173,33 @@ void foo_cad::on_playback_new_track(metadb_handle_ptr track)
WCHAR buffer[2048];
int len = MultiByteToWideChar(CP_UTF8, 0, format.get_ptr(), format.get_length() + 1, buffer, _countof(buffer));
+ if (m_bCoverRequired)
+ {
+ if (!m_pCover) m_pCover = new PlusCover();
+ WCHAR * p1 = buffer, *p2 = buffer;
+ unsigned int index = 8;
+ while ((p1 = wcschr(p2, L'\t')) != nullptr && index--)p2 = p1 + 1;
+
+ wstring str;
+ str.assign(p2, p1 - p2);
+
+ if (m_strFilePath != str)
+ {
+ m_strFilePath = str;
+ str = m_pCover->GetCover(str);
+
+ if (str.length() && _countof(buffer) >= len + str.length())
+ {
+ index = 2;
+ while ((p1 = wcschr(p2, L'\t')) != nullptr && index--)p2 = p1 + 1;
+
+ wstring temp = str + p1;
+ wcscpy(p1, temp.c_str());
+ len += str.length();
+ }
+ }
+ }
+
COPYDATASTRUCT cds;
cds.dwData = PM_TRACKDATA;
cds.cbData = len * sizeof(WCHAR);
@@ -386,6 +424,18 @@ LRESULT CALLBACK foo_cad::window_proc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARA
return 1;
}
+ case PlusMsg::PlusMsg_SetAttribute:
+ {
+ switch (wParam)
+ {
+ case PlusAttr::PlusAttr_CoverNotRequired:
+ foo_interface.get_static_instance().m_bCoverRequired = false;
+ return 1;
+ case PlusAttr::PlusAttr_CoverRequired:
+ foo_interface.get_static_instance().m_bCoverRequired = true;
+ return 1;
+ }
+ }
}
return 0;
diff --git a/foo_cad/Plugin.h b/foo_cad_plus/Plugin.h
similarity index 90%
rename from foo_cad/Plugin.h
rename to foo_cad_plus/Plugin.h
index 0e08255..e4c9f2b 100644
--- a/foo_cad/Plugin.h
+++ b/foo_cad_plus/Plugin.h
@@ -1,5 +1,6 @@
/*
Copyright (C) 2012 Birunthan Mohanathas
+ 2015 RangerCD
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License as published
@@ -19,6 +20,7 @@
#define FOOCAD_PLUGIN_H_
#include "../../SDK/foobar2000.h"
+#include "PlusCover.h"
class foo_cad :
public initquit,
@@ -50,6 +52,12 @@ class foo_cad :
HWND m_window;
HWND m_cad_window;
+
+ //Plus
+ std::wstring m_strFilePath;
+ PlusCover * m_pCover;
+
+ bool m_bCoverRequired;
};
#endif
diff --git a/foo_cad/Plugin.rc b/foo_cad_plus/Plugin.rc
similarity index 100%
rename from foo_cad/Plugin.rc
rename to foo_cad_plus/Plugin.rc
diff --git a/foo_cad_plus/PlusCover.cpp b/foo_cad_plus/PlusCover.cpp
new file mode 100644
index 0000000..9420ac1
--- /dev/null
+++ b/foo_cad_plus/PlusCover.cpp
@@ -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);
+}
diff --git a/foo_cad_plus/PlusCover.h b/foo_cad_plus/PlusCover.h
new file mode 100644
index 0000000..45abb62
--- /dev/null
+++ b/foo_cad_plus/PlusCover.h
@@ -0,0 +1,21 @@
+#ifndef FOOCAD_PLUSCOVER_H
+#define FOOCAD_PLUSCOVER_H
+
+#include
+
+class PlusCover
+{
+public:
+ PlusCover();
+ ~PlusCover();
+
+ std::wstring m_TempPath;
+
+ std::wstring GetCover(std::wstring FilePath);
+
+private:
+ unsigned int GenCover(std::wstring FilePath);
+ bool SearchCover(std::wstring FilePath);
+};
+
+#endif
\ No newline at end of file
diff --git a/foo_cad_plus/PlusMsg.h b/foo_cad_plus/PlusMsg.h
new file mode 100644
index 0000000..861b887
--- /dev/null
+++ b/foo_cad_plus/PlusMsg.h
@@ -0,0 +1,20 @@
+#ifndef FOOCAD_PLUSMSG_H
+#define FOOCAD_PLUSMSG_H
+
+#include
+
+enum PlusMsg
+{
+ PlusMsg_SetAttribute = WM_USER + 128,
+ PlusMsg_GetAttribute = WM_USER + 129,
+
+ PlusMsg_User = WM_USER + 255
+};
+
+enum PlusAttr
+{
+ PlusAttr_CoverNotRequired = 0x0000,
+ PlusAttr_CoverRequired = 0x0001
+};
+
+#endif
\ No newline at end of file
diff --git a/foo_cad_plus/Rainmeter/PluginNowPlaying/Cover.cpp b/foo_cad_plus/Rainmeter/PluginNowPlaying/Cover.cpp
new file mode 100644
index 0000000..ae97dcf
--- /dev/null
+++ b/foo_cad_plus/Rainmeter/PluginNowPlaying/Cover.cpp
@@ -0,0 +1,228 @@
+/*
+ Copyright (C) 2011 Birunthan Mohanathas (www.poiru.net)
+
+ 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.
+*/
+
+#include "StdAfx.h"
+#include "Cover.h"
+
+namespace {
+
+bool WriteCoverToFile(const TagLib::ByteVector& data, const std::wstring& target)
+{
+ FILE* f = _wfopen(target.c_str(), L"wb");
+ if (f)
+ {
+ const bool written = fwrite(data.data(), 1, data.size(), f) == data.size();
+ fclose(f);
+ return written;
+ }
+
+ return false;
+}
+
+bool ExtractAPE(TagLib::APE::Tag* tag, const std::wstring& target)
+{
+ const TagLib::APE::ItemListMap& listMap = tag->itemListMap();
+ if (listMap.contains("COVER ART (FRONT)"))
+ {
+ const TagLib::ByteVector nullStringTerminator(1, 0);
+ TagLib::ByteVector item = listMap["COVER ART (FRONT)"].value();
+ const int pos = item.find(nullStringTerminator); // Skip the filename.
+ if (pos != -1)
+ {
+ const TagLib::ByteVector& pic = item.mid(pos + 1);
+ return WriteCoverToFile(pic, target);
+ }
+ }
+
+ return false;
+}
+
+bool ExtractID3(TagLib::ID3v2::Tag* tag, const std::wstring& target)
+{
+ const TagLib::ID3v2::FrameList& frameList = tag->frameList("APIC");
+ if (!frameList.isEmpty())
+ {
+ // Just grab the first image.
+ const auto* frame = (TagLib::ID3v2::AttachedPictureFrame*)frameList.front();
+ return WriteCoverToFile(frame->picture(), target);
+ }
+
+ return false;
+}
+
+bool ExtractASF(TagLib::ASF::File* file, const std::wstring& target)
+{
+ const TagLib::ASF::AttributeListMap& attrListMap = file->tag()->attributeListMap();
+ if (attrListMap.contains("WM/Picture"))
+ {
+ const TagLib::ASF::AttributeList& attrList = attrListMap["WM/Picture"];
+ if (!attrList.isEmpty())
+ {
+ // Let's grab the first cover. TODO: Check/loop for correct type.
+ const TagLib::ASF::Picture& wmpic = attrList[0].toPicture();
+ if (wmpic.isValid())
+ {
+ return WriteCoverToFile(wmpic.picture(), target);
+ }
+ }
+ }
+
+ return false;
+}
+
+bool ExtractFLAC(TagLib::FLAC::File* file, const std::wstring& target)
+{
+ const TagLib::List& picList = file->pictureList();
+ if (!picList.isEmpty())
+ {
+ // Just grab the first image.
+ const TagLib::FLAC::Picture* pic = picList[0];
+ return WriteCoverToFile(pic->data(), target);
+ }
+
+ return false;
+}
+
+bool ExtractMP4(TagLib::MP4::File* file, const std::wstring& target)
+{
+ TagLib::MP4::Tag* tag = file->tag();
+ const TagLib::MP4::ItemListMap& itemListMap = tag->itemListMap();
+ if (itemListMap.contains("covr"))
+ {
+ const TagLib::MP4::CoverArtList& coverArtList = itemListMap["covr"].toCoverArtList();
+ if (!coverArtList.isEmpty())
+ {
+ const TagLib::MP4::CoverArt* pic = &(coverArtList.front());
+ return WriteCoverToFile(pic->data(), target);
+ }
+ }
+
+ return false;
+}
+
+} // namespace
+
+/*
+** Checks if cover art is in cache.
+**
+*/
+bool CCover::GetCached(std::wstring& path)
+{
+ path += L".art";
+ return (_waccess(path.c_str(), 0) == 0) ? true : false;
+}
+
+/*
+** Attemps to find local cover art in various formats.
+**
+*/
+bool CCover::GetLocal(std::wstring filename, const std::wstring& folder, std::wstring& target)
+{
+ std::wstring testPath = folder + filename;
+ testPath += L".";
+ std::wstring::size_type origLen = testPath.length();
+
+ const int extCount = 4;
+ LPCTSTR extName[extCount] = { L"jpg", L"jpeg", L"png", L"bmp" };
+
+ for (int i = 0; i < extCount; ++i)
+ {
+ testPath += extName[i];
+ if (_waccess(testPath.c_str(), 0) == 0)
+ {
+ target = testPath;
+ return true;
+ }
+ else
+ {
+ // Get rid of the added extension
+ testPath.resize(origLen);
+ }
+ }
+
+ return false;
+}
+
+/*
+** Attempts to extract cover art from audio files.
+**
+*/
+bool CCover::GetEmbedded(const TagLib::FileRef& fr, const std::wstring& target)
+{
+ bool found = false;
+
+ if (TagLib::MPEG::File* file = dynamic_cast(fr.file()))
+ {
+ if (file->ID3v2Tag())
+ {
+ found = ExtractID3(file->ID3v2Tag(), target);
+ }
+ if (!found && file->APETag())
+ {
+ found = ExtractAPE(file->APETag(), target);
+ }
+ }
+ else if (TagLib::FLAC::File* file = dynamic_cast(fr.file()))
+ {
+ found = ExtractFLAC(file, target);
+
+ if (!found && file->ID3v2Tag())
+ {
+ found = ExtractID3(file->ID3v2Tag(), target);
+ }
+ }
+ else if (TagLib::MP4::File* file = dynamic_cast(fr.file()))
+ {
+ found = ExtractMP4(file, target);
+ }
+ else if (TagLib::ASF::File* file = dynamic_cast(fr.file()))
+ {
+ found = ExtractASF(file, target);
+ }
+ else if (TagLib::APE::File* file = dynamic_cast(fr.file()))
+ {
+ if (file->APETag())
+ {
+ found = ExtractAPE(file->APETag(), target);
+ }
+ }
+ else if (TagLib::MPC::File* file = dynamic_cast(fr.file()))
+ {
+ if (file->APETag())
+ {
+ found = ExtractAPE(file->APETag(), target);
+ }
+ }
+
+ return found;
+}
+
+/*
+** Returns path without filename.
+**
+*/
+std::wstring CCover::GetFileFolder(const std::wstring& file)
+{
+ std::wstring::size_type pos = file.find_last_of(L'\\');
+ if (pos != std::wstring::npos)
+ {
+ return file.substr(0, ++pos);
+ }
+
+ return file;
+}
diff --git a/foo_cad_plus/Rainmeter/PluginNowPlaying/Cover.h b/foo_cad_plus/Rainmeter/PluginNowPlaying/Cover.h
new file mode 100644
index 0000000..46683f3
--- /dev/null
+++ b/foo_cad_plus/Rainmeter/PluginNowPlaying/Cover.h
@@ -0,0 +1,50 @@
+/*
+ Copyright (C) 2011 Birunthan Mohanathas (www.poiru.net)
+
+ 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.
+*/
+
+#ifndef __COVER_H__
+#define __COVER_H__
+
+// TagLib
+#include "fileref.h"
+#include "apefile.h"
+#include "apetag.h"
+#include "asffile.h"
+#include "attachedpictureframe.h"
+#include "commentsframe.h"
+#include "flacfile.h"
+#include "id3v1genres.h"
+#include "id3v2tag.h"
+#include "mpcfile.h"
+#include "mpegfile.h"
+#include "mp4file.h"
+#include "tag.h"
+#include "taglib.h"
+#include "textidentificationframe.h"
+#include "tstring.h"
+#include "vorbisfile.h"
+
+class CCover
+{
+public:
+ static bool GetCached(std::wstring& path);
+ static bool GetLocal(std::wstring filename, const std::wstring& folder, std::wstring& target);
+ static bool GetEmbedded(const TagLib::FileRef& fr, const std::wstring& target);
+ static std::wstring GetFileFolder(const std::wstring& file);
+};
+
+#endif
\ No newline at end of file
diff --git a/foo_cad_plus/Rainmeter/PluginNowPlaying/StdAfx.cpp b/foo_cad_plus/Rainmeter/PluginNowPlaying/StdAfx.cpp
new file mode 100644
index 0000000..366024d
--- /dev/null
+++ b/foo_cad_plus/Rainmeter/PluginNowPlaying/StdAfx.cpp
@@ -0,0 +1,19 @@
+/*
+ Copyright (C) 2010-2011 Birunthan Mohanathas (www.poiru.net)
+
+ 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.
+*/
+
+#include "StdAfx.h"
diff --git a/foo_cad_plus/Rainmeter/PluginNowPlaying/StdAfx.h b/foo_cad_plus/Rainmeter/PluginNowPlaying/StdAfx.h
new file mode 100644
index 0000000..1232e43
--- /dev/null
+++ b/foo_cad_plus/Rainmeter/PluginNowPlaying/StdAfx.h
@@ -0,0 +1,40 @@
+/*
+ Copyright (C) 2010-2011 Birunthan Mohanathas (www.poiru.net)
+
+ 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.
+*/
+
+#ifndef __STDAFX_H__
+#define __STDAFX_H__
+
+// WinAPI
+#include
+#include
+#include
+#include
+#include
+
+// STL
+#include
+#include