banshee r4638 - in trunk/banshee: . src/Core/Banshee.ThickClient/Banshee.Collection.Gui
- From: gburt svn gnome org
- To: svn-commits-list gnome org
- Subject: banshee r4638 - in trunk/banshee: . src/Core/Banshee.ThickClient/Banshee.Collection.Gui
- Date: Wed, 1 Oct 2008 01:11:55 +0000 (UTC)
Author: gburt
Date: Wed Oct 1 01:11:55 2008
New Revision: 4638
URL: http://svn.gnome.org/viewvc/banshee?rev=4638&view=rev
Log:
2008-09-30 Gabriel Burt <gabriel burt gmail com>
* src/Core/Banshee.ThickClient/Banshee.Collection.Gui/ArtworkManager.cs:
We allow putting files with extension .cover in the ~/.cache/album-art
folder, which means we should, on a later pass, cover them to jpeg if
necessary. That code path was broken, which also broke embedded cover art
fetching because it always names the files it fetches with a .cover
extension (BGO #388162).
Modified:
trunk/banshee/ChangeLog
trunk/banshee/src/Core/Banshee.ThickClient/Banshee.Collection.Gui/ArtworkManager.cs
Modified: trunk/banshee/src/Core/Banshee.ThickClient/Banshee.Collection.Gui/ArtworkManager.cs
==============================================================================
--- trunk/banshee/src/Core/Banshee.ThickClient/Banshee.Collection.Gui/ArtworkManager.cs (original)
+++ trunk/banshee/src/Core/Banshee.ThickClient/Banshee.Collection.Gui/ArtworkManager.cs Wed Oct 1 01:11:55 2008
@@ -89,38 +89,45 @@
public Pixbuf LookupScale (string id, int size)
{
- if (id == null) {
+ if (id == null || (size != 0 && size < 10)) {
return null;
}
-
+
+ // Find the scaled, cached file
string path = CoverArtSpec.GetPathForSize (id, size);
if (File.Exists (path)) {
- if (Path.GetExtension (path) == "cover") {
+ try {
+ return new Pixbuf (path);
+ } catch {
+ return null;
+ }
+ }
+
+ string orig_path = CoverArtSpec.GetPathForSize (id, 0);
+ bool orig_exists = File.Exists (orig_path);
+
+ if (!orig_exists) {
+ // It's possible there is an image with extension .cover that's waiting
+ // to be converted into a jpeg
+ string unconverted_path = Path.ChangeExtension (orig_path, "cover");
+ if (File.Exists (unconverted_path)) {
try {
- Pixbuf pixbuf = new Pixbuf (path);
+ Pixbuf pixbuf = new Pixbuf (unconverted_path);
if (pixbuf.Width < 50 || pixbuf.Height < 50) {
- File.Delete (path);
+ Hyena.Log.DebugFormat ("Ignoring cover art {0} because less than 50x50", unconverted_path);
return null;
}
- pixbuf.Save (Path.ChangeExtension (path, "jpg"), "jpeg");
- return pixbuf;
+ pixbuf.Save (orig_path, "jpeg");
+ orig_exists = true;
} catch {
- File.Delete (path);
+ } finally {
+ File.Delete (unconverted_path);
}
-
- return null;
- }
-
- try {
- return new Pixbuf (path);
- } catch {
- return null;
}
}
- string orig_path = CoverArtSpec.GetPathForSize (id, 0);
- if (File.Exists (orig_path) && size > 1) {
+ if (orig_exists && size >= 10) {
try {
Pixbuf pixbuf = new Pixbuf (orig_path);
Pixbuf scaled_pixbuf = pixbuf.ScaleSimple (size, size, Gdk.InterpType.Bilinear);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]