summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMaurice Laveaux <maurice@localhost.localdomain>2014-05-26 16:50:19 +0200
committerMaurice Laveaux <maurice@localhost.localdomain>2014-05-26 16:50:19 +0200
commite7bfb57f13ed735dd4c48bc2c608785bb1749b38 (patch)
treeade8cc8b688a20dcc5d63fba4e57908046dbd1fa
parent01923cc647bdc6a0e8728bd518e43e1e6a57b26d (diff)
downloadTwitterDataAnalytics-e7bfb57f13ed735dd4c48bc2c608785bb1749b38.tar.gz
Added a resume option.
* Resumes searching of tweets.
-rw-r--r--src/main/TweetShell.java23
1 files changed, 13 insertions, 10 deletions
diff --git a/src/main/TweetShell.java b/src/main/TweetShell.java
index 583b3a4..50014ef 100644
--- a/src/main/TweetShell.java
+++ b/src/main/TweetShell.java
@@ -211,7 +211,9 @@ public class TweetShell implements TwitterApi.PinSupplier {
del("Deletes a keyword from search", 1),
keywords("Display currently active keywords"),
commit("Activate the stream or apply the stream keyword changes"),
- search("Searches for the tweets of some user", 2),
+ search("Searches for the tweets of some user <screen_name> <amount_of_tweets>", 2),
+ resume("Resumes saved searched from the last search queue"),
+ output("Change the output filename", 1),
status("Show some status and statistics"),
flush("Writes any pending buffers"),
close("Close the stream"),
@@ -310,17 +312,17 @@ public class TweetShell implements TwitterApi.PinSupplier {
getStream().commit();
}
break;
+ case resume:
+ getSearch();
+ break;
case search:
Search search = getSearch();
search.search(params[0], Integer.parseInt(params[1]));
break;
case status:
TweetCounter tc;
- tc
- = (TweetCounter) resultListeners.findListener(TweetCounter.class
- );
- if (stream_cached
- != null && getStream()
+ tc = (TweetCounter) resultListeners.findListener(TweetCounter.class);
+ if (stream_cached != null && getStream()
.isValid()) {
System.out.println("Streaming is active.");
} else {
@@ -339,8 +341,7 @@ public class TweetShell implements TwitterApi.PinSupplier {
"Unique users: " + tc.getUsers().size());
break;
case flush:
- if (stream_cached
- != null) {
+ if (stream_cached != null) {
resultListeners.flush();
}
break;
@@ -370,8 +371,7 @@ public class TweetShell implements TwitterApi.PinSupplier {
throw new NoSuchElementException();
case target:
- if (params.length
- > 0) {
+ if (params.length > 0) {
// due to limitations of shell (does not handle escapes),
// do a manualy split as we cannot have spaces in our args.
if (params.length == 1) {
@@ -406,6 +406,9 @@ public class TweetShell implements TwitterApi.PinSupplier {
System.err.println("getStream().close() -- " + ex.getMessage());
}
}
+ if (search_cached != null) {
+ search_cached.close();
+ }
resultListeners.close();
}