|
@@ -86,11 +86,21 @@ class Apps(SmartTop) :
|
|
|
r = pd.DataFrame()
|
|
|
if 'filter' in args :
|
|
|
pattern = "|".join(args['filter'])
|
|
|
- r = df[df.name.str.contains(pattern)]
|
|
|
+ i = df.cmd.str.contains(pattern)
|
|
|
+ r = df[i]
|
|
|
+ ii= (1 + np.array(i)*-1) == 1
|
|
|
+ other = pd.DataFrame(df[ii].sum()).T
|
|
|
+ other.user = other.name = other.status = other.cmd = other.args = 'other'
|
|
|
+ other.started = other.pid = -1
|
|
|
+ other = other[other.columns[1:]]
|
|
|
for name in args['filter'] :
|
|
|
- filter = "name == '"+name+"'"
|
|
|
- if r.query(filter).size == 0 :
|
|
|
- r = r.append(self.empty(name))
|
|
|
+ i = r.cmd.str.contains(str(name),case=False,na=False)
|
|
|
+ if i.sum() == 0:
|
|
|
+ r = r.append(self.empty(name),sort=False)
|
|
|
+ else :
|
|
|
+ r.loc[i,'name'] = name
|
|
|
+ r = r.append(other,sort=False)
|
|
|
+ r.index = np.arange(r.shape[0])
|
|
|
return r
|
|
|
except Exception,e:
|
|
|
print (e)
|
|
@@ -133,7 +143,10 @@ class Folders(SmartTop):
|
|
|
#
|
|
|
# If the folder does NOT exists it should not be treated.
|
|
|
#
|
|
|
- r = pd.DataFrame(self._get(path))
|
|
|
- r = pd.DataFrame([{"name":path,"files":r.shape[0],"age_in_days":r.age.mean(),"size_in_kb":r.size.sum()}])
|
|
|
- _out = _out.append(r)
|
|
|
+ rows = self._get(path)
|
|
|
+ if len(rows) > 0 :
|
|
|
+ print rows
|
|
|
+ r = pd.DataFrame(rows)
|
|
|
+ r = pd.DataFrame([{"name":path,"files":r.shape[0],"age_in_days":r.age.mean(),"size_in_kb":r.size.sum()}])
|
|
|
+ _out = _out.append(r)
|
|
|
return _out
|