@ElizabethN - try this version. It should fix your issue with the number of books in a collection not being correct when using split. Thanks for the debug output
It was a simple error in the code. When I added the split collection feature I neglected to append the books to the collection name if it already existed and instead overwrote was was already saved. Previously before splitting the name could only appear once in the list I used so I just defined the collection to contain the books found for it in Calibre. With splitting added, the name could appear several times for each entry from Calibre and the code was just replacing the current list of books with the new books it found. So if it found A Smith had 5 books it stored them. Then when it found J Ton & A Smith had 3 books, it would do the split and then change A Smith to be just 3 books.