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

Enabled streaming toots (fix #84) #86

Merged
merged 8 commits into from
Nov 18, 2022
Merged

Enabled streaming toots (fix #84) #86

merged 8 commits into from
Nov 18, 2022

Conversation

schochastics
Copy link
Member

This enables streaming toots live.
@chainsawriot, just gonna leave this open for a bit in case you want to have a look/make suggestions.

@chainsawriot
Copy link
Collaborator

@schochastics I will give it a try.

close(con)
close(output)
})
invisible()
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@schochastics Would it be better to return an invisible file_name here (the same for all stream_* functions)? It would be quite useful when the input path (or file_name for stream_*) is NULL (the default). If file_name doesn't get returned, one can probably never get the path of that temp file (unless going through all temp files).

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In cases like this:

x <- stream_timeline_public(10)

One can never get the file back. (We might implement a parse parameter in the future, akin rtweet::stream_tweets)

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah i didnt quite understand what the parsing does in rtweet? Let me try to fix this. We shouldnt loose toots in tempfiles😬

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Their parse is just to return a tibble if TRUE and NULL if FALSE; kind of similar to the parse parameter of our get_* functions. Maybe we can do better to return a tibble if TRUE and the (actual) file_name if FALSE.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How does rtweet not loose track of the tmp file? https://github.com/ropensci/rtweet/blob/master/R/stream.R#L83-L88

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok i think i prefer to echo the tmp file name and not return anything. The parsing should be done when reading the json. I will push something later as a suggestion

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@schochastics Sure thing.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@chainsawriot Ok done. tmp file is now only echoed. I encourgae users in the vignette to always set a file_name

@schochastics
Copy link
Member Author

oh boy thanks for cleaning my mess :D

@chainsawriot
Copy link
Collaborator

@schochastics From my view, I think it's working and can be merged. The rest is #87

@schochastics schochastics merged commit b99d6f1 into main Nov 18, 2022
@schochastics schochastics deleted the streaming branch November 21, 2022 19:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants