Skip to content

Commit

Permalink
Merge pull request #534 from quickmic/next-gen-dev-python3
Browse files Browse the repository at this point in the history
10.0.40, review changelog for details
  • Loading branch information
quickmic authored Jul 13, 2024
2 parents 5081f3b + c668993 commit 9e36199
Show file tree
Hide file tree
Showing 4 changed files with 42 additions and 36 deletions.
2 changes: 1 addition & 1 deletion addon.xml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<?xml version='1.0' encoding='UTF-8' standalone="yes"?>
<addon id="plugin.service.emby-next-gen" name="Emby for Kodi Next Gen" version="10.0.39" provider-name="quickmic">
<addon id="plugin.service.emby-next-gen" name="Emby for Kodi Next Gen" version="10.0.40" provider-name="quickmic">
<requires>
<import addon="xbmc.python" version="3.0.1"/>
<import addon="script.module.dateutil" version="2.8.1" />
Expand Down
6 changes: 6 additions & 0 deletions changelog.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
10.0.40
=============
fix realtime sync issue for unsyncable content e.g. photos



10.0.39
=============
change log modes
Expand Down
8 changes: 6 additions & 2 deletions database/emby_db.py
Original file line number Diff line number Diff line change
Expand Up @@ -369,8 +369,12 @@ def get_UpdateItem(self):
del Ids

for Item in Items:
Data[Item[2]][Item[1]][Counter[Item[2]][Item[1]]] = str(Item[0])
Counter[Item[2]][Item[1]] += 1
if Item[1] in Data[Item[2]]:
Data[Item[2]][Item[1]][Counter[Item[2]][Item[1]]] = str(Item[0])
Counter[Item[2]][Item[1]] += 1
else: # e.g. photo updte -> # Item: (3541991, 'Photo', '999999999')
Data[Item[2]]["unknown"][Counter[Item[2]]["unknown"]] = str(Item[0])
Counter[Item[2]]["unknown"] += 1

for Key, Array in list(Data.items()):
DataProcessed[Key] = {"MusicVideo": Array["MusicVideo"][:Counter[Key]["MusicVideo"]], "Folder": Array["Folder"][:Counter[Key]["Folder"]], "Movie": Array["Movie"][:Counter[Key]["Movie"]], "Video": Array["Video"][:Counter[Key]["Video"]], "Series": Array["Series"][:Counter[Key]["Series"]], "Season": Array["Season"][:Counter[Key]["Season"]], "Episode": Array["Episode"][:Counter[Key]["Episode"]], "MusicArtist": Array["MusicArtist"][:Counter[Key]["MusicArtist"]], "MusicAlbum": Array["MusicAlbum"][:Counter[Key]["MusicAlbum"]], "Audio": Array["Audio"][:Counter[Key]["Audio"]], "Person": Array["Person"][:Counter[Key]["Person"]], "MusicGenre": Array["MusicGenre"][:Counter[Key]["MusicGenre"]], "Genre": Array["Genre"][:Counter[Key]["Genre"]], "Studio": Array["Studio"][:Counter[Key]["Studio"]], "Tag": Array["Tag"][:Counter[Key]["Tag"]], "BoxSet": Array["BoxSet"][:Counter[Key]["BoxSet"]], "Playlist": Array["Playlist"][:Counter[Key]["Playlist"]], "unknown": Array["unknown"][:Counter[Key]["unknown"]]} # Filter None
Expand Down
62 changes: 29 additions & 33 deletions emby/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -197,51 +197,47 @@ def get_Items_dynamic(self, ParentId, MediaTypes, Recursive, Extra, Resume, Libr

def get_Items_Ids(self, Ids, MediaTypes, Dynamic, Basic, ProcessProgressId, LibraryId, Extra):
ItemsQueue = queue.Queue()
Fields = []

if not Basic:
for MediaType in MediaTypes:
Fields += EmbyFields[MediaType.lower()]
for MediaType in MediaTypes:
if not Basic:
Fields = EmbyFields[MediaType.lower()]

#Dynamic list query, remove fields to improve performance
if Dynamic:
if "Series" in MediaTypes or "Season" in MediaTypes:
Fields += ("RecursiveItemCount", "ChildCount")
#Dynamic list query, remove fields to improve performance
if Dynamic:
if MediaType in ("Series", "Season"):
Fields += ("RecursiveItemCount", "ChildCount")

for DynamicListsRemoveField in self.DynamicListsRemoveFields:
if DynamicListsRemoveField in Fields:
Fields.remove(DynamicListsRemoveField)
for DynamicListsRemoveField in self.DynamicListsRemoveFields:
if DynamicListsRemoveField in Fields:
Fields.remove(DynamicListsRemoveField)

Fields = ",".join(list(dict.fromkeys(Fields))) # remove duplicates and join into string
else:
Fields = None
Fields = ",".join(list(dict.fromkeys(Fields))) # remove duplicates and join into string
else:
Fields = None

if len(MediaTypes) == 1:
Params = {'Fields': Fields, 'EnableTotalRecordCount': False, 'LocationTypes': "FileSystem,Remote,Offline", 'IncludeItemTypes': MediaTypes[0]}
else:
Params = {'Fields': Fields, 'EnableTotalRecordCount': False, 'LocationTypes': "FileSystem,Remote,Offline"}
Params = {'Fields': Fields, 'EnableTotalRecordCount': False, 'LocationTypes': "FileSystem,Remote,Offline", 'IncludeItemTypes': MediaType}

if Extra:
Params.update(Extra)
if Extra:
Params.update(Extra)

if 'SortBy' not in Params:
Params['SortBy'] = "None"

if 'SortBy' not in Params:
Params['SortBy'] = "None"
start_new_thread(self.async_get_Items_Ids, (f"Users/{self.EmbyServer.ServerData['UserId']}/Items", ItemsQueue, Params, Ids, Dynamic, ProcessProgressId, LibraryId))

start_new_thread(self.async_get_Items_Ids, (f"Users/{self.EmbyServer.ServerData['UserId']}/Items", ItemsQueue, Params, Ids, Dynamic, ProcessProgressId, LibraryId))
while True:
Items = ItemsQueue.getall()

while True:
Items = ItemsQueue.getall()
if not Items:
break

if not Items:
break
if Items[-1] == "QUIT":
yield from Items[:-1]
del Items
break

if Items[-1] == "QUIT":
yield from Items[:-1]
yield from Items
del Items
return

yield from Items
del Items

def async_get_Items_Ids(self, Request, ItemsQueue, Params, Ids, Dynamic, ProcessProgressId, LibraryId):
xbmc.log("EMBY.emby.api: THREAD: --->[ load Item by Ids ]", 0) # LOGDEBUG
Expand Down

0 comments on commit 9e36199

Please sign in to comment.