Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Created a way to notify when a torrent changed priorities via alert.
- Loading branch information
Showing
10 changed files
with
163 additions
and
13 deletions.
There are no files selected for viewing
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
27 changes: 27 additions & 0 deletions
27
src/com/frostwire/jlibtorrent/alerts/ScrapeFailedAlert.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,27 @@ | ||
package com.frostwire.jlibtorrent.alerts; | ||
|
||
import com.frostwire.jlibtorrent.swig.scrape_failed_alert; | ||
|
||
/** | ||
* If a scrape request fails, this alert is generated. This might be due | ||
* to the tracker timing out, refusing connection or returning an http response | ||
* code indicating an error. | ||
* | ||
* @author gubatron | ||
* @author aldenml | ||
*/ | ||
public final class ScrapeFailedAlert extends TrackerAlert<scrape_failed_alert> { | ||
|
||
public ScrapeFailedAlert(scrape_failed_alert alert) { | ||
super(alert); | ||
} | ||
|
||
/** | ||
* contains a message describing the error. | ||
* | ||
* @return | ||
*/ | ||
public String getMsg() { | ||
return alert.getMsg(); | ||
} | ||
} |
36 changes: 36 additions & 0 deletions
36
src/com/frostwire/jlibtorrent/alerts/ScrapeReplyAlert.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,36 @@ | ||
package com.frostwire.jlibtorrent.alerts; | ||
|
||
import com.frostwire.jlibtorrent.swig.scrape_reply_alert; | ||
|
||
/** | ||
* This alert is generated when a scrape request succeeds. | ||
* | ||
* @author gubatron | ||
* @author aldenml | ||
*/ | ||
public final class ScrapeReplyAlert extends TrackerAlert<scrape_reply_alert> { | ||
|
||
public ScrapeReplyAlert(scrape_reply_alert alert) { | ||
super(alert); | ||
} | ||
|
||
/** | ||
* the data returned in the scrape response. These numbers | ||
* may be -1 if the reponse was malformed. | ||
* | ||
* @return | ||
*/ | ||
public int getIncomplete() { | ||
return alert.getIncomplete(); | ||
} | ||
|
||
/** | ||
* the data returned in the scrape response. These numbers | ||
* may be -1 if the reponse was malformed. | ||
* | ||
* @return | ||
*/ | ||
public int getComplete() { | ||
return alert.getComplete(); | ||
} | ||
} |
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
38 changes: 38 additions & 0 deletions
38
src/com/frostwire/jlibtorrent/alerts/TorrentPrioritizeAlert.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,38 @@ | ||
package com.frostwire.jlibtorrent.alerts; | ||
|
||
import com.frostwire.jlibtorrent.TorrentHandle; | ||
import com.frostwire.jlibtorrent.swig.torrent_alert; | ||
|
||
/** | ||
* @author gubatron | ||
* @author aldenml | ||
*/ | ||
public final class TorrentPrioritizeAlert extends TorrentAlert<torrent_alert> { | ||
|
||
private final TorrentHandle th; | ||
|
||
public TorrentPrioritizeAlert(TorrentHandle th) { | ||
super(null); | ||
this.th = th; | ||
} | ||
|
||
@Override | ||
public AlertType getType() { | ||
return AlertType.TORRENT_PRIORITIZE; | ||
} | ||
|
||
@Override | ||
public String getWhat() { | ||
return ""; | ||
} | ||
|
||
@Override | ||
public int getCategory() { | ||
return com.frostwire.jlibtorrent.swig.alert.category_t.stats_notification.swigValue(); | ||
} | ||
|
||
@Override | ||
public TorrentHandle getHandle() { | ||
return th; | ||
} | ||
} |
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
29 changes: 29 additions & 0 deletions
29
src/com/frostwire/jlibtorrent/alerts/TrackerReplyAlert.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,29 @@ | ||
package com.frostwire.jlibtorrent.alerts; | ||
|
||
import com.frostwire.jlibtorrent.swig.tracker_reply_alert; | ||
|
||
/** | ||
* This alert is only for informational purpose. It is generated when a tracker announce | ||
* succeeds. It is generated regardless what kind of tracker was used, be it UDP, HTTP or | ||
* the DHT. | ||
* | ||
* @author gubatron | ||
* @author aldenml | ||
*/ | ||
public final class TrackerReplyAlert extends TrackerAlert<tracker_reply_alert> { | ||
|
||
public TrackerReplyAlert(tracker_reply_alert alert) { | ||
super(alert); | ||
} | ||
|
||
/** | ||
* tells how many peers the tracker returned in this response. This is | ||
* not expected to be more thant the ``num_want`` settings. These are not necessarily | ||
* all new peers, some of them may already be connected. | ||
* | ||
* @return | ||
*/ | ||
public int getNumPeers() { | ||
return alert.getNum_peers(); | ||
} | ||
} |