-
Notifications
You must be signed in to change notification settings - Fork 123
Add FlexGet add-on #149
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Add FlexGet add-on #149
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,4 @@ | ||
| 1.2.360 | ||
| - Initial version | ||
| 1.2.503 | ||
| - Version bump to FlexGet 1.2.503 |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,46 @@ | ||
| ################################################################################ | ||
| # This file is part of OpenELEC - http://www.openelec.tv | ||
| # Copyright (C) 2009-2012 Stephan Raue ([email protected]) | ||
| # | ||
| # This Program is free software; you can redistribute it and/or modify | ||
| # it under the terms of the GNU General Public License as published by | ||
| # the Free Software Foundation; either version 2, or (at your option) | ||
| # any later version. | ||
| # | ||
| # This Program is distributed in the hope that it will be useful, | ||
| # but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
| # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
| # GNU General Public License for more details. | ||
| # | ||
| # You should have received a copy of the GNU General Public License | ||
| # along with OpenELEC.tv; see the file COPYING. If not, write to | ||
| # the Free Software Foundation, 51 Franklin Street, Suite 500, Boston, MA 02110, USA. | ||
| # http://www.gnu.org/copyleft/gpl.html | ||
| ################################################################################ | ||
|
|
||
| PKG_NAME="FlexGet" | ||
| PKG_VERSION="1.2.503" | ||
| PKG_REV="1" | ||
| PKG_ARCH="any" | ||
| PKG_LICENSE="OSS" | ||
| PKG_SITE="http://flexget.com/" | ||
| PKG_URL="https://pypi.python.org/packages/source/F/$PKG_NAME/$PKG_NAME-$PKG_VERSION.tar.gz" | ||
| # PKG_SOURCE_DIR="$PKG_NAME" | ||
| PKG_DEPENDS_TARGET="toolchain Python" | ||
| PKG_PRIORITY="optional" | ||
| PKG_SECTION="service/downloadmanager" | ||
| PKG_SHORTDESC="FlexGet is a program aimed to automate downloading or processing content (torrents, podcasts, etc.) from different sources like RSS-feeds, html-pages, various sites and more." | ||
| PKG_LONGDESC="FlexGet is a multipurpose automation tool for content like torrents, nzbs, podcasts, comics, series, movies, etc. It can use different kinds of sources like RSS-feeds, html pages, csv files, search engines and there are even plugins for sites that do not provide any kind of useful feeds." | ||
| PKG_IS_ADDON="yes" | ||
| PKG_ADDON_TYPE="xbmc.service" | ||
| PKG_AUTORECONF="no" | ||
| PKG_MAINTAINER="unofficial.addon.pro" | ||
|
|
||
| addon() { | ||
| # set | ||
| # python -c "import sys; print(sys.path)" | ||
| mkdir -p $ADDON_BUILD/$PKG_ADDON_ID/site-packages | ||
| wget -O get-pip.py https://bootstrap.pypa.io/get-pip.py | ||
| python get-pip.py -t $ADDON_BUILD/$PKG_ADDON_ID/site-packages FlexGet | ||
| python get-pip.py -t $ADDON_BUILD/$PKG_ADDON_ID/site-packages transmissionrpc | ||
| } | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,39 @@ | ||
| #!/bin/sh | ||
|
|
||
| ################################################################################ | ||
| # This file is part of OpenELEC - http://www.openelec.tv | ||
| # Copyright (C) 2009-2012 Stephan Raue ([email protected]) | ||
| # | ||
| # This Program is free software; you can redistribute it and/or modify | ||
| # it under the terms of the GNU General Public License as published by | ||
| # the Free Software Foundation; either version 2, or (at your option) | ||
| # any later version. | ||
| # | ||
| # This Program is distributed in the hope that it will be useful, | ||
| # but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
| # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
| # GNU General Public License for more details. | ||
| # | ||
| # You should have received a copy of the GNU General Public License | ||
| # along with OpenELEC.tv; see the file COPYING. If not, write to | ||
| # the Free Software Foundation, 51 Franklin Street, Suite 500, Boston, MA 02110, USA. | ||
| # http://www.gnu.org/copyleft/gpl.html | ||
| ################################################################################ | ||
|
|
||
| . /etc/profile | ||
|
|
||
| oe_setup_addon service.downloadmanager.FlexGet | ||
|
|
||
| if [ "$FLEXGET_PATH_CUSTOM_CONFIG" = "" ]; then | ||
| FLEXGET_PATH_CUSTOM_CONFIG="/storage/.config/flexget" | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. this belongs to $ADDON_HOME/
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Can you clarify what you mean here? Do you mean it should be
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I mean no addon config should ever be stored outside addon's data folder. but well, if you want users to have an option to use their own config, okay.
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. FlexGet depends on the user providing a config.yml file; it doesn't do anything without it. The reason I put it in /storage/.config/flexget is so they can easily edit it over the network at smb://openelec.local/configfiles/flexget/config.yml or \openelec.local\configfiles\flexget\config.yml.
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. ok |
||
| fi | ||
| mkdir -p $FLEXGET_PATH_CUSTOM_CONFIG | ||
|
|
||
| # Addon settings | ||
| ADDON_DIR="$HOME/.kodi/addons/service.downloadmanager.FlexGet" | ||
| ADDON_HOME="$HOME/.kodi/userdata/addon_data/service.downloadmanager.FlexGet" | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. ADDON_DIR and ADDON_HOME are exported from from oe_setup_addon(), no need to redefine |
||
|
|
||
| export PYTHONPATH="$PYTHONPATH:$ADDON_DIR/site-packages/" | ||
|
|
||
| python -c "import flexget; flexget.main()" -c $FLEXGET_PATH_CUSTOM_CONFIG/config.yml $* | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,25 @@ | ||
| ################################################################################ | ||
| # This file is part of OpenELEC - http://www.openelec.tv | ||
| # Copyright (C) 2009-2012 Stephan Raue ([email protected]) | ||
| # | ||
| # This Program is free software; you can redistribute it and/or modify | ||
| # it under the terms of the GNU General Public License as published by | ||
| # the Free Software Foundation; either version 2, or (at your option) | ||
| # any later version. | ||
| # | ||
| # This Program is distributed in the hope that it will be useful, | ||
| # but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
| # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
| # GNU General Public License for more details. | ||
| # | ||
| # You should have received a copy of the GNU General Public License | ||
| # along with OpenELEC.tv; see the file COPYING. If not, write to | ||
| # the Free Software Foundation, 51 Franklin Street, Suite 500, Boston, MA 02110, USA. | ||
| # http://www.gnu.org/copyleft/gpl.html | ||
| ################################################################################ | ||
| #import xbmc, time, os, subprocess | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. remove the commented out lines. |
||
| #subprocess.Popen("FlexGet.service", shell=True, close_fds=True) | ||
| #import xbmcgui | ||
| #dialog = xbmcgui.Dialog() | ||
| #dialog.ok('', 'This is a console-only addon') | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,9 @@ | ||
| <settings> | ||
| <setting id="FLEXGET_PWD" value="openelec" /> | ||
| <setting id="FLEXGET_USER" value="openelec" /> | ||
| <setting id="FLEXGET_DL_DIR" value="/storage/downloads" /> | ||
| <setting id="FLEXGET_INC_DIR" value="/storage/downloads/incoming" /> | ||
| <setting id="FLEXGET_WATCH_DIR" value="/storage/downloads/watch" /> | ||
| <setting id="FLEXGET_ENABLE_CUSTOM_CONFIG" value="false" /> | ||
| <setting id="FLEXGET_PATH_CUSTOM_CONFIG" value="/storage/.config/flexget" /> | ||
| </settings> |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,20 @@ | ||
| [Unit] | ||
| Description=FlexGet | ||
| After=graphical.target | ||
|
|
||
| [Service] | ||
| Type=idle | ||
| ExecStart=/bin/sh -c "exec sh /storage/.kodi/addons/service.downloadmanager.FlexGet/bin/FlexGet.start daemon start" | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. you dont handle "daemon start" in FlexGet.start. drop this EDIT: oh, disregard, it seems to be handled by flexget's main() ?
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Right, those are passed on to FlexGet |
||
| ExecStop=/bin/sh -c "exec sh /storage/.kodi/addons/service.downloadmanager.FlexGet/bin/FlexGet.start daemon stop" | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. no need for this. just make sure systemd knows daemon's mainpid (best to use "exec python ... ..." in your start script) and systemd will take care to kill mainpid and (if any) subprocesses EDIT: disregard this. too :) |
||
| ExecReload=/bin/sh -c "exec sh /storage/.kodi/addons/service.downloadmanager.FlexGet/bin/FlexGet.start daemon reload" | ||
| TimeoutStopSec=5 | ||
| Restart=always | ||
| RestartSec=10 | ||
| StartLimitInterval=0 | ||
| Nice=19 | ||
| CPUSchedulingPolicy=idle | ||
| Restart=on-failure | ||
|
|
||
| [Install] | ||
| WantedBy=kodi.target | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this is not going to work for people who do not have (or do not want to use) get-pip.py
you should download FlexGet and dependencies, and install like any other python package we have (via cross setuptools). see Pillow/pyopenssl/etc.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Installing via pip is correct per the Python Packaging Authority (https://packaging.python.org/en/latest/current/) and per the FlexGet docs (https://github.com/Flexget/Flexget#how-to-use-git-checkout). FlexGet's 29 requirements are maintained in a requirements.txt file intended for pip.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
installing via pip in addon() is a no-go for those who maintain OE repos
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
besides that, some of your deps may contain (need to build) native libs (maybe not now, but tomorrow), no chance that'll work with host pip.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is there an appropriate place to call pip, like make_target() or makeinstall_target(), or do you mean that pip is entirely forbidden?
On the second comment, AFAIK, pip actually uses setuptools to do built packages. See here: https://pip.pypa.io/en/stable/reference/pip_wheel/. Maybe I'm missing something, but if compilation via setuptools already works for other packages (like pycrypto), I would think it would work fine with pip.