cowbell r43 - in trunk: . gui gui/services
- From: btaylor svn gnome org
- To: svn-commits-list gnome org
- Subject: cowbell r43 - in trunk: . gui gui/services
- Date: Wed, 11 Jun 2008 04:23:55 +0000 (UTC)
Author: btaylor
Date: Wed Jun 11 04:23:54 2008
New Revision: 43
URL: http://svn.gnome.org/viewvc/cowbell?rev=43&view=rev
Log:
2008-06-10 Brad Taylor <brad getcoded net>
* gui/AlbumCoverImage.cs:
* gui/services/AlbumArtworkCacheService.cs: Remove debugging
WriteLines.
* gui/MainWindow.cs: Make sure that AlbumArtworkCacheService is loaded
before FilesystemService in lieu of an actual dependency system.
* gui/services/FilesystemService.cs: Refactor FilesystemService to use
AlbumArtworkCacheService to save the cover image to the filesystem.
Clean up the playlist formatting code.
Modified:
trunk/ChangeLog
trunk/gui/AlbumCoverImage.cs
trunk/gui/MainWindow.cs
trunk/gui/services/AlbumArtworkCacheService.cs
trunk/gui/services/FilesystemService.cs
Modified: trunk/gui/AlbumCoverImage.cs
==============================================================================
--- trunk/gui/AlbumCoverImage.cs (original)
+++ trunk/gui/AlbumCoverImage.cs Wed Jun 11 04:23:54 2008
@@ -113,7 +113,6 @@
#region private methods
private void OnArtworkChanged (object o, ArtworkChangedArgs args)
{
-Console.WriteLine ("OnArtworkChanged: loading? {0}, data == null? {1}", args.IsLoading, (args.ImageData == null));
Gdk.Pixbuf pixbuf = null;
if (args.IsLoading) {
pixbuf = loadingcover;
Modified: trunk/gui/MainWindow.cs
==============================================================================
--- trunk/gui/MainWindow.cs (original)
+++ trunk/gui/MainWindow.cs Wed Jun 11 04:23:54 2008
@@ -44,9 +44,9 @@
ServiceManager.RegisterService (new XmlPreferencesService ());
ServiceManager.RegisterService (new DatabaseService ());
ServiceManager.RegisterService (new GLibDispatchService ());
+ ServiceManager.RegisterService (new AlbumArtworkCacheService ());
ServiceManager.RegisterService (new FilesystemService ());
ServiceManager.RegisterService (new MetadataProxyService ());
- ServiceManager.RegisterService (new AlbumArtworkCacheService ());
CliParser parser = new CliParser (Globals.AppName,
Catalog.GetString ("An elegant music organizer."),
Modified: trunk/gui/services/AlbumArtworkCacheService.cs
==============================================================================
--- trunk/gui/services/AlbumArtworkCacheService.cs (original)
+++ trunk/gui/services/AlbumArtworkCacheService.cs Wed Jun 11 04:23:54 2008
@@ -132,7 +132,6 @@
timeout_id = 0;
string stamp = CurrentStamp;
-Console.WriteLine ("OnGlobalDataModified: {0}", stamp);
// return the artwork if we've already cached it
if (artwork.ContainsKey (stamp)) {
@@ -156,10 +155,8 @@
private void WorkerFetchAlbumArtwork (string stamp)
{
-Console.WriteLine ("WorkerFetchAlbumArtwork");
byte[] data = null;
for (int i = 0; i < proxies.Count; i++) {
-Console.WriteLine ("Got a proxy!");
IArtworkProxy p = (IArtworkProxy)proxies[i].Value;
data = p.FetchAlbumArtwork ();
Modified: trunk/gui/services/FilesystemService.cs
==============================================================================
--- trunk/gui/services/FilesystemService.cs (original)
+++ trunk/gui/services/FilesystemService.cs Wed Jun 11 04:23:54 2008
@@ -28,14 +28,15 @@
{
public class FilesystemService : IFilesystemService
{
- /* public methods */
+#region public methods
public void Load ()
{
db_svc = (IDatabaseService)ServiceManager.GetService (
typeof (IDatabaseService));
-
prefs_svc = (IPreferencesService)ServiceManager.GetService (
typeof (IPreferencesService));
+ art_cache_svc = (IAlbumArtworkCacheService)ServiceManager.GetService (
+ typeof (IAlbumArtworkCacheService));
}
public bool Import (string filename)
@@ -122,8 +123,8 @@
string path = GetBasedir ();
if (prefs_svc.CacheCoverImage) {
- // FIXME:
- //MainWindow.SaveCoverImage (Path.Combine (path, Catalog.GetString ("cover.jpg")));
+ art_cache_svc.SaveCurrentArtwork (Path.Combine (path, Catalog.GetString ("cover.jpg")),
+ "jpeg");
}
if (prefs_svc.RenameFiles) {
@@ -231,8 +232,15 @@
ExportM3u (Path.Combine (path, Catalog.GetString ("playlist.m3u")));
}
}
+#endregion
+
+#region private fields
+ private IDatabaseService db_svc;
+ private IPreferencesService prefs_svc;
+ private IAlbumArtworkCacheService art_cache_svc;
+#endregion
- /* private methods */
+#region private methods
private static void ExportM3u (string filename)
{
IDatabaseService db_svc
@@ -247,8 +255,10 @@
foreach (Song s in sorted)
{
- stream.Write ("#EXTINF:" + s.Length + "," + s.Artist + " - " + s.Title + "\n");
- stream.Write (s.Filename + "\n");
+ // Use relative path names so that the m3u is more portable
+ stream.Write ("#EXTINF:{0},{1} - {2}\n", Math.Round (s.Length.TotalSeconds),
+ s.Artist, s.Title);
+ stream.Write (Path.GetFileName (s.Filename) + "\n");
}
stream.Flush ();
@@ -266,12 +276,15 @@
sorted.Sort ();
stream.Write ("[playlist]\n");
- stream.Write ("NumberOfEntries=" + db_svc.Items.Count + "\n");
+ stream.Write ("NumberOfEntries={0}\n", db_svc.Items.Count);
int i = 0;
foreach (Song s in sorted)
{
- stream.Write ("File" + i + "=" + s.Filename + "\n");
+ // Use relative path names so that the pls is more portable
+ stream.Write ("File{0}={1}\n", i, Path.GetFileName (s.Filename));
+ stream.Write ("Length{0}={1}\n", i, Math.Round (s.Length.TotalSeconds));
+ stream.Write ("Title{0}={1} - {2}\n", i, s.Artist, s.Title);
i++;
}
@@ -299,9 +312,6 @@
return songs;
}
-
- /* private fields */
- private IDatabaseService db_svc;
- private IPreferencesService prefs_svc;
+#endregion
}
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]