Remove six.moves: range, queue

This commit is contained in:
Odd Stråbø 2024-06-11 02:56:52 +00:00
parent 6a072cc71b
commit 0e80c7cbcc
2 changed files with 25 additions and 25 deletions

View file

@ -7,7 +7,7 @@ import threading
import concurrent.futures import concurrent.futures
from datetime import date from datetime import date
from six.moves import range, queue as Queue import queue
import requests import requests
@ -308,7 +308,7 @@ class GetItemWorker(threading.Thread):
while True: while True:
try: try:
item_ids = self.queue.get(timeout=1) item_ids = self.queue.get(timeout=1)
except Queue.Empty: except queue.Empty:
self.is_done = True self.is_done = True
LOG.info("--<[ q:download/%s ]", id(self)) LOG.info("--<[ q:download/%s ]", id(self))

View file

@ -6,7 +6,7 @@ from __future__ import division, absolute_import, print_function, unicode_litera
import threading import threading
from datetime import datetime, timedelta from datetime import datetime, timedelta
from six.moves import queue as Queue import queue
from kodi_six import xbmc, xbmcgui from kodi_six import xbmc, xbmcgui
@ -48,13 +48,13 @@ class Library(threading.Thread):
self.monitor = monitor self.monitor = monitor
self.player = monitor.monitor.player self.player = monitor.monitor.player
self.server = Jellyfin().get_client() self.server = Jellyfin().get_client()
self.updated_queue = Queue.Queue() self.updated_queue = queue.Queue()
self.userdata_queue = Queue.Queue() self.userdata_queue = queue.Queue()
self.removed_queue = Queue.Queue() self.removed_queue = queue.Queue()
self.updated_output = self.__new_queues__() self.updated_output = self.__new_queues__()
self.userdata_output = self.__new_queues__() self.userdata_output = self.__new_queues__()
self.removed_output = self.__new_queues__() self.removed_output = self.__new_queues__()
self.notify_output = Queue.Queue() self.notify_output = queue.Queue()
self.jellyfin_threads = [] self.jellyfin_threads = []
self.download_threads = [] self.download_threads = []
@ -67,16 +67,16 @@ class Library(threading.Thread):
def __new_queues__(self): def __new_queues__(self):
return { return {
"Movie": Queue.Queue(), "Movie": queue.Queue(),
"BoxSet": Queue.Queue(), "BoxSet": queue.Queue(),
"MusicVideo": Queue.Queue(), "MusicVideo": queue.Queue(),
"Series": Queue.Queue(), "Series": queue.Queue(),
"Season": Queue.Queue(), "Season": queue.Queue(),
"Episode": Queue.Queue(), "Episode": queue.Queue(),
"MusicAlbum": Queue.Queue(), "MusicAlbum": queue.Queue(),
"MusicArtist": Queue.Queue(), "MusicArtist": queue.Queue(),
"AlbumArtist": Queue.Queue(), "AlbumArtist": queue.Queue(),
"Audio": Queue.Queue(), "Audio": queue.Queue(),
} }
def run(self): def run(self):
@ -271,13 +271,13 @@ class Library(threading.Thread):
def worker_downloads(self): def worker_downloads(self):
"""Get items from jellyfin and place them in the appropriate queues.""" """Get items from jellyfin and place them in the appropriate queues."""
for queue in ( for work_queue in (
(self.updated_queue, self.updated_output), (self.updated_queue, self.updated_output),
(self.userdata_queue, self.userdata_output), (self.userdata_queue, self.userdata_output),
): ):
if queue[0].qsize() and len(self.download_threads) < DTHREADS: if work_queue[0].qsize() and len(self.download_threads) < DTHREADS:
new_thread = GetItemWorker(self.server, queue[0], queue[1]) new_thread = GetItemWorker(self.server, work_queue[0], work_queue[1])
new_thread.start() new_thread.start()
LOG.info("-->[ q:download/%s ]", id(new_thread)) LOG.info("-->[ q:download/%s ]", id(new_thread))
self.download_threads.append(new_thread) self.download_threads.append(new_thread)
@ -722,7 +722,7 @@ class UpdateWorker(threading.Thread):
try: try:
item = self.queue.get(timeout=1) item = self.queue.get(timeout=1)
except Queue.Empty: except queue.Empty:
break break
try: try:
@ -801,7 +801,7 @@ class UserDataWorker(threading.Thread):
try: try:
item = self.queue.get(timeout=1) item = self.queue.get(timeout=1)
except Queue.Empty: except queue.Empty:
break break
try: try:
@ -852,7 +852,7 @@ class SortWorker(threading.Thread):
try: try:
item_id = self.queue.get(timeout=1) item_id = self.queue.get(timeout=1)
except Queue.Empty: except queue.Empty:
break break
try: try:
@ -918,7 +918,7 @@ class RemovedWorker(threading.Thread):
try: try:
item = self.queue.get(timeout=1) item = self.queue.get(timeout=1)
except Queue.Empty: except queue.Empty:
break break
if item["Type"] == "Movie": if item["Type"] == "Movie":
@ -970,7 +970,7 @@ class NotifyWorker(threading.Thread):
try: try:
item = self.queue.get(timeout=3) item = self.queue.get(timeout=3)
except Queue.Empty: except queue.Empty:
break break
time = self.music_time if item[0] == "Audio" else self.video_time time = self.music_time if item[0] == "Audio" else self.video_time