transmission.torrents={all:null,puased:null,downloading:null,actively:null,searchResult:null,error:null,warning:null,folders:{},status:{},count:0,totalSize:0,loadSimpleInfo:!1,activeTorrentCount:0,pausedTorrentCount:0,fields:{base:"id,name,status,hashString,totalSize,percentDone,addedDate,trackerStats,leftUntilDone,rateDownload,rateUpload,recheckProgress,rateDownload,rateUpload,peersGettingFromUs,peersSendingToUs,uploadRatio,uploadedEver,downloadedEver,downloadDir,error,errorString,doneDate,queuePosition,activityDate", status:"id,name,status,totalSize,percentDone,trackerStats,leftUntilDone,rateDownload,rateUpload,recheckProgress,rateDownload,rateUpload,peersGettingFromUs,peersSendingToUs,uploadRatio,uploadedEver,downloadedEver,error,errorString,doneDate,queuePosition,activityDate",config:"downloadLimit,downloadLimited,peer-limit,seedIdleLimit,seedIdleMode,seedRatioLimit,seedRatioMode,uploadLimit,uploadLimited"},datas:{},recently:null,removed:null,isRecentlyActive:!1,newIds:[],btItems:[],getallids:function(b,d,c){var a= this.fields.base;this.loadSimpleInfo&&this.all&&(a=this.fields.status);a=a.split(",");$.isArray(c)&&$.unique($.merge(a,c));c={fields:a};this.isRecentlyActive=!1;this.all&&void 0==d?(c.ids="recently-active",this.isRecentlyActive=!0):d&&(c.ids=d);this.all||(this.all={});transmission.exec({method:"torrent-get",arguments:c},function(a){"success"==a.result?(transmission.torrents.newIds.length=0,transmission.torrents.loadSimpleInfo=!0,transmission.torrents.recently=a.arguments.torrents,transmission.torrents.removed= a.arguments.removed,transmission.torrents.splitid(),b&&b(a.arguments.torrents)):(transmission.torrents.datas=null,b&&b(null))})},splitid:function(){this.downloading=[];this.puased=[];this.actively=[];this.error=[];this.warning=[];this.btItems=[];transmission.downloadDirs=[];var b=transmission._status;this.status={};transmission.trackers={};this.totalSize=0;this.folders={};this.count=0;var d=new Base64,c;for(c in this.recently){var a=this.recently[c];this.datas[a.id]=a}var f=[];for(c in this.removed)a= this.removed[c],f.push(a);for(c in this.datas){a=this.datas[c];if(!a)return;if(-1!=$.inArray(a.id,f)&&0e.nextAnnounceTime&&(b.nextAnnounceTime=e.nextAnnounceTime):b.nextAnnounceTime=e.nextAnnounceTime, this.warning.push(b));0>b.leecherCount&&(b.leecherCount=0);0>b.seederCount&&(b.seederCount=0);b.leecher=b.leecherCount+" ("+b.peersGettingFromUs+")";b.seeder=b.seederCount+" ("+b.peersSendingToUs+")";b.trackers=c.join(";")}},getPeers:function(b){transmission.exec({method:"torrent-get",arguments:{fields:["peers","peersFrom"],ids:b}},function(b){console.log("data:",b)})},getMoreInfos:function(b,d,c){transmission.exec({method:"torrent-get",arguments:{fields:b.split(","),ids:d}},function(a){"success"== a.result?c&&c(a.arguments.torrents):c&&c(null)})},search:function(b,d){if(!b)return null;d||(d=this.all);var c=[];$.each(d,function(a,f){-1!=d[a].name.toLowerCase().indexOf(b.toLowerCase())&&c.push(d[a])});return this.searchResult=c},getFiles:function(b,d){transmission.exec({method:"torrent-get",arguments:{fields:["files","fileStats"],ids:b}},function(b){"success"==b.result?d&&d(b.arguments.torrents):d&&d(null)})},getConfig:function(b,d){this.getMoreInfos(this.fields.config,b,d)},getErrorIds:function(b, d){var c=[],a=new Date;1==d&&(a=a.getTime()/1E3);for(var f in this.error){var e=this.error[f];-1!=$.inArray(e.id,b)&&0