Compare commits
9 Commits
artist-inf
...
master
| Author | SHA1 | Date | |
|---|---|---|---|
| 4fffcd143e | |||
| e59b65d5e0 | |||
| fa0c4ec165 | |||
| 2c785729ee | |||
| d11505bd04 | |||
| d221fa4f39 | |||
| ec86d2abdd | |||
| b9a556eded | |||
| 4e15a1d0d3 |
@ -20,7 +20,7 @@ Leia compatible version available in alternate branch
|
|||||||
|
|
||||||
## Installation
|
## Installation
|
||||||
From repository
|
From repository
|
||||||
[repository.warwickh-0.9.0.zip](https://github.com/warwickh/repository.warwickh/raw/master/matrix/zips/repository.warwickh/repository.warwickh-0.9.0.zip) (Please report any issues)
|
[repository.warwickh](https://github.com/warwickh/repository.warwickh/raw/master/matrix/zips/repository.warwickh) (Please report any issues)
|
||||||
|
|
||||||
From GitHub
|
From GitHub
|
||||||
* Click the code button and download
|
* Click the code button and download
|
||||||
|
|||||||
@ -1,5 +1,5 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
|
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
|
||||||
<addon id="plugin.audio.subsonic" name="Subsonic" version="3.0.1" provider-name="BasilFX,warwickh">
|
<addon id="plugin.audio.subsonic" name="Subsonic" version="3.0.2" provider-name="BasilFX,warwickh">
|
||||||
<requires>
|
<requires>
|
||||||
<import addon="xbmc.python" version="3.0.0"/>
|
<import addon="xbmc.python" version="3.0.0"/>
|
||||||
</requires>
|
</requires>
|
||||||
|
|||||||
@ -20,6 +20,7 @@ from netrc import netrc
|
|||||||
from hashlib import md5
|
from hashlib import md5
|
||||||
import urllib.request
|
import urllib.request
|
||||||
import urllib.error
|
import urllib.error
|
||||||
|
import urllib.parse
|
||||||
from http import client as http_client
|
from http import client as http_client
|
||||||
from urllib.parse import urlencode
|
from urllib.parse import urlencode
|
||||||
from io import StringIO
|
from io import StringIO
|
||||||
@ -154,8 +155,18 @@ class Connection(object):
|
|||||||
request. This is not recommended as request
|
request. This is not recommended as request
|
||||||
URLs can get very long with some API calls
|
URLs can get very long with some API calls
|
||||||
"""
|
"""
|
||||||
self._baseUrl = baseUrl
|
|
||||||
self._hostname = baseUrl.split('://')[1].strip()
|
self._baseUrl = baseUrl.rstrip('/')
|
||||||
|
self._hostname = self._baseUrl.split('://')[1]
|
||||||
|
if len(self._hostname.split('/'))>1:
|
||||||
|
print(len(self._hostname.split('/')))
|
||||||
|
xbmc.log("Got a folder %s"%(self._hostname.split('/')[1]),xbmc.LOGDEBUG)
|
||||||
|
parts = urllib.parse.urlparse(self._baseUrl)
|
||||||
|
self._baseUrl = "%s://%s" % (parts.scheme, parts.hostname)
|
||||||
|
self._hostname = parts.hostname
|
||||||
|
self._serverPath = parts.path.strip('/') + '/rest'
|
||||||
|
else:
|
||||||
|
self._serverPath = serverPath.strip('/')
|
||||||
self._username = username
|
self._username = username
|
||||||
self._rawPass = password
|
self._rawPass = password
|
||||||
self._legacyAuth = legacyAuth
|
self._legacyAuth = legacyAuth
|
||||||
@ -172,7 +183,6 @@ class Connection(object):
|
|||||||
self._port = int(port)
|
self._port = int(port)
|
||||||
self._apiVersion = apiVersion
|
self._apiVersion = apiVersion
|
||||||
self._appName = appName
|
self._appName = appName
|
||||||
self._serverPath = serverPath.strip('/')
|
|
||||||
self._insecure = insecure
|
self._insecure = insecure
|
||||||
self._opener = self._getOpener(self._username, self._rawPass)
|
self._opener = self._getOpener(self._username, self._rawPass)
|
||||||
|
|
||||||
@ -899,7 +909,7 @@ class Connection(object):
|
|||||||
#xbmc.log("Requesting %s"%str(req.full_url),xbmc.LOGDEBUG)
|
#xbmc.log("Requesting %s"%str(req.full_url),xbmc.LOGDEBUG)
|
||||||
return_url = req.full_url
|
return_url = req.full_url
|
||||||
if self._insecure:
|
if self._insecure:
|
||||||
return_url += '|verifypeer=false'
|
return_url += '&verifypeer=false'
|
||||||
xbmc.log("Request is insecure %s"%return_url,level=xbmc.LOGDEBUG)
|
xbmc.log("Request is insecure %s"%return_url,level=xbmc.LOGDEBUG)
|
||||||
return return_url
|
return return_url
|
||||||
|
|
||||||
@ -948,7 +958,7 @@ class Connection(object):
|
|||||||
#xbmc.log("Requesting %s"%str(req.full_url),xbmc.LOGDEBUG)
|
#xbmc.log("Requesting %s"%str(req.full_url),xbmc.LOGDEBUG)
|
||||||
return_url = req.full_url
|
return_url = req.full_url
|
||||||
if self._insecure:
|
if self._insecure:
|
||||||
return_url += '|verifypeer=false'
|
return_url += '&verifypeer=false'
|
||||||
xbmc.log("Request is insecure %s"%return_url,level=xbmc.LOGDEBUG)
|
xbmc.log("Request is insecure %s"%return_url,level=xbmc.LOGDEBUG)
|
||||||
return return_url
|
return return_url
|
||||||
|
|
||||||
|
|||||||
@ -19,7 +19,8 @@ import inspect
|
|||||||
import time
|
import time
|
||||||
import hashlib
|
import hashlib
|
||||||
import pickle
|
import pickle
|
||||||
from collections import MutableMapping, namedtuple
|
from collections.abc import MutableMapping
|
||||||
|
from collections import namedtuple
|
||||||
from copy import deepcopy
|
from copy import deepcopy
|
||||||
from functools import wraps
|
from functools import wraps
|
||||||
from shutil import copyfile
|
from shutil import copyfile
|
||||||
@ -58,7 +59,7 @@ def _format_vars(variables):
|
|||||||
:return: formatted string with sorted ``var = val`` pairs
|
:return: formatted string with sorted ``var = val`` pairs
|
||||||
:rtype: str
|
:rtype: str
|
||||||
"""
|
"""
|
||||||
var_list = [(var, val) for var, val in iteritems(variables)]
|
var_list = [(var, val) for var, val in iter(variables.items())]
|
||||||
lines = []
|
lines = []
|
||||||
for var, val in sorted(var_list, key=lambda i: i[0]):
|
for var, val in sorted(var_list, key=lambda i: i[0]):
|
||||||
if not (var.startswith('__') or var.endswith('__')):
|
if not (var.startswith('__') or var.endswith('__')):
|
||||||
|
|||||||
73
main.py
73
main.py
@ -107,6 +107,11 @@ def root(params):
|
|||||||
'callback': 'search',
|
'callback': 'search',
|
||||||
'thumb': None
|
'thumb': None
|
||||||
},
|
},
|
||||||
|
'searchalbum': {
|
||||||
|
'name': Addon().get_localized_string(30045),
|
||||||
|
'callback': 'search_album',
|
||||||
|
'thumb': None
|
||||||
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
# Iterate through categories
|
# Iterate through categories
|
||||||
@ -578,27 +583,61 @@ def search(params):
|
|||||||
|
|
||||||
dialog = xbmcgui.Dialog()
|
dialog = xbmcgui.Dialog()
|
||||||
d = dialog.input(Addon().get_localized_string(30039), type=xbmcgui.INPUT_ALPHANUM)
|
d = dialog.input(Addon().get_localized_string(30039), type=xbmcgui.INPUT_ALPHANUM)
|
||||||
if not d:
|
|
||||||
d = " "
|
|
||||||
|
|
||||||
|
|
||||||
# get connection
|
|
||||||
connection = get_connection()
|
|
||||||
|
|
||||||
if connection==False:
|
|
||||||
return
|
|
||||||
|
|
||||||
listing = []
|
listing = []
|
||||||
|
|
||||||
# Get items
|
if d:
|
||||||
items = connection.search2(query=d)
|
# get connection
|
||||||
# Iterate through items
|
connection = get_connection()
|
||||||
for item in items.get('searchResult2').get('song'):
|
|
||||||
entry = get_entry_track( item, params)
|
|
||||||
listing.append(entry)
|
|
||||||
|
|
||||||
if len(listing) == 1:
|
if connection == False:
|
||||||
plugin.log('One single Media Folder found; do return listing from browse_indexes()...')
|
return
|
||||||
|
|
||||||
|
# Get items
|
||||||
|
items = connection.search2(query=d)
|
||||||
|
# Iterate through items
|
||||||
|
songs = items.get('searchResult2').get('song')
|
||||||
|
if songs:
|
||||||
|
for item in songs:
|
||||||
|
entry = get_entry_track( item, params)
|
||||||
|
listing.append(entry)
|
||||||
|
|
||||||
|
if len(listing) == 0:
|
||||||
|
plugin.log('No songs found; do return listing from browse_indexes()...')
|
||||||
|
return browse_indexes(params)
|
||||||
|
else:
|
||||||
|
add_directory_items(create_listing(listing))
|
||||||
|
|
||||||
|
|
||||||
|
@plugin.action()
|
||||||
|
def search_album(params):
|
||||||
|
|
||||||
|
dialog = xbmcgui.Dialog()
|
||||||
|
d = dialog.input(Addon().get_localized_string(30045), type=xbmcgui.INPUT_ALPHANUM)
|
||||||
|
|
||||||
|
listing = []
|
||||||
|
|
||||||
|
if d:
|
||||||
|
# get connection
|
||||||
|
connection = get_connection()
|
||||||
|
if connection==False:
|
||||||
|
return
|
||||||
|
# Get items, we are only looking for albums here
|
||||||
|
# so artistCount and songCount is set to 0
|
||||||
|
items = connection.search2(query=d, artistCount=0, songCount=0)
|
||||||
|
# Iterate through items
|
||||||
|
|
||||||
|
album_list = items.get('searchResult2').get('album')
|
||||||
|
if album_list:
|
||||||
|
for item in items.get('searchResult2').get('album'):
|
||||||
|
entry = get_entry_album( item, params)
|
||||||
|
listing.append(entry)
|
||||||
|
|
||||||
|
# I believe it is ok to return an empty listing if
|
||||||
|
# the search gave no result
|
||||||
|
# maybe inform the user?
|
||||||
|
if len(listing) == 0:
|
||||||
|
plugin.log('No albums found; do return listing from browse_indexes()...')
|
||||||
return browse_indexes(params)
|
return browse_indexes(params)
|
||||||
else:
|
else:
|
||||||
add_directory_items(create_listing(listing))
|
add_directory_items(create_listing(listing))
|
||||||
|
|||||||
@ -154,7 +154,7 @@ msgid "Browse"
|
|||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
msgctxt "#30039"
|
msgctxt "#30039"
|
||||||
msgid "Search"
|
msgid "Search Songs"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
msgctxt "#30040"
|
msgctxt "#30040"
|
||||||
@ -176,3 +176,7 @@ msgstr ""
|
|||||||
msgctxt "#30044"
|
msgctxt "#30044"
|
||||||
msgid "Scrobble to Last.FM"
|
msgid "Scrobble to Last.FM"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
|
msgctxt "#30045"
|
||||||
|
msgid "Search Albums"
|
||||||
|
msgstr ""
|
||||||
|
|||||||
@ -153,8 +153,8 @@ msgid "Browse"
|
|||||||
msgstr "Parcourir"
|
msgstr "Parcourir"
|
||||||
|
|
||||||
msgctxt "#30039"
|
msgctxt "#30039"
|
||||||
msgid "Search"
|
msgid "Search Songs"
|
||||||
msgstr "Rechercher"
|
msgstr "Rechercher Chansons"
|
||||||
|
|
||||||
|
|
||||||
msgctxt "#30040"
|
msgctxt "#30040"
|
||||||
@ -176,3 +176,7 @@ msgstr ""
|
|||||||
msgctxt "#30044"
|
msgctxt "#30044"
|
||||||
msgid "Scrobble to Last.FM"
|
msgid "Scrobble to Last.FM"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
|
msgctxt "#30045"
|
||||||
|
msgid "Search Albums"
|
||||||
|
msgstr "Rechercher Albums"
|
||||||
|
|||||||
@ -153,8 +153,8 @@ msgid "Browse"
|
|||||||
msgstr "Durchsuchen"
|
msgstr "Durchsuchen"
|
||||||
|
|
||||||
msgctxt "#30039"
|
msgctxt "#30039"
|
||||||
msgid "Search"
|
msgid "Search Songs"
|
||||||
msgstr "Suche"
|
msgstr "Suche Lieder"
|
||||||
|
|
||||||
msgctxt "#30040"
|
msgctxt "#30040"
|
||||||
msgid "useGET"
|
msgid "useGET"
|
||||||
@ -175,3 +175,7 @@ msgstr ""
|
|||||||
msgctxt "#30044"
|
msgctxt "#30044"
|
||||||
msgid "Scrobble to Last.FM"
|
msgid "Scrobble to Last.FM"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
|
msgctxt "#30045"
|
||||||
|
msgid "Search Albums"
|
||||||
|
msgstr "Suche Albums"
|
||||||
|
|||||||
Reference in New Issue
Block a user