fixed the mapping in source maps

This commit is contained in:
Hellow 2023-12-29 15:43:33 +01:00
parent 695c9f62b9
commit aa139a7f73
8 changed files with 19 additions and 52 deletions

View File

@ -2,5 +2,7 @@
<project version="4">
<component name="VcsDirectoryMappings">
<mapping directory="" vcs="Git" />
<mapping directory="$PROJECT_DIR$/../forks/sponsorblock.py" vcs="Git" />
<mapping directory="$PROJECT_DIR$/../rythmbox-id3-lyrics-support" vcs="Git" />
</component>
</project>

View File

@ -43,8 +43,7 @@ if __name__ == "__main__":
bandcamp_test = [
"s: #a Ghost Bath",
"3",
"d: 0"
"0"
]

View File

@ -41,6 +41,7 @@ if DEBUG_PAGES:
ALL_PAGES = {DEBUGGING_PAGE}
AUDIO_PAGES = ALL_PAGES.union(AUDIO_PAGES)
class Pages:
def __init__(self, exclude_pages: Set[Type[Page]] = None, exclude_shady: bool = False) -> None:
# initialize all page instances

View File

@ -34,9 +34,6 @@ class Results:
for index, music_object in self._by_index.items():
if index == exclude_index:
continue
music_object.strip_details()
class SearchResults(Results):
def __init__(

View File

@ -20,4 +20,6 @@ from .collection import Collection
from .country import Country
from .contact import Contact
from .parents import OuterProxy as DatabaseObject
from .parents import OuterProxy
DatabaseObject = TypeVar('T', bound=OuterProxy)

View File

@ -136,7 +136,7 @@ class OuterProxy:
def __eq__(self, other: Any):
return self.__hash__() == other.__hash__()
def merge(self, __other: OuterProxy, override: bool = False):
def merge(self, __other: Optional[OuterProxy], override: bool = False):
"""
1. merges the data of __other in self
2. replaces the data of __other with the data of self
@ -145,6 +145,10 @@ class OuterProxy:
:param override:
:return:
"""
if __other is None:
_ = "debug"
return
self._inner.__merge__(__other._inner, override=override)
__other._inner = self._inner

View File

@ -1,6 +1,6 @@
from collections import defaultdict
from enum import Enum
from typing import List, Dict, Set, Tuple, Optional
from typing import List, Dict, Set, Tuple, Optional, Iterable
from urllib.parse import urlparse
from ..utils.enums.source import SourcePages, SourceTypes
@ -12,14 +12,6 @@ from .collection import Collection
class Source(OuterProxy):
"""
create somehow like that
```python
# url won't be a valid one due to it being just an example
Source(src="youtube", url="https://youtu.be/dfnsdajlhkjhsd")
```
"""
page_enum: SourcePages
referer_page: SourcePages
@ -37,9 +29,6 @@ class Source(OuterProxy):
if referer_page is None:
referer_page = page_enum
if audio_url is None:
audio_url = url
super().__init__(page_enum=page_enum, url=url, referer_page=referer_page, audio_url=audio_url, **kwargs)
@classmethod
@ -120,16 +109,15 @@ class Source(OuterProxy):
class SourceCollection(Collection):
def __init__(self, source_list: List[Source] = None):
source_list = source_list if source_list is not None else []
def __init__(self, data: Optional[Iterable[Source]] = None, **kwargs):
self._page_to_source_list: Dict[SourcePages, List[Source]] = defaultdict(list)
super().__init__(data=source_list)
super().__init__(data=data, **kwargs)
def map_element(self, source: Source):
super().map_element(source)
def _map_element(self, __object: Source, **kwargs):
super()._map_element(__object, **kwargs)
self._page_to_source_list[source.page_enum].append(source)
self._page_to_source_list[__object.page_enum].append(__object)
@property
def source_pages(self) -> Set[SourcePages]:

View File

@ -174,34 +174,8 @@ class Page:
# set this to true, if all song details can also be fetched by fetching album details
NO_ADDITIONAL_DATA_FROM_SONG = False
def __init__(self):
super().__init__()
"""
CODE I NEED WHEN I START WITH MULTITHREADING
def __init__(self, end_event: EndThread, search_queue: Queue, search_result_queue: Queue):
self.end_event = end_event
self.search_queue = search_queue
self.search_result_queue = search_result_queue
super().__init__()
@property
def _empty_working_queues(self):
return self.search_queue.empty()
def run(self) -> None:
while bool(self.end_event) and self._empty_working_queues:
if not self.search_queue.empty():
self.search(self.search_queue.get())
self.search_result_queue.put(FinishedSearch())
continue
"""
def get_source_type(self, source: Source) -> Optional[Type[DatabaseObject]]:
return None