Exemple #1
0
 def testCurrentRescans(self):
     spider.pause()
     self._configmethod("rescan_root", self.static_path)
     rescans = self._configmethod("current_rescans")
     self.assertEqual(len(rescans), 1)
     self.assertEqual(rescans[0], self.static_path)
     spider.unpause()
Exemple #2
0
 def testCurrentRescans(self):
     spider.pause()
     self._configmethod("rescan_root", self.static_path)
     rescans = self._configmethod("current_rescans")
     self.assertEqual(len(rescans), 1)
     self.assertEqual(rescans[0], self.static_path)
     spider.unpause()
Exemple #3
0
 def testRemoveRoot(self):
     spider.pause()
     self._configmethod("rescan_root", self.static_path)
     rootcount = len(self._configmethod("all_roots"))
     res = self._configmethod("remove_root", self.static_path)
     self.assertEqual(len(res), rootcount - 1)
     for wp in spider.queue:
         print "q", wp, wp.root
     spider.unpause()
     self.needs_static()
Exemple #4
0
 def testRemoveRoot(self):
     spider.pause()
     self._configmethod("rescan_root", self.static_path)
     rootcount = len(self._configmethod("all_roots"))
     res = self._configmethod("remove_root", self.static_path)
     self.assertEqual(len(res), rootcount - 1)
     for wp in spider.queue:
         logger.debug("still queued %s %s", wp, wp.root)
     spider.unpause()
     self.needs_static()
Exemple #5
0
def remove_root(request, root):
    for x in WebPath.get_root_nodes():
        if x.url == root:
            spider.pause()
            start = time()
            logger.debug("deleting %s %s", root, x)
            MusicFile.objects.filter(parent__root = x).delete()
            WebPath.objects.filter(root = x).delete()
            x.delete()
            logger.debug("deleted %s", time()-start)
            spider.unpause()
            break
    
    return all_roots(request)
Exemple #6
0
def remove_root(request, root):
    for x in WebPath.get_root_nodes():
        if x.url == root:
            spider.pause()
            start = time()
            print "deleting", root, x
            MusicFile.objects.filter(parent__root=x).delete()
            WebPath.objects.filter(root=x).delete()
            x.delete()
            print "deleted", time() - start
            spider.unpause()
            break

    return all_roots(request)
Exemple #7
0
def rescan_root(request, root):
    result = "success"
    for x in WebPath.get_root_nodes():
        if x.url == root:
            spider.pause()
            x.delete()
            spider.add(WebPath.add_root(root))
            spider.unpause()
            break
    else:
        try:
            urlopen(root)
            spider.add(WebPath.add_root(url=root))
        except Exception, e:
            logger.debug("don't like %s %s %s", root, e, request.META)
            result = "failure"
Exemple #8
0
def rescan_root(request, root):
    result = "success"
    for x in WebPath.get_root_nodes():
        if x.url == root:
            spider.pause()
            x.delete()
            spider.add(WebPath.add_root(root))
            spider.unpause()
            break
    else:
        try:
            urlopen(root)
            spider.add(WebPath.add_root(url=root))
        except Exception, e:
            print "don't like", root, e
            print request.META
            result = "failure"