Batch delete bitstreams in the Bundle: THUMBNAIL

118 views
Skip to first unread message

euler

unread,
Jun 8, 2020, 8:47:23 PM6/8/20
to DSpace Technical Support
Dear All,

I have posted this query in SO [1] but so far I have no responses so I'll try my luck here. I would like to ask how to batch delete bitstreams that are in the Bundle: THUMBNAIL. Would it also be possible to only limit the deletion within a specific community or collection? Since there are collections that I have manually added the thumbnails and I don't want them to be deleted. In this regard, I am also asking if it is also possible to limit the deletion only for those with the description: IM Thumbnail.

So to recap, below are my specific conditions:

  • Delete all thumbnails within a specific community/collection
  • Delete all thumbnails within a specific community/collection only if it contains the description "IM Thumbnail"
Please note that I am aware of the --force flag in filter-media to regenerate the thumbnail but this will not work for manually added thumbnails. I have also items that have no ORIGINAL bundle but I have manually added the thumbnail so the --force flag is not applicable.

Thanks in advance and best regards,
Euler

Fatih Güneş

unread,
Jun 9, 2020, 1:20:54 AM6/9/20
to DSpace Technical Support
Hi Euler,
You can REST api for your goal. A script including:
GET /collections/{collectionId}/items
GET /items/{item id}/bitstreams
DELETE /items/{item id}/bitstreams/{bitstream id}

Best Regards,
Fatih

euler

unread,
Jun 9, 2020, 2:12:44 AM6/9/20
to DSpace Technical Support
Hi Fatih,

Thank you for your response. Creating a script and using the REST API for this, unfortunately, is unattainable for me. I'm expecting more on the database level for this and so an SQL query would be very much appreciated.

Thank you.

Best regards,
Euler

Nemiz, Elvi

unread,
Jun 9, 2020, 5:25:43 AM6/9/20
to DSpace Technical Support, joanca...@gmail.com
I found this thread [1] from the DSpace Community Mailing list. Thanks a lot for Joan Caparros for sharing his curation task code, now I can achieve my goal in deleting all thumbnails within a specific community/collection just by specifying the -i flag. I also created a curation task for deleting bitstreams in the TEXT bundle just by modifying his code replacing THUMBNAIL with TEXT. I'm happy that I don't have to do database manipulation. I wonder if it is possible to achieve my other todo task which is deleting thumbnails if it contains the description "IM Thumbnail" using Joan's curation task.


Thanks in advance!
Euler

--
All messages to this mailing list should adhere to the DuraSpace Code of Conduct: https://duraspace.org/about/policies/code-of-conduct/
---
You received this message because you are subscribed to a topic in the Google Groups "DSpace Technical Support" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/dspace-tech/l92kk4nvotU/unsubscribe.
To unsubscribe from this group and all its topics, send an email to dspace-tech...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/dspace-tech/0a177d5f-0778-4397-ae7e-4f02be4c9892o%40googlegroups.com.

Joan Caparros

unread,
Jun 9, 2020, 11:18:23 AM6/9/20
to DSpace Technical Support
Hi Euler,
I will try to add some code like:

if len(myBitstreams)>0:
    for k in range(0,len(myBitstreams)):
        if myBitstreams[k].getDescription() == 'IM Thumbnail':
            print "DELETE "+myBitstreams[k].getDescription()
            bitstreamService = ContentServiceFactory.getInstance().getBitstreamService()    
            bitstreamService.delete(Curator.curationContext(),myBitstreams[0])


I didn't check it but the methods are there and it should work.
Bests 
Joan 

El dimarts, 9 juny de 2020 11:25:43 UTC+2, euler va escriure:
To unsubscribe from this group and all its topics, send an email to dspac...@googlegroups.com.

euler

unread,
Jun 9, 2020, 11:33:54 PM6/9/20
to DSpace Technical Support
Hi Joan,

Thank you so much for the response. I tested the code below and it worked! I even modified it to also delete bundle:TEXT that have a description "Extracted text".

Thanks again for your help.

Sincerely,
Euler
Reply all
Reply to author
Forward
0 new messages