diff --git a/couchpotato/core/_base/updater/main.py b/couchpotato/core/_base/updater/main.py index 57a98c6..cf9150f 100644 --- a/couchpotato/core/_base/updater/main.py +++ b/couchpotato/core/_base/updater/main.py @@ -33,15 +33,12 @@ class Updater(Plugin): 'desc': 'Get updater information', 'return': { 'type': 'object', - 'example': """ - { - 'repo_name': "Name of used repository", - 'last_check': "last checked for update", - 'update_version': "available update version or empty", - 'version': current_cp_version - } - """ - } + 'example': """{ + 'repo_name': "Name of used repository", + 'last_check': "last checked for update", + 'update_version': "available update version or empty", + 'version': current_cp_version +}"""} }) addApiView('updater.update', self.doUpdateView) addApiView('updater.check', self.checkView, docs = { diff --git a/couchpotato/core/plugins/movie/main.py b/couchpotato/core/plugins/movie/main.py index cb9ffd9..aa578ca 100644 --- a/couchpotato/core/plugins/movie/main.py +++ b/couchpotato/core/plugins/movie/main.py @@ -58,10 +58,28 @@ class MoviePlugin(Plugin): } }) addApiView('movie.available_chars', self.charView) - - addApiView('movie.add', self.addView) - addApiView('movie.edit', self.edit) - addApiView('movie.delete', self.delete) + addApiView('movie.add', self.addView, docs = { + 'desc': 'Add new movie to the wanted list', + 'params': { + 'identifier': {'desc': 'IMDB id of the movie your want to add.'}, + 'profile_id': {'desc': 'ID of quality profile you want the add the movie in. If empty will use the default profile.'}, + 'title': {'desc': 'Movie title to use for searches. Has to be one of the titles returned by movie.search.'}, + } + }) + addApiView('movie.edit', self.edit, docs = { + 'desc': 'Add new movie to the wanted list', + 'params': { + 'id': {'desc': 'Movie ID you want to edit'}, + 'profile_id': {'desc': 'ID of quality profile you want the edit the movie to.'}, + 'default_title': {'desc': 'Movie title to use for searches. Has to be one of the titles returned by movie.search.'}, + } + }) + addApiView('movie.delete', self.delete, docs = { + 'desc': 'Delete a movie from the wanted list', + 'params': { + 'id': {'desc': 'Movie ID you want to delete'}, + } + }) addEvent('movie.add', self.add) addEvent('movie.get', self.get) diff --git a/couchpotato/core/plugins/release/main.py b/couchpotato/core/plugins/release/main.py index 9297dbb..01e7f60 100644 --- a/couchpotato/core/plugins/release/main.py +++ b/couchpotato/core/plugins/release/main.py @@ -16,8 +16,18 @@ class Release(Plugin): def __init__(self): addEvent('release.add', self.add) - addApiView('release.download', self.download) - addApiView('release.delete', self.delete) + addApiView('release.download', self.download, docs = { + 'desc': 'Send a release manually to the downloaders', + 'params': { + 'id': {'type': 'id', 'desc': 'ID of the release object in release-table'} + } + }) + addApiView('release.delete', self.delete, docs = { + 'desc': 'Check for available update', + 'params': { + 'id': {'type': 'id', 'desc': 'ID of the release object in release-table'} + } + }) def add(self, group): db = get_session() diff --git a/couchpotato/core/plugins/renamer/main.py b/couchpotato/core/plugins/renamer/main.py index b67214f..6541c18 100644 --- a/couchpotato/core/plugins/renamer/main.py +++ b/couchpotato/core/plugins/renamer/main.py @@ -22,7 +22,9 @@ class Renamer(Plugin): def __init__(self): - addApiView('renamer.scan', self.scanView) + addApiView('renamer.scan', self.scanView, docs = { + 'desc': 'For the renamer to check for new files to rename', + }) addEvent('renamer.scan', self.scan) addEvent('app.load', self.scan) @@ -31,7 +33,7 @@ class Renamer(Plugin): def scanView(self): - fireEvent('renamer.scan') + fireEventAsync('renamer.scan') return jsonified({ 'success': True diff --git a/couchpotato/core/plugins/status/main.py b/couchpotato/core/plugins/status/main.py index 5256f8d..b8c4f5f 100644 --- a/couchpotato/core/plugins/status/main.py +++ b/couchpotato/core/plugins/status/main.py @@ -29,7 +29,13 @@ class StatusPlugin(Plugin): addEvent('status.all', self.all) addEvent('app.initialize', self.fill) - addApiView('status.list', self.list) + addApiView('status.list', self.list, docs = { + 'desc': 'Check for available update', + 'return': {'type': 'object', 'example': """{ + 'success': True, + 'list': array, statuses +}"""} + }) def list(self): diff --git a/couchpotato/static/style/api.css b/couchpotato/static/style/api.css index 15bddd3..afba2b5 100644 --- a/couchpotato/static/style/api.css +++ b/couchpotato/static/style/api.css @@ -1,3 +1,4 @@ + html { font-size: 12px; line-height: 1.5; @@ -5,15 +6,22 @@ html { font-size: 14px; } +* { + margin: 0; + padding: 0; + -moz-box-sizing: border-box; + -webkit-box-sizing: border-box; + box-sizing: border-box; +} + h1, h2, h3, h4, h5 { clear: both; - padding: 0; - margin: 0; font-size: 14px; } h1 { font-size: 25px; + padding: 20px 40px; } h2 { @@ -21,18 +29,23 @@ h2 { } pre { - background: #ccc; + background: #eee; font-family: monospace; margin: 0; - padding: 2%; - width: 96%; + padding: 10px; + width: 100%; display: block; + font-size: 12px; } -.api { - margin-bottom: 20px; +.api, .missing { overflow: hidden; + border-bottom: 1px solid #eee; + padding: 40px; } + .api:hover { + color: #000; + } .api .description { color: #333; @@ -40,7 +53,7 @@ pre { } .api .params { - background: #f5f5f5; + background: #fafafa; width: 100%; } .api h3 { @@ -54,6 +67,14 @@ pre { width: 700px; } + .api .params td, .api .params th { + padding: 3px 5px; + border-bottom: 1px solid #eee; + } + .api .params tr:last-child td, .api .params tr:last-child th { + border: 0; + } + .api .params .param { vertical-align: top; } @@ -67,9 +88,10 @@ pre { font-style: italic; margin-right: 10px; width: 100px; + color: #666; } .api .return { float: left; width: 700px; - } + } \ No newline at end of file diff --git a/couchpotato/templates/api.html b/couchpotato/templates/api.html index 9852ccb..47fb6c3 100644 --- a/couchpotato/templates/api.html +++ b/couchpotato/templates/api.html @@ -6,7 +6,7 @@ -

API

+

CouchPotato API Documentation

{% for route in routes %} {% if api_docs.get(route) %}
@@ -15,7 +15,7 @@ {% if api_docs[route].get('params') %}

Params

- +
{% for param in api_docs[route]['params'] %} @@ -42,8 +42,10 @@ {% endif %} {% endfor %} -

Missing documentation

-
{{', '.join(api_docs_missing)}}
+
+

Missing documentation

+ {{', '.join(api_docs_missing)}} +
\ No newline at end of file
{{param}}