Skip to content

Commit

Permalink
Init
Browse files Browse the repository at this point in the history
  • Loading branch information
imrahil committed Mar 13, 2015
1 parent 2500208 commit 0070ccd
Show file tree
Hide file tree
Showing 5 changed files with 155 additions and 0 deletions.
54 changes: 54 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
# Byte-compiled / optimized / DLL files
__pycache__/
*.py[cod]

# C extensions
*.so

# Distribution / packaging
.Python
env/
build/
develop-eggs/
dist/
downloads/
eggs/
lib/
lib64/
parts/
sdist/
var/
*.egg-info/
.installed.cfg
*.egg

# PyInstaller
# Usually these files are written by a python script from a template
# before PyInstaller builds the exe, so as to inject date/other infos into it.
*.manifest
*.spec

# Installer logs
pip-log.txt
pip-delete-this-directory.txt

# Unit test / coverage reports
htmlcov/
.tox/
.coverage
.cache
nosetests.xml
coverage.xml

# Translations
*.mo
*.pot

# Django stuff:
*.log

# Sphinx documentation
docs/_build/

# PyBuilder
target/
15 changes: 15 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
# Plugin for OctoPrint - saves filename, print time and filament usage for each print

## Setup

Install the plugin like you would install any regular Python package from source:

pip install https://github.com/imrahil/OctoPrint-PrintHistoryPlugin/archive/master.zip

Make sure you use the same Python environment that you installed OctoPrint under, otherwise the plugin
won't be able to satisfy its dependencies.

Restart OctoPrint. `octoprint.log` should show you that the plugin was successfully found and loaded:

2014-09-18 17:49:21,500 - octoprint.plugin.core - INFO - Loading plugins from ... and installed plugin packages...
2014-09-18 17:49:21,611 - octoprint.plugin.core - INFO - Found 2 plugin(s): Print History Plugin (0.1), Discovery (0.1)
18 changes: 18 additions & 0 deletions octoprint_printhistory/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# coding=utf-8
from __future__ import absolute_import

__author__ = "Jarek Szczepanski <[email protected]>"
__license__ = "GNU Affero General Public License http://www.gnu.org/licenses/agpl.html"
__copyright__ = "Copyright (C) 2014 Jarek Szczepanski - Released under terms of the AGPLv3 License"

import octoprint.plugin
import octoprint.events

class PrintHistoryPlugin(octoprint.plugin.EventHandlerPlugin,
octoprint.plugin.SettingsPlugin,
octoprint.plugin.TemplatePlugin,
octoprint.plugin.AssetPlugin):


__plugin_name__ = "Print History Plugin"
__plugin_implementations__ = [PrintHistoryPlugin()]
1 change: 1 addition & 0 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
OctoPrint
67 changes: 67 additions & 0 deletions setup.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
# coding=utf-8
import setuptools

########################################################################################################################

plugin_identifier = "printhistory"
plugin_package = "octoprint_%s" % plugin_identifier
plugin_name = "OctoPrint-PrintHistory"
plugin_version = "0.1"
plugin_description = "Saves filename, print time and filament usage for each print"
plugin_author = "Jarek Szczepanski"
plugin_author_email = "[email protected]"
plugin_url = "https://github.com/imrahil/OctoPrint-PrintHistory"
plugin_license = "AGPLv3"
plugin_additional_data = []

########################################################################################################################

def package_data_dirs(source, sub_folders):
import os
dirs = []

for d in sub_folders:
folder = os.path.join(source, d)
if not os.path.exists(folder):
continue

for dirname, _, files in os.walk(folder):
dirname = os.path.relpath(dirname, source)
for f in files:
dirs.append(os.path.join(dirname, f))

return dirs

def params():
# Our metadata, as defined above
name = plugin_name
version = plugin_version
description = plugin_description
author = plugin_author
author_email = plugin_author_email
url = plugin_url
license = plugin_license

# we only have our plugin package to install
packages = [plugin_package]

# we might have additional data files in sub folders that need to be installed too
package_data = {plugin_package: package_data_dirs(plugin_package, ['static', 'templates', 'translations'] + plugin_additional_data)}
include_package_data = True

# If you have any package data that needs to be accessible on the file system, such as templates or static assets
# this plugin is not zip_safe.
zip_safe = False

# Read the requirements from our requirements.txt file
install_requires = open("requirements.txt").read().split("\n")

# Hook the plugin into the "octoprint.plugin" entry point, mapping the plugin_identifier to the plugin_package.
# That way OctoPrint will be able to find the plugin and load it.
entry_points = {
"octoprint.plugin": ["%s = %s" % (plugin_identifier, plugin_package)]
}

return locals()

setuptools.setup(**params())

0 comments on commit 0070ccd

Please sign in to comment.