memanga 0.5.0__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 (269) hide show
  1. memanga-0.5.0/LICENSE +21 -0
  2. memanga-0.5.0/PKG-INFO +190 -0
  3. memanga-0.5.0/README.md +126 -0
  4. memanga-0.5.0/memanga/__init__.py +8 -0
  5. memanga-0.5.0/memanga/__main__.py +10 -0
  6. memanga-0.5.0/memanga/api.py +257 -0
  7. memanga-0.5.0/memanga/backup.py +459 -0
  8. memanga-0.5.0/memanga/chapter_pipeline.py +565 -0
  9. memanga-0.5.0/memanga/chapters.py +124 -0
  10. memanga-0.5.0/memanga/cli.py +5252 -0
  11. memanga-0.5.0/memanga/cli_docs.py +299 -0
  12. memanga-0.5.0/memanga/completion.py +251 -0
  13. memanga-0.5.0/memanga/config.py +992 -0
  14. memanga-0.5.0/memanga/config_docs.py +761 -0
  15. memanga-0.5.0/memanga/cron.py +492 -0
  16. memanga-0.5.0/memanga/doctor.py +928 -0
  17. memanga-0.5.0/memanga/downloader/__init__.py +69 -0
  18. memanga-0.5.0/memanga/downloader/browsers.py +47 -0
  19. memanga-0.5.0/memanga/downloader/chapter.py +417 -0
  20. memanga-0.5.0/memanga/downloader/errors.py +16 -0
  21. memanga-0.5.0/memanga/downloader/folders.py +197 -0
  22. memanga-0.5.0/memanga/downloader/formats/__init__.py +8 -0
  23. memanga-0.5.0/memanga/downloader/formats/cbz.py +281 -0
  24. memanga-0.5.0/memanga/downloader/formats/epub.py +164 -0
  25. memanga-0.5.0/memanga/downloader/formats/folder.py +56 -0
  26. memanga-0.5.0/memanga/downloader/formats/images.py +36 -0
  27. memanga-0.5.0/memanga/downloader/formats/pdf.py +30 -0
  28. memanga-0.5.0/memanga/downloader/naming.py +222 -0
  29. memanga-0.5.0/memanga/downloader/post_processing.py +276 -0
  30. memanga-0.5.0/memanga/downloader/sources.py +67 -0
  31. memanga-0.5.0/memanga/downloader/updates.py +386 -0
  32. memanga-0.5.0/memanga/email_settings.py +111 -0
  33. memanga-0.5.0/memanga/emailer.py +974 -0
  34. memanga-0.5.0/memanga/first_run.py +346 -0
  35. memanga-0.5.0/memanga/gui/__init__.py +736 -0
  36. memanga-0.5.0/memanga/gui/__main__.py +528 -0
  37. memanga-0.5.0/memanga/gui/_subprocess.py +79 -0
  38. memanga-0.5.0/memanga/gui/app.py +884 -0
  39. memanga-0.5.0/memanga/gui/assets/icon/icon-1024.png +0 -0
  40. memanga-0.5.0/memanga/gui/assets/icon/icon-128.png +0 -0
  41. memanga-0.5.0/memanga/gui/assets/icon/icon-16.png +0 -0
  42. memanga-0.5.0/memanga/gui/assets/icon/icon-256.png +0 -0
  43. memanga-0.5.0/memanga/gui/assets/icon/icon-32.png +0 -0
  44. memanga-0.5.0/memanga/gui/assets/icon/icon-48.png +0 -0
  45. memanga-0.5.0/memanga/gui/assets/icon/icon-512.png +0 -0
  46. memanga-0.5.0/memanga/gui/assets/icon/icon-64.png +0 -0
  47. memanga-0.5.0/memanga/gui/assets/icon/icon.png +0 -0
  48. memanga-0.5.0/memanga/gui/assets/icons/__init__.py +199 -0
  49. memanga-0.5.0/memanga/gui/cache.py +372 -0
  50. memanga-0.5.0/memanga/gui/components/__init__.py +1 -0
  51. memanga-0.5.0/memanga/gui/components/brand_mark.py +63 -0
  52. memanga-0.5.0/memanga/gui/components/context_menu.py +35 -0
  53. memanga-0.5.0/memanga/gui/components/continue_card.py +145 -0
  54. memanga-0.5.0/memanga/gui/components/dialogs.py +87 -0
  55. memanga-0.5.0/memanga/gui/components/download_from_modal.py +108 -0
  56. memanga-0.5.0/memanga/gui/components/download_location_dialog.py +185 -0
  57. memanga-0.5.0/memanga/gui/components/error_details.py +180 -0
  58. memanga-0.5.0/memanga/gui/components/firefox_install_dialog.py +247 -0
  59. memanga-0.5.0/memanga/gui/components/flow.py +170 -0
  60. memanga-0.5.0/memanga/gui/components/keyboard.py +34 -0
  61. memanga-0.5.0/memanga/gui/components/layout_dropdown.py +23 -0
  62. memanga-0.5.0/memanga/gui/components/manga_card.py +546 -0
  63. memanga-0.5.0/memanga/gui/components/manga_row.py +129 -0
  64. memanga-0.5.0/memanga/gui/components/modal.py +213 -0
  65. memanga-0.5.0/memanga/gui/components/mode_dropdown.py +190 -0
  66. memanga-0.5.0/memanga/gui/components/notification.py +84 -0
  67. memanga-0.5.0/memanga/gui/components/offline_banner.py +120 -0
  68. memanga-0.5.0/memanga/gui/components/progress_item.py +80 -0
  69. memanga-0.5.0/memanga/gui/components/remove_manga_modal.py +121 -0
  70. memanga-0.5.0/memanga/gui/components/search_result.py +211 -0
  71. memanga-0.5.0/memanga/gui/components/sidebar.py +514 -0
  72. memanga-0.5.0/memanga/gui/components/slider.py +52 -0
  73. memanga-0.5.0/memanga/gui/components/status_dropdown.py +163 -0
  74. memanga-0.5.0/memanga/gui/components/theme_picker.py +254 -0
  75. memanga-0.5.0/memanga/gui/components/toast.py +149 -0
  76. memanga-0.5.0/memanga/gui/components/wrapping_label.py +54 -0
  77. memanga-0.5.0/memanga/gui/cover_fallback.py +142 -0
  78. memanga-0.5.0/memanga/gui/download_events.py +151 -0
  79. memanga-0.5.0/memanga/gui/events.py +61 -0
  80. memanga-0.5.0/memanga/gui/focus.py +218 -0
  81. memanga-0.5.0/memanga/gui/network_status.py +242 -0
  82. memanga-0.5.0/memanga/gui/pages/__init__.py +1 -0
  83. memanga-0.5.0/memanga/gui/pages/add_manga.py +305 -0
  84. memanga-0.5.0/memanga/gui/pages/base.py +81 -0
  85. memanga-0.5.0/memanga/gui/pages/detail.py +1588 -0
  86. memanga-0.5.0/memanga/gui/pages/downloads.py +660 -0
  87. memanga-0.5.0/memanga/gui/pages/library.py +828 -0
  88. memanga-0.5.0/memanga/gui/pages/notifications.py +404 -0
  89. memanga-0.5.0/memanga/gui/pages/reader.py +1214 -0
  90. memanga-0.5.0/memanga/gui/pages/reader_input.py +267 -0
  91. memanga-0.5.0/memanga/gui/pages/reader_navigation.py +324 -0
  92. memanga-0.5.0/memanga/gui/pages/reader_pages.py +932 -0
  93. memanga-0.5.0/memanga/gui/pages/reader_view_modes.py +195 -0
  94. memanga-0.5.0/memanga/gui/pages/search.py +431 -0
  95. memanga-0.5.0/memanga/gui/pages/settings.py +979 -0
  96. memanga-0.5.0/memanga/gui/pages/settings_tabs/__init__.py +32 -0
  97. memanga-0.5.0/memanga/gui/pages/settings_tabs/about.py +131 -0
  98. memanga-0.5.0/memanga/gui/pages/settings_tabs/advanced.py +470 -0
  99. memanga-0.5.0/memanga/gui/pages/settings_tabs/common.py +41 -0
  100. memanga-0.5.0/memanga/gui/pages/settings_tabs/general.py +305 -0
  101. memanga-0.5.0/memanga/gui/pages/settings_tabs/kindle_email.py +119 -0
  102. memanga-0.5.0/memanga/gui/pages/sources.py +733 -0
  103. memanga-0.5.0/memanga/gui/theme/__init__.py +364 -0
  104. memanga-0.5.0/memanga/gui/theme/qss_builder.py +647 -0
  105. memanga-0.5.0/memanga/gui/theme/tokens.py +220 -0
  106. memanga-0.5.0/memanga/gui/trash.py +43 -0
  107. memanga-0.5.0/memanga/gui/workers.py +985 -0
  108. memanga-0.5.0/memanga/image_limits.py +126 -0
  109. memanga-0.5.0/memanga/output.py +492 -0
  110. memanga-0.5.0/memanga/perf.py +85 -0
  111. memanga-0.5.0/memanga/persist.py +308 -0
  112. memanga-0.5.0/memanga/process_lock.py +166 -0
  113. memanga-0.5.0/memanga/schema.py +62 -0
  114. memanga-0.5.0/memanga/scrapers/__init__.py +748 -0
  115. memanga-0.5.0/memanga/scrapers/animesama.py +453 -0
  116. memanga-0.5.0/memanga/scrapers/asurascans.py +260 -0
  117. memanga-0.5.0/memanga/scrapers/atsumaru.py +325 -0
  118. memanga-0.5.0/memanga/scrapers/bakirahen.py +151 -0
  119. memanga-0.5.0/memanga/scrapers/base.py +547 -0
  120. memanga-0.5.0/memanga/scrapers/batoto.py +146 -0
  121. memanga-0.5.0/memanga/scrapers/berserkmangorg.py +121 -0
  122. memanga-0.5.0/memanga/scrapers/bluelockreadcom.py +128 -0
  123. memanga-0.5.0/memanga/scrapers/bluelockreadww2.py +151 -0
  124. memanga-0.5.0/memanga/scrapers/catalog.py +529 -0
  125. memanga-0.5.0/memanga/scrapers/coffeemanga.py +126 -0
  126. memanga-0.5.0/memanga/scrapers/comick.py +220 -0
  127. memanga-0.5.0/memanga/scrapers/comix.py +609 -0
  128. memanga-0.5.0/memanga/scrapers/coverage_data.py +212 -0
  129. memanga-0.5.0/memanga/scrapers/demonslayermanga.py +138 -0
  130. memanga-0.5.0/memanga/scrapers/dynasty.py +413 -0
  131. memanga-0.5.0/memanga/scrapers/ehentai.py +117 -0
  132. memanga-0.5.0/memanga/scrapers/fanfox.py +175 -0
  133. memanga-0.5.0/memanga/scrapers/flamecomics.py +217 -0
  134. memanga-0.5.0/memanga/scrapers/heavenmanga.py +432 -0
  135. memanga-0.5.0/memanga/scrapers/hentai20.py +210 -0
  136. memanga-0.5.0/memanga/scrapers/hentaifox.py +122 -0
  137. memanga-0.5.0/memanga/scrapers/hentairead.py +150 -0
  138. memanga-0.5.0/memanga/scrapers/hivetoons.py +147 -0
  139. memanga-0.5.0/memanga/scrapers/imhentai.py +109 -0
  140. memanga-0.5.0/memanga/scrapers/jojolionmanga.py +149 -0
  141. memanga-0.5.0/memanga/scrapers/kadocomi.py +544 -0
  142. memanga-0.5.0/memanga/scrapers/kagane.py +330 -0
  143. memanga-0.5.0/memanga/scrapers/kenganashuramanga.py +148 -0
  144. memanga-0.5.0/memanga/scrapers/kunmanga.py +125 -0
  145. memanga-0.5.0/memanga/scrapers/lectormanga.py +250 -0
  146. memanga-0.5.0/memanga/scrapers/leercapitulo.py +370 -0
  147. memanga-0.5.0/memanga/scrapers/lelscanvf.py +340 -0
  148. memanga-0.5.0/memanga/scrapers/luminousscans.py +192 -0
  149. memanga-0.5.0/memanga/scrapers/mangaball.py +271 -0
  150. memanga-0.5.0/memanga/scrapers/mangabolt.py +257 -0
  151. memanga-0.5.0/memanga/scrapers/mangabuddy.py +285 -0
  152. memanga-0.5.0/memanga/scrapers/mangademon.py +383 -0
  153. memanga-0.5.0/memanga/scrapers/mangadenizi.py +529 -0
  154. memanga-0.5.0/memanga/scrapers/mangadex.py +298 -0
  155. memanga-0.5.0/memanga/scrapers/mangadna.py +207 -0
  156. memanga-0.5.0/memanga/scrapers/mangadot.py +236 -0
  157. memanga-0.5.0/memanga/scrapers/mangafire.py +709 -0
  158. memanga-0.5.0/memanga/scrapers/mangafreak.py +143 -0
  159. memanga-0.5.0/memanga/scrapers/mangago.py +189 -0
  160. memanga-0.5.0/memanga/scrapers/mangahere.py +289 -0
  161. memanga-0.5.0/memanga/scrapers/mangahereonl.py +643 -0
  162. memanga-0.5.0/memanga/scrapers/mangahome.py +398 -0
  163. memanga-0.5.0/memanga/scrapers/mangahub.py +404 -0
  164. memanga-0.5.0/memanga/scrapers/mangahubus.py +557 -0
  165. memanga-0.5.0/memanga/scrapers/mangakatana.py +135 -0
  166. memanga-0.5.0/memanga/scrapers/manganato_gg.py +128 -0
  167. memanga-0.5.0/memanga/scrapers/mangapanda.py +504 -0
  168. memanga-0.5.0/memanga/scrapers/mangapark.py +412 -0
  169. memanga-0.5.0/memanga/scrapers/mangapark_cc.py +402 -0
  170. memanga-0.5.0/memanga/scrapers/mangapill.py +143 -0
  171. memanga-0.5.0/memanga/scrapers/mangarawink.py +384 -0
  172. memanga-0.5.0/memanga/scrapers/mangareader.py +125 -0
  173. memanga-0.5.0/memanga/scrapers/mangarw.py +399 -0
  174. memanga-0.5.0/memanga/scrapers/mangasorigines.py +382 -0
  175. memanga-0.5.0/memanga/scrapers/mangataro.py +326 -0
  176. memanga-0.5.0/memanga/scrapers/mangathemesia_sites.py +423 -0
  177. memanga-0.5.0/memanga/scrapers/mangatown.py +158 -0
  178. memanga-0.5.0/memanga/scrapers/mangavault.py +381 -0
  179. memanga-0.5.0/memanga/scrapers/mangoasis.py +180 -0
  180. memanga-0.5.0/memanga/scrapers/manhuafast.py +140 -0
  181. memanga-0.5.0/memanga/scrapers/manhuaplus.py +147 -0
  182. memanga-0.5.0/memanga/scrapers/manhuatop.py +406 -0
  183. memanga-0.5.0/memanga/scrapers/manhuaus.py +95 -0
  184. memanga-0.5.0/memanga/scrapers/manhwa18.py +136 -0
  185. memanga-0.5.0/memanga/scrapers/manhwaweb.py +401 -0
  186. memanga-0.5.0/memanga/scrapers/manytoon.py +116 -0
  187. memanga-0.5.0/memanga/scrapers/mashlemangaonline.py +108 -0
  188. memanga-0.5.0/memanga/scrapers/mgeko.py +134 -0
  189. memanga-0.5.0/memanga/scrapers/monstermangaonline.py +190 -0
  190. memanga-0.5.0/memanga/scrapers/nhentai.py +79 -0
  191. memanga-0.5.0/memanga/scrapers/olympus.py +407 -0
  192. memanga-0.5.0/memanga/scrapers/omegascans.py +129 -0
  193. memanga-0.5.0/memanga/scrapers/onemanga.py +588 -0
  194. memanga-0.5.0/memanga/scrapers/onepieceread.py +127 -0
  195. memanga-0.5.0/memanga/scrapers/onepiecetube.py +340 -0
  196. memanga-0.5.0/memanga/scrapers/onepunchmanmangaa.py +205 -0
  197. memanga-0.5.0/memanga/scrapers/onepunchmanread.py +129 -0
  198. memanga-0.5.0/memanga/scrapers/patimanga.py +399 -0
  199. memanga-0.5.0/memanga/scrapers/playwright_base.py +469 -0
  200. memanga-0.5.0/memanga/scrapers/rawkuma.py +408 -0
  201. memanga-0.5.0/memanga/scrapers/rawuwu.py +437 -0
  202. memanga-0.5.0/memanga/scrapers/readberserk.py +15 -0
  203. memanga-0.5.0/memanga/scrapers/readberserkmanga.py +136 -0
  204. memanga-0.5.0/memanga/scrapers/readblackclover.py +180 -0
  205. memanga-0.5.0/memanga/scrapers/readchainsawman.py +15 -0
  206. memanga-0.5.0/memanga/scrapers/readcomiconline.py +213 -0
  207. memanga-0.5.0/memanga/scrapers/readfairytail.py +15 -0
  208. memanga-0.5.0/memanga/scrapers/readhaikyuu.py +16 -0
  209. memanga-0.5.0/memanga/scrapers/readjjkcom.py +134 -0
  210. memanga-0.5.0/memanga/scrapers/readjjkmanga.py +129 -0
  211. memanga-0.5.0/memanga/scrapers/readjujutsukaisen.py +15 -0
  212. memanga-0.5.0/memanga/scrapers/readkingdomfree.py +143 -0
  213. memanga-0.5.0/memanga/scrapers/readmanga_base.py +190 -0
  214. memanga-0.5.0/memanga/scrapers/readmha.py +15 -0
  215. memanga-0.5.0/memanga/scrapers/readnaruto.py +15 -0
  216. memanga-0.5.0/memanga/scrapers/readonepiece.py +15 -0
  217. memanga-0.5.0/memanga/scrapers/readonepunchonline.py +109 -0
  218. memanga-0.5.0/memanga/scrapers/readopm.py +185 -0
  219. memanga-0.5.0/memanga/scrapers/readoshinoko.py +150 -0
  220. memanga-0.5.0/memanga/scrapers/readsnk.py +15 -0
  221. memanga-0.5.0/memanga/scrapers/readsnkmanga.py +140 -0
  222. memanga-0.5.0/memanga/scrapers/registry.py +707 -0
  223. memanga-0.5.0/memanga/scrapers/sakamotomanga.py +116 -0
  224. memanga-0.5.0/memanga/scrapers/senmanga.py +344 -0
  225. memanga-0.5.0/memanga/scrapers/sereinscan.py +260 -0
  226. memanga-0.5.0/memanga/scrapers/single_title_base.py +302 -0
  227. memanga-0.5.0/memanga/scrapers/single_title_sites.py +459 -0
  228. memanga-0.5.0/memanga/scrapers/tcbscans.py +121 -0
  229. memanga-0.5.0/memanga/scrapers/templates/__init__.py +20 -0
  230. memanga-0.5.0/memanga/scrapers/templates/laiond_cdn.py +152 -0
  231. memanga-0.5.0/memanga/scrapers/templates/mangosm.py +160 -0
  232. memanga-0.5.0/memanga/scrapers/templates/nuxt_ssr.py +197 -0
  233. memanga-0.5.0/memanga/scrapers/templates/og_image_meta.py +155 -0
  234. memanga-0.5.0/memanga/scrapers/templates/wordpress_madara.py +210 -0
  235. memanga-0.5.0/memanga/scrapers/thunderscans.py +242 -0
  236. memanga-0.5.0/memanga/scrapers/toonily.py +213 -0
  237. memanga-0.5.0/memanga/scrapers/truemanga.py +122 -0
  238. memanga-0.5.0/memanga/scrapers/uchuujin.py +310 -0
  239. memanga-0.5.0/memanga/scrapers/uzaymanga.py +411 -0
  240. memanga-0.5.0/memanga/scrapers/vymanga.py +149 -0
  241. memanga-0.5.0/memanga/scrapers/webtoon.py +549 -0
  242. memanga-0.5.0/memanga/scrapers/weebcentral.py +626 -0
  243. memanga-0.5.0/memanga/scrapers/wurmz.py +224 -0
  244. memanga-0.5.0/memanga/scrapers/zazamanga.py +167 -0
  245. memanga-0.5.0/memanga/scrapers/zonatmo.py +462 -0
  246. memanga-0.5.0/memanga/search.py +319 -0
  247. memanga-0.5.0/memanga/source_docs.py +771 -0
  248. memanga-0.5.0/memanga/state.py +695 -0
  249. memanga-0.5.0/memanga/state_stores/__init__.py +43 -0
  250. memanga-0.5.0/memanga/state_stores/_base.py +59 -0
  251. memanga-0.5.0/memanga/state_stores/activity.py +133 -0
  252. memanga-0.5.0/memanga/state_stores/backups.py +83 -0
  253. memanga-0.5.0/memanga/state_stores/catalogue.py +119 -0
  254. memanga-0.5.0/memanga/state_stores/failures.py +211 -0
  255. memanga-0.5.0/memanga/state_stores/library.py +255 -0
  256. memanga-0.5.0/memanga/state_stores/notifications.py +207 -0
  257. memanga-0.5.0/memanga/state_stores/reading.py +140 -0
  258. memanga-0.5.0/memanga/state_stores/searches.py +37 -0
  259. memanga-0.5.0/memanga/state_stores/source_health.py +66 -0
  260. memanga-0.5.0/memanga/suspicion.py +188 -0
  261. memanga-0.5.0/memanga/watch.py +149 -0
  262. memanga-0.5.0/memanga.egg-info/PKG-INFO +190 -0
  263. memanga-0.5.0/memanga.egg-info/SOURCES.txt +267 -0
  264. memanga-0.5.0/memanga.egg-info/dependency_links.txt +1 -0
  265. memanga-0.5.0/memanga.egg-info/entry_points.txt +3 -0
  266. memanga-0.5.0/memanga.egg-info/requires.txt +36 -0
  267. memanga-0.5.0/memanga.egg-info/top_level.txt +1 -0
  268. memanga-0.5.0/pyproject.toml +271 -0
  269. memanga-0.5.0/setup.cfg +4 -0
memanga-0.5.0/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 meellm
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
memanga-0.5.0/PKG-INFO ADDED
@@ -0,0 +1,190 @@
1
+ Metadata-Version: 2.4
2
+ Name: memanga
3
+ Version: 0.5.0
4
+ Summary: Automatic manga downloader with Kindle support
5
+ Author: meellm
6
+ License-Expression: MIT
7
+ Project-URL: Homepage, https://github.com/meellm/MeManga
8
+ Project-URL: Documentation, https://meellm.github.io/MeManga/
9
+ Project-URL: Repository, https://github.com/meellm/MeManga
10
+ Project-URL: Issues, https://github.com/meellm/MeManga/issues
11
+ Project-URL: Changelog, https://github.com/meellm/MeManga/blob/main/CHANGELOG.md
12
+ Project-URL: Releases, https://github.com/meellm/MeManga/releases
13
+ Keywords: manga,manga-downloader,comics,kindle,e-reader,epub,cbz,pdf
14
+ Classifier: Development Status :: 4 - Beta
15
+ Classifier: Environment :: Console
16
+ Classifier: Environment :: X11 Applications :: Qt
17
+ Classifier: Intended Audience :: End Users/Desktop
18
+ Classifier: Operating System :: MacOS
19
+ Classifier: Operating System :: Microsoft :: Windows
20
+ Classifier: Operating System :: POSIX :: Linux
21
+ Classifier: Programming Language :: Python :: 3
22
+ Classifier: Programming Language :: Python :: 3 :: Only
23
+ Classifier: Programming Language :: Python :: 3.11
24
+ Classifier: Programming Language :: Python :: 3.12
25
+ Classifier: Programming Language :: Python :: 3.13
26
+ Classifier: Topic :: Internet :: WWW/HTTP
27
+ Classifier: Topic :: Multimedia :: Graphics
28
+ Classifier: Topic :: Utilities
29
+ Requires-Python: >=3.11.5
30
+ Description-Content-Type: text/markdown
31
+ License-File: LICENSE
32
+ Requires-Dist: rich>=13.0.0
33
+ Requires-Dist: pyyaml>=6.0
34
+ Requires-Dist: requests>=2.28.0
35
+ Requires-Dist: urllib3>=2.8.0
36
+ Requires-Dist: img2pdf>=0.5.0
37
+ Requires-Dist: Pillow>=10.0.0
38
+ Requires-Dist: beautifulsoup4>=4.12.0
39
+ Requires-Dist: playwright>=1.40.0
40
+ Requires-Dist: cloudscraper>=1.2.71
41
+ Requires-Dist: pikepdf>=8.0.0
42
+ Requires-Dist: keyring>=24.0.0
43
+ Requires-Dist: playwright-stealth<3,>=2.0
44
+ Provides-Extra: gui
45
+ Requires-Dist: PySide6>=6.5.0; extra == "gui"
46
+ Provides-Extra: dev
47
+ Requires-Dist: memanga[gui]; extra == "dev"
48
+ Requires-Dist: pytest>=8.0; extra == "dev"
49
+ Requires-Dist: pytest-qt>=4.4; extra == "dev"
50
+ Requires-Dist: pytest-mock>=3.12; extra == "dev"
51
+ Requires-Dist: pytest-env>=1.1; extra == "dev"
52
+ Requires-Dist: packaging>=21.0; extra == "dev"
53
+ Requires-Dist: pytest-xdist>=3.5; extra == "dev"
54
+ Requires-Dist: pytest-cov>=4.1; extra == "dev"
55
+ Requires-Dist: ruff>=0.17.4; extra == "dev"
56
+ Requires-Dist: mypy>=2.4; extra == "dev"
57
+ Requires-Dist: pre-commit>=4.0; extra == "dev"
58
+ Provides-Extra: build
59
+ Requires-Dist: memanga[gui]; extra == "build"
60
+ Requires-Dist: pyinstaller<7.0,>=6.0; extra == "build"
61
+ Requires-Dist: certifi>=2024.7.0; extra == "build"
62
+ Requires-Dist: pywin32-ctypes>=0.2.0; sys_platform == "win32" and extra == "build"
63
+ Dynamic: license-file
64
+
65
+ <h1 align="center">MeManga</h1>
66
+
67
+ <p align="center">
68
+ <strong>Keep up with the manga you follow.</strong><br>
69
+ Track series, download new chapters and read them in the desktop app, or
70
+ run the same checks from the command line on a server or in Docker.
71
+ </p>
72
+
73
+ <p align="center">
74
+ <a href="https://github.com/meellm/MeManga/releases/latest"><img alt="Latest release" src="https://img.shields.io/github/v/release/meellm/MeManga"></a>
75
+ <a href="https://github.com/meellm/MeManga/releases"><img alt="Total downloads" src="https://img.shields.io/github/downloads/meellm/MeManga/total?label=downloads"></a>
76
+ <a href="https://hub.docker.com/r/meellm/memanga"><img alt="Docker pulls" src="https://img.shields.io/docker/pulls/meellm/memanga?label=docker%20pulls"></a>
77
+ <a href="LICENSE"><img alt="MIT license" src="https://img.shields.io/badge/license-MIT-blue"></a>
78
+ </p>
79
+
80
+ <p align="center">
81
+ <a href="https://meellm.github.io/MeManga/"><strong>Documentation</strong></a> ·
82
+ <a href="https://meellm.github.io/MeManga/guide/install"><strong>Download</strong></a> ·
83
+ <a href="https://github.com/meellm/MeManga/discussions"><strong>Discussions</strong></a> ·
84
+ <a href="https://github.com/meellm/MeManga/issues"><strong>Issues</strong></a>
85
+ </p>
86
+
87
+ <p align="center">
88
+ <img src="docs/public/media/app-library.png" alt="MeManga library with seven tracked series, their reading status and new-chapter counts" width="860">
89
+ </p>
90
+
91
+ ## What it does
92
+
93
+ MeManga keeps a library of the series you follow and checks their sources
94
+ for new chapters. It knows
95
+ <!-- source-count:start -->226 scrapers / 291 domains<!-- source-count:end -->.
96
+
97
+ - **Search across sources.** Find a series on many sites at once, and give
98
+ it backup sources for when its main source falls behind or a download
99
+ from it fails.
100
+ - **Download your way.** Save chapters as PDF, EPUB, CBZ, ZIP or image
101
+ folders.
102
+ - **Read in the app.** The desktop app has its own reader.
103
+ - **Send to Kindle.** Deliver chapters to a Kindle by email.
104
+ - **Check on a schedule.** Look for new chapters on a computer, a server or
105
+ in Docker.
106
+
107
+ <p align="center">
108
+ <img src="docs/public/media/app-detail.png" alt="Series page for Blue Lock with its source, status, download options and chapter list" width="49%">
109
+ <img src="docs/public/media/app-reader.png" alt="MeManga reader showing page 1 of Blue Lock chapter 368" width="49%">
110
+ <br>
111
+ <sub>Series titles and artwork
112
+ belong to their owners and appear here only to demonstrate the app. See
113
+ <a href="https://meellm.github.io/MeManga/reference/sources#using-sources-responsibly">Using sources responsibly</a>.</sub>
114
+ </p>
115
+
116
+ ## Get started
117
+
118
+ - **Desktop app** for Windows, macOS or Linux:
119
+ [Download and install](https://meellm.github.io/MeManga/guide/install#desktop-app),
120
+ then [First steps](https://meellm.github.io/MeManga/guide/first-steps) and
121
+ the [desktop manual](https://meellm.github.io/MeManga/desktop/library).
122
+ - **Command line**, for example on a server:
123
+ [Command line from source](https://meellm.github.io/MeManga/guide/install#command-line-from-source)
124
+ and [Use the command line](https://meellm.github.io/MeManga/guide/cli).
125
+ - **Docker:** [Run MeManga in Docker](https://meellm.github.io/MeManga/guide/docker).
126
+ - **Working on MeManga:**
127
+ [Set up for development](https://meellm.github.io/MeManga/developer/contributing)
128
+ and [CONTRIBUTING.md](CONTRIBUTING.md).
129
+
130
+ <p align="center">
131
+ <img src="docs/public/media/cli-demo.gif" alt="Terminal recording: memanga search adds Blue Lock from weebcentral.com, memanga check downloads chapters 368 and 369 as PDF files, and memanga list shows the tracked series" width="760">
132
+ </p>
133
+
134
+ Installing with `pip`, `pipx` or `uv` from a package index is
135
+ [not available yet](https://meellm.github.io/MeManga/guide/install#package-installs).
136
+ If something does not work, see
137
+ [Troubleshooting](https://meellm.github.io/MeManga/guide/troubleshooting).
138
+
139
+ The documentation follows the development version on the `main` branch,
140
+ while the release badge shows the latest download. Pages mark what is not
141
+ in the [latest release](https://github.com/meellm/MeManga/releases/latest)
142
+ yet, so check those notes before you expect a feature in a download.
143
+
144
+ ## Sources
145
+
146
+ [Supported websites](https://meellm.github.io/MeManga/reference/supported-websites)
147
+ lists every site MeManga has a scraper for, grouped by what it publishes,
148
+ and which ones a search includes. The
149
+ [technical catalog](https://meellm.github.io/MeManga/reference/sources)
150
+ shows how they are checked. Being listed does not mean a site works today:
151
+ sites change or go offline without notice. Some sources serve adult
152
+ content; the list keeps them in their own section at the end.
153
+
154
+ MeManga is a tool you run yourself. It does not host any manga and is not
155
+ affiliated with the sites it reads; listing a site is not an endorsement.
156
+ Use it in line with the terms of those sites, the law where you live and
157
+ the rights of the people who make the manga. See
158
+ [Using sources responsibly](https://meellm.github.io/MeManga/reference/sources#using-sources-responsibly).
159
+
160
+ ## Project status and contributing
161
+
162
+ MeManga is developed in public. There is no fixed release schedule and no
163
+ guaranteed response time for issues, questions or pull requests.
164
+ Contributions are welcome: bug reports and fixes, new and repaired sources,
165
+ and [translations](https://meellm.github.io/MeManga/developer/contributing#translations).
166
+ Start with [CONTRIBUTING.md](CONTRIBUTING.md).
167
+
168
+ - Questions and ideas: [Discussions](https://github.com/meellm/MeManga/discussions)
169
+ - Bugs and broken sources: [Issues](https://github.com/meellm/MeManga/issues)
170
+ - Security problems: [SECURITY.md](SECURITY.md)
171
+ - Code of conduct: [CODE_OF_CONDUCT.md](CODE_OF_CONDUCT.md)
172
+
173
+ You can also maintain a copy of your own. The source code is under the
174
+ [MIT license](LICENSE), which lets you use, copy, change and share it as
175
+ long as the copyright and permission notice are included.
176
+ [Write a scraper](https://meellm.github.io/MeManga/developer/scrapers)
177
+ explains how to add or repair a source, and
178
+ [Set up for development](https://meellm.github.io/MeManga/developer/contributing)
179
+ how to run a copy from source and test it.
180
+
181
+ ## License
182
+
183
+ MeManga's source code is under the [MIT license](LICENSE).
184
+
185
+ The desktop downloads and the Docker image also contain third-party
186
+ software under its own licenses. The desktop downloads include Qt and
187
+ PySide6, which are used under the GNU LGPL.
188
+ [Third-party licenses](https://meellm.github.io/MeManga/guide/install#third-party-licenses)
189
+ says where the notices and the LGPL source and replacement information are
190
+ found.
@@ -0,0 +1,126 @@
1
+ <h1 align="center">MeManga</h1>
2
+
3
+ <p align="center">
4
+ <strong>Keep up with the manga you follow.</strong><br>
5
+ Track series, download new chapters and read them in the desktop app, or
6
+ run the same checks from the command line on a server or in Docker.
7
+ </p>
8
+
9
+ <p align="center">
10
+ <a href="https://github.com/meellm/MeManga/releases/latest"><img alt="Latest release" src="https://img.shields.io/github/v/release/meellm/MeManga"></a>
11
+ <a href="https://github.com/meellm/MeManga/releases"><img alt="Total downloads" src="https://img.shields.io/github/downloads/meellm/MeManga/total?label=downloads"></a>
12
+ <a href="https://hub.docker.com/r/meellm/memanga"><img alt="Docker pulls" src="https://img.shields.io/docker/pulls/meellm/memanga?label=docker%20pulls"></a>
13
+ <a href="LICENSE"><img alt="MIT license" src="https://img.shields.io/badge/license-MIT-blue"></a>
14
+ </p>
15
+
16
+ <p align="center">
17
+ <a href="https://meellm.github.io/MeManga/"><strong>Documentation</strong></a> ·
18
+ <a href="https://meellm.github.io/MeManga/guide/install"><strong>Download</strong></a> ·
19
+ <a href="https://github.com/meellm/MeManga/discussions"><strong>Discussions</strong></a> ·
20
+ <a href="https://github.com/meellm/MeManga/issues"><strong>Issues</strong></a>
21
+ </p>
22
+
23
+ <p align="center">
24
+ <img src="docs/public/media/app-library.png" alt="MeManga library with seven tracked series, their reading status and new-chapter counts" width="860">
25
+ </p>
26
+
27
+ ## What it does
28
+
29
+ MeManga keeps a library of the series you follow and checks their sources
30
+ for new chapters. It knows
31
+ <!-- source-count:start -->226 scrapers / 291 domains<!-- source-count:end -->.
32
+
33
+ - **Search across sources.** Find a series on many sites at once, and give
34
+ it backup sources for when its main source falls behind or a download
35
+ from it fails.
36
+ - **Download your way.** Save chapters as PDF, EPUB, CBZ, ZIP or image
37
+ folders.
38
+ - **Read in the app.** The desktop app has its own reader.
39
+ - **Send to Kindle.** Deliver chapters to a Kindle by email.
40
+ - **Check on a schedule.** Look for new chapters on a computer, a server or
41
+ in Docker.
42
+
43
+ <p align="center">
44
+ <img src="docs/public/media/app-detail.png" alt="Series page for Blue Lock with its source, status, download options and chapter list" width="49%">
45
+ <img src="docs/public/media/app-reader.png" alt="MeManga reader showing page 1 of Blue Lock chapter 368" width="49%">
46
+ <br>
47
+ <sub>Series titles and artwork
48
+ belong to their owners and appear here only to demonstrate the app. See
49
+ <a href="https://meellm.github.io/MeManga/reference/sources#using-sources-responsibly">Using sources responsibly</a>.</sub>
50
+ </p>
51
+
52
+ ## Get started
53
+
54
+ - **Desktop app** for Windows, macOS or Linux:
55
+ [Download and install](https://meellm.github.io/MeManga/guide/install#desktop-app),
56
+ then [First steps](https://meellm.github.io/MeManga/guide/first-steps) and
57
+ the [desktop manual](https://meellm.github.io/MeManga/desktop/library).
58
+ - **Command line**, for example on a server:
59
+ [Command line from source](https://meellm.github.io/MeManga/guide/install#command-line-from-source)
60
+ and [Use the command line](https://meellm.github.io/MeManga/guide/cli).
61
+ - **Docker:** [Run MeManga in Docker](https://meellm.github.io/MeManga/guide/docker).
62
+ - **Working on MeManga:**
63
+ [Set up for development](https://meellm.github.io/MeManga/developer/contributing)
64
+ and [CONTRIBUTING.md](CONTRIBUTING.md).
65
+
66
+ <p align="center">
67
+ <img src="docs/public/media/cli-demo.gif" alt="Terminal recording: memanga search adds Blue Lock from weebcentral.com, memanga check downloads chapters 368 and 369 as PDF files, and memanga list shows the tracked series" width="760">
68
+ </p>
69
+
70
+ Installing with `pip`, `pipx` or `uv` from a package index is
71
+ [not available yet](https://meellm.github.io/MeManga/guide/install#package-installs).
72
+ If something does not work, see
73
+ [Troubleshooting](https://meellm.github.io/MeManga/guide/troubleshooting).
74
+
75
+ The documentation follows the development version on the `main` branch,
76
+ while the release badge shows the latest download. Pages mark what is not
77
+ in the [latest release](https://github.com/meellm/MeManga/releases/latest)
78
+ yet, so check those notes before you expect a feature in a download.
79
+
80
+ ## Sources
81
+
82
+ [Supported websites](https://meellm.github.io/MeManga/reference/supported-websites)
83
+ lists every site MeManga has a scraper for, grouped by what it publishes,
84
+ and which ones a search includes. The
85
+ [technical catalog](https://meellm.github.io/MeManga/reference/sources)
86
+ shows how they are checked. Being listed does not mean a site works today:
87
+ sites change or go offline without notice. Some sources serve adult
88
+ content; the list keeps them in their own section at the end.
89
+
90
+ MeManga is a tool you run yourself. It does not host any manga and is not
91
+ affiliated with the sites it reads; listing a site is not an endorsement.
92
+ Use it in line with the terms of those sites, the law where you live and
93
+ the rights of the people who make the manga. See
94
+ [Using sources responsibly](https://meellm.github.io/MeManga/reference/sources#using-sources-responsibly).
95
+
96
+ ## Project status and contributing
97
+
98
+ MeManga is developed in public. There is no fixed release schedule and no
99
+ guaranteed response time for issues, questions or pull requests.
100
+ Contributions are welcome: bug reports and fixes, new and repaired sources,
101
+ and [translations](https://meellm.github.io/MeManga/developer/contributing#translations).
102
+ Start with [CONTRIBUTING.md](CONTRIBUTING.md).
103
+
104
+ - Questions and ideas: [Discussions](https://github.com/meellm/MeManga/discussions)
105
+ - Bugs and broken sources: [Issues](https://github.com/meellm/MeManga/issues)
106
+ - Security problems: [SECURITY.md](SECURITY.md)
107
+ - Code of conduct: [CODE_OF_CONDUCT.md](CODE_OF_CONDUCT.md)
108
+
109
+ You can also maintain a copy of your own. The source code is under the
110
+ [MIT license](LICENSE), which lets you use, copy, change and share it as
111
+ long as the copyright and permission notice are included.
112
+ [Write a scraper](https://meellm.github.io/MeManga/developer/scrapers)
113
+ explains how to add or repair a source, and
114
+ [Set up for development](https://meellm.github.io/MeManga/developer/contributing)
115
+ how to run a copy from source and test it.
116
+
117
+ ## License
118
+
119
+ MeManga's source code is under the [MIT license](LICENSE).
120
+
121
+ The desktop downloads and the Docker image also contain third-party
122
+ software under its own licenses. The desktop downloads include Qt and
123
+ PySide6, which are used under the GNU LGPL.
124
+ [Third-party licenses](https://meellm.github.io/MeManga/guide/install#third-party-licenses)
125
+ says where the notices and the LGPL source and replacement information are
126
+ found.
@@ -0,0 +1,8 @@
1
+ """MeManga - Automatic manga downloader with Kindle support.
2
+
3
+ The supported Python interface is :mod:`memanga.api` and ``__version__``;
4
+ every other module is internal and may change in any release.
5
+ """
6
+
7
+ # The one place the version is set; pyproject.toml reads it at build time.
8
+ __version__ = "0.5.0"
@@ -0,0 +1,10 @@
1
+ #!/usr/bin/env python3
2
+ """
3
+ Entry point for running MeManga as a module:
4
+ python -m memanga
5
+ """
6
+
7
+ from memanga.cli import main
8
+
9
+ if __name__ == "__main__":
10
+ main()
@@ -0,0 +1,257 @@
1
+ """Supported Python API (issue #359).
2
+
3
+ This module and ``memanga.__version__`` are the only supported Python
4
+ interface. Every other module is internal and may change in any release.
5
+
6
+ The API reads a library; it never changes one. Opening a :class:`Library`
7
+ never writes config.yaml or state.json, never repairs a damaged state file,
8
+ never creates or moves the config folder and never takes the config
9
+ directory lock, so it works while a check or the desktop app is running.
10
+ Checks, downloads and edits are done with the command-line interface
11
+ (``memanga check``, ``memanga add`` ...), whose exit codes and ``--json``
12
+ output are its scripting contract.
13
+
14
+ Example::
15
+
16
+ from memanga.api import Library
17
+
18
+ library = Library() # or Library("/path/to/config-dir")
19
+ for series in library.series(status="reading"):
20
+ print(series.title, series.last_chapter)
21
+ """
22
+
23
+ from __future__ import annotations
24
+
25
+ import os
26
+ from dataclasses import dataclass
27
+ from pathlib import Path
28
+ from typing import Iterable, List, Optional, Tuple, Union
29
+
30
+ from . import config as _config_mod
31
+ from .chapters import chapter_order_key
32
+ from .config import Config, explicit_config_dir
33
+ from .downloader.sources import _get_sources_from_manga
34
+ from .email_settings import kindle_scope, manga_sends_to_kindle
35
+ from .state import State
36
+
37
+ __all__ = ["Library", "LibraryError", "Series", "Source"]
38
+
39
+
40
+ class LibraryError(Exception):
41
+ """The library cannot be read: its config folder does not exist, or
42
+ config.yaml or state.json cannot be loaded or holds a value of the
43
+ wrong type. The message says which folder or file and why; nothing
44
+ was created or changed."""
45
+
46
+
47
+ @dataclass(frozen=True)
48
+ class Source:
49
+ """One source of a series: its source name and URL."""
50
+ name: str
51
+ url: str
52
+
53
+
54
+ @dataclass(frozen=True)
55
+ class Series:
56
+ """One tracked manga, as it was when the library was (re)loaded."""
57
+ #: Position in the library, the ``#N`` the CLI accepts (1-based).
58
+ position: int
59
+ title: str
60
+ #: "reading", "on-hold", "dropped" or "completed".
61
+ status: str
62
+ #: "auto" or "manual".
63
+ mode: str
64
+ #: Primary source first, then the backup sources.
65
+ sources: Tuple[Source, ...]
66
+ last_chapter: Optional[str]
67
+ #: In chapter order.
68
+ downloaded_chapters: Tuple[str, ...]
69
+ #: Chapters whose download failed and can be retried, in chapter order.
70
+ failed_chapters: Tuple[str, ...]
71
+ send_to_kindle: bool
72
+
73
+
74
+ def _chapters(chapters) -> Tuple[str, ...]:
75
+ return tuple(sorted((str(c) for c in chapters), key=chapter_order_key))
76
+
77
+
78
+ class _Malformed(Exception):
79
+ """A loaded file holds a value of the wrong type."""
80
+
81
+
82
+ def _default_root() -> Path:
83
+ """The default config folder as default_config_dir() picks it, but
84
+ without moving a legacy ~/.config/memanga (issue #249): a library
85
+ that is still there is read in place."""
86
+ native = _config_mod.platform_config_dir()
87
+ legacy = _config_mod.legacy_config_dir()
88
+ if _config_mod.has_config_data(native) or not _config_mod.has_config_data(legacy):
89
+ return native
90
+ return legacy
91
+
92
+
93
+ def _is_chapter(value) -> bool:
94
+ return isinstance(value, (str, int, float)) and not isinstance(value, bool)
95
+
96
+
97
+ def _check_text(where: str, mapping, *keys) -> None:
98
+ for key in keys:
99
+ value = mapping.get(key)
100
+ if value is not None and not isinstance(value, str):
101
+ raise _Malformed(f"{where}: {key} must be text")
102
+
103
+
104
+ def _check_config(config: Config) -> None:
105
+ """Raise _Malformed when a config value the API reads has the wrong
106
+ type, so it never surfaces as a TypeError or KeyError."""
107
+ download_dir = config.get("delivery.download_dir")
108
+ if download_dir is not None and not isinstance(download_dir, str):
109
+ raise _Malformed("delivery.download_dir must be text")
110
+ manga_list = config.get("manga", [])
111
+ if not isinstance(manga_list, list):
112
+ raise _Malformed("manga must be a list")
113
+ for i, manga in enumerate(manga_list, 1):
114
+ if not isinstance(manga, dict):
115
+ raise _Malformed(f"manga #{i} must be a mapping")
116
+ title = manga.get("title")
117
+ if not isinstance(title, str) or not title:
118
+ raise _Malformed(f"manga #{i} has no title")
119
+ where = f"manga #{i} ({title})"
120
+ _check_text(where, manga, "status", "mode", "source", "url")
121
+ sources = manga.get("sources", [])
122
+ if not isinstance(sources, list):
123
+ raise _Malformed(f"{where}: sources must be a list")
124
+ for source in sources:
125
+ if isinstance(source, dict):
126
+ _check_text(f"{where} sources", source, "source", "url")
127
+ elif not isinstance(source, str):
128
+ raise _Malformed(f"{where}: each source must be a URL or a mapping")
129
+
130
+
131
+ def _check_state(state: State, titles) -> None:
132
+ """Raise _Malformed when a state value the API reads for ``titles``
133
+ has the wrong type."""
134
+ manga_state = state.get("manga", {})
135
+ if not isinstance(manga_state, dict):
136
+ raise _Malformed("manga must be a mapping")
137
+ for title in titles:
138
+ # A title with no entry has no state yet; an entry stored as
139
+ # null is a value of the wrong type, not a missing entry.
140
+ if title not in manga_state:
141
+ continue
142
+ entry = manga_state[title]
143
+ where = f"manga {title!r}"
144
+ if not isinstance(entry, dict):
145
+ raise _Malformed(f"{where} must be a mapping")
146
+ last = entry.get("last_chapter")
147
+ if last is not None and not _is_chapter(last):
148
+ raise _Malformed(f"{where}: last_chapter must be a chapter")
149
+ downloaded = entry.get("downloaded", [])
150
+ if not isinstance(downloaded, list) or not all(map(_is_chapter, downloaded)):
151
+ raise _Malformed(f"{where}: downloaded must be a list of chapters")
152
+ if not isinstance(entry.get("failed_chapters", {}), dict):
153
+ raise _Malformed(f"{where}: failed_chapters must be a mapping")
154
+
155
+
156
+ class Library:
157
+ """Read-only view of the library in one config directory.
158
+
159
+ ``config_dir`` is chosen as the CLI chooses it: the argument, else
160
+ ``$MEMANGA_CONFIG_DIR``, else the default config folder. Opening and
161
+ reading never create, move, lock or change anything; a library still
162
+ in the legacy ~/.config/memanga folder is read there. Data is read
163
+ once; call :meth:`reload` to see later changes.
164
+
165
+ Raises :class:`LibraryError` when the config folder does not exist,
166
+ or config.yaml or state.json cannot be loaded or holds a value of the
167
+ wrong type.
168
+ """
169
+
170
+ def __init__(self, config_dir: Union[str, "os.PathLike[str]", None] = None):
171
+ self._explicit_dir = explicit_config_dir(config_dir)
172
+ self.reload()
173
+
174
+ @property
175
+ def config_dir(self) -> Path:
176
+ """The config directory this library reads."""
177
+ return self._config_dir
178
+
179
+ @property
180
+ def download_dir(self) -> Path:
181
+ """Where chapters are saved (``delivery.download_dir``)."""
182
+ return self._download_dir
183
+
184
+ def reload(self) -> None:
185
+ """Read config.yaml and state.json again.
186
+
187
+ The default folder is chosen again, so a library the CLI has since
188
+ moved out of the legacy folder is still found. Raises
189
+ :class:`LibraryError` and keeps the previous data when the library
190
+ cannot be read.
191
+ """
192
+ root = self._explicit_dir or _default_root()
193
+ # Config and State create a missing folder; a reader must not.
194
+ if not root.is_dir():
195
+ raise LibraryError(
196
+ f"no MeManga library at {root}: the folder does not exist")
197
+ config = Config(root, tolerate_errors=True)
198
+ if config.load_error:
199
+ raise LibraryError(
200
+ f"cannot load config file {config.config_path}: {config.load_error}")
201
+ try:
202
+ _check_config(config)
203
+ except _Malformed as e:
204
+ raise LibraryError(f"invalid config file {config.config_path}: {e}") from None
205
+ # recover=False: a damaged state.json is only repaired by a
206
+ # process holding the config directory lock (issue #244).
207
+ state = State(root, recover=False)
208
+ if state.load_error:
209
+ raise LibraryError(f"cannot load state file: {state.load_error}")
210
+ manga_list = config.get("manga", [])
211
+ try:
212
+ _check_state(state, [manga["title"] for manga in manga_list])
213
+ except _Malformed as e:
214
+ raise LibraryError(f"invalid state file {state.state_path}: {e}") from None
215
+ scope = kindle_scope(config)
216
+ series = [
217
+ self._make_series(i, manga, state, scope)
218
+ for i, manga in enumerate(manga_list, 1)
219
+ ]
220
+ self._config_dir = root
221
+ self._download_dir = config.download_dir
222
+ self._series = series
223
+
224
+ @staticmethod
225
+ def _make_series(position: int, manga, state: State, scope: str) -> Series:
226
+ title = manga["title"]
227
+ sources = tuple(
228
+ Source(name=s.get("source") or "", url=s["url"])
229
+ for s in _get_sources_from_manga(manga) if s.get("url")
230
+ )
231
+ last_chapter = state.get_last_chapter(title)
232
+ return Series(
233
+ position=position,
234
+ title=title,
235
+ status=manga.get("status") or "reading",
236
+ mode=manga.get("mode") or "auto",
237
+ sources=sources,
238
+ last_chapter=None if last_chapter is None else str(last_chapter),
239
+ downloaded_chapters=_chapters(state.get_downloaded_chapters(title)),
240
+ failed_chapters=_chapters(state.get_failed_chapters(title)),
241
+ send_to_kindle=manga_sends_to_kindle(manga, scope),
242
+ )
243
+
244
+ def series(self, status: Union[str, Iterable[str], None] = None) -> List[Series]:
245
+ """Tracked manga in library order, optionally only those with
246
+ ``status`` (one status or several)."""
247
+ if status is None:
248
+ return list(self._series)
249
+ wanted = {status} if isinstance(status, str) else set(status)
250
+ return [s for s in self._series if s.status in wanted]
251
+
252
+ def get(self, title: str) -> Optional[Series]:
253
+ """The manga titled exactly ``title``, or None."""
254
+ for series in self._series:
255
+ if series.title == title:
256
+ return series
257
+ return None