|
From: Tapio V. <aa...@us...> - 2011-01-25 10:24:09
|
Module: editor
Branch: master
Commit: 5541dec56580d545e936988d3044e06d461557e2
Author: Tapio Vierros <tap...@gm...>
Date: Tue Jan 25 12:22:50 2011 +0200
Remove dependency to boost::regex and boost::filesystem.
---
CMakeLists.txt | 2 +-
songparser.cc | 25 +------------------------
2 files changed, 2 insertions(+), 25 deletions(-)
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 714c48e..5a286f4 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -24,7 +24,7 @@ foreach(lib AVFormat SWScale)
add_definitions(${${lib}_DEFINITIONS})
endforeach(lib)
-find_package(Boost 1.36 REQUIRED COMPONENTS thread regex filesystem system)
+find_package(Boost 1.36 REQUIRED COMPONENTS thread)
include_directories(${Boost_INCLUDE_DIRS})
list(APPEND LIBS ${Boost_LIBRARIES})
diff --git a/songparser.cc b/songparser.cc
index 708c2e6..bf2bc9b 100644
--- a/songparser.cc
+++ b/songparser.cc
@@ -2,8 +2,6 @@
#include <QFile>
#include <QFileInfo>
-#include <boost/regex.hpp>
-#include <boost/filesystem.hpp>
namespace SongParserUtil {
@@ -68,29 +66,8 @@ SongParser::SongParser(Song& s):
if (!QFileInfo(m_song.path + m_song.background).exists()) m_song.background = "";
if (!QFileInfo(m_song.path + m_song.video).exists()) m_song.video = "";
- // In case no images/videos were specified, try to guess them
- try {
- if (m_song.cover.isEmpty() || m_song.background.isEmpty() || m_song.video.isEmpty()) {
- boost::regex coverfile("((cover|album|label|\\[co\\])\\.(png|jpeg|jpg|svg))$", boost::regex_constants::icase);
- boost::regex backgroundfile("((background|bg||\\[bg\\])\\.(png|jpeg|jpg|svg))$", boost::regex_constants::icase);
- boost::regex videofile("(.*\\.(avi|mpg|mpeg|flv|mov|mp4))$", boost::regex_constants::icase);
- boost::cmatch match;
-
- for (boost::filesystem::directory_iterator dirIt(s.path.toStdString()), dirEnd; dirIt != dirEnd; ++dirIt) {
- boost::filesystem::path p = dirIt->path();
- std::string name = p.leaf(); // File basename
- if (m_song.cover.isEmpty() && regex_match(name.c_str(), match, coverfile)) {
- m_song.cover = QString::fromStdString(name);
- } else if (m_song.background.isEmpty() && regex_match(name.c_str(), match, backgroundfile)) {
- m_song.background = QString::fromStdString(name);
- } else if (m_song.video.isEmpty() && regex_match(name.c_str(), match, videofile)) {
- m_song.video = QString::fromStdString(name);
- }
- }
- }
- } catch (...) {
- // FIXME: Due to conversion errors, directory_iterator may fail - reimplement with Qt
- }
+ // TODO: Should we try to guess images and stuff?
+
finalize(); // Do some adjusting to the notes
s.loadStatus = Song::FULL;
}
|