mastodon-archive
mastodon-archive copied to clipboard
Specifying bookmarks or statuses with text search resets other specified collections
I've just run 2 searches which should yield identical results:
mastodon-archive text --collection bookmarks --collection favourites --collection mentions <account> <searchTerm>
mastodon-archive text --collection favourites --collection mentions --collection bookmarks <account> <searchTerm>
The first yields 2 results, the second none. So it seems that specifying --collection bookmarks
resets all previously selected --collection
parameters. Looks like the same is happening when introducing statuses
to the game (as last collection): only statuses are reported then, while putting it first, statuses and mentions are reported both, so specifying --collections
multiple times works per se.
Yeah, these don't add up.
As you can see in the code below, there is just one "collection" value in use:
if collection == "all":
statuses = itertools.chain.from_iterable(
data[collection] for collection in ["statuses", "favourites", "bookmarks", "mentions"]
)
else:
statuses = data[collection]
The argument parsing is always the same:
parser_content.add_argument("--collection", dest='collection',
choices=['statuses', 'favourites', 'bookmarks', 'mentions', 'all'],
default='statuses',
help='export statuses, favourites, bookmarks or mentions')
So in order to fix this, we would have to change the destination into a list (i.e. find the appropriate passage in argparse documentation), and then change all the places were we handle the argument to assemble the data we're looking at to handle a list of collections instead of a single collection (or the keyword "all").
Ah, I see. Just wanted to add that the same happens with statuses
– but taking a closer list (my search terms hit too many toots it seems) and counting, it seems it's just the last collection on the command-line that will be taken into consideration.
OK, then maybe this issue should be renamed to something like "allow multiple collections to be specified"?