More work with regards to imager
This commit is contained in:
parent
59b25749e1
commit
2fe68e7745
@ -13,6 +13,7 @@ main(int argc, char **argv)
|
|||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
int ret = 0;
|
int ret = 0;
|
||||||
|
Ecdb_Source *src;
|
||||||
|
|
||||||
if (!ecore_init())
|
if (!ecore_init())
|
||||||
{
|
{
|
||||||
@ -44,7 +45,15 @@ main(int argc, char **argv)
|
|||||||
i = 1;
|
i = 1;
|
||||||
while ((i < argc) && (argv))
|
while ((i < argc) && (argv))
|
||||||
{
|
{
|
||||||
ecore_list_append(proj->files, strdup(argv[i]));
|
if (ecore_file_exists(argv[i]))
|
||||||
|
{
|
||||||
|
if (ecore_file_is_dir(argv[i]))
|
||||||
|
ret = 1;
|
||||||
|
src = ecdb_source_new();
|
||||||
|
ecdb_source_data_set(src, argv[i], ret);
|
||||||
|
ecdb_source_child_append(proj->files, src);
|
||||||
|
ret = 0;
|
||||||
|
}
|
||||||
i++;
|
i++;
|
||||||
}
|
}
|
||||||
proj->simulate = TRUE;
|
proj->simulate = TRUE;
|
||||||
|
@ -46,7 +46,7 @@ ecdb_burn_project_init(Ecdb_Burn_Project *proj)
|
|||||||
proj->underrun_proof = TRUE;
|
proj->underrun_proof = TRUE;
|
||||||
proj->opc = TRUE;
|
proj->opc = TRUE;
|
||||||
proj->multi = TRUE;
|
proj->multi = TRUE;
|
||||||
proj->files = ecore_list_new();
|
proj->files = ecdb_source_new();
|
||||||
|
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
@ -311,7 +311,7 @@ ecdb_burn_finished(void *data, int type, void *event)
|
|||||||
/* To be removed from here at some point */
|
/* To be removed from here at some point */
|
||||||
Ecdb_Burn_Project *t;
|
Ecdb_Burn_Project *t;
|
||||||
t = ECDB_BURN(proj->proj);
|
t = ECDB_BURN(proj->proj);
|
||||||
ecore_list_destroy(t->files);
|
FREE(t->files);
|
||||||
FREE(t);
|
FREE(t);
|
||||||
FREE(proj);
|
FREE(proj);
|
||||||
ecore_event_add(ECORE_EVENT_SIGNAL_EXIT, NULL, NULL, NULL);
|
ecore_event_add(ECORE_EVENT_SIGNAL_EXIT, NULL, NULL, NULL);
|
||||||
|
@ -50,6 +50,19 @@ struct _Ecdb_Project_Info
|
|||||||
BurnDriveStatus stat;
|
BurnDriveStatus stat;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
/* Typecast a pointer to an Ecdb_Source */
|
||||||
|
#define ECDB_SOURCE(src) ((Ecdb_Source *) src)
|
||||||
|
|
||||||
|
typedef struct _Ecdb_Source Ecdb_Source;
|
||||||
|
struct _Ecdb_Source
|
||||||
|
{
|
||||||
|
const char *dst;
|
||||||
|
unsigned char rec:1;
|
||||||
|
unsigned char num_children;
|
||||||
|
Ecdb_Source **children;
|
||||||
|
IsoNode *node;
|
||||||
|
};
|
||||||
|
|
||||||
/* Typecast a pointer to an Ecdb_Project */
|
/* Typecast a pointer to an Ecdb_Project */
|
||||||
#define ECDB_PROJECT(proj) ((Ecdb_Project *) proj)
|
#define ECDB_PROJECT(proj) ((Ecdb_Project *) proj)
|
||||||
|
|
||||||
@ -60,7 +73,7 @@ struct _Ecdb_Burn_Project
|
|||||||
Ecdb_Project proj;
|
Ecdb_Project proj;
|
||||||
|
|
||||||
/* Files are important here */
|
/* Files are important here */
|
||||||
Ecore_List *files;
|
Ecdb_Source *files;
|
||||||
|
|
||||||
/* Ids */
|
/* Ids */
|
||||||
char *volume_id;
|
char *volume_id;
|
||||||
@ -111,17 +124,4 @@ struct _Ecdb_Erase_Project
|
|||||||
/* Typecast a pointer to an Ecdb_Erase_Project */
|
/* Typecast a pointer to an Ecdb_Erase_Project */
|
||||||
#define ECDB_ERASE(proj) ((Ecdb_Erase_Project *) proj)
|
#define ECDB_ERASE(proj) ((Ecdb_Erase_Project *) proj)
|
||||||
|
|
||||||
/* Typecast a pointer to an Ecdb_Source */
|
|
||||||
#define ECDB_SOURCE(src) ((Ecdb_Source *) src)
|
|
||||||
|
|
||||||
typedef struct _Ecdb_Source Ecdb_Source;
|
|
||||||
struct _Ecdb_Source
|
|
||||||
{
|
|
||||||
const char *dst;
|
|
||||||
unsigned char rec:1;
|
|
||||||
unsigned char num_children;
|
|
||||||
Ecdb_Source **children;
|
|
||||||
IsoNode *node;
|
|
||||||
};
|
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@ -89,48 +89,43 @@ ecdb_source_add_children_rec(Ecdb_Source *parent, IsoImage *image)
|
|||||||
i++;
|
i++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
/* Deprecated code */
|
|
||||||
|
|
||||||
/* Some limitations here need to be worked out
|
/* proj->files should only have children */
|
||||||
* Handle: audio, etc */
|
|
||||||
BurnSource *
|
BurnSource *
|
||||||
ecdb_image_project(Ecdb_Burn_Project *proj)
|
ecdb_image_project(Ecdb_Burn_Project *proj)
|
||||||
{
|
{
|
||||||
IsoImage *image;
|
IsoImage *image;
|
||||||
IsoDir *root;
|
Ecdb_Source *c;
|
||||||
IsoWriteOpts *opts;
|
IsoWriteOpts *opts;
|
||||||
BurnSource *data_src, *fifo_src;
|
BurnSource *data_src, *fifo_src;
|
||||||
char *path;
|
|
||||||
int ret;
|
|
||||||
|
|
||||||
efreet_mime_init();
|
if ((!proj->files) || (!proj->files->dst))
|
||||||
|
|
||||||
if ((!proj->files) || (ecore_list_empty_is(proj->files)))
|
|
||||||
return NULL;
|
return NULL;
|
||||||
else if (ecore_list_count(proj->files) == 1)
|
|
||||||
|
/* To handle already-suplied image files */
|
||||||
|
efreet_mime_init();
|
||||||
|
if (proj->files->num_children == 1)
|
||||||
{
|
{
|
||||||
path = ecore_list_first(proj->files);
|
efreet_mime_init();
|
||||||
if ((path) && (!ecore_file_is_dir(path)) &&
|
c = proj->files->children[0];
|
||||||
(!strcmp(efreet_mime_type_get(path),
|
if ((!ecore_file_is_dir(c->dst)) &&
|
||||||
|
(!strcmp(efreet_mime_type_get(c->dst),
|
||||||
"application/x-cd-image")))
|
"application/x-cd-image")))
|
||||||
{
|
{
|
||||||
path = ecore_list_first_remove(proj->files);
|
data_src = burn_file_source_new(c->dst, NULL);
|
||||||
data_src = burn_file_source_new(path, NULL);
|
|
||||||
FREE(path);
|
|
||||||
goto FIFO_CREATE;
|
goto FIFO_CREATE;
|
||||||
}
|
}
|
||||||
|
efreet_mime_shutdown();
|
||||||
}
|
}
|
||||||
|
|
||||||
ret = iso_image_new(proj->volume_id, &image);
|
/* Otherwise we have a bunch of files */
|
||||||
|
if (!iso_image_new(proj->volume_id, &image))
|
||||||
if (!ret)
|
|
||||||
{
|
{
|
||||||
printf("Failed to create an iso image!\n");
|
printf("Failed to create image!\n");
|
||||||
iso_finish();
|
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Disk ids */
|
/* Set all ids */
|
||||||
if (proj->publisher_id)
|
if (proj->publisher_id)
|
||||||
iso_image_set_publisher_id(image, proj->publisher_id);
|
iso_image_set_publisher_id(image, proj->publisher_id);
|
||||||
if (proj->data_preparer_id)
|
if (proj->data_preparer_id)
|
||||||
@ -147,72 +142,38 @@ ecdb_image_project(Ecdb_Burn_Project *proj)
|
|||||||
if (proj->biblio_id)
|
if (proj->biblio_id)
|
||||||
iso_image_set_biblio_file_id(image, proj->biblio_id);
|
iso_image_set_biblio_file_id(image, proj->biblio_id);
|
||||||
|
|
||||||
/* Write Options - default to distribution for now */
|
if (!iso_write_opts_new(&opts, 2))
|
||||||
ret = iso_write_opts_new(&opts, 2);
|
|
||||||
if (!ret)
|
|
||||||
{
|
{
|
||||||
printf("Failed to create writing options!\n");
|
printf("Failed to create writing options!\n");
|
||||||
iso_image_unref(image);
|
iso_image_unref(image);
|
||||||
iso_finish();
|
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Most set by default with 2 ^ */
|
/* And some write opts stuff */
|
||||||
iso_write_opts_set_iso_level(opts, proj->iso_level);
|
iso_write_opts_set_iso_level(opts, proj->iso_level);
|
||||||
iso_write_opts_set_joliet(opts, proj->use_joliet);
|
iso_write_opts_set_joliet(opts, proj->use_joliet);
|
||||||
iso_write_opts_set_rockridge(opts, proj->use_rockridge);
|
iso_write_opts_set_rockridge(opts, proj->use_rockridge);
|
||||||
iso_write_opts_set_iso1999(opts, proj->iso1990);
|
iso_write_opts_set_iso1999(opts, proj->iso1990);
|
||||||
//iso_write_opts_set_appendable(opts, proj->appendable);
|
iso_write_opts_set_appendable(opts, proj->multi);
|
||||||
|
|
||||||
iso_tree_set_follow_symlinks(image, proj->follow_symlinks);
|
iso_tree_set_follow_symlinks(image, proj->follow_symlinks);
|
||||||
iso_tree_set_ignore_hidden(image, proj->ignore_hidden);
|
iso_tree_set_ignore_hidden(image, proj->ignore_hidden);
|
||||||
iso_tree_set_ignore_special(image, proj->ignore_special);
|
iso_tree_set_ignore_special(image, proj->ignore_special);
|
||||||
|
|
||||||
root = iso_image_get_root(image);
|
/* actually fill image with some files now */
|
||||||
ecore_list_first_goto(proj->files);
|
proj->files->node = ISO_NODE(iso_image_get_root(image));
|
||||||
|
ecdb_source_add_children_rec(proj->files, image);
|
||||||
ret = 0;
|
|
||||||
while ((path = ecore_list_remove(proj->files)))
|
|
||||||
{
|
|
||||||
/* For now just this, in future special, symlink */
|
|
||||||
if (ecore_file_is_dir(path))
|
|
||||||
iso_tree_add_dir_rec(image, root, path);
|
|
||||||
else if (ecore_file_exists(path))
|
|
||||||
iso_tree_add_node(image, root, path, NULL);
|
|
||||||
else
|
|
||||||
{
|
|
||||||
FREE(path);
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
FREE(path);
|
|
||||||
ret++;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!ret)
|
|
||||||
{
|
|
||||||
printf("No files appended to image!\n");
|
|
||||||
iso_image_unref(image);
|
|
||||||
iso_write_opts_free(opts);
|
|
||||||
iso_finish();
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
/* Make the burn source here */
|
||||||
iso_image_create_burn_source(image, opts, &data_src);
|
iso_image_create_burn_source(image, opts, &data_src);
|
||||||
iso_write_opts_free(opts);
|
iso_write_opts_free(opts);
|
||||||
iso_image_unref(image);
|
iso_image_unref(image);
|
||||||
|
|
||||||
FIFO_CREATE:
|
/* And, convert to fifo */
|
||||||
|
FIFO_CREATE:
|
||||||
fifo_src = burn_fifo_source_new(data_src,
|
fifo_src = burn_fifo_source_new(data_src,
|
||||||
proj->fifo_chunksize, proj->fifo_chunks, 0);
|
proj->fifo_chunksize, proj->fifo_chunks, 0);
|
||||||
burn_source_free(data_src);
|
burn_source_free(data_src);
|
||||||
|
|
||||||
/* I can't call this now, as it destroys the libiso_msgr before the
|
|
||||||
* library is finished - I'll just init and finish once...
|
|
||||||
*/
|
|
||||||
|
|
||||||
//iso_finish();
|
|
||||||
efreet_mime_shutdown();
|
|
||||||
|
|
||||||
return fifo_src;
|
return fifo_src;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -33,7 +33,7 @@ ecdb_shutdown(void *data, int type, void *event)
|
|||||||
ecore_list_destroy(em->drives);
|
ecore_list_destroy(em->drives);
|
||||||
free(em);
|
free(em);
|
||||||
ecore_main_loop_quit();
|
ecore_main_loop_quit();
|
||||||
return 0;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
Loading…
Reference in New Issue
Block a user