forked from I2P_Developers/i2p.i2p
i2psnark: More consistency and torrent links in messages
This commit is contained in:
@ -1315,11 +1315,12 @@ public class SnarkManager implements CompleteListener {
|
||||
running = false;
|
||||
}
|
||||
// Were we running last time?
|
||||
String link = linkify(torrent);
|
||||
if (!dontAutoStart && shouldAutoStart() && running) {
|
||||
torrent.startTorrent();
|
||||
addMessage(_t("Torrent added and started: \"{0}\"", torrent.getBaseName()));
|
||||
addMessageNoEscape(_t("Torrent added and started: {0}", link));
|
||||
} else {
|
||||
addMessage(_t("Torrent added: \"{0}\"", torrent.getBaseName()));
|
||||
addMessageNoEscape(_t("Torrent added: {0}", link));
|
||||
}
|
||||
}
|
||||
|
||||
@ -1982,7 +1983,7 @@ public class SnarkManager implements CompleteListener {
|
||||
if (shouldRemove)
|
||||
removeTorrentStatus(torrent);
|
||||
if (!wasStopped)
|
||||
addMessage(_t("Torrent stopped: \"{0}\"", torrent.getBaseName()));
|
||||
addMessageNoEscape(_t("Torrent stopped: {0}", linkify(torrent)));
|
||||
}
|
||||
return torrent;
|
||||
}
|
||||
@ -2001,7 +2002,7 @@ public class SnarkManager implements CompleteListener {
|
||||
boolean wasStopped = torrent.isStopped();
|
||||
torrent.stopTorrent();
|
||||
if (!wasStopped)
|
||||
addMessage(_t("Torrent stopped: \"{0}\"", torrent.getBaseName()));
|
||||
addMessageNoEscape(_t("Torrent stopped: {0}", linkify(torrent)));
|
||||
if (shouldRemove)
|
||||
removeTorrentStatus(torrent);
|
||||
}
|
||||
@ -2087,14 +2088,8 @@ public class SnarkManager implements CompleteListener {
|
||||
Storage storage = snark.getStorage();
|
||||
if (meta == null || storage == null)
|
||||
return;
|
||||
StringBuilder buf = new StringBuilder(256);
|
||||
String base = DataHelper.escapeHTML(storage.getBaseName());
|
||||
buf.append("<a href=\"").append(_contextPath).append('/').append(base);
|
||||
if (meta.getFiles() != null)
|
||||
buf.append('/');
|
||||
buf.append("\">").append(base).append("</a>");
|
||||
if (snark.getDownloaded() > 0)
|
||||
addMessageNoEscape(_t("Download finished: {0}", buf.toString())); // + " (" + _t("size: {0}B", DataHelper.formatSize2(len)) + ')');
|
||||
addMessageNoEscape(_t("Download finished: {0}", linkify(snark)));
|
||||
updateStatus(snark);
|
||||
}
|
||||
|
||||
@ -2150,7 +2145,7 @@ public class SnarkManager implements CompleteListener {
|
||||
_magnets.remove(snark.getName());
|
||||
removeMagnetStatus(snark.getInfoHash());
|
||||
addMessage(_t("Metainfo received for {0}", snark.getName()));
|
||||
addMessage(_t("Starting up torrent {0}", storage.getBaseName()));
|
||||
addMessageNoEscape(_t("Starting up torrent {0}", linkify(snark)));
|
||||
return name;
|
||||
} catch (IOException ioe) {
|
||||
addMessage(_t("Failed to copy torrent file to {0}", name));
|
||||
@ -2184,6 +2179,27 @@ public class SnarkManager implements CompleteListener {
|
||||
|
||||
// End Snark.CompleteListeners
|
||||
|
||||
/**
|
||||
* An HTML link to the file if complete and a single file,
|
||||
* to the directory if not complete or not a single file,
|
||||
* or simply the unlinkified name of the snark if a magnet
|
||||
*
|
||||
* @since 0.9.23
|
||||
*/
|
||||
private String linkify(Snark snark) {
|
||||
MetaInfo meta = snark.getMetaInfo();
|
||||
Storage storage = snark.getStorage();
|
||||
if (meta == null || storage == null)
|
||||
return DataHelper.escapeHTML(snark.getBaseName());
|
||||
StringBuilder buf = new StringBuilder(256);
|
||||
String base = DataHelper.escapeHTML(storage.getBaseName());
|
||||
buf.append("<a href=\"").append(_contextPath).append('/').append(base);
|
||||
if (meta.getFiles() != null || !storage.complete())
|
||||
buf.append('/');
|
||||
buf.append("\">").append(base).append("</a>");
|
||||
return buf.toString();
|
||||
}
|
||||
|
||||
/**
|
||||
* Add all magnets from the config file
|
||||
*
|
||||
@ -2412,7 +2428,7 @@ public class SnarkManager implements CompleteListener {
|
||||
boolean connected = _util.connected();
|
||||
if ((!connected) && !_util.isConnecting())
|
||||
addMessage(_t("Opening the I2P tunnel"));
|
||||
addMessage(_t("Starting up torrent {0}", snark.getBaseName()));
|
||||
addMessageNoEscape(_t("Starting up torrent {0}", linkify(snark)));
|
||||
if (connected) {
|
||||
snark.startTorrent();
|
||||
} else {
|
||||
@ -2570,13 +2586,14 @@ public class SnarkManager implements CompleteListener {
|
||||
updateStatus(snark);
|
||||
if (_log.shouldWarn())
|
||||
_log.warn("Finished recheck of " + snark.getBaseName() + " changed? " + changed);
|
||||
String link = linkify(snark);
|
||||
if (changed) {
|
||||
int pieces = snark.getPieces();
|
||||
double completion = (pieces - snark.getNeeded()) / (double) pieces;
|
||||
String complete = (new DecimalFormat("0.00%")).format(completion);
|
||||
addMessage(_t("Finished recheck of torrent {0}, now {1} complete", snark.getBaseName(), complete));
|
||||
addMessageNoEscape(_t("Finished recheck of torrent {0}, now {1} complete", link, complete));
|
||||
} else {
|
||||
addMessage(_t("Finished recheck of torrent {0}, unchanged", snark.getBaseName()));
|
||||
addMessageNoEscape(_t("Finished recheck of torrent {0}, unchanged", link));
|
||||
}
|
||||
} catch (Exception e) {
|
||||
_log.error("Error rechecking " + snark.getBaseName(), e);
|
||||
|
11
history.txt
11
history.txt
@ -1,7 +1,18 @@
|
||||
2015-10-21 zzz
|
||||
* i2psnark: More consistency and torrent links in messages
|
||||
* Router: Increase timer thread priority
|
||||
|
||||
2015-10-17 zzz
|
||||
* Crypto:
|
||||
- Consolidate duplicate unlimited strength crypto check code
|
||||
- Disable TLS_DHE_DSS_WITH_AES_128_CBC_SHA
|
||||
|
||||
2015-10-16 zzz
|
||||
* Console: Add Java 6 warning to summary bar
|
||||
* i2psnark:
|
||||
- Fix deadlock (ticket #1432)
|
||||
- Add "smart sort" option, set sort based on language (tickets #637, #1303)
|
||||
- Don't balloon files on ARM (ticket #1684)
|
||||
|
||||
2015-10-14 zzz
|
||||
* Update:
|
||||
|
@ -18,7 +18,7 @@ public class RouterVersion {
|
||||
/** deprecated */
|
||||
public final static String ID = "Monotone";
|
||||
public final static String VERSION = CoreVersion.VERSION;
|
||||
public final static long BUILD = 18;
|
||||
public final static long BUILD = 19;
|
||||
|
||||
/** for example "-test" */
|
||||
public final static String EXTRA = "";
|
||||
|
Reference in New Issue
Block a user