Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(4470)

Unified Diff: chrome/browser/media_galleries/fileapi/itunes_library_parser.h

Issue 16231016: Extract track information from iTunes library xml file. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix win test Created 7 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: chrome/browser/media_galleries/fileapi/itunes_library_parser.h
diff --git a/chrome/browser/media_galleries/fileapi/itunes_library_parser.h b/chrome/browser/media_galleries/fileapi/itunes_library_parser.h
new file mode 100644
index 0000000000000000000000000000000000000000..1da155363fffd375c443e38b30e9b10e1fe38eb5
--- /dev/null
+++ b/chrome/browser/media_galleries/fileapi/itunes_library_parser.h
@@ -0,0 +1,46 @@
+// Copyright (c) 2013 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef CHROME_BROWSER_MEDIA_GALLERIES_FILEAPI_ITUNES_LIBRARY_PARSER_H_
+#define CHROME_BROWSER_MEDIA_GALLERIES_FILEAPI_ITUNES_LIBRARY_PARSER_H_
+
+#include <map>
+#include <set>
+
+#include "base/files/file_path.h"
+
+namespace itunes {
+
+class ITunesLibraryParser {
+ public:
+ struct Track {
+ Track(uint64 id, const base::FilePath& location);
+ bool operator<(const Track& other) const;
+
+ uint64 id;
+ base::FilePath location;
+ };
+
+ typedef std::set<Track> Album;
+ typedef std::map<std::string /*album name*/, Album> Albums;
+ typedef std::map<std::string /*artist name*/, Albums> Library;
+
+ ITunesLibraryParser();
+ ~ITunesLibraryParser();
+
+ // Returns true if at least one track was found. Malformed track entries
+ // are silently ignored.
+ bool Parse(const std::string& xml);
+
+ const Library& library() { return library_; }
+
+ private:
+ Library library_;
+
+ DISALLOW_COPY_AND_ASSIGN(ITunesLibraryParser);
+};
+
+} // namespace itunes
+
+#endif // CHROME_BROWSER_MEDIA_GALLERIES_FILEAPI_ITUNES_LIBRARY_PARSER_H_

Powered by Google App Engine
This is Rietveld 408576698