diff --git a/TODO b/TODO index 8dbeb84be..0d81d0626 100644 --- a/TODO +++ b/TODO @@ -8,7 +8,7 @@ - Clicking play plays selected item - Edit tags in playlist view -- Watch subdirectories in library +- Disabled fields in tag editor Long-term: - iPod diff --git a/src/edittagdialog.ui b/src/edittagdialog.ui index afce2915c..d9bef591f 100644 --- a/src/edittagdialog.ui +++ b/src/edittagdialog.ui @@ -27,6 +27,9 @@ Title + + title + @@ -37,6 +40,9 @@ Album + + album + @@ -47,6 +53,9 @@ Artist + + artist + @@ -57,6 +66,9 @@ Genre + + genre + @@ -67,6 +79,9 @@ Track + + track + @@ -92,6 +107,9 @@ Year + + year + @@ -117,6 +135,9 @@ Comment + + comment + @@ -168,6 +189,17 @@
lineedit.h
+ + buttonBox + title + album + artist + genre + track + year + comment + filename + @@ -177,8 +209,8 @@ accept() - 248 - 254 + 591 + 262 157 @@ -193,8 +225,8 @@ reject() - 316 - 260 + 591 + 268 286 diff --git a/src/librarywatcher.cpp b/src/librarywatcher.cpp index e624598ae..94f6fb5b3 100644 --- a/src/librarywatcher.cpp +++ b/src/librarywatcher.cpp @@ -35,6 +35,16 @@ void LibraryWatcher::AddDirectories(const DirectoryList& directories) { // Start monitoring this directory for more changes fs_watcher_->addPath(dir.path); + + // And all the subdirectories + QDirIterator it(dir.path, + QDir::NoDotAndDotDot | QDir::Dirs, + QDirIterator::Subdirectories); + while (it.hasNext()) { + QString subdir(it.next()); + fs_watcher_->addPath(subdir); + paths_watched_[subdir] = dir; + } } } @@ -43,6 +53,16 @@ void LibraryWatcher::RemoveDirectories(const DirectoryList &directories) { fs_watcher_->removePath(dir.path); paths_watched_.remove(dir.path); paths_needing_rescan_.removeAll(dir.path); + + // And all the subdirectories + QDirIterator it(dir.path, + QDir::NoDotAndDotDot | QDir::Dirs, + QDirIterator::Subdirectories); + while (it.hasNext()) { + QString subdir(it.next()); + fs_watcher_->removePath(subdir); + paths_watched_.remove(subdir); + } } } @@ -140,6 +160,7 @@ bool LibraryWatcher::FindSongByPath(const SongList& list, const QString& path, S } void LibraryWatcher::DirectoryChanged(const QString &path) { + qDebug() << path; if (!paths_needing_rescan_.contains(path)) paths_needing_rescan_ << path; diff --git a/src/song.cpp b/src/song.cpp index 813801c1e..b1fd05db8 100644 --- a/src/song.cpp +++ b/src/song.cpp @@ -1,5 +1,7 @@ #include "song.h" +#include + #include #include #include @@ -315,5 +317,12 @@ bool Song::Save() const { ref.tag()->setYear(d->year_); ref.tag()->setTrack(d->track_); - return ref.save(); + bool ret = ref.save(); + if (ret) { + // Linux: inotify doesn't seem to notice the change to the file unless we + // change the timestamps as well. (this is what touch does) + utimensat(0, QFile::encodeName(d->filename_).constData(), NULL, 0); + } + + return ret; }