Example #1
0
        public void Begin(string device, bool enableErrorCorrection)
        {
            try {
                Profile profile             = null;
                ProfileConfiguration config = ServiceManager.MediaProfileManager.GetActiveProfileConfiguration("cd-importing");

                if (config != null)
                {
                    profile = config.Profile;
                }
                else
                {
                    profile = ServiceManager.MediaProfileManager.GetProfileForMimeType("audio/vorbis")
                              ?? ServiceManager.MediaProfileManager.GetProfileForMimeType("audio/flac");
                    if (profile != null)
                    {
                        Log.InformationFormat("Using default/fallback encoding profile: {0}", profile.Name);
                        ProfileConfiguration.SaveActiveProfile(profile, "cd-importing");
                    }
                }

                if (profile != null)
                {
                    encoder_pipeline = profile.Pipeline.GetProcessById("gstreamer");
                    output_extension = profile.OutputFileExtension;
                }

                if (String.IsNullOrEmpty(encoder_pipeline))
                {
                    throw new ApplicationException();
                }

                Hyena.Log.InformationFormat("Ripping using encoder profile `{0}' with pipeline: {1}", profile.Name, encoder_pipeline);
            } catch (Exception e) {
                throw new ApplicationException(Catalog.GetString("Could not find an encoder for ripping."), e);
            }

            try {
                int paranoia_mode = enableErrorCorrection ? 255 : 0;
                handle = new HandleRef(this, br_new(device, paranoia_mode, encoder_pipeline));

                progress_handler = new RipperProgressHandler(OnNativeProgress);
                br_set_progress_callback(handle, progress_handler);

                mimetype_handler = new RipperMimeTypeHandler(OnNativeMimeType);
                br_set_mimetype_callback(handle, mimetype_handler);

                finished_handler = new RipperFinishedHandler(OnNativeFinished);
                br_set_finished_callback(handle, finished_handler);

                error_handler = new RipperErrorHandler(OnNativeError);
                br_set_error_callback(handle, error_handler);
            } catch (Exception e) {
                throw new ApplicationException(Catalog.GetString("Could not create CD ripping driver."), e);
            }
        }
        public ProfileComboBoxConfigurable(MediaProfileManager manager, string configurationId, Box parent)
        {
            HBox editor = new HBox();

            configuration_id = configurationId;
            combo            = new ProfileComboBox(manager);
            combo.Show();

            button          = new ProfileConfigureButton(configurationId);
            button.ComboBox = combo;
            button.Show();

            editor.Spacing = 5;
            editor.PackStart(combo, true, true, 0);
            editor.PackStart(button, false, false, 0);
            editor.Show();

            ProfileConfiguration config = manager.GetActiveProfileConfiguration(configurationId);

            if (config != null)
            {
                Combo.SetActiveProfile(config.Profile);
            }

            description = new DescriptionLabel(delegate {
                var profile = Combo.ActiveProfile;
                return(profile != null ? profile.Description : "");
            });

            Combo.Changed += delegate {
                if (Combo.ActiveProfile != null)
                {
                    Hyena.Log.DebugFormat("Setting active encoding profile: {0} (saved to {1})",
                                          Combo.ActiveProfile.Name, configurationId);
                    ProfileConfiguration.SaveActiveProfile(Combo.ActiveProfile, configurationId);
                    description.Update();
                }
            };

            Combo.StateChanged += delegate {
                if (Combo.State == StateType.Insensitive && description.Parent != null)
                {
                    ((Container)parent ?? this).Remove(description);
                }
                else if (description.Parent == null)
                {
                    description.PackInto(parent ?? this, parent != null);
                }
            };

            Spacing = 5;
            PackStart(editor, true, true, 0);
            description.PackInto(parent ?? this, parent != null);
        }
Example #3
0
        public void Begin(string device, bool enableErrorCorrection)
        {
            try {
                this.device        = device;
                this.paranoia_mode = enableErrorCorrection ? 255 : 0;
                Profile profile             = null;
                ProfileConfiguration config = ServiceManager.MediaProfileManager.GetActiveProfileConfiguration("cd-importing");

                if (config != null)
                {
                    profile = config.Profile;
                }
                else
                {
                    profile = ServiceManager.MediaProfileManager.GetProfileForMimeType("audio/vorbis")
                              ?? ServiceManager.MediaProfileManager.GetProfileForMimeType("audio/flac");
                    if (profile != null)
                    {
                        Log.InformationFormat("Using default/fallback encoding profile: {0}", profile.Name);
                        ProfileConfiguration.SaveActiveProfile(profile, "cd-importing");
                    }
                }

                if (profile != null)
                {
                    encoder_pipeline = profile.Pipeline.GetProcessById("gstreamer");
                    output_extension = profile.OutputFileExtension;
                }

                if (String.IsNullOrEmpty(encoder_pipeline))
                {
                    throw new ApplicationException();
                }
                timer           = new System.Timers.Timer();
                timer.Interval  = 200;
                timer.AutoReset = true;
                timer.Elapsed  += OnTick;
                Hyena.Log.InformationFormat("Ripping using encoder profile `{0}' with pipeline: {1}", profile.Name, encoder_pipeline);
            } catch (Exception e) {
                throw new ApplicationException(Catalog.GetString("Could not find an encoder for ripping."), e);
            }
        }