summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKevin Anthony <kevin@nosideracing.com>2011-10-05 09:54:22 -0400
committerKevin Anthony <kevin@nosideracing.com>2011-10-05 09:54:22 -0400
commit5cd13a91b068a37f818a0816fce6ca54a6018d23 (patch)
tree77c849cbc92e882e8000bb5dce82379c42a5801c
parent19bc895a76fb803cb27125fed8d94e3183fdab7f (diff)
AlbumArtWriter: Added two new features
* Added Force Copy which forces a copy of the album art into the album folders * Added a configuration window, Allowing for naming of the art file, as well as they image type Notes: When we register the ration buttons, we must register every button Even though registering every radio button will make toggled get called twice, Because if we have more then 3 radio buttons, it's possable to have a state change that is not caught so we must register every button
-rw-r--r--src/AlbumArtWriter/AlbumArtWriter.csproj15
-rw-r--r--src/AlbumArtWriter/Banshee.AlbumArtWriter/AlbumArtWriterJob.cs93
-rw-r--r--src/AlbumArtWriter/Banshee.AlbumArtWriter/AlbumArtWriterService.cs80
-rw-r--r--src/AlbumArtWriter/Banshee.AlbumArtWriter/ConfigurationDialog.cs98
-rw-r--r--src/AlbumArtWriter/Banshee.AlbumArtWriter/ConfigurationSchema.cs68
-rw-r--r--src/AlbumArtWriter/Makefile.am12
-rw-r--r--src/AlbumArtWriter/Resources/GlobalUI.xml11
7 files changed, 329 insertions, 48 deletions
diff --git a/src/AlbumArtWriter/AlbumArtWriter.csproj b/src/AlbumArtWriter/AlbumArtWriter.csproj
index 4c25e2f..210ead3 100644
--- a/src/AlbumArtWriter/AlbumArtWriter.csproj
+++ b/src/AlbumArtWriter/AlbumArtWriter.csproj
@@ -14,7 +14,7 @@
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<CheckForOverflowUnderflow>true</CheckForOverflowUnderflow>
- <RootNamespace>Foo</RootNamespace>
+ <RootNamespace>AlbumArtWriter</RootNamespace>
<AssemblyOriginatorKeyFile>.</AssemblyOriginatorKeyFile>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
@@ -27,6 +27,7 @@
</CustomCommands>
</CustomCommands>
<Optimize>false</Optimize>
+ <WarningLevel>4</WarningLevel>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Windows|AnyCPU' ">
<DebugSymbols>true</DebugSymbols>
@@ -34,6 +35,7 @@
<OutputPath>..\..\..\bin</OutputPath>
<PlatformTarget>x86</PlatformTarget>
<Optimize>false</Optimize>
+ <WarningLevel>4</WarningLevel>
</PropertyGroup>
<ItemGroup>
<Reference Include="System" />
@@ -52,43 +54,40 @@
<Package>mono-addins</Package>
</Reference>
<Reference Include="Banshee.Core, Version=1.7.0.0, Culture=neutral">
- <Package>banshee-core</Package>
<SpecificVersion>False</SpecificVersion>
</Reference>
<Reference Include="Banshee.Services, Version=1.7.0.0, Culture=neutral">
- <Package>banshee-services</Package>
<SpecificVersion>False</SpecificVersion>
</Reference>
<Reference Include="Banshee.ThickClient, Version=1.7.0.0, Culture=neutral">
- <Package>banshee-thickclient</Package>
<SpecificVersion>False</SpecificVersion>
</Reference>
<Reference Include="Banshee.Widgets, Version=1.7.0.0, Culture=neutral">
- <Package>banshee-thickclient</Package>
<SpecificVersion>False</SpecificVersion>
</Reference>
<Reference Include="Hyena, Version=1.7.0.0, Culture=neutral">
- <Package>banshee-hyena</Package>
<SpecificVersion>False</SpecificVersion>
</Reference>
<Reference Include="Hyena.Data.Sqlite, Version=1.7.0.0, Culture=neutral">
- <Package>banshee-hyena-data-sqlite</Package>
<SpecificVersion>False</SpecificVersion>
</Reference>
<Reference Include="Hyena.Gui, Version=1.7.0.0, Culture=neutral">
- <Package>banshee-hyena-gui</Package>
<SpecificVersion>False</SpecificVersion>
</Reference>
<Reference Include="System.Core" />
+ <Reference Include="System.Drawing" />
</ItemGroup>
<ItemGroup>
<EmbeddedResource Include="AlbumArtWriter.addin.xml">
<LogicalName>AlbumArtWriter.addin.xml</LogicalName>
</EmbeddedResource>
+ <EmbeddedResource Include="Resources\GlobalUI.xml" />
</ItemGroup>
<ItemGroup>
<Compile Include="Banshee.AlbumArtWriter\AlbumArtWriterJob.cs" />
<Compile Include="Banshee.AlbumArtWriter\AlbumArtWriterService.cs" />
+ <Compile Include="Banshee.AlbumArtWriter\ConfigurationDialog.cs" />
+ <Compile Include="Banshee.AlbumArtWriter\ConfigurationSchema.cs" />
</ItemGroup>
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
<ProjectExtensions>
diff --git a/src/AlbumArtWriter/Banshee.AlbumArtWriter/AlbumArtWriterJob.cs b/src/AlbumArtWriter/Banshee.AlbumArtWriter/AlbumArtWriterJob.cs
index 0468852..77ed023 100644
--- a/src/AlbumArtWriter/Banshee.AlbumArtWriter/AlbumArtWriterJob.cs
+++ b/src/AlbumArtWriter/Banshee.AlbumArtWriter/AlbumArtWriterJob.cs
@@ -2,7 +2,7 @@
// AlbumArtWriterJob.cs
//
// Authors:
-// Kevin Anthony <Kevin@NosideRacing.com>
+// Kevin Anthony <Kevin.S.Anthony@gmail.com>
//
// Copyright (C) 2011 Kevin Anthony
//
@@ -43,35 +43,42 @@ namespace Banshee.AlbumArtWriter
{
public class AlbumArtWriterJob : DbIteratorJob
{
+ private AlbumArtWriterService service;
private DateTime CurrentTime;
private DateTime TimeOffset;
- public AlbumArtWriterJob () : base(AddinManager.CurrentLocalizer.GetString ("Saving Cover Art To Album folders"))
+
+ public AlbumArtWriterJob (AlbumArtWriterService in_service) : base(AddinManager.CurrentLocalizer.GetString ("Saving Cover Art To Album folders"))
{
+ service = in_service;
CurrentTime = DateTime.Now;
- TimeOffset = CurrentTime - TimeSpan.FromDays (7);
+ if ((service != null) && (service.ForceRecopy)){
+ TimeOffset = CurrentTime;
+ } else {
+ TimeOffset = CurrentTime - TimeSpan.FromDays(7);
+ }
CountCommand = new HyenaSqliteCommand (@"
- SELECT count(DISTINCT CoreTracks.AlbumID)
- FROM CoreTracks, CoreAlbums
- WHERE
- CoreTracks.PrimarySourceID = ? AND
- CoreTracks.AlbumID = CoreAlbums.AlbumID AND
- CoreTracks.AlbumID NOT IN (
- SELECT AlbumID from AlbumArtWriter WHERE
- SavedOrTried > 0 AND LastUpdated >= ?)
- ", ServiceManager.SourceManager.MusicLibrary.DbId, TimeOffset);
-
+ SELECT count(DISTINCT CoreTracks.AlbumID)
+ FROM CoreTracks, CoreAlbums
+ WHERE
+ CoreTracks.PrimarySourceID = ? AND
+ CoreTracks.AlbumID = CoreAlbums.AlbumID AND
+ CoreTracks.AlbumID NOT IN (
+ SELECT AlbumID from AlbumArtWriter WHERE
+ SavedOrTried > 0 AND LastUpdated >= ?)"
+ , ServiceManager.SourceManager.MusicLibrary.DbId, TimeOffset);
+
SelectCommand = new HyenaSqliteCommand (@"
- SELECT DISTINCT CoreAlbums.AlbumID, CoreAlbums.Title, CoreArtists.Name, CoreTracks.Uri, CoreTracks.TrackID
- FROM CoreTracks, CoreArtists, CoreAlbums
- WHERE
- CoreTracks.PrimarySourceID = ? AND
- CoreTracks.AlbumID = CoreAlbums.AlbumID AND
- CoreAlbums.ArtistID = CoreArtists.ArtistID AND
- CoreTracks.AlbumID NOT IN (
- SELECT AlbumID from AlbumArtWriter WHERE
- SavedOrTried > 0 AND LastUpdated >= ?)
- GROUP BY CoreTracks.AlbumID ORDER BY CoreTracks.DateUpdatedStamp DESC LIMIT ?", ServiceManager.SourceManager.MusicLibrary.DbId, TimeOffset, 1);
-
+ SELECT DISTINCT CoreAlbums.AlbumID, CoreAlbums.Title, CoreArtists.Name, CoreTracks.Uri, CoreTracks.TrackID
+ FROM CoreTracks, CoreArtists, CoreAlbums
+ WHERE
+ CoreTracks.PrimarySourceID = ? AND
+ CoreTracks.AlbumID = CoreAlbums.AlbumID AND
+ CoreAlbums.ArtistID = CoreArtists.ArtistID AND
+ CoreTracks.AlbumID NOT IN (
+ SELECT AlbumID from AlbumArtWriter WHERE
+ SavedOrTried > 0 AND LastUpdated >= ?)
+ GROUP BY CoreTracks.AlbumID ORDER BY CoreTracks.DateUpdatedStamp DESC LIMIT ?",
+ ServiceManager.SourceManager.MusicLibrary.DbId, TimeOffset, 1);
SetResources (Resource.Database);
PriorityHints = PriorityHints.LongRunning;
@@ -103,13 +110,28 @@ namespace Banshee.AlbumArtWriter
private void WriteArt (DatabaseTrackInfo track)
{
string ArtWorkPath = CoverArtSpec.GetPath (track.ArtworkId);
- string WritePath = Path.Combine (Path.GetDirectoryName (track.LocalPath), "album.jpg");
-
- if (File.Exists (ArtWorkPath)) {
+ string ext = null;
+ if (service.JPG){
+ ext = ".jpg";
+ } else if (service.PNG){
+ ext = ".png";
+ } else {
+ Log.Warning("Neather JPG or PNG is set, exiting Album Art Writer");
+ AbortThread();
+ }
+ string filename = service.ArtName+ext;
+ string WritePath = Path.Combine (Path.GetDirectoryName (track.LocalPath), filename);
+
+ if ((File.Exists (ArtWorkPath)) || (service.ForceRecopy)) {
if (!File.Exists (WritePath)) {
try {
- File.Copy (ArtWorkPath, WritePath);
- Log.DebugFormat ("Copying: {0} \t\t to: {1}", ArtWorkPath, WritePath);
+ if (!(ArtWorkPath.EndsWith(ext))){
+ ConvertFileType(ArtWorkPath,WritePath);
+ } else {
+ Log.DebugFormat ("Copying: {0} \t\t to: {1}", ArtWorkPath, WritePath);
+ File.Copy (ArtWorkPath, WritePath,service.ForceRecopy);
+ }
+
ServiceManager.DbConnection.Execute ("INSERT OR REPLACE INTO AlbumArtWriter (AlbumID, SavedOrTried,LastUpdated) VALUES (?, ?, ?)", track.AlbumId, 3, CurrentTime);
} catch (IOException error) {
ServiceManager.DbConnection.Execute ("INSERT OR REPLACE INTO AlbumArtWriter (AlbumID, SavedOrTried,LastUpdated) VALUES (?, ?, ?)", track.AlbumId, 1, CurrentTime);
@@ -124,7 +146,18 @@ namespace Banshee.AlbumArtWriter
ServiceManager.DbConnection.Execute ("INSERT OR REPLACE INTO AlbumArtWriter (AlbumID, SavedOrTried,LastUpdated) VALUES (?, ?, ?)", track.AlbumId, 1, CurrentTime);
}
}
-
+ private void ConvertFileType(string in_path, string out_path){
+ System.Drawing.Image in_image = System.Drawing.Image.FromFile(in_path);
+ if (in_path.EndsWith("jpg")){
+ //convert from jpg -> png
+ Log.DebugFormat("Converting JPG {0} to PNG {1}",in_path,out_path);
+ in_image.Save(out_path,System.Drawing.Imaging.ImageFormat.Png);
+ } else {
+ //convert from png -> jpg
+ Log.DebugFormat("Converting JPG {0} to PNG {1}",in_path,out_path);
+ in_image.Save(out_path,System.Drawing.Imaging.ImageFormat.Jpeg);
+ }
+ }
protected override void OnCancelled ()
{
AbortThread ();
diff --git a/src/AlbumArtWriter/Banshee.AlbumArtWriter/AlbumArtWriterService.cs b/src/AlbumArtWriter/Banshee.AlbumArtWriter/AlbumArtWriterService.cs
index 498d61c..34855f1 100644
--- a/src/AlbumArtWriter/Banshee.AlbumArtWriter/AlbumArtWriterService.cs
+++ b/src/AlbumArtWriter/Banshee.AlbumArtWriter/AlbumArtWriterService.cs
@@ -2,7 +2,7 @@
// AlbumArtWriterService.cs
//
// Authors:
-// Kevin Anthony <Kevin@NosideRacing.com>
+// Kevin Anthony <Kevin.S.Anthony@gmail.com>
//
// Copyright (C) 2011 Kevin Anthony
//
@@ -27,19 +27,26 @@
//
using System;
-
+using Gtk;
using Mono.Addins;
using Banshee.ServiceStack;
using Banshee.Configuration;
using Banshee.Sources;
+using Banshee.Gui;
+using Hyena;
+using Banshee.MediaEngine;
namespace Banshee.AlbumArtWriter
{
- public class AlbumArtWriterService : IExtensionService
+ public class AlbumArtWriterService : IExtensionService, IDisposable
{
private bool disposed;
private AlbumArtWriterJob job;
+ private InterfaceActionService action_service;
+ private ActionGroup actions;
+ private uint ui_manager_id;
+ private bool forced;
public AlbumArtWriterService ()
{
@@ -61,13 +68,32 @@ namespace Banshee.AlbumArtWriter
)");
DatabaseConfigurationClient.Client.Set<int>("AlbumArtWriter", "Version", 1);
}
- if (DatabaseConfigurationClient.Client.Get<int> ("AlbumArtWriter", "Version", 0) < 2) {
+ if (DatabaseConfigurationClient.Client.Get<int> ("AlbumArtWriter", "Version", 0) < 2) {
ServiceManager.DbConnection.Execute (@"ALTER TABLE AlbumArtWriter ADD COLUMN LastUpdated INTEGER");
DatabaseConfigurationClient.Client.Set<int>("AlbumArtWriter", "Version", 2);
}
if (!ServiceStartup ()) {
ServiceManager.SourceManager.SourceAdded += OnSourceAdded;
}
+
+ action_service = ServiceManager.Get<InterfaceActionService> ();
+
+ actions = new ActionGroup ("AlbumArtWriter");
+
+ actions.Add (new ActionEntry [] {
+ new ActionEntry ("AlbumArtWriterAction", null,
+ AddinManager.CurrentLocalizer.GetString ("Album Art Writer"), null,
+ null, null),
+ new ActionEntry ("AlbumArtWriterConfigureAction", Stock.Properties,
+ AddinManager.CurrentLocalizer.GetString ("_Configure..."), null,
+ AddinManager.CurrentLocalizer.GetString ("Configure the Album Art Writer plugin"), OnConfigure),
+ new ActionEntry ("AlbumArtWriterForceAction", Stock.Refresh,
+ AddinManager.CurrentLocalizer.GetString ("Force Copy"), null,
+ AddinManager.CurrentLocalizer.GetString ("Force Recopy of all Album Art"), onForce)
+ });
+
+ action_service.UIManager.InsertActionGroup (actions, 0);
+ ui_manager_id = action_service.UIManager.AddUiFromResource ("GlobalUI.xml");
}
private void OnSourceAdded (SourceAddedArgs args)
@@ -100,6 +126,10 @@ namespace Banshee.AlbumArtWriter
return;
}
+ action_service.UIManager.RemoveUi (ui_manager_id);
+ action_service.UIManager.RemoveActionGroup (actions);
+ actions = null;
+
ServiceManager.SourceManager.MusicLibrary.TracksAdded -= OnTracksAdded;
/* Setting SavedOrTried to 0 where SavedOrTried = 1 allows album art to be written next time */
ServiceManager.DbConnection.Execute (@"UPDATE AlbumArtWriter SET SavedOrTried = 0 WHERE SavedOrTried = 1");
@@ -109,14 +139,52 @@ namespace Banshee.AlbumArtWriter
public void StartWriterJob ()
{
if (job == null) {
- job = new AlbumArtWriterJob ();
+ job = new AlbumArtWriterJob (this);
job.Finished += delegate {
job = null;
+ forced = false;
};
job.Start ();
}
}
-
+ #region Actons
+ private void onForce(object o, EventArgs args){
+ Log.Information("Forcing Copy of album art");
+ forced = true;
+ StartWriterJob();
+ }
+ private void OnConfigure (object o, EventArgs args)
+ {
+ ConfigurationDialog dialog = new ConfigurationDialog (this);
+ dialog.Run ();
+ dialog.Destroy ();
+ }
+ #endregion
+ #region Configuration properties
+ internal bool AlbumArtWriterEnabled
+ {
+ get { return ConfigurationSchema.IsEnabled.Get (); }
+ set { ConfigurationSchema.IsEnabled.Set (value); }
+ } internal bool JPG
+ {
+ get { return ConfigurationSchema.JPG.Get (); }
+ set { ConfigurationSchema.JPG.Set (value); }
+ }
+ internal bool PNG
+ {
+ get { return ConfigurationSchema.PNG.Get (); }
+ set { ConfigurationSchema.PNG.Set (value); }
+ }
+ internal string ArtName
+ {
+ get { return ConfigurationSchema.ArtName.Get (); }
+ set { ConfigurationSchema.ArtName.Set (value); }
+ }
+ internal bool ForceRecopy{
+ get {return this.forced;}
+ set {this.forced = value;}
+ }
+ #endregion
private void OnTracksAdded (Source sender, TrackEventArgs args)
{
StartWriterJob ();
diff --git a/src/AlbumArtWriter/Banshee.AlbumArtWriter/ConfigurationDialog.cs b/src/AlbumArtWriter/Banshee.AlbumArtWriter/ConfigurationDialog.cs
new file mode 100644
index 0000000..e487713
--- /dev/null
+++ b/src/AlbumArtWriter/Banshee.AlbumArtWriter/ConfigurationDialog.cs
@@ -0,0 +1,98 @@
+//
+// AlbumArtWriterService.cs
+//
+// Authors:
+// Kevin Anthony <Kevin.S.Anthony@gmail.com>
+//
+// Copyright (C) 2011 Kevin Anthony
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+//
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+//
+
+
+using System;
+using Gtk;
+using Mono.Addins;
+
+using Banshee.Gui.Dialogs;
+
+namespace Banshee.AlbumArtWriter
+{
+ public class ConfigurationDialog : BansheeDialog
+ {
+ private AlbumArtWriterService service;
+ private Entry artname_entry;
+ private RadioButton jpg;
+ private RadioButton png;
+
+ public ConfigurationDialog (AlbumArtWriterService service) : base (AddinManager.CurrentLocalizer.GetString ("Album Art Writer Configuration"))
+ {
+ this.service = service;
+
+ Frame artframe = new Frame("artbox_frame");
+ artframe.Label = AddinManager.CurrentLocalizer.GetString("Output File Name (No Extension)");
+ HBox artname_box = new HBox ();
+ artname_box.PackStart (new Label (AddinManager.CurrentLocalizer.GetString ("File Name:")), false, false, 0);
+ artname_entry = new Entry ();
+ artname_box.PackStart (artname_entry, true, true, 3);
+
+ artframe.Add(artname_box);
+ artframe.ShadowType = (ShadowType) 4;
+
+ VBox.PackStart( artframe,false,false,3);
+
+ Frame fileframe = new Frame("artbox_frame");
+ fileframe.Label = AddinManager.CurrentLocalizer.GetString("Output File type");
+ HBox image_radio_button_h_box = new HBox ();
+ jpg = new RadioButton (null, "JPG File");
+ png = new RadioButton (jpg, "PNG File");
+ image_radio_button_h_box.PackStart(jpg, false, false, 3);
+ image_radio_button_h_box.PackStart(png, false, false, 3);
+ fileframe.Add(image_radio_button_h_box);
+ fileframe.ShadowType = (ShadowType) 4;
+ VBox.PackStart (fileframe, false, false, 3);
+ AddDefaultCloseButton ();
+ ShowAll();
+
+ // initialize values
+ artname_entry.Text = service.ArtName;
+ if (service.JPG){
+ jpg.Activate();
+ } else if (service.PNG) {
+ png.Activate();
+ }
+
+ // attach change handlers
+ artname_entry.Changed += new EventHandler (on_ArtName_Changed);
+ jpg.Toggled += new EventHandler(on_Radio_Clicked);
+ png.Toggled += new EventHandler(on_Radio_Clicked);
+ }
+
+ private void on_ArtName_Changed (object source, System.EventArgs args)
+ {
+ service.ArtName = artname_entry.Text;
+ }
+ private void on_Radio_Clicked (object source, System.EventArgs args)
+ {
+ service.JPG = jpg.Active;
+ service.PNG = png.Active;
+ }
+ }
+}
diff --git a/src/AlbumArtWriter/Banshee.AlbumArtWriter/ConfigurationSchema.cs b/src/AlbumArtWriter/Banshee.AlbumArtWriter/ConfigurationSchema.cs
new file mode 100644
index 0000000..f7dcf3a
--- /dev/null
+++ b/src/AlbumArtWriter/Banshee.AlbumArtWriter/ConfigurationSchema.cs
@@ -0,0 +1,68 @@
+//
+// ConfigurationSchema.cs
+//
+// Author:
+// Kevin Anthony <Kevin.S.Anthony@gmail.com>
+//
+// Copyright (C) 2011 Kevin Anthony
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+//
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+//
+
+
+using System;
+
+using Banshee.Configuration;
+
+namespace Banshee.AlbumArtWriter
+{
+ public static class ConfigurationSchema
+ {
+ private const string conf_namespace = "plugins.alarm";
+
+ public static readonly SchemaEntry<bool> IsEnabled
+ = new SchemaEntry<bool> (
+ conf_namespace, "is_enabled",
+ false, "Enable the Album Writer plugin",
+ ""
+ );
+
+ public static readonly SchemaEntry<bool> JPG
+ = new SchemaEntry<bool> (
+ conf_namespace, "write_jpg",
+ true, "Write Art as JPG",
+ ""
+ );
+
+ public static readonly SchemaEntry<bool> PNG
+ = new SchemaEntry<bool> (
+ conf_namespace, "write_png",
+ false, "Write Art as PNG",
+ ""
+ ); public static readonly SchemaEntry<string> ArtName
+ = new SchemaEntry<string> (
+ conf_namespace, "art_name",
+ "album", "The Name (Without Extension) to write the art",
+ ""
+ );
+
+ }
+}
+
diff --git a/src/AlbumArtWriter/Makefile.am b/src/AlbumArtWriter/Makefile.am
index 1540621..495ca9b 100644
--- a/src/AlbumArtWriter/Makefile.am
+++ b/src/AlbumArtWriter/Makefile.am
@@ -1,12 +1,16 @@
ASSEMBLY = Banshee.AlbumArtWriter
-LINK = $(BANSHEE_LIBS)
+LINK = $(BANSHEE_LIBS) -r:System.Drawing
SOURCES = \
Banshee.AlbumArtWriter/AlbumArtWriterJob.cs \
- Banshee.AlbumArtWriter/AlbumArtWriterService.cs
-
-RESOURCES = AlbumArtWriter.addin.xml
+ Banshee.AlbumArtWriter/AlbumArtWriterService.cs \
+ Banshee.AlbumArtWriter/ConfigurationDialog.cs \
+ Banshee.AlbumArtWriter/ConfigurationSchema.cs
+RESOURCES = \
+ AlbumArtWriter.addin.xml \
+ Resources/GlobalUI.xml
+
if ENABLE_ALBUMARTWRITER
include $(top_srcdir)/build/build.mk
else
diff --git a/src/AlbumArtWriter/Resources/GlobalUI.xml b/src/AlbumArtWriter/Resources/GlobalUI.xml
new file mode 100644
index 0000000..63f3cba
--- /dev/null
+++ b/src/AlbumArtWriter/Resources/GlobalUI.xml
@@ -0,0 +1,11 @@
+<ui>
+ <menubar name="MainMenu">
+ <menu name="ToolsMenu" action="ToolsMenuAction">
+ <menu name="AlbumArtWriter" action="AlbumArtWriterAction">
+ <menuitem name="AlbumArtWriterForce" action="AlbumArtWriterForceAction" />
+ <separator />
+ <menuitem name="AlbumArtWriterConfigure" action="AlbumArtWriterConfigureAction" />
+ </menu>
+ </menu>
+ </menubar>
+</ui>