Skip to content

Commit

Permalink
ensure showing the first item's background art on library open even i…
Browse files Browse the repository at this point in the history
…f we've got multiple chunks
  • Loading branch information
pannal committed Sep 2, 2018
1 parent d16083e commit d928601
Showing 1 changed file with 12 additions and 9 deletions.
21 changes: 12 additions & 9 deletions lib/windows/library.py
Original file line number Diff line number Diff line change
Expand Up @@ -1237,18 +1237,21 @@ def updateItem(self, mli=None):
backgroundthread.BGThreader.moveToFront(task)
break

def setBackground(self, items, randomize=True):
if randomize:
if self.backgroundSet:
return
self.backgroundSet = True
def setBackground(self, items, position, randomize=True):
if self.backgroundSet:
return

if randomize:
item = random.choice(items)
self.setProperty('background', util.backgroundFromArt(item.art, width=self.width, height=self.height))
else:
if items:
self.setProperty('background', util.backgroundFromArt(items[0].art,
width=self.width, height=self.height))
# we want the first item of the first chunk
if position is not 0:
return

self.setProperty('background', util.backgroundFromArt(items[0].art,
width=self.width, height=self.height))
self.backgroundSet = True

def fill(self):
if self.chunkMode:
Expand Down Expand Up @@ -1520,7 +1523,7 @@ def _chunkCallback(self, items, start):
if self.chunkMode and not self.chunkMode.posIsValid(start):
return
pos = start
self.setBackground(items, randomize=not util.advancedSettings.dynamicBackgrounds)
self.setBackground(items, pos, randomize=not util.advancedSettings.dynamicBackgrounds)

thumbDim = TYPE_KEYS.get(self.section.type, TYPE_KEYS['movie'])['thumb_dim']
artDim = TYPE_KEYS.get(self.section.type, TYPE_KEYS['movie']).get('art_dim', (256, 256))
Expand Down

0 comments on commit d928601

Please sign in to comment.