mirror of
https://github.com/jellyfin/jellyfin-kodi.git
synced 2024-12-24 09:46:11 +00:00
Move incremental to generator
This commit is contained in:
parent
6736223a86
commit
c4669e5b86
4 changed files with 27 additions and 4 deletions
|
@ -119,6 +119,14 @@ def get_seasons(self, show_id):
|
|||
|
||||
#################################################################################################
|
||||
|
||||
def get_all(generator):
|
||||
|
||||
items = []
|
||||
for item in generator:
|
||||
items.extend(item['Items'])
|
||||
|
||||
return items
|
||||
|
||||
def get_items(parent_id, item_type=None, basic=False, params=None):
|
||||
|
||||
query = {
|
||||
|
@ -178,6 +186,20 @@ def get_albums_by_artist(artist_id):
|
|||
for items in get_items(None, "MusicAlbum", params=params):
|
||||
yield items
|
||||
|
||||
def sortby_mediatype(item_ids):
|
||||
|
||||
sorted_items = {}
|
||||
|
||||
items = get_all(get_item_list(item_ids))
|
||||
for item in items:
|
||||
|
||||
mediatype = item.get('Type')
|
||||
if mediatype:
|
||||
sorted_items.setdefault(mediatype, []).append(item)
|
||||
|
||||
return sorted_items
|
||||
|
||||
|
||||
def _split_list(item_list, size):
|
||||
# Split up list in pieces of size. Will generate a list of lists
|
||||
return [item_list[i:i + size] for i in range(0, len(item_list), size)]
|
||||
|
|
|
@ -4,6 +4,7 @@
|
|||
|
||||
import logging
|
||||
|
||||
import emby as mb
|
||||
import read_embyserver as embyserver
|
||||
from objects import Movies, MusicVideos, TVShows, Music
|
||||
from utils import settings
|
||||
|
@ -90,7 +91,7 @@ class Items(object):
|
|||
elif process == "remove":
|
||||
items_process.remove_all(itemtype, itemlist)
|
||||
else:
|
||||
process_items = self.emby.getFullItems(itemlist)
|
||||
process_items = mb.get_all(mb.get_item_list(itemlist))
|
||||
items_process.process_all(itemtype, process, process_items, total)
|
||||
|
||||
|
||||
|
|
|
@ -572,7 +572,7 @@ class LibrarySync(threading.Thread):
|
|||
|
||||
# Prepare items according to process process_type
|
||||
if process_type == "added":
|
||||
items = self.emby.sortby_mediatype(listItems)
|
||||
items = mb.sortby_mediatype(listItems)
|
||||
|
||||
elif process_type in ("userdata", "remove"):
|
||||
items = emby_db.sortby_mediaType(listItems, unsorted=False)
|
||||
|
@ -580,7 +580,7 @@ class LibrarySync(threading.Thread):
|
|||
else:
|
||||
items = emby_db.sortby_mediaType(listItems)
|
||||
if items.get('Unsorted'):
|
||||
sorted_items = self.emby.sortby_mediatype(items['Unsorted'])
|
||||
sorted_items = mb.sortby_mediatype(items['Unsorted'])
|
||||
doupdate = items_process.itemsbyId(sorted_items, "added", pDialog)
|
||||
if doupdate:
|
||||
embyupdate, kodiupdate_video = doupdate
|
||||
|
|
|
@ -144,7 +144,7 @@ class PlaybackUtils(object):
|
|||
|
||||
# Stack: [(url, listitem), (url, ...), ...]
|
||||
self.stack[0][1].setPath(self.stack[0][0])
|
||||
try:
|
||||
try:
|
||||
if self._detect_widgets():
|
||||
# widgets do not fill artwork correctly
|
||||
log.info("Detected widget.")
|
||||
|
|
Loading…
Reference in a new issue