mirror of
https://github.com/azlux/botamusique
synced 2024-11-23 22:06:09 +00:00
Compare commits
No commits in common. "32191bfd9ad454cd3590422add335257cb8e1eba" and "cb95e25178bb1ecf5833eff23f39a83a2b25abbc" have entirely different histories.
32191bfd9a
...
cb95e25178
@ -14,10 +14,6 @@ import variables as var
|
|||||||
import util
|
import util
|
||||||
|
|
||||||
|
|
||||||
class ItemNotCachedError(Exception):
|
|
||||||
pass
|
|
||||||
|
|
||||||
|
|
||||||
class MusicCache(dict):
|
class MusicCache(dict):
|
||||||
def __init__(self, db: MusicDatabase):
|
def __init__(self, db: MusicDatabase):
|
||||||
super().__init__()
|
super().__init__()
|
||||||
@ -146,7 +142,7 @@ class CachedItemWrapper:
|
|||||||
if self.id in self.lib:
|
if self.id in self.lib:
|
||||||
return self.lib[self.id]
|
return self.lib[self.id]
|
||||||
else:
|
else:
|
||||||
raise ItemNotCachedError(f"Uncached item of id {self.id}, type {self.type}.")
|
raise ValueError(f"Uncached item of id {self.id}, type {self.type}.")
|
||||||
|
|
||||||
def to_dict(self):
|
def to_dict(self):
|
||||||
dict = self.item().to_dict()
|
dict = self.item().to_dict()
|
||||||
|
@ -5,8 +5,7 @@ import random
|
|||||||
import time
|
import time
|
||||||
|
|
||||||
import variables as var
|
import variables as var
|
||||||
from media.cache import (CachedItemWrapper, ItemNotCachedError,
|
from media.cache import CachedItemWrapper, get_cached_wrapper_from_dict, get_cached_wrapper_by_id
|
||||||
get_cached_wrapper_from_dict, get_cached_wrapper_by_id)
|
|
||||||
from database import Condition
|
from database import Condition
|
||||||
from media.item import ValidationFailedError, PreparationFailedError
|
from media.item import ValidationFailedError, PreparationFailedError
|
||||||
|
|
||||||
@ -225,15 +224,6 @@ class BasePlaylist(list):
|
|||||||
self.validating_thread_lock.acquire()
|
self.validating_thread_lock.acquire()
|
||||||
while len(self.pending_items) > 0:
|
while len(self.pending_items) > 0:
|
||||||
item = self.pending_items.pop()
|
item = self.pending_items.pop()
|
||||||
try:
|
|
||||||
item.item()
|
|
||||||
except ItemNotCachedError:
|
|
||||||
# In some very subtle case, items are removed and freed from
|
|
||||||
# the playlist and the cache, before validation even starts,
|
|
||||||
# causes, freed items remain in pending_items.
|
|
||||||
# Simply ignore these items here.
|
|
||||||
continue
|
|
||||||
|
|
||||||
self.log.debug("playlist: validating %s" % item.format_debug_string())
|
self.log.debug("playlist: validating %s" % item.format_debug_string())
|
||||||
ver = item.version
|
ver = item.version
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user