David 10 anni fa
parent
commit
51aff89c46
3 ha cambiato i file con 9 aggiunte e 4 eliminazioni
  1. 1 1
      front/index.html
  2. 1 1
      front/js/app.js
  3. 7 2
      qmanager.py

+ 1 - 1
front/index.html

@@ -49,7 +49,7 @@
 										<i ng-show="l.STATUS=='DISCONNECTED'">Found {{l.OUT.length}} matches:</i>
 										<ul>
 											<li ng-repeat="o in l.OUT | limitTo:limit[l.ID]||5">
-												<a ng-click="download(o.text)">{{o.bot}} --- {{o.book}} --- {{o.info}}</a>
+												<a ng-click="download(o.TEXT)">{{o.BOT}} --- {{o.BOOK}} --- {{o.TAGS}} --- {{o.INFO}}</a>
 											</li>
 										</ul>
 									</td>

+ 1 - 1
front/js/app.js

@@ -64,7 +64,7 @@ app.controller('main', function($scope,$http,$interval) {
 	$scope.showMore = function(l){
 		$scope.limit[l.ID] = $scope.limit[l.ID] ? undefined : l.OUT.length;
 	}
-	$interval($scope.getList, 2500);
+	$interval($scope.getList, 3500);
 });
 
 app.directive('progressBar', function(){

+ 7 - 2
qmanager.py

@@ -73,13 +73,18 @@ class task:
     def get_output(self):
        if type(self.OUTPUT) == str or self.OUTPUT is None:
            return self.OUTPUT
+       TAGS_R = re.compile('[\[(].*?[\])]|\.rar|v\d.*?\s')
        books = self.OUTPUT
        ret=[]
        for book in books:
-           groups = re.search("(?P<BOT>^!\w+)(?P<BOOK>.*?)(?P<INFO>::INFO.*$)",book)
+           book = book.replace("---","")
+           groups = re.search("(?P<BOT>^!\w+)(?P<BOOK>.*?)(?P<INFO>::INFO.*)?$",book)
            if groups is None:
-               ret.append("None?")
+               #print("[No groups] %s" % book)
+               return books
            groups=groups.groupdict()
+           groups["BOOK"]=re.sub(TAGS_R,"",groups["BOOK"]) #remove tags from book
+           groups["TAGS"]=[ r.strip("()[]") for r in re.findall(TAGS_R,book) ]
            groups["TEXT"]=book
            ret.append(groups)
        return ret