## RhythmDBImportJob RhythmDBImportJob — batch import job |

## Functions

RhythmDBImportJob * | rhythmdb_import_job_new ()
void | rhythmdb_import_job_add_uri ()
void | rhythmdb_import_job_start ()
void | rhythmdb_import_job_cancel ()
gboolean | rhythmdb_import_job_complete ()
gboolean | rhythmdb_import_job_scan_complete ()
int | rhythmdb_import_job_get_total ()
int | rhythmdb_import_job_get_imported ()
int | rhythmdb_import_job_get_processed ()

## Properties

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

## Signals

void | complete | Run Last
void | entry-added | Run Last
void | scan-complete | Run Last
void | status-changed | Run Last

## Types and Values

struct | RhythmDBImportJob
struct | RhythmDBImportJobClass

## Object Hierarchy

        GObject
        ╰── RhythmDBImportJob

## Implemented Interfaces

RhythmDBImportJob implements RBTaskProgress.

## 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.

## Functions

### 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.

#### Parameters

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.

#### Parameters

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.

#### Parameters

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.

#### Parameters

job | the RhythmDBImportJob |

### rhythmdb_import_job_complete ()

    gboolean
    rhythmdb_import_job_complete (RhythmDBImportJob *job);

Returns whether the import job is complete.

#### Parameters

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.

#### Parameters

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.

#### Parameters

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.

#### Parameters

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.

#### Parameters

job | the RhythmDBImportJob |

#### Returns

file count

## Types and Values

### 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);
    };

## Property Details

### The `“db”` property

      “db”                       RhythmDB *

RhythmDB object.

Flags: Read / Write / Construct Only

### The `“entry-type”` property

      “entry-type”               RhythmDBEntryType *

Entry type to use for entries added by this job.

Flags: Read / Write / Construct Only

### The `“error-type”` property

      “error-type”               RhythmDBEntryType *

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

Flags: Read / Write / Construct Only

### The `“ignore-type”` property

      “ignore-type”              RhythmDBEntryType *

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

Flags: Read / Write / Construct Only

## Signal Details

### The `“complete”` signal

    void
    user_function (RhythmDBImportJob *job,
                   gint               total,
                   gpointer           user_data)

Emitted when the whole import job is complete.

#### Parameters

job | the RhythmDBImportJob |
total | the number of items imported. |
user_data | user data set when the signal handler was connected. |

Flags: Run Last

### The `“entry-added”` signal

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

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

#### Parameters

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

Flags: Run Last

### The `“scan-complete”` signal

    void
    user_function (RhythmDBImportJob *job,
                   gint               total,
                   gpointer           user_data)

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

#### Parameters

job | the RhythmDBImportJob |
total | the number of items scanned. |
user_data | user data set when the signal handler was connected. |

Flags: Run Last

### The `“status-changed”` signal

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

Emitted when the status of the import job has changed.

#### Parameters

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. |

Flags: Run Last