use of com.limegroup.gnutella.gui.tables.SizeHolder in project frostwire by frostwire.
the class LibraryPlaylistsTableDataLine method initialize.
/**
* Sets up the DataLine for use with the playlist.
*/
public void initialize(PlaylistItem item) {
super.initialize(item);
sizeHolder = new SizeHolder(item.getFileSize());
exists = new File(item.getFilePath()).exists();
bitrate = initializer.getTrackBitrate();
if (bitrate != null && bitrate.length() > 0 && !bitrate.endsWith(" kbps")) {
bitrate = bitrate + " kbps";
}
this.nameCell = new NameHolder(initializer.getTrackTitle());
this.actionsHolder = new LibraryActionsHolder(this, false);
}
use of com.limegroup.gnutella.gui.tables.SizeHolder in project frostwire by frostwire.
the class SearchResultDataLine method initialize.
/**
* Initializes this line with the specified search result.
*/
public void initialize(UISearchResult sr) {
super.initialize(sr);
RESULT = sr;
_mediaType = NamedMediaType.getFromExtension(getExtension());
addedOn = sr.getCreationTime() > 0 ? new Date(sr.getCreationTime()) : null;
actionsHolder = new SearchResultActionsHolder(sr);
name = new SearchResultNameHolder(sr);
seeds = RESULT.getSeeds() <= 0 || !(RESULT instanceof TorrentUISearchResult) ? "" : String.valueOf(RESULT.getSeeds());
icon = getIcon();
size = new SizeHolder(getSize());
source = new SourceHolder(RESULT);
}
use of com.limegroup.gnutella.gui.tables.SizeHolder in project frostwire by frostwire.
the class LibraryFilesTableDataLine method initialize.
/**
* Initialize the object.
* It will fail if not given a FileDesc or a File
* (File is retained for compatibility with the Incomplete folder)
*/
public void initialize(File file) {
super.initialize(file);
String fullPath = file.getPath();
try {
fullPath = file.getCanonicalPath();
} catch (IOException ignored) {
}
String _name = initializer.getName();
_type = "";
if (!file.isDirectory()) {
// _isDirectory = false;
int index = _name.lastIndexOf(".");
int index2 = fullPath.lastIndexOf(File.separator);
_path = fullPath.substring(0, index2);
if (index != -1 && index != 0) {
_type = _name.substring(index + 1);
_name = _name.substring(0, index);
}
} else {
_path = fullPath;
// _isDirectory = true;
}
// directories implicitly set SizeHolder to null and display nothing
if (initializer.isFile()) {
long _size = initializer.length();
_sizeHolder = new SizeHolder(_size);
} else {
_sizeHolder = ZERO_SIZED_HOLDER;
}
this.lastModified = new Date(initializer.lastModified());
this.actionsHolder = new LibraryActionsHolder(this, false);
this.nameCell = new NameHolder(_name);
if (initializer != null && initializer.isFile() && FilenameUtils.getExtension(initializer.getName()) != null && FilenameUtils.getExtension(initializer.getName()).toLowerCase().endsWith("torrent")) {
BTInfoAdditionalMetadataHolder additionalMetadataHolder = null;
try {
additionalMetadataHolder = new BTInfoAdditionalMetadataHolder(initializer, initializer.getName());
} catch (Throwable t) {
System.err.println("[InvalidTorrent] Can't create BTInfoAdditionalMetadataholder out of " + initializer.getAbsolutePath());
t.printStackTrace();
}
boolean hasLicense = additionalMetadataHolder != null && additionalMetadataHolder.getLicenseBroker() != null;
boolean hasPaymentOptions = additionalMetadataHolder != null && additionalMetadataHolder.getPaymentOptions() != null;
if (hasLicense) {
license = additionalMetadataHolder.getLicenseBroker().getLicenseName();
}
if (license == null) {
license = "";
}
if (hasPaymentOptions) {
paymentOptions = additionalMetadataHolder.getPaymentOptions();
} else {
paymentOptions = new PaymentOptions(null, null);
}
paymentOptions.setItemName(_name);
}
}
Aggregations