Skip to content

Commit

Permalink
remove error when server dont exists
Browse files Browse the repository at this point in the history
  • Loading branch information
lusum committed Mar 22, 2020
1 parent b82a28f commit 0a7709c
Showing 1 changed file with 12 additions and 6 deletions.
18 changes: 12 additions & 6 deletions default.py
Original file line number Diff line number Diff line change
Expand Up @@ -276,7 +276,10 @@ def addItem( object_type, mode , elem, useCacheArt=True):
addSongLinks(elem)

def get_all(object_type):
limit = int(ampache.getSetting(object_type))
try:
limit = int(ampache.getSetting(object_type))
except:
return
step = 500
for offset in range( 0, limit, step):
newLimit = offset+step
Expand Down Expand Up @@ -446,11 +449,14 @@ def get_random(object_type):
amtype='song'

xbmcplugin.setContent(int(sys.argv[1]), object_type)

random_items = (int(ampache.getSetting("random_items"))*3)+3
xbmc.log("AmpachePlugin::get_random: random_items " + str(random_items), xbmc.LOGDEBUG )
items = int(ampache.getSetting(object_type))
xbmc.log("AmpachePlugin::get_random: total items in the catalog " + str(items), xbmc.LOGDEBUG )

try:
random_items = (int(ampache.getSetting("random_items"))*3)+3
xbmc.log("AmpachePlugin::get_random: random_items " + str(random_items), xbmc.LOGDEBUG )
items = int(ampache.getSetting(object_type))
xbmc.log("AmpachePlugin::get_random: total items in the catalog " + str(items), xbmc.LOGDEBUG )
except:
return
if random_items > items:
#if items are less than random_itmes, return all items
get_items(object_type, limit=items)
Expand Down

0 comments on commit 0a7709c

Please sign in to comment.