Пример #1
0
        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);
        }
        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);
        }
        public AlbumArtWriterJob(AlbumArtWriterService in_service) : base(AddinManager.CurrentLocalizer.GetString("Saving Cover Art To Album folders"))
        {
            service     = in_service;
            CurrentTime = DateTime.Now;
            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);

            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);
            SetResources(Resource.Database);
            PriorityHints = PriorityHints.LongRunning;

            IsBackground = true;
            CanCancel    = true;
            DelayShow    = true;
        }
        public AlbumArtWriterJob(AlbumArtWriterService in_service)
            : base(AddinManager.CurrentLocalizer.GetString ("Saving Cover Art To Album folders"))
        {
            service = in_service;
            CurrentTime = DateTime.Now;
            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);

            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);
            SetResources (Resource.Database);
            PriorityHints = PriorityHints.LongRunning;

            IsBackground = true;
            CanCancel = true;
            DelayShow = true;
        }