sbFileAlbumArtFetcher.h
Go to the documentation of this file.
1 /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
2 /* vim: set sw=2 :miv */
3 /*
4 //
5 // BEGIN SONGBIRD GPL
6 //
7 // This file is part of the Songbird web player.
8 //
9 // Copyright(c) 2005-2008 POTI, Inc.
10 // http://songbirdnest.com
11 //
12 // This file may be licensed under the terms of of the
13 // GNU General Public License Version 2 (the "GPL").
14 //
15 // Software distributed under the License is distributed
16 // on an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, either
17 // express or implied. See the GPL for the specific language
18 // governing rights and limitations.
19 //
20 // You should have received a copy of the GPL along with this
21 // program. If not, go to http://www.gnu.org/licenses/gpl.html
22 // or write to the Free Software Foundation, Inc.,
23 // 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
24 //
25 // END SONGBIRD GPL
26 //
27 */
28 
29 #ifndef __SB_FILEALBUMARTFETCHER_H__
30 #define __SB_FILEALBUMARTFETCHER_H__
31 
32 //------------------------------------------------------------------------------
33 //------------------------------------------------------------------------------
34 //
35 // Songbird local file album art fetcher.
36 //
37 //------------------------------------------------------------------------------
38 //------------------------------------------------------------------------------
39 
45 //------------------------------------------------------------------------------
46 //
47 // Songbird local file album art fetcher imported services.
48 //
49 //------------------------------------------------------------------------------
50 
51 // Songbird imports.
52 #include <sbIAlbumArtFetcher.h>
53 #include <sbIAlbumArtService.h>
54 
55 // Mozilla imports.
56 #include <nsCOMPtr.h>
57 #include <nsIArray.h>
58 #include <nsIIOService.h>
59 #include <nsISimpleEnumerator.h>
60 #include <nsIPrefBranch.h>
61 #include <nsTArray.h>
62 #include <nsStringGlue.h>
63 #include <nsISupportsPrimitives.h>
64 #include <nsIURL.h>
65 
66 
67 
68 //------------------------------------------------------------------------------
69 //
70 // Songbird local file album art fetcher defs.
71 //
72 //------------------------------------------------------------------------------
73 
74 //
75 // Songbird local file album art fetcher component defs.
76 //
77 
78 #define SB_FILEALBUMARTFETCHER_CLASSNAME "sbFileAlbumArtFetcher"
79 #define SB_FILEALBUMARTFETCHER_CID \
80  /* {5fdeaf80-1a91-4970-8cba-c016cd6edc82} */ \
81  { \
82  0x5fdeaf80, \
83  0x1a91, \
84  0x4970, \
85  { 0x8c, 0xba, 0xc0, 0x16, 0xcd, 0x6e, 0xdc, 0x82 } \
86  }
87 
88 
89 //------------------------------------------------------------------------------
90 //
91 // Songbird local file album art fetcher classes.
92 //
93 //------------------------------------------------------------------------------
94 
100 {
101  //----------------------------------------------------------------------------
102  //
103  // Public interface.
104  //
105  //----------------------------------------------------------------------------
106 
107 public:
108 
109  //
110  // Inherited interfaces.
111  //
112 
114  NS_DECL_SBIALBUMARTFETCHER
115 
116 
117  //
118  // Public services.
119  //
120 
122 
123  virtual ~sbFileAlbumArtFetcher();
124 
125  nsresult Initialize();
126 
127 
128  //----------------------------------------------------------------------------
129  //
130  // Private interface.
131  //
132  //----------------------------------------------------------------------------
133 
134 private:
135 
136  //
137  // mPrefService Preference service to get prefs.
138  // mAlbumArtService Art service - used for caching
139  // mIOService I/O service.
140  // mFileExtensionList List of album art file extensions.
141  // mFileBaseNameList List of album art file names.
142  // mAlbumArtSourceList List of album art sources.
143  //
144 
145  nsCOMPtr<nsIPrefBranch> mPrefService;
146  nsCOMPtr<sbIAlbumArtService> mAlbumArtService;
147  nsCOMPtr<nsIIOService> mIOService;
148  nsTArray<nsString> mFileExtensionList;
149  nsTArray<nsString> mFileBaseNameList;
150  nsCOMPtr<nsIArray> mAlbumArtSourceList;
151 
152 
153  //
154  // Internal services.
155  //
156 
157  nsresult GetURLDirEntries(nsIURL* aURL,
158  PRBool* aIsLocalFile,
159  nsISimpleEnumerator** aDirEntries);
160 
161  nsresult FindAlbumArtFile(sbIMediaItem* aMediaItem,
162  nsIFile** aAlbumArtFile);
163 };
164 
165 
166 #endif // __SB_FILEALBUMARTFETCHER_H__
167 
NS_DECL_ISUPPORTS NS_DECL_SBIALBUMARTFETCHER sbFileAlbumArtFetcher()
Interface that defines a single item of media in the system.
Interface for an album art fetcher. Instantiate as a component instance.