Newbie question: automate changing collection info

CharlasHacking LibraryThing

Únete a LibraryThing para publicar.

Newbie question: automate changing collection info

Este tema está marcado actualmente como "inactivo"—el último mensaje es de hace más de 90 días. Puedes reactivarlo escribiendo una respuesta.

1rkstafford
Mar 13, 2019, 8:05 pm

First, I'm new to this group, and I apologize if this question violates the community norms. I looked around couldn't find any topics that addresses this issue, but I might have missed one.

I have used LibraryThing for a long time to keep track of where my books are stored. I have done this by creating collections ("Box 1", "Box 2", "Office shelves", etc.) and assigning books to them. Last year I moved houses, and all of my books are in different places now. I have a spreadsheet with one row per book that includes the old and new location (collection) info. Is there a way to update the locations in bulk? I would love to avoid clicking through the update collection process ~1400 times for every book in my library.

Thanks for any help.

2rosalita
Mar 13, 2019, 8:23 pm

First of all, welcome! This group is mostly for people interested in using third-party extensions and other techniques to perform tasks in LibraryThing that the native software doesn't support. If you have future questions about general "how-to" topics, you'll probably find more help in the Welcome to LibraryThing or the Talk About Library Thing groups.

Having said that, it sounds like the feature you are looking for is a standard LibraryThing feature called PowerEdit. That's the lightning bolt in the row of buttons at the top of your catalog. You can use that to select multiple books from whatever subset of books you have displayed and then add or remove them from specific collections.

I think the functionality is fairly straightforward once you enter PowerEdit mode but if you do have follow-up questions about how to make it work, feel free to ask here in this thread.

3rkstafford
Mar 13, 2019, 9:21 pm

Thanks. I have not used Power Edit; it looks like it would be better than editing each book individually, but it would still require me to look up and select books individually to move them around. My hope is that I could do something like this (I'm assuming that the collections info is stored in a table, MyBooksCollections, indexed by BookId, and that I could get access to a table with my updates, UpdateList, with columns BookId, OldCollection, and NewCollection):

DELETE MyBooksCollections
FROM MyBooksCollections o
JOIN UpdateList n
ON o.BookId=n.BookId
WHERE o.Collection = n.OldCollection
;

INSERT INTO MyBooksCollections (BookId, Collection)
SELECT BookId, NewCollection
FROM UpdateList
;

4jjwilson61
Mar 13, 2019, 11:04 pm

>3 rkstafford: No, you can't get direct access to the database.

5rkstafford
Mar 13, 2019, 11:51 pm

Thanks. I thought that would be true, but I figured it wouldn't hurt to ask. If I get to the URL for the book in my collection, in either view mode (e.g., https://www.librarything.com/work/51858/book/16557859) or edit mode (e.g., https://www.librarything.com/work/18196/edit/15269778), is there a way to code changes to the selected collections?

6andyl
Mar 14, 2019, 4:40 am

>5 rkstafford:

Technically it is possible to do so - code can be written to go to the edit page, to click on the 'show all' button, to select the right collections etc and then save. However it isn't straightforward and certainly not a quick job

Power Edit is the way to do this as mentioned by rosalita. It makes moving all of "Box 2" to "Shelf 8" easy. If your boxes have been randomly distributed to different collections then you are probably going to have to manually change all the records.

7divinenanny
Mar 14, 2019, 5:25 am

>6 andyl:
To add to andyl's description, I tried to write this (using Selenium, so going through the GUI) when writing my script to automatically manual add a work. I gave up, because I couldn't get the "open collection list" -> "check these boxes" flow right. I believe I ran in to trouble with regards to not being able to identify the specific check boxes in relation to the collection I wanted (the collections themselves have specific static IDs). It probably is possible, but I just gave up on collections all together really.