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

Use filename or file properties in tweet text? #8

Open
MrCarter13 opened this issue May 2, 2016 · 5 comments
Open

Use filename or file properties in tweet text? #8

MrCarter13 opened this issue May 2, 2016 · 5 comments

Comments

@MrCarter13
Copy link

Somehow be able to include a filename in the tweet text, which would allow for sourcing images directly in the tweet.

@joaquinlpereyra
Copy link
Owner

joaquinlpereyra commented May 2, 2016

Ok, very quick and dirty:

Replace line 11 of bot/status.py with:

self.text = tweet_media.split('/')[-1]

That should be enough. Mind that this works for Linux and (I think) Mac, I think Windows uses \ to separate folders, so you should replace the '/' with '' for Windows, I think.

Also, this also tweets the file extension. If you don't want to do that, you could do something like

self.text = tweet_media.split('/')[-1].split('.')[0]

But I didn't test that.

I'll leave this open to include it in the options and such in the future.

@MrCarter13
Copy link
Author

awesome, ill try it out, thanks!

@joaquinlpereyra
Copy link
Owner

@MrCarter13 let me know if it worked! thanks for the contribution :)

@MrCarter13
Copy link
Author

okay i tried out your solution and it sort of works, the image is still tweeted properly, but the filename seems to be randomly chosen independently of the image. For example if the bot tweets ImageA.jpg the filename included in the tweet text might be ImageB.jpg

Another quick question: how would i go about including a url before the filename?

thanks for your feedback :)

@joaquinlpereyra
Copy link
Owner

uh. that's weird. i'll look into it.

if you want to include the same url in every one of your posts, look at the "tweet text" option. if you want the url to change depending on the image, that's... not possible right now, unless not in a non-hackish way.

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