diff --git a/buildozer.spec b/buildozer.spec index 05eaab8..a05d57b 100644 --- a/buildozer.spec +++ b/buildozer.spec @@ -28,11 +28,11 @@ source.exclude_dirs = cache #source.exclude_patterns = license,images/*/*.jpg # (str) Application versioning (method 1) -version = 0.1 +#version = 0.1 # (str) Application versioning (method 2) -# version.regex = __version__ = ['"](.*)['"] -# version.filename = %(source.dir)s/main.py +version.regex = __version__ = ['"](.*)['"] +version.filename = %(source.dir)s/main.py # (list) Application requirements # comma separated e.g. requirements = sqlite3,kivy @@ -41,7 +41,7 @@ requirements = python3,setuptools,requests,certifi,urllib3,chardet,idna,sqlite3, # (str) Custom source folders for requirements # Sets custom source for any requirements with recipes # requirements.source.kivy = ../../kivy -##requirements.source.kivy = ../../kivy +#requirements.source.kivy = ../kivysrc # (list) Garden requirements #garden_requirements = diff --git a/cncbot.py b/cncbot.py index d8d6119..44cbe48 100644 --- a/cncbot.py +++ b/cncbot.py @@ -2,8 +2,10 @@ import pydle import random import string -CNC_HOST='forest.deflax.net' +CNC_HOST='dark.deflax.net' +CNC_CHANNEL='#izba' ADMIN_NICKNAMES = [ 'afx' ] +MOTD='] Forest CnC ready!' def get_random_string(length): letters = string.ascii_lowercase @@ -13,7 +15,8 @@ def get_random_string(length): class ForestBot(pydle.Client): async def on_connect(self): await super().on_connect() - await self.join('#forest') + await self.join(CNC_CHANNEL) + await self.message(CNC_CHANNEL, '] {}'.format(MOTD)) async def is_admin(self, nickname): """ @@ -27,7 +30,7 @@ class ForestBot(pydle.Client): # This is a blocking operation, so use yield. if nickname in ADMIN_NICKNAMES: info = await self.whois(nickname) - print(info) + print('] Detected privileged request from {}'.format(info)) admin = info['identified'] return admin @@ -35,22 +38,22 @@ class ForestBot(pydle.Client): async def on_message(self, target, source, message): await super().on_message(target, source, message) - # Print Help - if message.startswith('!help {}'.format(target)): - await self.message(target, '] CnC globalforest__armeabi-v7a-debug-0.1 ') - await self.message(target, '!id - cnc user info' + # Print help + if message.startswith('help {}'.format(self.nickname)): + await self.message(target, '] cnc usage:') + await self.message(target, '] help - displays help') + await self.message(target, '] id - cnc user info') - # Tell a user if they are an administrator for this bot. - if message.startswith('!id {}'.format(target)): + # Show user info + if message.startswith('id {}'.format(self.nickname)): admin = await self.is_admin(source) - if admin: - await self.message(target, 'You are an administrator. :)'.format(source)) + await self.message(target, '] You are an administrator. :)'.format(source)) else: - await self.message(target, 'You are NOT an administrator. :('.format(source)) + await self.message(target, '] You are NOT an administrator. :('.format(source)) def CnCApp(): - cnc = ForestBot('client_' + get_random_string(5)) + cnc = ForestBot('cnc_' + get_random_string(6)) cnc.run(CNC_HOST, tls=False, tls_verify=False) if __name__ == '__main__': diff --git a/forestmapview.kv b/forestmapview.kv index 8726756..2e9aef5 100644 --- a/forestmapview.kv +++ b/forestmapview.kv @@ -4,15 +4,18 @@ #:include treemarker.kv : + url: "http://forest.deflax.net:8111/tile/{z}/{x}/{y}.png" lat: 42.131331 lon: 24.747571 zoom: 17 + min_zoom: 17 + max_zoom: 17 snap_to_zoom: True pause_on_action: True - on_zoom: + #on_zoom: #self.zoom = 10 if self.zoom < 10 else self.zoom #self.print_current_zoom(self.zoom) - self.zoom = 17 + #self.zoom = 17 on_lat: self.start_get_fov_trees() on_lon: diff --git a/forestmapview.py b/forestmapview.py index 06dc42e..432fc71 100644 --- a/forestmapview.py +++ b/forestmapview.py @@ -27,7 +27,7 @@ class ForestMapView(MapView): # Get reference to main app and the db cursor app = App.get_running_app() # Gebug gps position - print("] Current map position: " + str(self.get_bbox())) + print("] Current map position lat: {} lon: {} ".format(self.lat, self.lon)) min_lat, min_lon, max_lat, max_lon = self.get_bbox() sql_statement = "SELECT * FROM locations WHERE x > %s AND x < %s AND y > %s AND y < %s" % (min_lat, max_lat, min_lon, max_lon) #sql_statement = "SELECT * FROM locations" app.cursor.execute(sql_statement) diff --git a/main.py b/main.py index 281c2d1..3b31b3b 100644 --- a/main.py +++ b/main.py @@ -1,3 +1,6 @@ +__author__ = "afx" +__version__ = "0.2" + # Import system modules import multiprocessing import random @@ -27,7 +30,7 @@ from cncbot import CnCApp # Welcome message MOTD = """] -] GlobalForest 0.1 by afx""" +] GlobalForest {} by afx""".format(__version__) Builder.load_string(""" : @@ -91,5 +94,5 @@ if __name__ == '__main__': kivyapp.run() # Cleanup subprocesses - print('] Terminating cnc.') - cnc.kill() \ No newline at end of file + print('] Terminating subprocesses.') + cnc.kill()