OpenELEC Forum
problem creating addon - Printable Version

+- OpenELEC Forum (https://forum.openelec.tv)
+-- Forum: Generic Forum (https://forum.openelec.tv/forumdisplay.php?fid=5)
+--- Forum: OPENELEC ADDONS (https://forum.openelec.tv/forumdisplay.php?fid=29)
+---- Forum: unofficial OpenELEC Addons (https://forum.openelec.tv/forumdisplay.php?fid=31)
+---- Thread: problem creating addon (/showthread.php?tid=78930)



problem creating addon - Luivit - 11-17-2015

hi, I'm trying to create an addon for OpenELEC (to learn).
I encountered some problems, which I hope you can solve.
I already compiled OpenELEC, and this is the package.mk
Code:
PKG_NAME="tvnamer"
PKG_VERSION="2.3"
PKG_REV="0"
PKG_ARCH="any"
PKG_LICENSE="GPL"
PKG_SITE="http://github.com/dbr/tvnamer"
PKG_URL="https://pypi.python.org/packages/source/t/$PKG_NAME/$PKG_NAME-$PKG_VERSION.tar.gz"
PKG_DEPENDS_TARGET="toolchain Python tvdb_api"
PKG_PRIORITY="optional"
PKG_SECTION="python"
PKG_SHORTDESC="Automatic TV episode namer"
PKG_LONGDESC="Automatically names downloaded/recorded TV-episodes, by parsing filenames and retrieving show-names from www.thetvdb.com"
PKG_IS_ADDON="yes"
PKG_ADDON_TYPE="xbmc.python.script"
PKG_ADDON_PROVIDES=""
PKG_ADDON_REPOVERSION="6.0"
PKG_AUTORECONF="no"
PKG_MAINTAINER="luivit (luivit39@gmail.com)"

make_target() {
python setup.py build
}

makeinstall_target() {
: # nop
}

addon() {
mkdir -p $ADDON_BUILD/$PKG_ADDON_ID/bin
cp $PKG_BUILD/.$TARGET_NAME/tvnamer $ADDON_BUILD/$PKG_ADDON_ID/bin/tvnamer
}
while this is the dependence:
Code:
PKG_NAME="tvdb_api"
PKG_VERSION="1.10"
PKG_REV="0"
PKG_ARCH="any"
PKG_LICENSE="GPL"
PKG_SITE="http://github.com/dbr/tvdb_api/tree/master"
PKG_URL="https://pypi.python.org/packages/source/t/$PKG_NAME/$PKG_NAME-$PKG_VERSION.tar.gz"
PKG_DEPENDS_TARGET="toolchain Python"
PKG_PRIORITY="optional"
PKG_SECTION="libs"
PKG_SHORTDESC="Interface to thetvdb.com"
PKG_LONGDESC="API interface to TheTVDB.com"
PKG_IS_ADDON="no"
PKG_AUTORECONF="yes"
PKG_MAINTAINER="luivit (luivit39@gmail.com)"
--- when i launch
Code:
PROJECT=Generic ARCH=x86_64 scripts/create_addon tvnamer
the script returns
Code:
GET tvnamer
--2015-11-17 10:02:31-- https://pypi.python.org/packages/source/t/tvnamer/tvnamer-2.3.tar.gz
Resolving pypi.python.org (pypi.python.org)... 185.31.17.223
Connecting to pypi.python.org (pypi.python.org)|185.31.17.223|:443... connected.HTTP request sent, awaiting response... 200 OK
Length: 44415 (43K) [application/octet-stream]
Saving to: 'sources/tvnamer/tvnamer-2.3.tar.gz'

100%[======================================>] 44,415 --.-K/s in 0.05s

2015-11-17 10:02:31 (870 KB/s) - 'sources/tvnamer/tvnamer-2.3.tar.gz' saved [44415/44415]

UNPACK tvnamer
GET tvdb_api
--2015-11-17 10:02:34-- https://pypi.python.org/packages/source/t/tvdb_api/tvdb_api-1.10.tar.gz
Resolving pypi.python.org (pypi.python.org)... 185.31.17.223
Connecting to pypi.python.org (pypi.python.org)|185.31.17.223|:443... connected.HTTP request sent, awaiting response... 200 OK
Length: 34630 (34K) [application/octet-stream]
Saving to: 'sources/tvdb_api/tvdb_api-1.10.tar.gz'

100%[======================================>] 34,630 --.-K/s in 0.03s

2015-11-17 10:02:34 (1.05 MB/s) - 'sources/tvdb_api/tvdb_api-1.10.tar.gz' saved [34630/34630]

UNPACK tvdb_api
BUILD tvdb_api (target)
configure.in or configure.ac not found
What is missing? thx


problem creating addon - ultraman - 11-17-2015

In tvdb_api package.mk set PKG_AUTORECONF="no" and add same make_target().
This will at least compile both packages. Then move on.


problem creating addon - Luivit - 11-17-2015

ultraman post=151909 Wrote:In tvdb_api package.mk set PKG_AUTORECONF="no" and add same make_target().
This will at least compile both packages. Then move on.
thanks for the quick response
now:
Code:
BUILD tvdb_api (target)
running build
running build_py
creating build
creating build/lib
copying tvdb_api.py -> build/lib
copying tvdb_ui.py -> build/lib
copying tvdb_exceptions.py -> build/lib
copying tvdb_cache.py -> build/lib
make: bbcode.txt done insert_posts.sh mybb_posts.csv mybb_posts.sql new newnew oej34_kunena_messages.csv oej34_kunena_messages_text.csv oej34_kunena_messages_text.sql oej34_kunena_users_banned.csv oej34_kunena_users.csv oej34_users.csv old openelecj34prod.sql posts.sh replace.sh table_posts test.csv test.txt update_sample.sql No rule to make target 'install'. Stop.



problem creating addon - ultraman - 11-17-2015

Add
Code:
makeinstall_target() {
python setup.py install --root=$INSTALL --prefix=/usr
}

post_makeinstall_target() {
find $INSTALL/usr/lib -name "*.py" -exec rm -rf "{}" ";"
}



problem creating addon - Luivit - 11-17-2015

Thanks, now works.
I modified the function addon to include tvdb_api.
Code:
addon() {
mkdir -p $ADDON_BUILD/$PKG_ADDON_ID/resources/lib/
cp -R $PKG_BUILD/tvnamer $ADDON_BUILD/$PKG_ADDON_ID/resources/lib/tvnamer
cp $(get_build_dir tvdb_api)/build/lib/* $ADDON_BUILD/$PKG_ADDON_ID/resources/lib/tvnamer
}

In OpenELEC works, but I have to look for the full path ".kodi/addons/shell.python.tvnamer/resources/lib/tvnamer" then
Code:
python main.py filetorename

how do I create a symbolic link to "python main.py" during zip installation?
Example "tvnamer filetorename" simply


problem creating addon - ultraman - 11-17-2015

In both package.mk add makeinstall_target() and you copy pyo files from .install_pkg folder.

Second question I don't understand. I think you don't call something.py because you have pyo files? And you can put all command in one shell script which takes arguments to run.


problem creating addon - Luivit - 11-17-2015

I created the file "tvnamer" in sources/bin/
Code:
#!/bin/sh
ADDON_DIR="$HOME/.kodi/addons/tools.tvnamer"
python $ADDON_DIR/resources/lib/tvnamer/main.py $@
Now I can call main.py through "tvnamer" command.

ultraman Wrote:Second question I don't understand. I think you don't call something.py because you have pyo files? And you can put all command in one shell script which takes arguments to run.
I use .py files so I changed the package.mk
package.mk tvdb_api:
Code:
PKG_VERSION="1.10"
PKG_REV="0"
PKG_ARCH="any"
PKG_LICENSE="GPL"
PKG_SITE="http://github.com/dbr/tvdb_api/tree/master"
PKG_URL="https://pypi.python.org/packages/source/t/$PKG_NAME/$PKG_NAME-$PKG_VERSION.tar.gz"
PKG_DEPENDS_TARGET="toolchain Python"
PKG_PRIORITY="optional"
PKG_SECTION="libs"
PKG_SHORTDESC="Interface to thetvdb.com"
PKG_LONGDESC="API interface to TheTVDB.com"
PKG_IS_ADDON="no"
PKG_AUTORECONF="no"
PKG_MAINTAINER="luivit (luivit39@gmail.com)"

makeinstall_target() {
python setup.py build
}

make_target() {
python setup.py build

package tvnamer
Code:
PKG_VERSION="2.3"
PKG_REV="0"
PKG_ARCH="any"
PKG_LICENSE="GPL"
PKG_SITE="http://github.com/dbr/tvnamer"
PKG_URL="https://pypi.python.org/packages/source/t/$PKG_NAME/$PKG_NAME-$PKG_VERSION.tar.gz"
PKG_DEPENDS_TARGET="toolchain Python tvdb_api"
PKG_PRIORITY="optional"
PKG_SECTION="tools"
PKG_SHORTDESC="Automatic TV episode namer"
PKG_LONGDESC="Automatically names downloaded/recorded TV-episodes, by parsing filenames and retrieving show-names from www.thetvdb.com"
PKG_IS_ADDON="yes"
PKG_ADDON_TYPE="xbmc.python.script"
PKG_ADDON_PROVIDES=""
PKG_ADDON_REPOVERSION="6.0"
PKG_AUTORECONF="no"
PKG_MAINTAINER="luivit (luivit39@gmail.com)"

make_target() {
python setup.py build
}
makeinstall_target() {
: # nop
}

addon() {
mkdir -p $ADDON_BUILD/$PKG_ADDON_ID/resources/lib/
cp -R $PKG_BUILD/build/lib/tvnamer $ADDON_BUILD/$PKG_ADDON_ID/resources/lib/tvnamer
cp $(get_build_dir tvdb_api)/build/lib/* $ADDON_BUILD/$PKG_ADDON_ID/resources/lib/tvnamer
}
Now everything works, thanks for the help...
If I want put this addon in your repository on github (hypothetically, do not think for now that is the case), it should put in "addons/tools"? and tvdb_api in lib directory? Right? Just to understand the operation: p