My Twitter Engine
I managed to squeeze in finishing my twitter data engine between sleep and playing airsoft today. It isn’t totally what I want because I’m not sure how to do what I want, but here it is.
Just download it and configure with CMake. Be sure you specify where you installed KDE with -DCMAKE_INSTALL_PREFIX=/path/to/kde4/ so that I can find Plasma.
There is no plasmoid included with this package, just a simple interface to Twitter’s API. It only retrieves the public timeline, individual user timelines, and individual tweets. To use it, ask for the “twitter” data engine in your plasmoid. As noted in a previous post, the layout of the data is essentially the same, but with a few tweaks:
"Timeline" [ 34824324 38902380 38904302 38290874 ] “Timeline:Workman161″ [ 38902380 ] “Update:38902380″ “ID” 38902380 “Date” (QDateTime) “Status” “Hey, I’m building a plasma engine!” “User” “workman161″
Square brackets denote QLists, quotes denote QStrings. The “Timeline” source is the public timeline. Each tweet gets its own source. This layout seemed to be the most logical way of forming it to me, but I’m sure others have better ideas. Suggestions are welcome. Have a look at the engine explorer for a more hands-on view. Speaking of which,
Bugs
What new software isn’t complete without nagging bugs?
- User timelines don’t get automatically updated. To receive word of an update, it must fall off the engine and then the plasmoid must manually query it.
- The initial creation is asynchronous.
- A limit of 30 sources might be a problem for people with a lot of friends to follow.
Suggestions
During the course of development, I came across some suggestions for the plasma team. First, making some sources ‘immutable’ would be nice. It is possible for the public timeline to fall out of the list, which means DataEngine::query() is useless. Second, more examples of ‘proper’ usage of Plasma for asynchronous data sources. That’d be really nice. Third, allowing plasmoids to interact with the engines. Right now communication is rather one-dimensional. The plasmoid asks for what it wants, and the engine feeds it as long as it is alive. Having the plasmoid do something such as telling the engine to mount a device or update your twitter status would further separate the implementation from the design.
