missionpanel 1.1.7__tar.gz → 1.2.1__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {missionpanel-1.1.7 → missionpanel-1.2.1}/PKG-INFO +1 -1
- {missionpanel-1.1.7 → missionpanel-1.2.1}/missionpanel/example/ttrss.py +22 -10
- {missionpanel-1.1.7 → missionpanel-1.2.1}/missionpanel.egg-info/PKG-INFO +1 -1
- {missionpanel-1.1.7 → missionpanel-1.2.1}/setup.py +1 -1
- {missionpanel-1.1.7 → missionpanel-1.2.1}/LICENSE +0 -0
- {missionpanel-1.1.7 → missionpanel-1.2.1}/README.md +0 -0
- {missionpanel-1.1.7 → missionpanel-1.2.1}/missionpanel/__init__.py +0 -0
- {missionpanel-1.1.7 → missionpanel-1.2.1}/missionpanel/example/__init__.py +0 -0
- {missionpanel-1.1.7 → missionpanel-1.2.1}/missionpanel/example/rsshub.py +0 -0
- {missionpanel-1.1.7 → missionpanel-1.2.1}/missionpanel/handler/__init__.py +0 -0
- {missionpanel-1.1.7 → missionpanel-1.2.1}/missionpanel/handler/handler.py +0 -0
- {missionpanel-1.1.7 → missionpanel-1.2.1}/missionpanel/orm/__init__.py +0 -0
- {missionpanel-1.1.7 → missionpanel-1.2.1}/missionpanel/orm/core.py +0 -0
- {missionpanel-1.1.7 → missionpanel-1.2.1}/missionpanel/orm/handler.py +0 -0
- {missionpanel-1.1.7 → missionpanel-1.2.1}/missionpanel/submitter/__init__.py +0 -0
- {missionpanel-1.1.7 → missionpanel-1.2.1}/missionpanel/submitter/abc.py +0 -0
- {missionpanel-1.1.7 → missionpanel-1.2.1}/missionpanel/submitter/asynchronous.py +0 -0
- {missionpanel-1.1.7 → missionpanel-1.2.1}/missionpanel/submitter/submitter.py +0 -0
- {missionpanel-1.1.7 → missionpanel-1.2.1}/missionpanel.egg-info/SOURCES.txt +0 -0
- {missionpanel-1.1.7 → missionpanel-1.2.1}/missionpanel.egg-info/dependency_links.txt +0 -0
- {missionpanel-1.1.7 → missionpanel-1.2.1}/missionpanel.egg-info/requires.txt +0 -0
- {missionpanel-1.1.7 → missionpanel-1.2.1}/missionpanel.egg-info/top_level.txt +0 -0
- {missionpanel-1.1.7 → missionpanel-1.2.1}/setup.cfg +0 -0
@@ -80,27 +80,39 @@ class TTRSSSubmitter(AsyncSubmitter, metaclass=abc.ABCMeta):
|
|
80
80
|
async def derive_matcher(self, mission_content) -> List[str]:
|
81
81
|
return [mission_content['url']]
|
82
82
|
|
83
|
-
async def create_missions(self, url: str, username: str, password: str, cat_id: int, **httpx_client_options):
|
83
|
+
async def create_missions(self, url: str, username: str, password: str, cat_id: int, semaphore=asyncio.Semaphore(3), **httpx_client_options):
|
84
84
|
async with TTRSSClient(url, username, password, **httpx_client_options) as client:
|
85
85
|
feeds = await client.api({
|
86
86
|
"op": "getFeeds",
|
87
87
|
"cat_id": cat_id,
|
88
88
|
"limit": None
|
89
89
|
})
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
|
90
|
+
|
91
|
+
mission_content_queue = asyncio.Queue(len(feeds))
|
92
|
+
|
93
|
+
async def feed_task(feed):
|
94
|
+
async with semaphore:
|
95
|
+
content = await client.api({
|
96
|
+
"op": "getHeadlines",
|
97
|
+
"feed_id": feed['id'],
|
98
|
+
"limit": 1,
|
99
|
+
"view_mode": "all_articles",
|
100
|
+
"order_by": "feed_dates"
|
101
|
+
})
|
102
|
+
async for mission_content in self.parse_content(feed, content, **httpx_client_options):
|
103
|
+
await mission_content_queue.put(mission_content)
|
104
|
+
|
105
|
+
async def mission_task():
|
106
|
+
for _ in range(len(feeds)):
|
107
|
+
mission_content = await mission_content_queue.get()
|
99
108
|
matchers = await self.derive_matcher(mission_content)
|
100
109
|
await self.create_mission(mission_content, matchers)
|
101
110
|
tags = await self.derive_tags(mission_content)
|
102
111
|
if len(tags) > 0:
|
103
112
|
await self.add_tags(matchers, tags)
|
113
|
+
mission_content_queue.task_done()
|
114
|
+
|
115
|
+
await asyncio.gather(mission_task(), *[feed_task(feed) for feed in feeds])
|
104
116
|
|
105
117
|
|
106
118
|
class TTRSSHubSubmitter(TTRSSSubmitter):
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|