Couchpotato release and update addons.xml generator script

This commit is contained in:
aptalca 2016-10-25 13:46:40 -04:00
parent 3f52858731
commit f93e4ee5cc
25 changed files with 226 additions and 35 deletions

View File

@ -1,5 +1,31 @@
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<addons>
<addon id="docker.linuxserver.couchpotato"
name="CouchPotato (LinuxServer.io)"
version="1.0.0"
provider-name="linuxserver.io">
<requires>
<import addon="os.libreelec.tv" version="7.0"/>
<import addon="xbmc.python" version="2.1.0"/>
<import addon="service.system.docker" version="0.0.0" />
</requires>
<extension point="xbmc.service" library="default.py">
<provides></provides>
</extension>
<extension point="xbmc.addon.metadata">
<summary>CouchPotato in a docker container</summary>
<description>
CouchPotato is an automatic NZB and torrent downloader. You can keep a movies I want list and it will search for NZBs/torrents of these movies every X hours. Once a movie is found, it will send it to SABnzbd or download the torrent to a specified directory.
This is a docker container brought to you by the LinuxServer team.
Please visit www.linuxserver.io for more information.
</description>
<disclaimer>
</disclaimer>
<platform>all</platform>
</extension>
</addon>
<addon id="docker.linuxserver.duckdns"
name="DuckDNS (LinuxServer.io)"
version="1.0.0"

View File

@ -1 +1 @@
52e65acef3bd497551ab7c8ed420a1ec
ffd67e369029d9d160394eed9dd78a40

View File

@ -22,7 +22,12 @@
# * https://offshoregit.com/tknorris/tknorris-release-repo/raw/master/addons_xml_generator2.py
# * Based on code by j48antialias:
# * https://anarchintosh-projects.googlecode.com/files/addons_xml_generator.py
# *
# * Changes since v2:
# * - (assumed) zips reside in folder "download"
# * - md5 checksum creation added for zips
# * - Skip moving files and zip creation if zip file for the same version already exists
""" addons.xml generator """
import os
@ -159,37 +164,42 @@ if (__name__ == "__main__"):
for elem in root.iter('addon'):
print('%s %s version: %s' % (x, elem.tag, elem.attrib['version']))
version = '-' + elem.attrib['version']
# #check if and move addon, changelog, fanart and icon to zipdir
for y in filesinfoldertozip:
# print('processing file: ' + os.path.join(rootdir,x,y))
if re.search("addon|changelog|icon|fanart", y):
shutil.copyfile(os.path.join(rootdir, x, y), os.path.join(zipsfolder, y))
print('Copying %s to %s' % (y, zipsfolder))
# #check for and zip the folders
print('Zipping %s and moving to %s\n' % (x, zipsfolder))
try:
zipfolder(zipfilenamefirstpart + version + zipfilenamelastpart, foldertozip, zipsfolder, x)
print('zipped with zipfolder')
# # #check for existing zips
if not os.path.exists(zipsfolder + x + version + '.zip'):
# #check if and move addon, changelog, fanart and icon to zipdir
for y in filesinfoldertozip:
# print('processing file: ' + os.path.join(rootdir,x,y))
if re.search("addon|changelog|icon|fanart", y):
shutil.copyfile(os.path.join(rootdir, x, y), os.path.join(zipsfolder, y))
print('Copying %s to %s' % (y, zipsfolder))
# #check for and zip the folders
print('Zipping %s and moving to %s\n' % (x, zipsfolder))
try:
import md5
m = md5.new(open("%s" % (zipsfolder + x + version + '.zip'), "r").read()).hexdigest()
except ImportError:
import hashlib
m = hashlib.md5(open("%s" % (zipsfolder + x + version + '.zip'), "r", encoding="UTF-8").read().encode("UTF-8")).hexdigest()
try:
open("%s" % (zipsfolder + x + version + '.zip.md5'), "wb").write(m.encode("UTF-8"))
print("zip.md5 file created\n")
except Exception as e:
print("An error occurred creating zip.md5 file!\n%s" % e)
except:
if os.path.exists(zipsfolder + x + version + '.zip'):
os.remove(zipsfolder + x + version + '.zip')
print('trying shutil')
try:
shutil.move(shutil.make_archive(foldertozip + version, 'zip', rootdir, x), zipsfolder)
print('zipped with shutil\n')
except Exception as e:
print('Cannot create zip file\nshutil %s\n' % e)
zipfolder(zipfilenamefirstpart + version + zipfilenamelastpart, foldertozip, zipsfolder, x)
print('zipped with zipfolder')
# # #create md5 checksum for zips
try:
import md5
m = md5.new(open("%s" % (zipsfolder + x + version + '.zip'), "r").read()).hexdigest()
except ImportError:
import hashlib
m = hashlib.md5(open("%s" % (zipsfolder + x + version + '.zip'), "r", encoding="UTF-8").read().encode("UTF-8")).hexdigest()
try:
open("%s" % (zipsfolder + x + version + '.zip.md5'), "wb").write(m.encode("UTF-8"))
print("zip.md5 file created\n")
except Exception as e:
print("An error occurred creating zip.md5 file!\n%s" % e)
except:
if os.path.exists(zipsfolder + x + version + '.zip'):
os.remove(zipsfolder + x + version + '.zip')
print('trying shutil')
try:
shutil.move(shutil.make_archive(foldertozip + version, 'zip', rootdir, x), zipsfolder)
print('zipped with shutil\n')
except Exception as e:
print('Cannot create zip file\nshutil %s\n' % e)
else:
print('Zip file for %s version %s already exists, skipping moving files and zip creation.\n' % (x, version))
except Exception as e:
print('Cannot create or move the needed files\n%s' % e)
print('Done')

View File

@ -0,0 +1,26 @@
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<addon id="docker.linuxserver.couchpotato"
name="CouchPotato (LinuxServer.io)"
version="1.0.0"
provider-name="linuxserver.io">
<requires>
<import addon="os.libreelec.tv" version="7.0"/>
<import addon="xbmc.python" version="2.1.0"/>
<import addon="service.system.docker" version="0.0.0" />
</requires>
<extension point="xbmc.service" library="default.py">
<provides></provides>
</extension>
<extension point="xbmc.addon.metadata">
<summary>CouchPotato in a docker container</summary>
<description>
CouchPotato is an automatic NZB and torrent downloader. You can keep a movies I want list and it will search for NZBs/torrents of these movies every X hours. Once a movie is found, it will send it to SABnzbd or download the torrent to a specified directory.
This is a docker container brought to you by the LinuxServer team.
Please visit www.linuxserver.io for more information.
</description>
<disclaimer>
</disclaimer>
<platform>all</platform>
</extension>
</addon>

View File

@ -0,0 +1,18 @@
#!/bin/sh
name="$(basename $0)"
. /etc/profile
oe_setup_addon "$name"
docker rm "$name" 2>/dev/null
docker pull linuxserver/couchpotato:latest
[[ ! -z "$(docker images | grep 'linuxserver/couchpotato' | grep '<none>' | sed 's/\s\+/\t/g' | cut -f3)" ]] && \
docker rmi $(docker images | grep 'linuxserver/couchpotato' | grep '<none>' | sed 's/\s\+/\t/g' | cut -f3)
docker run --name="$name" \
-e PUID="0" \
-e PGID="0" \
-e TZ="$(xmlstarlet sel -t -m '//timezone[1]' -v . -n </storage/.kodi/userdata/guisettings.xml)" \
-v "$V_config":/config \
-v "$V_movies":/movies \
-v "$V_downloads":/downloads \
-p "$P_port":5050 \
linuxserver/couchpotato:latest

View File

@ -0,0 +1,5 @@
docker.linuxserver.couchpotato:
----------------------
1.0.0
-Initial release

View File

@ -0,0 +1,18 @@
import subprocess
import xbmc
import xbmcaddon
class Monitor(xbmc.Monitor):
def __init__(self, *args, **kwargs):
xbmc.Monitor.__init__(self)
self.id = xbmcaddon.Addon().getAddonInfo('id')
def onSettingsChanged(self):
subprocess.call(['systemctl', 'restart', self.id])
if __name__ == '__main__':
Monitor().waitForAbort()

Binary file not shown.

After

Width:  |  Height:  |  Size: 26 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 80 KiB

View File

@ -0,0 +1,26 @@
msgid ""
msgstr ""
msgctxt "#30000"
msgid "Configuration"
msgstr ""
msgctxt "#30001"
msgid "Note: Kodi remote sources can not be used as Docker volume host sources"
msgstr ""
msgctxt "#30005"
msgid "Map /config"
msgstr ""
msgctxt "#30006"
msgid "Map /movies"
msgstr ""
msgctxt "#30007"
msgid "Map /downloads"
msgstr ""
msgctxt "#30008"
msgid "Listening port for web gui"
msgstr ""

View File

@ -0,0 +1,10 @@
<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<settings>
<category label="30000">
<setting label="30001" type="lsep" />
<setting label="30005" type="folder" id="V_config" default="/storage/.kodi/userdata/addon_data/docker.linuxserver.couchpotato/config" option="writeable" />
<setting label="30006" type="folder" id="V_movies" default="/storage/videos" option="writeable" />
<setting label="30007" type="folder" id="V_downloads" default="/storage/.kodi/userdata/addon_data/docker.linuxserver.couchpotato/downloads" option="writeable" />
<setting label="30008" type="number" id="P_port" default="5050" />
</category>
</settings>

View File

@ -0,0 +1,6 @@
<settings>
<setting id="V_config" value="/storage/.kodi/userdata/addon_data/docker.linuxserver.couchpotato/config" />/
<setting id="V_movies" value="/storage/videos" />
<setting id="V_downloads" value="/storage/.kodi/userdata/addon_data/docker.linuxserver.couchpotato/downloads" />
<setting id="P_port" value="5050" />
</settings>

View File

@ -0,0 +1,14 @@
[Unit]
Description=%p container
Requires=service.system.docker.service
After=service.system.docker.service
[Service]
Restart=always
RestartSec=10s
TimeoutStartSec=0
ExecStart=/bin/sh /storage/.kodi/addons/%p/bin/%p
ExecStop=/storage/.kodi/addons/service.system.docker/bin/docker kill %p
[Install]
WantedBy=multi-user.target

View File

@ -0,0 +1,26 @@
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<addon id="docker.linuxserver.couchpotato"
name="CouchPotato (LinuxServer.io)"
version="1.0.0"
provider-name="linuxserver.io">
<requires>
<import addon="os.libreelec.tv" version="7.0"/>
<import addon="xbmc.python" version="2.1.0"/>
<import addon="service.system.docker" version="0.0.0" />
</requires>
<extension point="xbmc.service" library="default.py">
<provides></provides>
</extension>
<extension point="xbmc.addon.metadata">
<summary>CouchPotato in a docker container</summary>
<description>
CouchPotato is an automatic NZB and torrent downloader. You can keep a movies I want list and it will search for NZBs/torrents of these movies every X hours. Once a movie is found, it will send it to SABnzbd or download the torrent to a specified directory.
This is a docker container brought to you by the LinuxServer team.
Please visit www.linuxserver.io for more information.
</description>
<disclaimer>
</disclaimer>
<platform>all</platform>
</extension>
</addon>

View File

@ -0,0 +1,5 @@
docker.linuxserver.couchpotato:
----------------------
1.0.0
-Initial release

View File

@ -0,0 +1 @@
fa043ec398879cdd6fbe4c45766d0ba4

Binary file not shown.

After

Width:  |  Height:  |  Size: 26 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 80 KiB

View File

@ -1 +1 @@
d33fea8cc9f5b3782ad9af7fabdd49c6
169700d732329d035ba807182af7aaa6

View File

@ -1 +1 @@
ce84f9acc8663a099219a42e59f1eac6
33d6545cd9670027cb82c37876011191

View File

@ -1 +1 @@
46dbe0fc602039cfdf1a084e0b4fb926
ad121193d57d9d55ab7e50d20e388a03