Skip to content

Commit

Permalink
Merge pull request #4369 from lusum/matrix
Browse files Browse the repository at this point in the history
[plugin.audio.ampache@matrix] 3.1.0+matrix.1
  • Loading branch information
basrieter authored Sep 13, 2023
2 parents ab18a3b + 10775e5 commit df19952
Show file tree
Hide file tree
Showing 4 changed files with 39 additions and 19 deletions.
2 changes: 1 addition & 1 deletion plugin.audio.ampache/addon.xml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
<addon id="plugin.audio.ampache" version="3.0.0+matrix.1" name="Ampache" provider-name="lusum">
<addon id="plugin.audio.ampache" version="3.1.0+matrix.1" name="Ampache" provider-name="lusum">
<requires>
<import addon="script.module.future" version="0.18.2"/>
<import addon="xbmc.python" version="3.0.0"/>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -424,19 +424,19 @@ msgstr "Plugin Ampache"

msgctxt "#30190"
msgid "Recently Played Artists..."
msgstr "Artisti suonati recentemente..."
msgstr "Artisti ascoltati recentemente..."

msgctxt "#30191"
msgid "Recently Played Albums..."
msgstr "Album suonati recentemente..."
msgstr "Album ascoltati recentemente..."

msgctxt "#30192"
msgid "Recently Played Songs..."
msgstr "Canzoni suonate recentemente..."
msgstr "Canzoni ascoltate recentemente..."

msgctxt "#30193"
msgid "Recently Played..."
msgstr "Suonati recentemente..."
msgstr "Ascoltati recentemente..."

msgctxt "#30194"
msgid "Next items..."
Expand Down
21 changes: 15 additions & 6 deletions plugin.audio.ampache/resources/lib/ampache_connect.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ def __init__(self):
self.id=None
self.rating=None
#force the latest version on the server
self.version="610001"
self.version="600001"

def getBaseUrl(self):
return '/server/xml.server.php'
Expand Down Expand Up @@ -127,12 +127,21 @@ def handle_request(self,url):
try:
req = urllib.request.Request(url)
if ut.strBool_to_bool(ssl_certs_str):
gcontext = ssl.SSLContext(ssl.PROTOCOL_TLSv1)
response = urllib.request.urlopen(req, context=gcontext, timeout=400)
xbmc.log("AmpachePlugin::handle_request: ssl",xbmc.LOGDEBUG)
if PY2:
response = urllib.request.urlopen(req, timeout=400)
else:
gcontext = ssl.create_default_context()
gcontext.check_hostname = False
gcontext.verify_mode = ssl.CERT_NONE
response = urllib.request.urlopen(req, context=gcontext, timeout=400)
xbmc.log("AmpachePlugin::handle_request: disable ssl certificates",xbmc.LOGDEBUG)
else:
response = urllib.request.urlopen(req, timeout=400)
xbmc.log("AmpachePlugin::handle_request: nossl",xbmc.LOGDEBUG)
if PY2:
gcontext = ssl.SSLContext(ssl.PROTOCOL_TLSv1)
response = urllib.request.urlopen(req, context=gcontext, timeout=400)
else:
response = urllib.request.urlopen(req, timeout=400)
xbmc.log("AmpachePlugin::handle_request: ssl certificates",xbmc.LOGDEBUG)
except urllib.error.HTTPError as e:
xbmc.log("AmpachePlugin::handle_request: HTTPError " +\
repr(e),xbmc.LOGDEBUG)
Expand Down
27 changes: 19 additions & 8 deletions plugin.audio.ampache/resources/lib/ampache_plugin.py
Original file line number Diff line number Diff line change
Expand Up @@ -145,17 +145,23 @@ def get_infolabels(elem_type , node):
return infoLabels

def getNestedTypeText(node, elem_tag ,elem_type):
obj_elem = node.find(elem_type)
if obj_elem is not None or obj_elem != '':
obj_tag = obj_elem.findtext(elem_tag)
return obj_tag
try:
obj_elem = node.find(elem_type)
if obj_elem is not None or obj_elem != '':
obj_tag = obj_elem.findtext(elem_tag)
return obj_tag
except:
return None
return None

def getNestedTypeId(node,elem_type):
obj_elem = node.find(elem_type)
if obj_elem is not None or obj_elem != '':
obj_id = obj_elem.attrib["id"]
return obj_id
try:
obj_elem = node.find(elem_type)
if obj_elem is not None or obj_elem != '':
obj_id = obj_elem.attrib["id"]
return obj_id
except:
return None
return None

#this function is used to speed up the loading of the images using differents
Expand Down Expand Up @@ -231,6 +237,11 @@ def addLinks(elem,elem_type,useCacheArt,mode):
elif elem_type == "playlist":
if useCacheArt:
image = art.get_art(object_id,"playlist")
try:
numItems = str(node.findtext("items"))
name = name + " (" + numItems + ")"
except:
pass
else:
useCacheArt = False

Expand Down

0 comments on commit df19952

Please sign in to comment.