Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Specifying bookmarks or statuses with text search resets other specified collections #85

Open
IzzySoft opened this issue Nov 7, 2022 · 2 comments

Comments

@IzzySoft
Copy link
Contributor

IzzySoft commented Nov 7, 2022

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.

@kensanata
Copy link
Owner

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").

@IzzySoft
Copy link
Contributor Author

IzzySoft commented Nov 8, 2022

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"?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants