RhythmDBImportJob

## RhythmDBImportJob RhythmDBImportJob — batch import job |

## Synopsis

    struct              RhythmDBImportJob;
    struct              RhythmDBImportJobClass;
    RhythmDBImportJob * rhythmdb_import_job_new             (RhythmDB *db,
                                                             RhythmDBEntryType *entry_type,
                                                             RhythmDBEntryType *ignore_type,
                                                             RhythmDBEntryType *error_type);
    void                rhythmdb_import_job_add_uri         (RhythmDBImportJob *job,
                                                             const char *uri);
    void                rhythmdb_import_job_start           (RhythmDBImportJob *job);
    void                rhythmdb_import_job_cancel          (RhythmDBImportJob *job);
    gboolean            rhythmdb_import_job_complete        (RhythmDBImportJob *job);
    gboolean            rhythmdb_import_job_scan_complete   (RhythmDBImportJob *job);
    int                 rhythmdb_import_job_get_total       (RhythmDBImportJob *job);
    int                 rhythmdb_import_job_get_imported    (RhythmDBImportJob *job);
    int                 rhythmdb_import_job_get_processed   (RhythmDBImportJob *job);

## Object Hierarchy

      GObject
       +----RhythmDBImportJob

## Implemented Interfaces

RhythmDBImportJob implements RBTaskProgress.

## Properties

      "db"                       RhythmDB*             : Read / Write / Construct Only
      "entry-type"               RhythmDBEntryType*    : Read / Write / Construct Only
      "error-type"               RhythmDBEntryType*    : Read / Write / Construct Only
      "ignore-type"              RhythmDBEntryType*    : Read / Write / Construct Only

## Signals

      "complete"                                       : Run Last
      "entry-added"                                    : Run Last
      "scan-complete"                                  : Run Last
      "status-changed"                                 : Run Last

## Description

Tracks the addition to the database of files under a set of directories, providing status information.

The entry types to use for the database entries added by the import job are specified on creation.

## Details

### struct RhythmDBImportJob

    struct RhythmDBImportJob;

### struct RhythmDBImportJobClass

    struct RhythmDBImportJobClass {
    	GObjectClass parent_class;

    	/* signals */
    	void (*entry_added) (RhythmDBImportJob *job, RhythmDBEntry *entry);
    	void (*status_changed) (RhythmDBImportJob *job, int total, int imported);
    	void (*scan_complete) (RhythmDBImportJob *job, int total);
    	void (*complete) (RhythmDBImportJob *job, int total);
    };

### rhythmdb_import_job_new ()

    RhythmDBImportJob * rhythmdb_import_job_new             (RhythmDB *db,
                                                             RhythmDBEntryType *entry_type,
                                                             RhythmDBEntryType *ignore_type,
                                                             RhythmDBEntryType *error_type);

Creates a new import job with the specified entry types. Before starting the job, the caller must add one or more paths to import.

`db` : | the RhythmDB object
`entry_type` : | the RhythmDBEntryType to use for normal entries
`ignore_type` : | the RhythmDBEntryType to use for ignored files (or NULL to not create ignore entries)
`error_type` : | the RhythmDBEntryType to use for import error entries (or NULL for none)
Returns : | new RhythmDBImportJob object.

### rhythmdb_import_job_add_uri ()

    void                rhythmdb_import_job_add_uri         (RhythmDBImportJob *job,
                                                             const char *uri);

Adds a URI to import. All files under the specified URI will be imported.

`job` : | a RhythmDBImportJob
`uri` : | the URI to import

### rhythmdb_import_job_start ()

    void                rhythmdb_import_job_start           (RhythmDBImportJob *job);

Starts the import job. After this method has been called, no more URIs may be added to the import job. May only be called once for a given import job.

`job` : | the RhythmDBImportJob

### rhythmdb_import_job_cancel ()

    void                rhythmdb_import_job_cancel          (RhythmDBImportJob *job);

Cancels the import job. The job will cease as soon as possible. More directories may be scanned and more files may be imported before the job actually ceases.

`job` : | the RhythmDBImportJob

### rhythmdb_import_job_complete ()

    gboolean            rhythmdb_import_job_complete        (RhythmDBImportJob *job);

Returns whether the import job is complete.

`job` : | the RhythmDBImportJob
Returns : | TRUE if complete.

### rhythmdb_import_job_scan_complete ()

    gboolean            rhythmdb_import_job_scan_complete   (RhythmDBImportJob *job);

Returns whether the directory scan phase of the import job is complete.

`job` : | the RhythmDBImportJob
Returns : | TRUE if complete

### rhythmdb_import_job_get_total ()

    int                 rhythmdb_import_job_get_total       (RhythmDBImportJob *job);

Returns the total number of files that will be processed by this import job. This increases as the import directories are scanned.

`job` : | the RhythmDBImportJob
Returns : | the total number of files to be processed

### rhythmdb_import_job_get_imported ()

    int                 rhythmdb_import_job_get_imported    (RhythmDBImportJob *job);

Returns the number of files successfully imported by the import job so far.

`job` : | the RhythmDBImportJob
Returns : | file count

### rhythmdb_import_job_get_processed ()

    int                 rhythmdb_import_job_get_processed   (RhythmDBImportJob *job);

Returns the number of files processed by the import job so far.

`job` : | the RhythmDBImportJob
Returns : | file count

## Property Details

### The `"db"` property

      "db"                       RhythmDB*             : Read / Write / Construct Only

RhythmDB object.

### The `"entry-type"` property

      "entry-type"               RhythmDBEntryType*    : Read / Write / Construct Only

Entry type to use for entries added by this job.

### The `"error-type"` property

      "error-type"               RhythmDBEntryType*    : Read / Write / Construct Only

Entry type to use for import error entries added by this job.

### The `"ignore-type"` property

      "ignore-type"              RhythmDBEntryType*    : Read / Write / Construct Only

Entry type to use for ignored entries added by this job.

## Signal Details

### The `"complete"` signal

    void                user_function                      (RhythmDBImportJob *job,
                                                            gint               arg1,
                                                            gpointer           user_data)      : Run Last

Emitted when the whole import job is complete.

`job` : | the RhythmDBImportJob
`user_data` : | user data set when the signal handler was connected.

### The `"entry-added"` signal

    void                user_function                      (RhythmDBImportJob *job,
                                                            RhythmDBEntry     *entry,
                                                            gpointer           user_data)      : Run Last

Emitted when an entry has been added to the database by the import job.

`job` : | the RhythmDBImportJob
`entry` : | the newly added RhythmDBEntry
`user_data` : | user data set when the signal handler was connected.

### The `"scan-complete"` signal

    void                user_function                      (RhythmDBImportJob *job,
                                                            gint               arg1,
                                                            gpointer           user_data)      : Run Last

Emitted when the directory scan is complete. Once the scan is complete, the total number of files to be processed will not change.

`job` : | the RhythmDBImportJob
`user_data` : | user data set when the signal handler was connected.

### The `"status-changed"` signal

    void                user_function                      (RhythmDBImportJob *job,
                                                            gint               total,
                                                            gint               imported,
                                                            gpointer           user_data)      : Run Last

Emitted when the status of the import job has changed.

`job` : | the RhythmDBImportJob
`total` : | the current total number of files to process
`imported` : | the current count of files imported
`user_data` : | user data set when the signal handler was connected.