mirror of
https://github.com/simon987/Simple-Incremental-Search-Tool.git
synced 2025-04-19 18:16:45 +00:00
Made it work on Windows
This commit is contained in:
parent
66dabd7ce5
commit
4b151966b3
@ -29,7 +29,7 @@ class RunningTask:
|
|||||||
|
|
||||||
class Crawler:
|
class Crawler:
|
||||||
|
|
||||||
def __init__(self, enabled_parsers: list, mime_guesser: MimeGuesser=ContentMimeGuesser(), indexer=None, dir_id=0,
|
def __init__(self, enabled_parsers: list, mime_guesser: MimeGuesser=ExtensionMimeGuesser(), indexer=None, dir_id=0,
|
||||||
root_dir="/"):
|
root_dir="/"):
|
||||||
self.documents = []
|
self.documents = []
|
||||||
self.enabled_parsers = enabled_parsers
|
self.enabled_parsers = enabled_parsers
|
||||||
|
14
indexer.py
14
indexer.py
@ -1,9 +1,11 @@
|
|||||||
import json
|
import json
|
||||||
import elasticsearch
|
import elasticsearch
|
||||||
|
from elasticsearch.exceptions import TransportError
|
||||||
from threading import Thread
|
from threading import Thread
|
||||||
import subprocess
|
import subprocess
|
||||||
import requests
|
import requests
|
||||||
import config
|
import config
|
||||||
|
import platform
|
||||||
|
|
||||||
|
|
||||||
class Indexer:
|
class Indexer:
|
||||||
@ -24,14 +26,19 @@ class Indexer:
|
|||||||
|
|
||||||
time.sleep(15)
|
time.sleep(15)
|
||||||
|
|
||||||
try:
|
if self.es.indices.exists(self.index_name):
|
||||||
requests.head("http://localhost:9200")
|
print("Index is already setup")
|
||||||
except requests.exceptions.ConnectionError:
|
else:
|
||||||
print("First time setup...")
|
print("First time setup...")
|
||||||
self.init()
|
self.init()
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def run_elasticsearch():
|
def run_elasticsearch():
|
||||||
|
|
||||||
|
if platform.system() == "Windows":
|
||||||
|
subprocess.Popen(["elasticsearch\\bin\\elasticsearch.bat"])
|
||||||
|
else:
|
||||||
|
print(platform.system())
|
||||||
subprocess.Popen(["elasticsearch/bin/elasticsearch"])
|
subprocess.Popen(["elasticsearch/bin/elasticsearch"])
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
@ -62,6 +69,7 @@ class Indexer:
|
|||||||
self.es.indices.create(self.index_name)
|
self.es.indices.create(self.index_name)
|
||||||
|
|
||||||
def init(self):
|
def init(self):
|
||||||
|
if self.es.indices.exists(self.index_name):
|
||||||
self.es.indices.delete(index=self.index_name)
|
self.es.indices.delete(index=self.index_name)
|
||||||
self.es.indices.create(index=self.index_name)
|
self.es.indices.create(index=self.index_name)
|
||||||
self.es.indices.close(index=self.index_name)
|
self.es.indices.close(index=self.index_name)
|
||||||
|
@ -1,5 +1,4 @@
|
|||||||
import hashlib
|
import hashlib
|
||||||
import magic
|
|
||||||
import os
|
import os
|
||||||
import mimetypes
|
import mimetypes
|
||||||
import subprocess
|
import subprocess
|
||||||
|
@ -2,7 +2,7 @@ from PIL import Image
|
|||||||
import os
|
import os
|
||||||
from multiprocessing import Value, Process
|
from multiprocessing import Value, Process
|
||||||
import ffmpeg
|
import ffmpeg
|
||||||
import cairosvg
|
#import cairosvg
|
||||||
|
|
||||||
|
|
||||||
class ThumbnailGenerator:
|
class ThumbnailGenerator:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user