-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Reimplemented globals (broadcasts) tracking.
Now tMediator makes API request and gets info from json instead of parsing forum.
- Loading branch information
Showing
10 changed files
with
99 additions
and
76 deletions.
There are no files selected for viewing
Binary file not shown.
23 changes: 23 additions & 0 deletions
23
tMediator/src/com/seroperson/mediator/parsing/DateDeserializer.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
package com.seroperson.mediator.parsing; | ||
|
||
import com.google.gson.JsonDeserializationContext; | ||
import com.google.gson.JsonDeserializer; | ||
import com.google.gson.JsonElement; | ||
import com.google.gson.JsonParseException; | ||
|
||
import java.lang.reflect.Type; | ||
import java.text.ParseException; | ||
import java.text.SimpleDateFormat; | ||
import java.util.Date; | ||
|
||
public class DateDeserializer implements JsonDeserializer<Date>{ | ||
public Date deserialize(JsonElement json, Type typeOfT, JsonDeserializationContext context) throws JsonParseException { | ||
SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); | ||
try { | ||
return format.parse(json.getAsString()); | ||
} catch (ParseException e) { | ||
System.err.println(e.getMessage()); | ||
} | ||
return new Date(); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
14 changes: 14 additions & 0 deletions
14
tMediator/src/com/seroperson/mediator/tori/stuff/Broadcast.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
package com.seroperson.mediator.tori.stuff; | ||
|
||
//http://forum.toribash.com/tori_broadcast.php?format=json&explain | ||
public class Broadcast { | ||
public BroadcastedMessage[] broadcasts; | ||
|
||
@Override | ||
public String toString() { | ||
if (broadcasts != null && broadcasts[0] != null) | ||
return broadcasts[0].toString(); | ||
else | ||
return "No broadcast"; | ||
} | ||
} |
14 changes: 14 additions & 0 deletions
14
tMediator/src/com/seroperson/mediator/tori/stuff/BroadcastedMessage.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
package com.seroperson.mediator.tori.stuff; | ||
|
||
import java.util.Date; | ||
|
||
public class BroadcastedMessage { | ||
public Date post_time; | ||
public String message; | ||
public String username; | ||
|
||
@Override | ||
public String toString() { | ||
return post_time.toString() + ": " + message + " by " + username; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters