2008-04-01 21:30:41 +00:00
|
|
|
#include "ecdb.h"
|
|
|
|
|
|
|
|
/* Some limitations here need to be worked out
|
|
|
|
* Handle: audio, etc */
|
|
|
|
BurnSource *
|
2008-05-15 00:14:33 +00:00
|
|
|
ecdb_image_project(Ecdb_Burn_Project *proj)
|
2008-04-01 21:30:41 +00:00
|
|
|
{
|
|
|
|
IsoImage *image;
|
|
|
|
IsoDir *root;
|
|
|
|
IsoWriteOpts *opts;
|
|
|
|
BurnSource *data_src, *fifo_src;
|
|
|
|
char *path;
|
|
|
|
int ret;
|
|
|
|
|
|
|
|
efreet_mime_init();
|
|
|
|
|
|
|
|
if ((!proj->files) || (ecore_list_empty_is(proj->files)))
|
|
|
|
return NULL;
|
|
|
|
else if (ecore_list_count(proj->files) == 1)
|
|
|
|
{
|
|
|
|
path = ecore_list_first(proj->files);
|
|
|
|
if ((path) && (!ecore_file_is_dir(path)) &&
|
|
|
|
(!strcmp(efreet_mime_type_get(path),
|
|
|
|
"application/x-cd-image")))
|
|
|
|
{
|
|
|
|
path = ecore_list_first_remove(proj->files);
|
|
|
|
data_src = burn_file_source_new(path, NULL);
|
|
|
|
FREE(path);
|
|
|
|
goto FIFO_CREATE;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
ret = iso_image_new(proj->volume_id, &image);
|
|
|
|
|
|
|
|
if (!ret)
|
|
|
|
{
|
|
|
|
printf("Failed to create an iso image!\n");
|
|
|
|
iso_finish();
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Disk ids */
|
|
|
|
if (proj->publisher_id)
|
|
|
|
iso_image_set_publisher_id(image, proj->publisher_id);
|
|
|
|
if (proj->data_preparer_id)
|
|
|
|
iso_image_set_data_preparer_id(image,
|
|
|
|
proj->data_preparer_id);
|
|
|
|
if (proj->system_id)
|
|
|
|
iso_image_set_system_id(image, proj->system_id);
|
|
|
|
if (proj->application_id)
|
|
|
|
iso_image_set_application_id(image, proj->application_id);
|
|
|
|
if (proj->copywrite_id)
|
|
|
|
iso_image_set_copyright_file_id(image, proj->copywrite_id);
|
|
|
|
if (proj->abstract_id)
|
|
|
|
iso_image_set_abstract_file_id(image, proj->abstract_id);
|
|
|
|
if (proj->biblio_id)
|
|
|
|
iso_image_set_biblio_file_id(image, proj->biblio_id);
|
|
|
|
|
|
|
|
/* Write Options - default to distribution for now */
|
|
|
|
ret = iso_write_opts_new(&opts, 2);
|
|
|
|
if (!ret)
|
|
|
|
{
|
|
|
|
printf("Failed to create writing options!\n");
|
|
|
|
iso_image_unref(image);
|
|
|
|
iso_finish();
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Most set by default with 2 ^ */
|
|
|
|
iso_write_opts_set_iso_level(opts, proj->iso_level);
|
|
|
|
iso_write_opts_set_joliet(opts, proj->use_joliet);
|
|
|
|
iso_write_opts_set_rockridge(opts, proj->use_rockridge);
|
|
|
|
iso_write_opts_set_iso1999(opts, proj->iso1990);
|
|
|
|
//iso_write_opts_set_appendable(opts, proj->appendable);
|
|
|
|
|
|
|
|
iso_tree_set_follow_symlinks(image, proj->follow_symlinks);
|
|
|
|
iso_tree_set_ignore_hidden(image, proj->ignore_hidden);
|
|
|
|
iso_tree_set_ignore_special(image, proj->ignore_special);
|
|
|
|
|
|
|
|
root = iso_image_get_root(image);
|
|
|
|
ecore_list_first_goto(proj->files);
|
|
|
|
|
|
|
|
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();
|
2008-04-07 23:02:05 +00:00
|
|
|
return NULL;
|
2008-04-01 21:30:41 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
iso_image_create_burn_source(image, opts, &data_src);
|
|
|
|
iso_write_opts_free(opts);
|
|
|
|
iso_image_unref(image);
|
|
|
|
|
|
|
|
FIFO_CREATE:
|
|
|
|
fifo_src = burn_fifo_source_new(data_src,
|
|
|
|
proj->fifo_chunksize, proj->fifo_chunks, 0);
|
|
|
|
burn_source_free(data_src);
|
2008-04-08 01:45:30 +00:00
|
|
|
|
|
|
|
/* I can't call this now, as it destroys the libiso_msgr before the
|
|
|
|
* library is finished - I'll just init and finish once...
|
|
|
|
*/
|
2008-05-15 00:14:33 +00:00
|
|
|
|
2008-04-08 01:45:30 +00:00
|
|
|
//iso_finish();
|
2008-04-01 21:30:41 +00:00
|
|
|
efreet_mime_shutdown();
|
|
|
|
|
|
|
|
return fifo_src;
|
|
|
|
}
|
|
|
|
|