Skip to content

Conversation

fredrik-eriksson
Copy link

Description

An addon for controling projectors connected via serial port. A more detailed description can be found on the project github page: https://github.com/fredrik-eriksson/kodi_projcontrol

It requires the pyserial module to work, and I've submitted that module in a separate PR. This addon can also optionally use flask to create a REST service to control the projector, however flask is not in the kodi repositories, and I have no will to submit and maintain it. As this addon is still usable (and hopefully even useful) even without the REST service I hope it's OK to include it anyway.

Checklist:

  • My code follows the add-on rules and piracy stance of this project.
  • I have read the CONTRIBUTING document
  • Each add-on submission should be a single commit with using the following style: [script.foo.bar] v1.0.0

Additional information :

  • Submitting your add-on to this specific branch makes it available to any Kodi version equal or higher than the branch name with the applicable Kodi dependencies limits.
  • add-on development wiki page.
  • Kodi pydocs provide information about the Python API
  • PEP8 codingstyle which is considered best practise but not mandatory.
  • This add-on repository has automated code guideline check which could help you improve your coding. You can find the results of these check at Codacy. You can create your own account as well to continuously monitor your python coding before submitting to repo.
  • Development questions can be asked in the add-on development section on the Kodi forum.

@TravisBuddy
Copy link

Travis Buddy

Hey Fredrik Eriksson,
please review the following log in order to understand the failure reason. There might also be some helpful tips along the way.
It'll be awesome if you fix what's wrong and commit the changes.

1st Build

Expand here
INFO: Checking add-on service.projcontrol
INFO: Created by Fredrik Eriksson
INFO: Addon id matches folder name
ERROR: Required addon script.module.pyserial not available in current repository.
INFO: This is a new addon
INFO: Image icon exists
ERROR: Icon.png should be solid. It has transparency.
INFO: icon dimensions are fine 256x256
INFO: You might want to add a fanart
WARN: Complex entry point. Check: service.py | Counted lines: 126 | Lines allowed: 15
ERROR: We found 2 problems and 1 warnings, please check the logfile.

Copy link
Member

@enen92 enen92 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

See comments. Sorry for the time taken.

@@ -0,0 +1,26 @@
ADDON_NAME := $(shell grep '<addon id="' addon.xml |cut -d\" -f2)

This comment was marked as spam.

</requires>
<extension point="xbmc.service" library="service.py" start="login" />
<extension point="xbmc.addon.metadata">
<platform>all</platform>

This comment was marked as spam.

version="1.2.0"
provider-name="Fredrik Eriksson">
<requires>
<import addon="xbmc.python" version="2.19.0"/>

This comment was marked as spam.

<extension point="xbmc.service" library="service.py" start="login" />
<extension point="xbmc.addon.metadata">
<platform>all</platform>
<summary lang="en">Control your projector from Kodi</summary>

This comment was marked as spam.

<extension point="xbmc.addon.metadata">
<platform>all</platform>
<summary lang="en">Control your projector from Kodi</summary>
<summary lang="sv">Hantera din projektor med Kodi</summary>

This comment was marked as spam.

This comment was marked as spam.

This comment was marked as spam.

<import addon="script.module.pyserial" version="3.4.0"/>
</requires>
<extension point="xbmc.service" library="service.py" start="login" />
<extension point="xbmc.addon.metadata">

This comment was marked as spam.

This comment was marked as spam.


"""
res = self._send_command("(LMP?)")
if res is not None:

This comment was marked as spam.

time_since_stop = datetime.datetime.now() - self._last_power_command_
if time_since_stop.days == 0 and time_since_stop.seconds < min_turnaround:
log("Screensaver deactivated too soon, will sleep a while before starting projector")
xbmc.sleep((min_turnaround-time_since_stop.seconds)*1000)

This comment was marked as spam.

req = urllib2.Request(url, data, headers)
res = urllib2.urlopen(req)

print(res.read())

This comment was marked as spam.


import logging

import flask

This comment was marked as spam.

@fredrik-eriksson
Copy link
Author

Nice, thanks for the feedback. I had hoped to get this included by making the flask requirement optional, but I can understand why that won't work :)
I've never used bottle, but I'll try to port the API to it instead, thanks for the tip. I'm not really ready to drop the feature as I've found it quite useful.

Regarding platforms I figured this would work on any platform where python (and the dependencies) worked, as long as you know what device name to configure in pyserial. As far as I know I do not use anything that is platform specific. That said, I've only a Linux-machine to test with I'll guess I'll have to restrict it to Linux. The people who connect projectors by serial cables are probably Linux-users anyway :)

As Travis gave a warning about complex entry point I've also done some restructuring. Not sure if it became better or not, but I'll probably need some time to test and make sure everything still works before updating this pull request.

@enen92
Copy link
Member

enen92 commented Jul 26, 2018

Its fine to keep it for all at the moment. If you find out it won't work on some platform you update it later

@petterreinholdtsen
Copy link

petterreinholdtsen commented Jul 30, 2018 via email

@TravisBuddy
Copy link

Travis Buddy

Hey Fredrik Eriksson,
please review the following log in order to understand the failure reason. There might also be some helpful tips along the way.
It'll be awesome if you fix what's wrong and commit the changes.

1st Build

Expand here
INFO: Checking add-on service.projcontrol
INFO: Created by Fredrik Eriksson
INFO: Addon id matches folder name
ERROR: Required addon script.module.pyserial not available in current repository.
INFO: This is a new addon
INFO: Image icon exists
INFO: Icon dimensions are fine 256x256
INFO: You might want to add a fanart
INFO: epson.py
╒═════╤══════════════════════════════════════╤════════════════════════════════════════════╕
│   # │ Existing Code                        │ Changes required                           │
╞═════╪══════════════════════════════════════╪════════════════════════════════════════════╡
│  59 │ return _valid_sources_[model].keys() │ return list(_valid_sources_[model].keys()) │
╘═════╧══════════════════════════════════════╧════════════════════════════════════════════╛
INFO: infocus.py
╒═════╤══════════════════════════════════════╤════════════════════════════════════════════╕
│   # │ Existing Code                        │ Changes required                           │
╞═════╪══════════════════════════════════════╪════════════════════════════════════════════╡
│  65 │ return _valid_sources_[model].keys() │ return list(_valid_sources_[model].keys()) │
╘═════╧══════════════════════════════════════╧════════════════════════════════════════════╛
ERROR: We found 1 problems and 0 warnings, please check the logfile.

@TravisBuddy
Copy link

Travis Buddy

Hey Fredrik Eriksson,
please review the following log in order to understand the failure reason. There might also be some helpful tips along the way.
It'll be awesome if you fix what's wrong and commit the changes.

1st Build

Expand here
INFO: Checking add-on service.projcontrol
INFO: Created by Fredrik Eriksson
INFO: Addon id matches folder name
ERROR: Required addon script.module.pyserial not available in current repository.
INFO: This is a new addon
INFO: Image icon exists
INFO: Icon dimensions are fine 256x256
INFO: You might want to add a fanart
ERROR: We found 1 problems and 0 warnings, please check the logfile.

@fredrik-eriksson
Copy link
Author

Sorry for the time taken, I think all requested changes has been honored now, and the bottle module seems to work just fine for this plugin. Travis seems happy except for the (obviously) missing pyserial plugin, so I hope this is good enough :)

@TravisBuddy
Copy link

Travis Buddy

Hey Fredrik Eriksson,
please review the following log in order to understand the failure reason. There might also be some helpful tips along the way.
It'll be awesome if you fix what's wrong and commit the changes.

1st Build

Expand here
INFO: Checking add-on service.projcontrol
INFO: Created by Fredrik Eriksson
INFO: Addon id matches folder name
ERROR: Required addon script.module.pyserial not available in current repository.
INFO: This is a new addon
INFO: Image icon exists
INFO: Icon dimensions are fine 256x256
INFO: You might want to add a fanart
ERROR: We found 1 problems and 0 warnings, please check the logfile.

@enen92
Copy link
Member

enen92 commented Aug 16, 2018

Glad to know bottle worked fine for you. Unfortunately I can't merge with travis failing in this repository, we'll have to wait for pyserial to hit our repos (once the repository generator runs again) or someone with higher privileges than myself need to handle it. Pinging @Rechi

@MartijnKaijser MartijnKaijser merged commit 30a86c8 into xbmc:krypton Aug 16, 2018
@fredrik-eriksson fredrik-eriksson deleted the projcontrol branch November 17, 2022 07:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants