Permalink
Browse files

0.0.1

  • Loading branch information...
1 parent 081c1c5 commit 92c6c44e0c61db9f45fa5822b78c6bf31afdee67 @deoxxa committed Nov 19, 2011
Showing with 135 additions and 0 deletions.
  1. +27 −0 README.mkd
  2. +86 −0 lib/torrent-util.js
  3. +22 −0 package.json
View
@@ -0,0 +1,27 @@
+node-torrent-util
+=================
+
+Overview
+--------
+
+.torrent files differ wildly in their contents. This package aims to make it a
+little easier to extract the various metadata components from them in a simple
+way.
+
+Features
+--------
+
+* "created by" field parsing
+
+Usage
+-----
+
+```
+var torrent_util = require("torrent-util");
+var created_by = torrent_util.parse_created_by("uTorrent/2040");
+```
+
+Contact
+-------
+
+Github, email or IRC. I'm on freenode.
View
@@ -0,0 +1,86 @@
+exports.parse_client_banner = function(banner) {
+ if (matches = banner.match(/^uTorrent\/(.+)$/)) {
+ return {client: "uTorrent", version: matches[1]};
+ }
+ if (matches = banner.match(/^Azureus\/(.+)$/) {
+ return {client: "Azureus", version: matches[1]});
+ }
+ if (matches = banner.match(/^AzureusBitTyrant\/(.+?)$/) {
+ return {client: "Azureus Bit Tyrant", version: matches[1]};
+ }
+ if (matches = banner.match(/^BitComet\/(.+?)$/) {
+ return {client: "BitComet", version: matches[1]};
+ }
+ if (matches = banner.match(/^BitLet\/(.+?)$/) {
+ return {client: "BitLet", version: matches[1]};
+ }
+ if (matches = banner.match(/^BitLord\/(.+?)$/) {
+ return {client: "BitLord", version: matches[1]};
+ }
+ if (matches = banner.match(/^BitSpirit\/(.+?)$/) {
+ return {client: "BitSpirit", version: matches[1]};
+ }
+ if (matches = banner.match(/^BitTorrent\/(.+?)$/) {
+ return {client: "Mainline BitTorrent", version: matches[1]};
+ }
+ if (matches = banner.match(/^buildtorrent\/(.+?)$/) {
+ return {client: "buildtorrent", version: matches[1]};
+ }
+ if (matches = banner.match(/^Burnbit (.+?)$/) {
+ return {client: "Burnbit", version: matches[1]};
+ }
+ if (matches = banner.match(/^Enhanced-CTorrent\/(.+?)$/) {
+ return {client: "CTorrent (enhanced)", version: matches[1]};
+ }
+ if (matches = banner.match(/^Flush (.+?)$/) {
+ return {client: "Flush", version: matches[1]};
+ }
+ if (matches = banner.match(/^Halite v (.+?)$/) {
+ return {client: "Halite", version: matches[1]};
+ }
+ if (matches = banner.match(/^KTorrent$/) {
+ return {client: "KTorrent"};
+ }
+ if (matches = banner.match(/^KTorrent[\/ ](.+?)$/) {
+ return {client: "KTorrent", version: matches[1]};
+ }
+ if (matches = banner.match(/^mktorrent$/) {
+ return {client: "mktorrent"};
+ }
+ if (matches = banner.match(/^mktorrent (.+?)$/) {
+ return {client: "mktorrent", version: matches[1]};
+ }
+ if (matches = banner.match(/^mktorrent-GUI \[mktorrent (.+?)\]$/) {
+ return {client: "mktorrent (via mktorrent-GUI)", version: matches[1]};
+ }
+ if (matches = banner.match(/^py3createtorrent v(.+?)$/) {
+ return {client: "py3createtorrent", version: matches[1]};
+ }
+ if (matches = banner.match(/^qBittorrent v(.+?)$/) {
+ return {client: "qBittorrent", version: matches[1]};
+ }
+ if (matches = banner.match(/^ruTorrent \(PHP Class - Adrien Gibrat\)$/) {
+ return {client: "ruTorrent"};
+ }
+ if (matches = banner.match(/^Sturmtruppen-bt$/) {
+ return {client: "Sturmtruppen-bt"};
+ }
+ if (matches = banner.match(/^Tixati v(.+?)$/) {
+ return {client: "Tixati", version: matches[1]};
+ }
+ if (matches = banner.match(/^TorrentAid (.+?)$/) {
+ return {client: "TorrentAid", version: matches[1]};
+ }
+ if (matches = banner.match(/^TorrentB\/(.+?) libtorrent\/(.+?)$/) {
+ return {client: "TorrentB", version: matches[1], extra: "libttorrent " + matches[2]};
+ }
+ if (matches = banner.match(/^TorrentSpy\/(.+?)$/) {
+ return {client: "TorrentSpy", version: matches[1]};
+ }
+ if (matches = banner.match(/^Transmission\/(.+?) \((.+?)\)$/) {
+ return {client: "TorrentSpy", version: matches[1], extra: matches[2]};
+ }
+ if (matches = banner.match(/^VIP Torrent\/(.+?)$/) {
+ return {client: "TorrentSpy", version: matches[1], extra: matches[2]};
+ }
+};
View
@@ -0,0 +1,22 @@
+{
+ "name": "torrent-util",
+ "description": "Various utility functions for making sense of .torrent files",
+ "version": "0.0.1",
+ "author": {
+ "name": "Conrad Pankoff",
+ "email": "deoxxa@fknsrs.biz",
+ "url": "http://www.fknsrs.biz/"
+ },
+ "url": "http://github.com/deoxxa/node-torrent-util",
+ "license" : "BSD",
+ "repository" : { "type":"git", "url":"git://github.com/deoxxa/node-torrent-util.git" },
+ "keywords" : [
+ "torrent",
+ "utility"
+ ],
+ "main": "./lib/torrent-util",
+ "dependencies": {},
+ "engines": {
+ "node" : ">=0.4.12"
+ }
+}

0 comments on commit 92c6c44

Please sign in to comment.