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.
Files changed (23) hide show
  1. {missionpanel-1.1.7 → missionpanel-1.2.1}/PKG-INFO +1 -1
  2. {missionpanel-1.1.7 → missionpanel-1.2.1}/missionpanel/example/ttrss.py +22 -10
  3. {missionpanel-1.1.7 → missionpanel-1.2.1}/missionpanel.egg-info/PKG-INFO +1 -1
  4. {missionpanel-1.1.7 → missionpanel-1.2.1}/setup.py +1 -1
  5. {missionpanel-1.1.7 → missionpanel-1.2.1}/LICENSE +0 -0
  6. {missionpanel-1.1.7 → missionpanel-1.2.1}/README.md +0 -0
  7. {missionpanel-1.1.7 → missionpanel-1.2.1}/missionpanel/__init__.py +0 -0
  8. {missionpanel-1.1.7 → missionpanel-1.2.1}/missionpanel/example/__init__.py +0 -0
  9. {missionpanel-1.1.7 → missionpanel-1.2.1}/missionpanel/example/rsshub.py +0 -0
  10. {missionpanel-1.1.7 → missionpanel-1.2.1}/missionpanel/handler/__init__.py +0 -0
  11. {missionpanel-1.1.7 → missionpanel-1.2.1}/missionpanel/handler/handler.py +0 -0
  12. {missionpanel-1.1.7 → missionpanel-1.2.1}/missionpanel/orm/__init__.py +0 -0
  13. {missionpanel-1.1.7 → missionpanel-1.2.1}/missionpanel/orm/core.py +0 -0
  14. {missionpanel-1.1.7 → missionpanel-1.2.1}/missionpanel/orm/handler.py +0 -0
  15. {missionpanel-1.1.7 → missionpanel-1.2.1}/missionpanel/submitter/__init__.py +0 -0
  16. {missionpanel-1.1.7 → missionpanel-1.2.1}/missionpanel/submitter/abc.py +0 -0
  17. {missionpanel-1.1.7 → missionpanel-1.2.1}/missionpanel/submitter/asynchronous.py +0 -0
  18. {missionpanel-1.1.7 → missionpanel-1.2.1}/missionpanel/submitter/submitter.py +0 -0
  19. {missionpanel-1.1.7 → missionpanel-1.2.1}/missionpanel.egg-info/SOURCES.txt +0 -0
  20. {missionpanel-1.1.7 → missionpanel-1.2.1}/missionpanel.egg-info/dependency_links.txt +0 -0
  21. {missionpanel-1.1.7 → missionpanel-1.2.1}/missionpanel.egg-info/requires.txt +0 -0
  22. {missionpanel-1.1.7 → missionpanel-1.2.1}/missionpanel.egg-info/top_level.txt +0 -0
  23. {missionpanel-1.1.7 → missionpanel-1.2.1}/setup.cfg +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: missionpanel
3
- Version: 1.1.7
3
+ Version: 1.2.1
4
4
  Summary: A mission panel
5
5
  Home-page: https://github.com/yindaheng98/missionpanel
6
6
  Author: yindaheng98
@@ -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
- for feed in feeds:
91
- content = await client.api({
92
- "op": "getHeadlines",
93
- "feed_id": feed['id'],
94
- "limit": 1,
95
- "view_mode": "all_articles",
96
- "order_by": "feed_dates"
97
- })
98
- async for mission_content in self.parse_content(feed, content, **httpx_client_options):
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):
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: missionpanel
3
- Version: 1.1.7
3
+ Version: 1.2.1
4
4
  Summary: A mission panel
5
5
  Home-page: https://github.com/yindaheng98/missionpanel
6
6
  Author: yindaheng98
@@ -12,7 +12,7 @@ package_dir = {
12
12
 
13
13
  setup(
14
14
  name='missionpanel',
15
- version='1.1.7',
15
+ version='1.2.1',
16
16
  author='yindaheng98',
17
17
  author_email='yindaheng98@gmail.com',
18
18
  url='https://github.com/yindaheng98/missionpanel',
File without changes
File without changes
File without changes