Skip to content

Commit

Permalink
Rebranding
Browse files Browse the repository at this point in the history
Pokeminer is now Monocle!
  • Loading branch information
Noctem committed Jan 27, 2017
1 parent 864216c commit a29c30d
Show file tree
Hide file tree
Showing 45 changed files with 82 additions and 82 deletions.
6 changes: 3 additions & 3 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,6 +1,3 @@
### Images ###
monocle/monocle-icons/

### Python ###
# Byte-compiled / optimized / DLL files
__pycache__/
Expand Down Expand Up @@ -125,3 +122,6 @@ notification-images/
Thumbs.db
ehthumbs.db
Desktop.ini

### Images ###
monocle/static/monocle-icons
2 changes: 1 addition & 1 deletion .gitmodules
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
[submodule "monocle-icons"]
path = pokeminer/static/monocle-icons
path = monocle/static/monocle-icons
url = https://github.com/Noctem/monocle-icons.git
ignore = all
2 changes: 1 addition & 1 deletion LICENSE
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
MIT License

Copyright for portions of Pokeminer+ are held by Tomasz Modrzyński (2016), all others are held by David Christenson (2016).
Copyright for portions of Monocle are held by Tomasz Modrzyński (2016), all others are held by David Christenson (2017).

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
Expand Down
23 changes: 14 additions & 9 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
# pokeminer+
# Monocle

[![Build Status](https://travis-ci.org/Noctem/pokeminer.svg?branch=develop)](https://travis-ci.org/Noctem/pokeminer)
[![Build Status](https://travis-ci.org/Noctem/Monocle.svg?branch=develop)](https://travis-ci.org/Noctem/Monocle)

A Pokémon Go scraper capable of scanning large areas for Pokémon spawns over long periods of time. Features spawnpoint scanning, Twitter and PushBullet notifications, accurate expiration times and estimates based on historical data, pokestop and gym collection, a CAPTCHA solving script, and more.
Monocle is the distinguished Pokémon Go scanner capable of scanning large areas for spawns. Features spawnpoint scanning, Twitter and PushBullet notifications, accurate expiration times and estimates based on historical data, pokestop and gym collection, a CAPTCHA solving script, and more.

[A demonstration of the Twitter notifications can be viewed here](https://twitter.com/SLCPokemon).
A [demonstration of the Twitter notifications can be viewed here](https://twitter.com/SLCPokemon).

[![Distinguished Pokemon](https://i.imgur.com/9vud1wo.jpg)](https://darkestnight.deviantart.com/art/A-Distinguished-Pokeman-208009200)


## How does it work?
Expand Down Expand Up @@ -41,8 +43,9 @@ Since it uses [Leaflet](http://leafletjs.com/) for mapping, the appearance and d

## Setting up
1. Install Python 3.5 or later (3.6 is recommended)
2. `git clone https://github.com/Noctem/pokeminer.git` or download the [zip](https://github.com/Noctem/pokeminer/archive/develop.zip)
3. Copy `config.example.py` to `pokeminer/config.py` and customize it with your accounts, location, database information, and any other relevant settings. The comments in the config example provide some information about the options.
2. `git clone --recursive https://github.com/Noctem/Monocle.git`
* Optionally install a custom icon package from elsewhere
3. Copy `config.example.py` to `monocle/config.py` and customize it with your accounts, location, database information, and any other relevant settings. The comments in the config example provide some information about the options.
4. `pip3 install -r requirements.txt`
* Optionally `pip3 install` additional packages listed in optional-requirements
* *pushbullet.py* is required for pushbullet notifications
Expand All @@ -63,7 +66,7 @@ Since it uses [Leaflet](http://leafletjs.com/) for mapping, the appearance and d
* Optionally run the live map interface and reporting system: `python3 web.py`


**Note**: Pokeminer works with Python 3.5 or later only. Python 2.7 is **not supported** and is not compatible at all since I moved from threads to coroutines. Seriously, it's 2016, Python 2.7 hasn't been developed for 6 years, why don't you upgrade already?
**Note**: Monocle works with Python 3.5 or later only. Python 2.7 is **not supported** and is not compatible at all since I moved from threads to coroutines. Seriously, it's 2016, Python 2.7 hasn't been developed for 6 years, why don't you upgrade already?

Note that if you want more than 10 workers simultaneously running, SQLite is likely not the best choice. I personally use and recommend PostgreSQL, but MySQL and SQLite should also work.

Expand All @@ -80,10 +83,12 @@ The workers' live locations and stats can be viewed from the main map by enablin

The gyms statistics server is in a separate file, because it's intended to be shared publicly as a webpage.

[![gyms](https://i.imgur.com/MWpHAEWm.jpg)](pokeminer/static/demo/gyms.png)
[![gyms](https://i.imgur.com/MWpHAEWm.jpg)](monocle/static/demo/gyms.png)

## License

See [LICENSE](LICENSE).

This project is based on the coroutines branch of (now discontinued) [pokeminer](https://github.com/modrzew/pokeminer/tree/coroutines). Pokeminer was originally based on an early version of [PokemonGo-Map](https://github.com/AHAAAAAAA/PokemonGo-Map), but no longer shares any code with it. It currently uses my lightly modified fork of [pgoapi](https://github.com/Noctem/pgoapi).
This project is based on the coroutines branch of [pokeminer](https://github.com/modrzew/pokeminer/tree/coroutines) (now discontinued). *Pokeminer* was originally based on an early version of [PokemonGo-Map](https://github.com/AHAAAAAAA/PokemonGo-Map), but no longer shares any code with it. It uses my [pogo_async](https://github.com/Noctem/pgoapi), my fork of pgoapi which uses *aiohttp* for asynchronous network requests.

The [excellent image](https://darkestnight.deviantart.com/art/A-Distinguished-Pokeman-208009200) near the top of this README was painted by [darkestnight](https://darkestnight.deviantart.com/).
10 changes: 5 additions & 5 deletions config.example.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
### All lines that are commented out (and some that aren't) are optional ###

DB_ENGINE = 'sqlite:///db.sqlite'
#DB_ENGINE = 'mysql://user:pass@localhost/pokeminer'
#DB_ENGINE = 'postgresql://user:pass@localhost/pokeminer
#DB_ENGINE = 'mysql://user:pass@localhost/monocle'
#DB_ENGINE = 'postgresql://user:pass@localhost/monocle

AREA_NAME = 'SLC' # the city or region you are scanning
LANGUAGE = 'EN' # ISO 639-1 codes EN, DE, FR, and ZH for Pokémon names.
Expand Down Expand Up @@ -166,8 +166,8 @@
# Bytestring key to authenticate with manager for inter-process communication
#AUTHKEY = b'm3wtw0'
# Address to use for manager, leave unset or set to None if you're note sure.
#MANAGER_ADDRESS = r'\\.\pipe\pokeminer' # must be in this format for Windows
#MANAGER_ADDRESS = 'pokeminer.sock' # the socket name for Unix systems
#MANAGER_ADDRESS = r'\\.\pipe\monocle' # must be in this format for Windows
#MANAGER_ADDRESS = 'monocle.sock' # the socket name for Unix systems
#MANAGER_ADDRESS = ('127.0.0.1', 5002) # could be used for CAPTCHA solving and live worker maps on remote systems

# Store the cell IDs so that they don't have to be recalculated every visit.
Expand All @@ -184,7 +184,7 @@

# As many hashtags as can fit will be included in your tweets, these will
# be combined with landmark-specific hashtags (if applicable).
HASHTAGS = {AREA_NAME, 'Pokeminer+', 'PokemonGO'}
HASHTAGS = {AREA_NAME, 'Monocle', 'PokemonGO'}
#TZ_OFFSET = 0 # UTC offset in hours (if different from system time)

# the required number of seconds remaining to notify about a Pokémon
Expand Down
2 changes: 1 addition & 1 deletion create_db.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#!/usr/bin/env python3

from pokeminer import db
from monocle import db

db.Base.metadata.create_all(db.get_engine())
10 changes: 5 additions & 5 deletions gyms.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,13 @@

from flask import Flask, render_template

from pokeminer.names import POKEMON_NAMES
from pokeminer import config
from pokeminer import db
from pokeminer import utils
from monocle.names import POKEMON_NAMES
from monocle import config
from monocle import db
from monocle import utils


app = Flask(__name__, template_folder=resource_filename('pokeminer', 'templates'))
app = Flask(__name__, template_folder=resource_filename('monocle', 'templates'))


def get_args():
Expand Down
8 changes: 4 additions & 4 deletions manifest.in
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
recursive-include pokeminer/static *.png
recursive-include pokeminer/static/css *.css
recursive-include pokeminer/static/js *.js
recursive-include pokeminer/templates *.html
recursive-include monocle/static *.png
recursive-include monocle/static/css *.css
recursive-include monocle/static/js *.js
recursive-include monocle/templates *.html
2 changes: 1 addition & 1 deletion pokeminer/__init__.py → monocle/__init__.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
__title__ = 'Pokeminer+'
__title__ = 'monocle'
__version__ = '0.8a'
__author__ = 'Noctem'
__license__ = 'MIT License'
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
6 changes: 3 additions & 3 deletions pokeminer/notification.py → monocle/notification.py
Original file line number Diff line number Diff line change
Expand Up @@ -102,12 +102,12 @@ def __init__(self, pokemon_id, iv, moves, time_of_day):

def create(self):
if self.time_of_day > 1:
bg = resource_stream('pokeminer', 'static/monocle-icons/assets/notification-bg-night.png')
bg = resource_stream('monocle', 'static/monocle-icons/assets/notification-bg-night.png')
else:
bg = resource_stream('pokeminer', 'static/monocle-icons/assets/notification-bg-day.png')
bg = resource_stream('monocle', 'static/monocle-icons/assets/notification-bg-day.png')
ims = cairo.ImageSurface.create_from_png(bg)
self.context = cairo.Context(ims)
pokepic = resource_stream('pokeminer', 'static/original-icons/{}.png'.format(self.pokemon_id))
pokepic = resource_stream('monocle', 'static/original-icons/{}.png'.format(self.pokemon_id))
self.draw_stats()
self.draw_image(pokepic, 204, 224)
self.draw_name()
Expand Down
2 changes: 1 addition & 1 deletion pokeminer/overseer.py → monocle/overseer.py
Original file line number Diff line number Diff line change
Expand Up @@ -262,7 +262,7 @@ def get_status_message(self):
visits_per_second = self.visits / seconds_since_start

output = [
'PokeMiner running for {}'.format(running_for),
'Monocle running for {}'.format(running_for),
'Known spawns: {}, unknown: {}, more: {}'.format(
len(self.spawns),
self.spawns.mysteries_count,
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ <h3>You literally own {{ area_size }} km² of {{ area_name }}.</h3>

<hr>

<p><small><i>Generated {{ minutes_ago }} minutes ago using data from {{ last_date_minutes_ago }} minutes ago gathered by <a href="https://github.com/Noctem/pokeminer">pokeminer+</a></i></small></p>
<p><small><i>Generated {{ minutes_ago }} minutes ago using data from {{ last_date_minutes_ago }} minutes ago gathered by <a href="https://github.com/Noctem/Monocle">Monocle</a></i></small></p>
</div>

{% include 'footer.html' ignore missing %}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Pokeminer</title>
<title>Monocle</title>
<style>
.floating-panel {
z-index: 1000;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Pokeminer - {{ area_name }}</title>
<title>Monocle - {{ area_name }}</title>
<link rel="stylesheet" href="{{ url_for('static', filename='css/leaflet.css') }}">
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no" />
<style>
Expand Down Expand Up @@ -48,7 +48,7 @@
</style>
</head>
<body>
<h1>Pokeminer is initializing, please wait.</h1>
<h1>Monocle is initializing, please wait.</h1>

<div id="main-map" class="map"></div>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Pokeminer Report - {{ area_name }}</title>
<title>Monocle Report - {{ area_name }}</title>
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" integrity="sha384-BVYiiSIFeK1dGmJRAkycuHAHRg32OmUcww7on3RYdg4Va+PmSTsz/K68vbdEjh4u" crossorigin="anonymous">

<style>
Expand Down Expand Up @@ -100,12 +100,12 @@
</head>
<body>
<div class="container">
<h1>Pokeminer Report</h1>
<h1>Monocle Report</h1>
<h4>Generated on {{ current_date.strftime('%Y-%m-%d %H:%M:%S') }}</h4>

<p><b>Disclaimer:</b> data may be incomplete due to various issues that might have happened (bugs, unstable servers, bugs on the servers etc.). If there is data about a sighting of a Pokemon in given location at particular time, almost certainly such spawning happened. On the other hand, there is no guarantee that Pokeminer database contains <i>all</i> spawnings, so there might be wild Pokemon not contained in this report. Your mileage may vary.</p>
<p><b>Disclaimer:</b> data may be incomplete due to various issues that might have happened (bugs, unstable servers, bugs on the servers etc.). If there is data about a sighting of a Pokemon, that spawn almost certainly happened. On the other hand, there is no guarantee that the database contains <i>all</i> spawns, so there may be Pokemon missing from this report. Your mileage may vary.</p>

<p>This report contains statistics about data gathered during mining session for {{ area_name }}.</p>
<p>This report contains statistics about data gathered from scanning {{ area_name }}.</p>

<p>During that session, <b> {{ total_spawn_count }}</b> Pokemon have been seen on an area of about <b>{{ area_size }} square km</b>. Data gathering started on <b>{{ session_start.strftime('%Y-%m-%d %H:%M:%S') }}</b> and ended on <b>{{ session_end.strftime('%Y-%m-%d %H:%M:%S') }}</b>, lasting <b>{{ session_length_hours }} hours</b>. There were {{ spawns_per_hour }} spawns per hour on average.</p>

Expand Down Expand Up @@ -182,9 +182,9 @@ <h3>Nonexistent species</h3>

<h2>Footnotes</h2>

<p>This report was generated using pokeminer+, a tool for gathering data about Pokemon Go.</p>
<p>This report was generated using Monocle, a tool for gathering data about Pokemon Go.</p>

<p>Visit <a href="https://github.com/Noctem/pokeminer">https://github.com/Noctem/pokeminer</a> for more info.</p>
<p>Check out <a href="https://github.com/Noctem/Monocle">Monocle on GitHub</a> for more info.</p>

<p>This report is available under Creative Commons CC-BY-4.0 license: <a href="https://creativecommons.org/licenses/by/4.0/">https://creativecommons.org/licenses/by/4.0/</a>.</p>
</div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Pokeminer Report: {{ pokemon_name }} in {{ area_name }}</title>
<title>Monocle Report: {{ pokemon_name }} in {{ area_name }}</title>
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" integrity="sha384-BVYiiSIFeK1dGmJRAkycuHAHRg32OmUcww7on3RYdg4Va+PmSTsz/K68vbdEjh4u" crossorigin="anonymous">

<style>
Expand Down Expand Up @@ -85,12 +85,12 @@
</head>
<body>
<div class="container">
<h1>Pokeminer Report: #{{ pokemon_id }} {{ pokemon_name }}</h1>
<h1>Monocle Report: #{{ pokemon_id }} {{ pokemon_name }}</h1>
<h4>Generated on {{ current_date.strftime('%Y-%m-%d %H:%M:%S') }}</h4>

<p><b>Disclaimer:</b> data may be incomplete due to various issues that might have happened (bugs, unstable servers, bugs on the servers etc.). If there is data about a sighting of a Pokemon in given location at particular time, almost certainly such spawning happened. On the other hand, there is no guarantee that Pokeminer database contains <i>all</i> spawnings, so there might be wild Pokemon not contained in this report. Your mileage may vary.</p>
<p><b>Disclaimer:</b> data may be incomplete due to various issues that might have happened (bugs, unstable servers, bugs on the servers etc.). If there is data about a sighting of a Pokemon, that spawn almost certainly happened. On the other hand, there is no guarantee that the database contains <i>all</i> spawns, so there may be Pokemon missing from this report. Your mileage may vary.</p>

<p>This report contains statistics about data gathered during mining session for {{ area_name }} for single species - {{ pokemon_name }}.</p>
<p>This report contains statistics about data gathered from scanning {{ area_name }} for single species - {{ pokemon_name }}.</p>

<div class="pokemon-image">
<img src="/static/monocle-icons/original-icons/{{ pokemon_id }}.png" alt="{{ pokemon_name }}">
Expand All @@ -116,9 +116,9 @@ <h3>Spawning hours</h3>

<h2>Footnotes</h2>

<p>This report was generated using pokeminer+, a tool for gathering data about Pokemon Go.</p>
<p>This report was generated using Monocle, a tool for gathering data about Pokemon Go.</p>

<p>Visit <a href="https://github.com/Noctem/pokeminer">https://github.com/Noctem/pokeminer</a> for more info.</p>
<p>Check out <a href="https://github.com/Noctem/Monocle">Monocle on GitHub</a> for more info.</p>

<p>This report is available under Creative Commons CC-BY-4.0 license: <a href="https://creativecommons.org/licenses/by/4.0/">https://creativecommons.org/licenses/by/4.0/</a>.</p>
</div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Pokeminer - {{ area_name }}</title>
<title>Monocle - {{ area_name }}</title>
<link rel="stylesheet" href="{{ url_for('static', filename='css/leaflet.css') }}">
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no" />
<style>
Expand Down Expand Up @@ -48,7 +48,7 @@
</style>
</head>
<body>
<h1>Pokeminer is initializing, please wait.</h1>
<h1>Monocle is initializing, please wait.</h1>

<div id="main-map" class="map"></div>

Expand All @@ -59,7 +59,7 @@ <h1>Pokeminer is initializing, please wait.</h1>
<script>
var WorkerIcon = L.Icon.extend({
options: {
iconSize: [25, 25],
iconSize: [20, 20],
className: 'worker-icon',
iconUrl: '{{ url_for("static", filename="monocle-icons/assets/ball.png") }}'
}
Expand Down Expand Up @@ -145,7 +145,7 @@ <h1>Pokeminer is initializing, please wait.</h1>
map.locate({ enableHighAccurracy: true, setView: true });
});

setInterval(refresh, 5000);
setInterval(refresh, 7500);
refresh();
});
</script>
Expand Down
4 changes: 2 additions & 2 deletions pokeminer/utils.py → monocle/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -322,9 +322,9 @@ def get_address():
if config.MANAGER_ADDRESS:
return config.MANAGER_ADDRESS
if platform == 'win32':
address = r'\\.\pipe\pokeminer'
address = r'\\.\pipe\monocle'
elif hasattr(socket, 'AF_UNIX'):
address = join(config.DIRECTORY, 'pokeminer.sock')
address = join(config.DIRECTORY, 'monocle.sock')
else:
address = ('127.0.0.1', 5001)
return address
Expand Down
File renamed without changes.
8 changes: 4 additions & 4 deletions scan.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
import time

try:
from pokeminer import config
from monocle import config
except ImportError as e:
raise ImportError('Please copy config.example.py to config.py and customize it.') from e

Expand Down Expand Up @@ -121,9 +121,9 @@
else:
config.DIRECTORY = ''

from pokeminer.utils import get_address, dump_pickle
from pokeminer.worker import Worker
from pokeminer.overseer import Overseer
from monocle.utils import get_address, dump_pickle
from monocle.worker import Worker
from monocle.overseer import Overseer

class AccountManager(BaseManager):
pass
Expand Down
2 changes: 1 addition & 1 deletion scripts/generate_device_info.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
from random import choice
from uuid import uuid4

from pokeminer.config import ACCOUNTS
from monocle.config import ACCOUNTS

def get_device():
devices = ('iPhone5,1', 'iPhone5,2', 'iPhone5,3', 'iPhone5,4', 'iPhone6,1', 'iPhone6,2', 'iPhone7,1', 'iPhone7,2', 'iPhone8,1', 'iPhone8,2', 'iPhone8,4', 'iPhone9,1', 'iPhone9,2', 'iPhone9,3', 'iPhone9,4')
Expand Down
7 changes: 3 additions & 4 deletions scripts/pickle_landmarks.example.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
#!/usr/bin/env python3

try:
from pokeminer.landmarks import Landmarks
except ImportError:
print('Copy this script to the pokeminer directory, not scripts/')
raise
from monocle.landmarks import Landmarks
except ImportError as e:
raise ImportError('Run this script from your Monocle directory') from e

import pickle

Expand Down
9 changes: 4 additions & 5 deletions scripts/test-notifications.py
Original file line number Diff line number Diff line change
@@ -1,14 +1,13 @@
#!/usr/bin/env python3

from pokeminer import config
from monocle import config
config.ALWAYS_NOTIFY_IDS = {71}
config.HASHTAGS = {'test'}

from pokeminer.names import POKEMON_NAMES
POKEMON_NAMES[0] = 'Test'
from monocle.names import POKEMON_NAMES

from pokeminer.notification import Notifier
from pokeminer.shared import Spawns
from monocle.notification import Notifier
from monocle.shared import Spawns


spawns = Spawns()
Expand Down
Loading

0 comments on commit a29c30d

Please sign in to comment.