fixed the mapping in source maps
This commit is contained in:
parent
695c9f62b9
commit
aa139a7f73
@ -2,5 +2,7 @@
|
|||||||
<project version="4">
|
<project version="4">
|
||||||
<component name="VcsDirectoryMappings">
|
<component name="VcsDirectoryMappings">
|
||||||
<mapping directory="" vcs="Git" />
|
<mapping directory="" vcs="Git" />
|
||||||
|
<mapping directory="$PROJECT_DIR$/../forks/sponsorblock.py" vcs="Git" />
|
||||||
|
<mapping directory="$PROJECT_DIR$/../rythmbox-id3-lyrics-support" vcs="Git" />
|
||||||
</component>
|
</component>
|
||||||
</project>
|
</project>
|
@ -43,8 +43,7 @@ if __name__ == "__main__":
|
|||||||
|
|
||||||
bandcamp_test = [
|
bandcamp_test = [
|
||||||
"s: #a Ghost Bath",
|
"s: #a Ghost Bath",
|
||||||
"3",
|
"0"
|
||||||
"d: 0"
|
|
||||||
]
|
]
|
||||||
|
|
||||||
|
|
||||||
|
@ -41,6 +41,7 @@ if DEBUG_PAGES:
|
|||||||
ALL_PAGES = {DEBUGGING_PAGE}
|
ALL_PAGES = {DEBUGGING_PAGE}
|
||||||
AUDIO_PAGES = ALL_PAGES.union(AUDIO_PAGES)
|
AUDIO_PAGES = ALL_PAGES.union(AUDIO_PAGES)
|
||||||
|
|
||||||
|
|
||||||
class Pages:
|
class Pages:
|
||||||
def __init__(self, exclude_pages: Set[Type[Page]] = None, exclude_shady: bool = False) -> None:
|
def __init__(self, exclude_pages: Set[Type[Page]] = None, exclude_shady: bool = False) -> None:
|
||||||
# initialize all page instances
|
# initialize all page instances
|
||||||
|
@ -34,9 +34,6 @@ class Results:
|
|||||||
for index, music_object in self._by_index.items():
|
for index, music_object in self._by_index.items():
|
||||||
if index == exclude_index:
|
if index == exclude_index:
|
||||||
continue
|
continue
|
||||||
|
|
||||||
music_object.strip_details()
|
|
||||||
|
|
||||||
|
|
||||||
class SearchResults(Results):
|
class SearchResults(Results):
|
||||||
def __init__(
|
def __init__(
|
||||||
|
@ -20,4 +20,6 @@ from .collection import Collection
|
|||||||
from .country import Country
|
from .country import Country
|
||||||
from .contact import Contact
|
from .contact import Contact
|
||||||
|
|
||||||
from .parents import OuterProxy as DatabaseObject
|
from .parents import OuterProxy
|
||||||
|
|
||||||
|
DatabaseObject = TypeVar('T', bound=OuterProxy)
|
||||||
|
@ -136,7 +136,7 @@ class OuterProxy:
|
|||||||
def __eq__(self, other: Any):
|
def __eq__(self, other: Any):
|
||||||
return self.__hash__() == other.__hash__()
|
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
|
1. merges the data of __other in self
|
||||||
2. replaces the data of __other with the data of self
|
2. replaces the data of __other with the data of self
|
||||||
@ -145,6 +145,10 @@ class OuterProxy:
|
|||||||
:param override:
|
:param override:
|
||||||
:return:
|
:return:
|
||||||
"""
|
"""
|
||||||
|
if __other is None:
|
||||||
|
_ = "debug"
|
||||||
|
return
|
||||||
|
|
||||||
self._inner.__merge__(__other._inner, override=override)
|
self._inner.__merge__(__other._inner, override=override)
|
||||||
__other._inner = self._inner
|
__other._inner = self._inner
|
||||||
|
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
from collections import defaultdict
|
from collections import defaultdict
|
||||||
from enum import Enum
|
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 urllib.parse import urlparse
|
||||||
|
|
||||||
from ..utils.enums.source import SourcePages, SourceTypes
|
from ..utils.enums.source import SourcePages, SourceTypes
|
||||||
@ -12,14 +12,6 @@ from .collection import Collection
|
|||||||
|
|
||||||
|
|
||||||
class Source(OuterProxy):
|
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
|
page_enum: SourcePages
|
||||||
referer_page: SourcePages
|
referer_page: SourcePages
|
||||||
|
|
||||||
@ -37,9 +29,6 @@ class Source(OuterProxy):
|
|||||||
if referer_page is None:
|
if referer_page is None:
|
||||||
referer_page = page_enum
|
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)
|
super().__init__(page_enum=page_enum, url=url, referer_page=referer_page, audio_url=audio_url, **kwargs)
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
@ -120,16 +109,15 @@ class Source(OuterProxy):
|
|||||||
|
|
||||||
|
|
||||||
class SourceCollection(Collection):
|
class SourceCollection(Collection):
|
||||||
def __init__(self, source_list: List[Source] = None):
|
def __init__(self, data: Optional[Iterable[Source]] = None, **kwargs):
|
||||||
source_list = source_list if source_list is not None else []
|
|
||||||
self._page_to_source_list: Dict[SourcePages, List[Source]] = defaultdict(list)
|
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):
|
def _map_element(self, __object: Source, **kwargs):
|
||||||
super().map_element(source)
|
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
|
@property
|
||||||
def source_pages(self) -> Set[SourcePages]:
|
def source_pages(self) -> Set[SourcePages]:
|
||||||
|
@ -174,34 +174,8 @@ class Page:
|
|||||||
|
|
||||||
# set this to true, if all song details can also be fetched by fetching album details
|
# set this to true, if all song details can also be fetched by fetching album details
|
||||||
NO_ADDITIONAL_DATA_FROM_SONG = False
|
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]]:
|
def get_source_type(self, source: Source) -> Optional[Type[DatabaseObject]]:
|
||||||
return None
|
return None
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user