Skip to content
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

Update all submodules and port repo_generator.py to Python 3 #61

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 10 additions & 10 deletions addons.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@

_BEAM_ = ["service.subtitles.titulky.com", "service.subtitles.serialzone.cz"]
# list of addons that we are releasing

Expand Down Expand Up @@ -54,7 +53,7 @@
"plugin.video.sl",
"plugin.video.mall.tv",
"plugin.video.bombuj.filmyserialy",
"plugin.video.stream-cinema"
"plugin.video.stream-cinema",
] + _BEAM_

import os
Expand All @@ -67,25 +66,26 @@


def find():
released_addons = requests.get('http://kodi-czsk.github.io/repository/repo/addons.xml').text
released_addons = requests.get("http://kodi-czsk.github.io/repository/repo/addons.xml").text
try:
root = ET.XML(released_addons.encode('utf-8'))
root = ET.XML(released_addons.encode("utf-8"))
except: # initially there are no addons.xml
print 'Failed to parse remove addons.xml - releasing everything'
print("Failed to parse remove addons.xml - releasing everything")
return __ADDONS__
to_release = []
for id in __ADDONS__:
released = root.find('addon[@id=\"%s\"]' % id)
released = root.find('addon[@id="%s"]' % id)
if released == None:
to_release.append(id)
continue
released_version = released.get('version')
xmldoc = ET.parse(os.path.join(id, 'addon.xml'))
new_version = xmldoc.getroot().get('version')
released_version = released.get("version")
xmldoc = ET.parse(os.path.join(id, "addon.xml"))
new_version = xmldoc.getroot().get("version")
if not released_version == new_version:
to_release.append(id)
return to_release


if __name__ == "__main__":
for id in find():
print "Addon %s " % id
print(f"Addon {id}")
2 changes: 1 addition & 1 deletion plugin.audio.dmd-czech.play.cz
2 changes: 1 addition & 1 deletion plugin.image.rouming
Submodule plugin.image.rouming updated 4 files
+11 −0 README
+82 −17 addon.py
+24 −20 addon.xml
+22 −0 changelog.txt
2 changes: 1 addition & 1 deletion plugin.video.dmd-czech.aktualne
2 changes: 1 addition & 1 deletion plugin.video.dmd-czech.huste
2 changes: 1 addition & 1 deletion plugin.video.dmd-czech.novaplus
2 changes: 1 addition & 1 deletion plugin.video.dmd-czech.stream
2 changes: 1 addition & 1 deletion plugin.video.dvtv
Submodule plugin.video.dvtv updated 1 files
+0 −3 README.md
2 changes: 1 addition & 1 deletion plugin.video.gordon.ura.cz
2 changes: 1 addition & 1 deletion plugin.video.hejbejse.tv
2 changes: 1 addition & 1 deletion plugin.video.idnestv
2 changes: 1 addition & 1 deletion plugin.video.joj.sk
2 changes: 1 addition & 1 deletion plugin.video.mixer.cz
2 changes: 1 addition & 1 deletion plugin.video.o2tvgo
2 changes: 1 addition & 1 deletion plugin.video.sport5
2 changes: 1 addition & 1 deletion plugin.video.stream-cinema
2 changes: 1 addition & 1 deletion plugin.video.ta3.com
2 changes: 1 addition & 1 deletion plugin.video.tipsport.elh
Submodule plugin.video.tipsport.elh updated 82 files
+8 −0 .github/pull.yml
+1 −0 .gitignore
+295 −0 CHANGELOG.md
+6 −0 README.md
+54 −13 addon.xml
+221 −45 default.py
+ icon.png
+0 −27 resources/language/Czech/strings.xml
+0 −27 resources/language/English/strings.xml
+190 −0 resources/language/resource.language.cs_cz/strings.po
+193 −0 resources/language/resource.language.en_gb/strings.po
+189 −0 resources/language/resource.language.sk_sk/strings.po
+188 −11 resources/lib/kodi_helper.py
+66 −0 resources/lib/match.py
+122 −0 resources/lib/mem_storage.py
+15 −0 resources/lib/site.py
+34 −0 resources/lib/stream.py
+123 −0 resources/lib/stream_strategy.py
+154 −0 resources/lib/stream_strategy_factory.py
+36 −2 resources/lib/tipsport_exceptions.py
+188 −212 resources/lib/tipsport_stream_generator.py
+7 −0 resources/lib/user_data.py
+64 −0 resources/lib/utils.py
+ resources/media/LOGOS/CZ_CHANCE/benatky_nad_jizerou.png
+ resources/media/LOGOS/CZ_CHANCE/frydek_mistek.png
+ resources/media/LOGOS/CZ_CHANCE/havirov.png
+ resources/media/LOGOS/CZ_CHANCE/jihlava.png
+ resources/media/LOGOS/CZ_CHANCE/kadan.png
+ resources/media/LOGOS/CZ_CHANCE/kladno.png
+ resources/media/LOGOS/CZ_CHANCE/kolin.png
+ resources/media/LOGOS/CZ_CHANCE/litomerice.png
+ resources/media/LOGOS/CZ_CHANCE/poruba.png
+ resources/media/LOGOS/CZ_CHANCE/prerov.png
+ resources/media/LOGOS/CZ_CHANCE/prostejov.png
+ resources/media/LOGOS/CZ_CHANCE/slavia_praha.png
+ resources/media/LOGOS/CZ_CHANCE/sokolov.png
+ resources/media/LOGOS/CZ_CHANCE/sumperk.png
+ resources/media/LOGOS/CZ_CHANCE/trebic.png
+ resources/media/LOGOS/CZ_CHANCE/usti_nad_labem.png
+ resources/media/LOGOS/CZ_CHANCE/vrchlabi.png
+ resources/media/LOGOS/CZ_CHANCE/vsetin.png
+ resources/media/LOGOS/CZ_TIPSPORT/ceske_budejovice.png
+ resources/media/LOGOS/CZ_TIPSPORT/hradec_kralove.png
+ resources/media/LOGOS/CZ_TIPSPORT/karlovy_vary.png
+ resources/media/LOGOS/CZ_TIPSPORT/kometa_brno.png
+ resources/media/LOGOS/CZ_TIPSPORT/liberec.png
+ resources/media/LOGOS/CZ_TIPSPORT/litvinov.png
+ resources/media/LOGOS/CZ_TIPSPORT/mlada_boleslav.png
+ resources/media/LOGOS/CZ_TIPSPORT/olomouc.png
+ resources/media/LOGOS/CZ_TIPSPORT/pardubice.png
+ resources/media/LOGOS/CZ_TIPSPORT/plzen.png
+ resources/media/LOGOS/CZ_TIPSPORT/sparta_praha.png
+ resources/media/LOGOS/CZ_TIPSPORT/trinec.png
+ resources/media/LOGOS/CZ_TIPSPORT/vitkovice.png
+ resources/media/LOGOS/CZ_TIPSPORT/zlin.png
+ resources/media/LOGOS/OLD/chomutov.png
+ resources/media/LOGOS/SK_TIPSPORT/banska_bystrica.png
+ resources/media/LOGOS/SK_TIPSPORT/budapest.png
+ resources/media/LOGOS/SK_TIPSPORT/detva.png
+ resources/media/LOGOS/SK_TIPSPORT/dukla_trencin.png
+ resources/media/LOGOS/SK_TIPSPORT/kosice.png
+ resources/media/LOGOS/SK_TIPSPORT/liptovsky_mikulas.png
+ resources/media/LOGOS/SK_TIPSPORT/michalovce.png
+ resources/media/LOGOS/SK_TIPSPORT/miskolc.png
+ resources/media/LOGOS/SK_TIPSPORT/nitra.png
+ resources/media/LOGOS/SK_TIPSPORT/nove_zamky.png
+ resources/media/LOGOS/SK_TIPSPORT/orange_20.png
+ resources/media/LOGOS/SK_TIPSPORT/poprad.png
+ resources/media/LOGOS/SK_TIPSPORT/slovan.png
+ resources/media/LOGOS/SK_TIPSPORT/zilina.png
+ resources/media/LOGOS/SK_TIPSPORT/zvolen.png
+ resources/media/LOGOS/vs.png
+ resources/media/cz_chance_liga_logo.png
+ resources/media/cz_tipsport_logo.png
+ resources/media/sk_tipsport_logo.png
+ resources/screenshot-01.jpg
+ resources/screenshot-02.jpg
+ resources/screenshot-03.jpg
+96 −12 resources/settings.xml
+35 −0 test_tipsport.py
+0 −0 tests/__init__.py
+20 −0 tests/test_tipsport_stream_generator.py
67 changes: 31 additions & 36 deletions repo_generator.py
Original file line number Diff line number Diff line change
@@ -1,74 +1,69 @@
""" downloaded from http://xbmc-addons.googlecode.com/svn/addons/ """
""" iownloaded from http://xbmc-addons.googlecode.com/svn/addons/ """
""" addons.xml generator """

import os
import md5
import hashlib

from addons import __ADDONS__


class Generator:
"""
Generates a new addons.xml file from each addons addon.xml file
and a new addons.xml.md5 hash file. Must be run from the root of
the checked-out repo. Only handles single depth folder structure.
Generates a new addons.xml file from each addons addon.xml file
and a new addons.xml.md5 hash file. Must be run from the root of
the checked-out repo. Only handles single depth folder structure.
"""
def __init__( self ):

def __init__(self):
# generate files
self._generate_addons_file()
self._generate_md5_file()
# notify user
print "Finished updating addons xml and md5 files"
print(f"Finished updating addons xml and md5 files")

def _generate_addons_file( self ):
def _generate_addons_file(self):
# final addons text
addons_xml = u"<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<addons>\n"
addons_xml = '<?xml version="1.0" encoding="UTF-8"?>\n<addons>\n'
# loop thru and add each addons addon.xml file
for addon in __ADDONS__:
try:
# skip any file or .git folder
if ( not os.path.isdir( addon )):
print "Addon %s does not exist" % addon
if not os.path.isdir(addon):
print(f"Addon {addon} does not exist")
continue
# create path
_path = os.path.join( addon, "addon.xml" )
_path = os.path.join(addon, "addon.xml")
# split lines for stripping
xml_lines = open( _path, "r" ).read().splitlines()
xml_lines = open(_path, "r").read().splitlines()
# new addon
addon_xml = ""
# loop thru cleaning each line
for line in xml_lines:
# skip encoding format line
if ( line.find( "<?xml" ) >= 0 ): continue
if line.find("<?xml") >= 0:
continue
# add line
addon_xml += unicode( line.rstrip() + "\n", "utf-8" )
addon_xml += line.rstrip() + "\n"
# we succeeded so add to our final addons.xml text
addons_xml += addon_xml.rstrip() + "\n\n"
except Exception, e:
except Exception as e:
# missing or poorly formatted addon.xml
print "Excluding %s for %s" % ( _path, e, )
print(f"Excluding {_path} for {e}")
# clean and add closing tag
addons_xml = addons_xml.strip() + u"\n</addons>\n"
addons_xml = addons_xml.strip() + "\n</addons>\n"
# save file
self._save_file( addons_xml.encode( "utf-8" ), file="tmp/addons.xml" )
self._save_file(addons_xml, file="tmp/addons.xml")

def _generate_md5_file( self ):
try:
# create a new md5 hash
m = md5.new( open( "tmp/addons.xml" ).read() ).hexdigest()
# save file
self._save_file( m, file="tmp/addons.xml.md5" )
except Exception, e:
# oops
print "An error occurred creating addons.xml.md5 file!\n%s" % ( e, )
def _generate_md5_file(self):
# create a new md5 hash
m = hashlib.md5(open("tmp/addons.xml").read().encode("utf-8")).hexdigest()
self._save_file(m, file="tmp/addons.xml.md5")

def _save_file( self, data, file ):
try:
# write data to the file
open( file, "w" ).write( data )
except Exception, e:
# oops
print "An error occurred saving %s file!\n%s" % ( file, e, )
def _save_file(self, data, file):
with open(file, "w") as fp:
fp.write(data)


if ( __name__ == "__main__" ):
if __name__ == "__main__":
# start
Generator()
2 changes: 1 addition & 1 deletion script.module.demjson
2 changes: 1 addition & 1 deletion script.module.dmd-czech.common
2 changes: 1 addition & 1 deletion service.subtitles.serialzone.cz
2 changes: 1 addition & 1 deletion service.subtitles.titulky.com
28 changes: 14 additions & 14 deletions tools/bump_addon
Original file line number Diff line number Diff line change
@@ -1,23 +1,23 @@
#!/usr/bin/env python

import sys,os
import sys, os
import xml.etree.ElementTree as ET

fileName = os.path.join (sys.argv[1],'addon.xml')
xmldoc = ET.parse( fileName )
fileName = os.path.join(sys.argv[1], "addon.xml")
xmldoc = ET.parse(fileName)
root = xmldoc.getroot()

# bump version
version = root.get('version')
parts = version.split('.')
version = root.get("version")
parts = version.split(".")
parts[-1] = str(int(parts[-1]) + 1)
print 'Addon version bumped to %s' % '.'.join(parts)
root.set('version','.'.join(parts))
for node in root.findall('requires/import'):
dependency = os.path.join (node.get('addon'),'addon.xml')
print("Addon version bumped to {'.'.join(parts)}")
root.set("version", ".".join(parts))
for node in root.findall("requires/import"):
dependency = os.path.join(node.get("addon"), "addon.xml")
if os.path.exists(dependency):
ver = ET.parse(dependency).getroot().get('version')
if ver != node.get('version'):
node.set('version',ver)
print 'Dependency %s to %s' % (node.get('addon'),ver)
xmldoc.write(fileName,xml_declaration=True,encoding='utf-8')
ver = ET.parse(dependency).getroot().get("version")
if ver != node.get("version"):
node.set("version", ver)
print("Dependency {node.get('addon')} to {ver}")
xmldoc.write(fileName, xml_declaration=True, encoding="utf-8")
5 changes: 2 additions & 3 deletions tools/get_addon_attribute
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,5 @@ import xml.dom.minidom

(fileName, attrName) = sys.argv[1:]

xmldoc = xml.dom.minidom.parse( fileName )
print xmldoc.childNodes[0].getAttribute( attrName )

xmldoc = xml.dom.minidom.parse(fileName)
print(xmldoc.childNodes[0].getAttribute(attrName))
2 changes: 1 addition & 1 deletion weather.shmu.pocasie