Set downloadDir for magnets
Hide search button, doesn't work Replace logo
This commit is contained in:
@ -3320,6 +3320,9 @@ XMWebUIPlugin {
|
|||||||
// downloadDir | string | tr_torrent
|
// downloadDir | string | tr_torrent
|
||||||
if (storage != null) {
|
if (storage != null) {
|
||||||
value = storage.getBase().getAbsolutePath();
|
value = storage.getBase().getAbsolutePath();
|
||||||
|
} else {
|
||||||
|
//value = "TBD";
|
||||||
|
value = _manager.getDataDir().getAbsolutePath();
|
||||||
}
|
}
|
||||||
} else if (field.equals("downloadedEver")) {
|
} else if (field.equals("downloadedEver")) {
|
||||||
// RPC v0
|
// RPC v0
|
||||||
@ -3540,10 +3543,12 @@ XMWebUIPlugin {
|
|||||||
long needed = download.getNeededLength();
|
long needed = download.getNeededLength();
|
||||||
if (needed < 0)
|
if (needed < 0)
|
||||||
needed = download.getRemainingLength();
|
needed = download.getRemainingLength();
|
||||||
if (needed < 0)
|
if (needed < 0) {
|
||||||
needed = 1; // TODO
|
value = 0.0f;
|
||||||
long whenDone = download.getTotalLength() - download.getSkippedLength();
|
} else {
|
||||||
value = 1.0f - (needed / (float) whenDone);
|
long whenDone = download.getTotalLength() - download.getSkippedLength();
|
||||||
|
value = 1.0f - (needed / (float) whenDone);
|
||||||
|
}
|
||||||
} else if (field.equals("pieces")) {
|
} else if (field.equals("pieces")) {
|
||||||
// RPC v5
|
// RPC v5
|
||||||
value = torrentGet_pieces(download);
|
value = torrentGet_pieces(download);
|
||||||
@ -5340,176 +5345,6 @@ XMWebUIPlugin {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/****
|
|
||||||
private class
|
|
||||||
MagnetDownload
|
|
||||||
implements Snark
|
|
||||||
{
|
|
||||||
private URL magnet_url;
|
|
||||||
private String name;
|
|
||||||
private byte[] hash;
|
|
||||||
private long create_time;
|
|
||||||
private Map<TorrentAttribute,Long> attributes = new HashMap<TorrentAttribute, Long>();
|
|
||||||
private String temp_dir = _util.getTempDir().getAbsolutePath();
|
|
||||||
private Throwable error;
|
|
||||||
|
|
||||||
private
|
|
||||||
MagnetDownload(
|
|
||||||
URL _magnet,
|
|
||||||
String friendlyName )
|
|
||||||
{
|
|
||||||
create_time = _context.clock().now();
|
|
||||||
magnet_url = _magnet;
|
|
||||||
String str = magnet_url.toExternalForm();
|
|
||||||
int pos = str.indexOf( '?' );
|
|
||||||
if ( pos != -1 ) {
|
|
||||||
str = str.substring( pos+1 );
|
|
||||||
}
|
|
||||||
String[] args = str.split( "&" );
|
|
||||||
Map<String,String> arg_map = new HashMap<String,String>();
|
|
||||||
for ( String arg: args ) {
|
|
||||||
String[] bits = arg.split( "=" );
|
|
||||||
if ( bits.length == 2 ) {
|
|
||||||
try {
|
|
||||||
String lhs = bits[0].trim().toLowerCase( Locale.US );
|
|
||||||
String rhs = URLDecoder.decode( bits[1].trim(), "UTF-8");
|
|
||||||
if ( lhs.equals( "xt" )) {
|
|
||||||
if ( rhs.toLowerCase( Locale.US ).startsWith( "urn:btih:" )) {
|
|
||||||
arg_map.put( lhs, rhs );
|
|
||||||
} else {
|
|
||||||
String existing = arg_map.get( "xt" );
|
|
||||||
if ( existing == null ||
|
|
||||||
( !existing.toLowerCase( Locale.US ).startsWith( "urn:btih:" ) && rhs.startsWith( "urn:sha1:" ))) {
|
|
||||||
arg_map.put( lhs, rhs );
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
arg_map.put( lhs, rhs );
|
|
||||||
}
|
|
||||||
} catch( Throwable e ) {
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
hash = new byte[0];
|
|
||||||
String hash_str = arg_map.get( "xt" );
|
|
||||||
if ( hash_str != null ) {
|
|
||||||
hash_str = hash_str.toLowerCase( Locale.US );
|
|
||||||
if ( hash_str.startsWith( "urn:btih:" ) || hash_str.startsWith( "urn:sha1" )) {
|
|
||||||
hash = UrlUtils.decodeSHA1Hash( hash_str.substring( 9 ));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
name = arg_map.get( "dn" );
|
|
||||||
if ( name == null ) {
|
|
||||||
if ( friendlyName != null ) {
|
|
||||||
name = friendlyName;
|
|
||||||
} else if ( hash == null ) {
|
|
||||||
name = magnet_url.toExternalForm();
|
|
||||||
} else {
|
|
||||||
name = Base32.encode( hash );
|
|
||||||
}
|
|
||||||
}
|
|
||||||
name = "Magnet download for '" + name + "'";
|
|
||||||
getID( this, true );
|
|
||||||
}
|
|
||||||
|
|
||||||
private long
|
|
||||||
getCreateTime()
|
|
||||||
{
|
|
||||||
return( create_time );
|
|
||||||
}
|
|
||||||
|
|
||||||
private URL
|
|
||||||
getMagnetURL()
|
|
||||||
{
|
|
||||||
return( magnet_url );
|
|
||||||
}
|
|
||||||
|
|
||||||
public boolean
|
|
||||||
isStub()
|
|
||||||
{
|
|
||||||
return( true );
|
|
||||||
}
|
|
||||||
|
|
||||||
public Snark
|
|
||||||
destubbify()
|
|
||||||
throws DownloadException
|
|
||||||
{
|
|
||||||
throw( new DownloadException( "Not supported" ));
|
|
||||||
}
|
|
||||||
|
|
||||||
public String
|
|
||||||
getName()
|
|
||||||
{
|
|
||||||
return( name );
|
|
||||||
}
|
|
||||||
|
|
||||||
public byte[]
|
|
||||||
getInfoHash()
|
|
||||||
{
|
|
||||||
return( hash );
|
|
||||||
}
|
|
||||||
|
|
||||||
public MetaInfo
|
|
||||||
getTorrent()
|
|
||||||
{
|
|
||||||
return( null );
|
|
||||||
}
|
|
||||||
|
|
||||||
public long
|
|
||||||
getTorrentSize()
|
|
||||||
{
|
|
||||||
return( 16*1024 ); // dont know the size
|
|
||||||
}
|
|
||||||
|
|
||||||
public String
|
|
||||||
getSavePath()
|
|
||||||
{
|
|
||||||
return( temp_dir );
|
|
||||||
}
|
|
||||||
|
|
||||||
private void
|
|
||||||
setError(
|
|
||||||
Throwable e )
|
|
||||||
{
|
|
||||||
error = e;
|
|
||||||
}
|
|
||||||
|
|
||||||
private Throwable
|
|
||||||
getError()
|
|
||||||
{
|
|
||||||
return( error );
|
|
||||||
}
|
|
||||||
|
|
||||||
public SnarkFile[]
|
|
||||||
getStubFiles()
|
|
||||||
{
|
|
||||||
return( new SnarkFile[0]);
|
|
||||||
}
|
|
||||||
|
|
||||||
public long
|
|
||||||
getLongAttribute(
|
|
||||||
TorrentAttribute attribute )
|
|
||||||
{
|
|
||||||
Long l = attributes.get( attribute );
|
|
||||||
return( l==null?0:l );
|
|
||||||
}
|
|
||||||
|
|
||||||
public void
|
|
||||||
setLongAttribute(
|
|
||||||
TorrentAttribute attribute,
|
|
||||||
long value)
|
|
||||||
{
|
|
||||||
attributes.put( attribute, value );
|
|
||||||
}
|
|
||||||
|
|
||||||
public void
|
|
||||||
remove()
|
|
||||||
throws DownloadException
|
|
||||||
{
|
|
||||||
}
|
|
||||||
}
|
|
||||||
****/
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Copied from Vuze UrlUtils.java
|
* Copied from Vuze UrlUtils.java
|
||||||
*/
|
*/
|
||||||
|
@ -49,7 +49,7 @@
|
|||||||
<script type="text/javascript" src="./javascript/notifications.js"></script>
|
<script type="text/javascript" src="./javascript/notifications.js"></script>
|
||||||
<script type="text/javascript" src="./javascript/easyXDM-2.4.18.4.min.js"></script>
|
<script type="text/javascript" src="./javascript/easyXDM-2.4.18.4.min.js"></script>
|
||||||
<script type="text/javascript" src="./javascript/vuze.js"></script>
|
<script type="text/javascript" src="./javascript/vuze.js"></script>
|
||||||
<title>Vuze Remote</title>
|
<title>I2PSnark Remote</title>
|
||||||
</head>
|
</head>
|
||||||
<body id="transmission_body">
|
<body id="transmission_body">
|
||||||
|
|
||||||
@ -62,7 +62,9 @@
|
|||||||
<div id="toolbar-remove" title="Remove Selected Torrents"></div>
|
<div id="toolbar-remove" title="Remove Selected Torrents"></div>
|
||||||
<div id="toolbar-start-all" title="Start All Torrents"></div>
|
<div id="toolbar-start-all" title="Start All Torrents"></div>
|
||||||
<div id="toolbar-pause-all" title="Pause All Torrents"></div>
|
<div id="toolbar-pause-all" title="Pause All Torrents"></div>
|
||||||
|
<!--
|
||||||
<div id="toolbar-search" title="Search"></div>
|
<div id="toolbar-search" title="Search"></div>
|
||||||
|
-->
|
||||||
|
|
||||||
<div id="toolbar-inspector" title="Toggle Inspector"></div>
|
<div id="toolbar-inspector" title="Toggle Inspector"></div>
|
||||||
</div>
|
</div>
|
||||||
@ -92,7 +94,7 @@
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div id="torrent_logo">
|
<div id="torrent_logo">
|
||||||
<img src="style/transmission/images/graphics/vuze_remote_logo.png" alt="Vuze Remote">
|
<img src="style/i2p/images/graphics/i2plogo.png" alt="I2PSnark Remote">
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div id="statusbar">
|
<div id="statusbar">
|
||||||
|
BIN
src/jsp/web/style/i2p/images/graphics/i2plogo.png
Normal file
BIN
src/jsp/web/style/i2p/images/graphics/i2plogo.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 8.3 KiB |
Reference in New Issue
Block a user