Merge branch 'develop'

This commit is contained in:
rembo10
2013-06-21 23:47:14 +07:00
5 changed files with 25 additions and 9 deletions

View File

@@ -35,6 +35,7 @@ findArtist&name=$artistname[&limit=$limit] (perform artist query on musicbrainz.
findAlbum&name=$albumname[&limit=$limit] (perform album query on musicbrainz. Returns: title, url (artist), id (artist), albumurl, albumid, score, uniquename (artist - with disambiguation)
addArtist&id=$artistid (add an artist to the db by artistid)
addAlbum&id=$releaseid (add an album to the db by album release id)
delArtist&id=$artistid (delete artist from db by artistid)

View File

@@ -23,7 +23,7 @@ import copy
cmd_list = [ 'getIndex', 'getArtist', 'getAlbum', 'getUpcoming', 'getWanted', 'getSimilar', 'getHistory', 'getLogs',
'findArtist', 'findAlbum', 'addArtist', 'delArtist', 'pauseArtist', 'resumeArtist', 'refreshArtist',
'queueAlbum', 'unqueueAlbum', 'forceSearch', 'forceProcess', 'getVersion', 'checkGithub',
'addAlbum', 'queueAlbum', 'unqueueAlbum', 'forceSearch', 'forceProcess', 'getVersion', 'checkGithub',
'shutdown', 'restart', 'update', 'getArtistArt', 'getAlbumArt', 'getArtistInfo', 'getAlbumInfo', 'getArtistThumb', 'getAlbumThumb']
class Api(object):
@@ -247,6 +247,20 @@ class Api(object):
return
def _addAlbum(self, **kwargs):
if 'id' not in kwargs:
self.data = 'Missing parameter: id'
return
else:
self.id = kwargs['id']
try:
importer.addReleaseById(self.id)
except Exception, e:
self.data = e
return
def _queueAlbum(self, **kwargs):
if 'id' not in kwargs:

View File

@@ -44,7 +44,7 @@ def startmb():
mbport = int(headphones.CUSTOMPORT)
sleepytime = int(headphones.CUSTOMSLEEP)
elif headphones.MIRROR == "headphones":
mbhost = "192.30.34.130"
mbhost = "176.58.107.206"
mbport = 8181
mbuser = headphones.HPUSER
mbpass = headphones.HPPASS

View File

@@ -348,7 +348,7 @@ def searchNZB(albumid=None, new=False, losslessOnly=False):
if data:
d = json.loads(data.replace('null','None'))
d = json.loads(data)
if d['matches'] <= 0:
logger.info(u"No results found from NZBsRus for %s" % term)
@@ -789,7 +789,7 @@ def searchTorrent(albumid=None, new=False, losslessOnly=False):
searchURL = providerurl + "/?%s" % urllib.urlencode(params)
try:
data = urllib2.urlopen(searchURL, timeout=20).read()
data = urllib2.urlopen(searchURL, timeout=20)
except urllib2.URLError, e:
logger.warn('Error fetching data from %s: %s' % (provider, e))
data = False
@@ -799,6 +799,7 @@ def searchTorrent(albumid=None, new=False, losslessOnly=False):
logger.info(u'Parsing results from <a href="%s">KAT</a>' % searchURL)
d = feedparser.parse(data)
if not len(d.entries):
logger.info(u"No results found from %s for %s" % (provider, term))
pass
@@ -807,10 +808,10 @@ def searchTorrent(albumid=None, new=False, losslessOnly=False):
for item in d.entries:
try:
rightformat = True
title = item.title
seeders = item.seeds
url = item.links[1]['url']
size = int(item.links[1]['length'])
title = item['title']
seeders = item['torrent_seeds']
url = item['links'][1]['href']
size = int(item['links'][1]['length'])
try:
if format == "2":
request = urllib2.Request(url)

View File

@@ -497,7 +497,7 @@ def _mb_request(path, method='GET', auth_required=False, client_required=False,
req.add_header('User-Agent', _useragent)
# Add headphones credentials
if hostname == '192.30.34.130:8181':
if hostname == '176.58.107.206:8181':
base64string = base64.encodestring('%s:%s' % (hpuser, hppassword)).replace('\n', '')
req.add_header("Authorization", "Basic %s" % base64string)