Пример #1
0
bool UploadDialog::deleteIpodAlbum(IpodAlbumItem* const album) const
{
    kDebug() << "deleting album: " << album->name() << ", and removing all photos" ;
    itdb_photodb_photoalbum_remove( m_itdb, album->photoAlbum(), true/*remove photos*/);

    return true;
}
Пример #2
0
static int do_remove (int argc, char **argv)
{
    GError *error = NULL;
    Itdb_PhotoDB *db;
    Itdb_PhotoAlbum *album = NULL;

    if (argc < 4)
    {
	g_print (_("Insufficient number of command line arguments.\n"));
	usage (argc, argv);
	return 1;
    }

    db = itdb_photodb_parse (argv[2], &error);
    if (db == NULL)
    {
	if (error)
	{
	    g_print (_("Error reading iPod photo database (%s).\n"),
		     error->message);
	    g_error_free (error);
	    error = NULL;
	}
	else
	{
	    g_print (_("Error reading iPod photo database.\n"));
	}
	return 1;
    }

    /* Find specified photoalbum */
    if (strcmp (argv[3], "NULL") != 0)
    {
	album = itdb_photodb_photoalbum_by_name (db, argv[3]);
	if (!album)
	{
	    g_print (_("Specified album '%s' not found. Aborting.\n"),
		     argv[3]);
	    itdb_photodb_free (db);
	    return 1;
	}
    }

    if (argc == 4)
    {
	/* Remove photoalbum altogether, but preserve pics */
	if (album == NULL)
	{
	    g_print (_("Cannot remove Photo Library playlist. Aborting.\n"));
	    itdb_photodb_free (db);
	    return 1;
	}
	itdb_photodb_photoalbum_remove (db, album, FALSE);
    }
    else
    {
	/* Remove specified pictures */
	int i;
	for (i=4; i<argc; ++i)
	{
	    Itdb_Artwork *photo;
	    guint32 id;

	    id = g_strtod (argv[i], NULL);

	    photo = get_photo_by_id (db, id);

	    if (photo == NULL)
	    {
		g_print (_("Warning: could not find photo with ID <%d>. Skipping...\n"),
			 id);
	    }
	    else
	    {
		itdb_photodb_remove_photo (db, album, photo);
	    }
	}
    }

    itdb_photodb_write (db, NULL);
    itdb_photodb_free (db);
    return 0;
}