Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#13 2010-11-15 19:11:42

vagari
Plugin Author
Registered: 2004-08-25
Posts: 19

Re: vag_tumblr_import: Import Tumblr posts to your TXP site.

Hi freethrow,

The way the plugin basically works (honestly I haven’t sifted through the code in a while so bear with me) is on install the plugin adds some nested categories (like tumblr->quote). Then you tell the plugin what your tumblr username is and using the read part of the Tumblr API every time you post to Tumblr the plugin pulls the content into your Textpattern site as a new post. This is done either on page refresh or based on a cron job you set up (with caching).

There are some customizations built in for how the plugin labels the imported posts. Also for what text is used for links back to the post on the Tumblr site.

Do you have any other questions?

Offline

#14 2010-11-16 19:09:49

freethrow
New Member
Registered: 2010-06-15
Posts: 3

Re: vag_tumblr_import: Import Tumblr posts to your TXP site.

Thank you Vagari. Yesterday I figured out that I have a bunch of new categories… Works pretty nice, I think I’m gonna have to make a new section, maybe put it on the fron page and start tumblin… Good work!

This is a bit of topic, but since you do write plugins for TP, I would be interested in your opinion> is there a future for textpattern, it’s been my favourite for a very long time, but I was away from webdev for a couple of years and I saw that there are a lot of problems, plugin incompatibilities etc…

Offline

#15 2011-12-18 22:20:16

dnwng
New Member
Registered: 2011-12-18
Posts: 3

Re: vag_tumblr_import: Import Tumblr posts to your TXP site.

Hello,
I installed this plugin and it pulls the posts in okay but when I set it to Page Load, it re-imports every single post every time the page loads instead of just the new ones. This also happens when I push the manual refresh—it pulls in everything from Tumblr again, creating duplicates. I haven’t been able to get the cron job option to work so I can’t say if this happens with that as well.

Is there something I need to do to prevent it from pulling in everything and just pull in the new posts?

Thanks!

Offline

#16 2011-12-19 14:57:49

vagari
Plugin Author
Registered: 2004-08-25
Posts: 19

Re: vag_tumblr_import: Import Tumblr posts to your TXP site.

Hi dnwng,

Actually, the double posts would happen using a CRON job too. It’s a bug that appeared a while back and I’m sorry to say that my friend who was the inspiration for this plugin has abandoned posting pretty much anywhere. Thus I haven’t gone back to fix it. I’ll take a look and see what I can find… I know there are now two different APIs and this is built on the first. Lets hope that doesn’t convolute things too much…

Offline

#17 2011-12-19 17:51:12

vagari
Plugin Author
Registered: 2004-08-25
Posts: 19

Re: vag_tumblr_import: Import Tumblr posts to your TXP site.

dnwng,

Whoops, I wasn’t forward thinking enough and used INT instead of BIGINT for the Tumblr ID column. That’s what was creating the bug. I’ve updated the table creation code in the plugin, but I don’t have time to figure out upgrading current implementations right this second. So if you have a previous install and the table already exists in the database you can simply alter the column to BIGINT UNSIGNED. Sorry about the repeated posts. =/

If anyone has any pointers on code to fix this on an upgrade I’m all ears.

Offline

#18 2011-12-20 00:21:38

dnwng
New Member
Registered: 2011-12-18
Posts: 3

Re: vag_tumblr_import: Import Tumblr posts to your TXP site.

Hi Vagari,

Thanks for the reply. Unfortunately some problems still persist. Now when I hit refresh, it gives me a little message on the top left that says “from cache” and pulls everything in again. I tried deleting all the posts and then refreshing again but then it doesn’t pull in anything. I have to set it back to INT for it to pull in anything if there is nothing in the textpattern archive.

I tried deleting the plugin and then reinstalling but the same thing happens.

Offline

#19 2011-12-20 15:18:13

vagari
Plugin Author
Registered: 2004-08-25
Posts: 19

Re: vag_tumblr_import: Import Tumblr posts to your TXP site.

Hi dnwng,

Sorry, that’s a byproduct of the quick fix. I’ve now updated the code to convert the tumblr_ID type while doing the rest of the database tweaking. Lets see if I can be more clear in answering your questions…

1) Caching is fine. We shouldn’t be hammering the tumblr servers with every page load. It’s simply a copy of the latest data pulled in.
2) Everything is pulled in again because even though we’ve modified the tumblr_ID to BIGINT it still doesn’t have the proper ids. It still thinks they’re all new posts. It should be the last time they are imported.
3) The posts don’t come back because now their IDs are properly in the vag_tumblr_import_rel table. The system thinks they’re still there when you refresh. It only checks the plugin’s table.
4) Setting it back to INT only works because the bug is back. It’s not properly inserting the tumblr_ID value any more.

I’d suggest going into MySQL and removing the duplicates from the vag_tumblr_import_rel table, and the textpattern table (you can also upgrade to the latest version, it’ll modify the table on its own). And then next time you do an import it should grab the latest posts, only once.

Sorry for the confusion, my plugin was written a while ago and doesn’t use all the hooks/callbacks that have been implemented. It’s not very good at cleaning up after itself. I guess the next step would be to add a callback to delete the relevant info when a post is removed from within Textpattern.

Offline

#20 2011-12-22 02:39:33

dnwng
New Member
Registered: 2011-12-18
Posts: 3

Re: vag_tumblr_import: Import Tumblr posts to your TXP site.

Ah, I got it—that makes sense! Thanks for the explanation. I think it’s working now. I have it set to page load and it’s not continually pulling in the same posts so that’s a good sign! Thanks again!

Offline

Board footer

Powered by FluxBB