tbr-deal-finder 0.1.6__py3-none-any.whl → 0.1.7__py3-none-any.whl
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.
- tbr_deal_finder/book.py +28 -2
- tbr_deal_finder/cli.py +21 -22
- tbr_deal_finder/config.py +10 -2
- tbr_deal_finder/library_exports.py +6 -3
- tbr_deal_finder/owned_books.py +18 -0
- tbr_deal_finder/retailer/audible.py +36 -0
- tbr_deal_finder/retailer/chirp.py +61 -2
- tbr_deal_finder/retailer/librofm.py +34 -3
- tbr_deal_finder/retailer/models.py +2 -0
- tbr_deal_finder/retailer_deal.py +43 -30
- {tbr_deal_finder-0.1.6.dist-info → tbr_deal_finder-0.1.7.dist-info}/METADATA +7 -5
- tbr_deal_finder-0.1.7.dist-info/RECORD +23 -0
- tbr_deal_finder-0.1.6.dist-info/RECORD +0 -22
- {tbr_deal_finder-0.1.6.dist-info → tbr_deal_finder-0.1.7.dist-info}/WHEEL +0 -0
- {tbr_deal_finder-0.1.6.dist-info → tbr_deal_finder-0.1.7.dist-info}/entry_points.txt +0 -0
- {tbr_deal_finder-0.1.6.dist-info → tbr_deal_finder-0.1.7.dist-info}/licenses/LICENSE +0 -0
tbr_deal_finder/book.py
CHANGED
@@ -5,6 +5,7 @@ from enum import Enum
|
|
5
5
|
from typing import Optional, Union
|
6
6
|
|
7
7
|
import click
|
8
|
+
from Levenshtein import ratio
|
8
9
|
from unidecode import unidecode
|
9
10
|
|
10
11
|
from tbr_deal_finder.config import Config
|
@@ -43,6 +44,10 @@ class Book:
|
|
43
44
|
self.list_price = round(self.list_price, 2)
|
44
45
|
self.normalized_authors = get_normalized_authors(self.authors)
|
45
46
|
|
47
|
+
# Strip the title down to its most basic repr
|
48
|
+
# Improves hit rate on retailers
|
49
|
+
self.title = self.title.split(":")[0].split("(")[0].strip()
|
50
|
+
|
46
51
|
if not self.deal_id:
|
47
52
|
self.deal_id = f"{self.title}__{self.normalized_authors}__{self.format}__{self.retailer}"
|
48
53
|
|
@@ -118,6 +123,14 @@ def print_books(books: list[Book]):
|
|
118
123
|
click.echo(str(book))
|
119
124
|
|
120
125
|
|
126
|
+
def get_full_title_str(title: str, authors: Union[list, str]) -> str:
|
127
|
+
return f"{title}__{get_normalized_authors(authors)}"
|
128
|
+
|
129
|
+
|
130
|
+
def get_title_id(title: str, authors: Union[list, str], book_format: BookFormat) -> str:
|
131
|
+
return f"{title}__{get_normalized_authors(authors)}__{book_format.value}"
|
132
|
+
|
133
|
+
|
121
134
|
def get_normalized_authors(authors: Union[str, list[str]]) -> list[str]:
|
122
135
|
if isinstance(authors, str):
|
123
136
|
authors = [i for i in authors.split(",")]
|
@@ -125,5 +138,18 @@ def get_normalized_authors(authors: Union[str, list[str]]) -> list[str]:
|
|
125
138
|
return sorted([_AUTHOR_RE.sub('', unidecode(author)).lower() for author in authors])
|
126
139
|
|
127
140
|
|
128
|
-
def
|
129
|
-
|
141
|
+
def is_matching_authors(a1: list[str], a2: list[str]) -> bool:
|
142
|
+
"""Checks if two normalized authors are matching.
|
143
|
+
Matching here means that they are at least 80% similar using levenshtein distance.
|
144
|
+
|
145
|
+
Score is calculated as follows:
|
146
|
+
1 - (distance / (len1 + len2))
|
147
|
+
|
148
|
+
:param a1:
|
149
|
+
:param a2:
|
150
|
+
:return:
|
151
|
+
"""
|
152
|
+
return any(
|
153
|
+
any(ratio(author1, author2, score_cutoff=.8) for author2 in a2)
|
154
|
+
for author1 in a1
|
155
|
+
)
|
tbr_deal_finder/cli.py
CHANGED
@@ -28,12 +28,6 @@ from tbr_deal_finder.utils import (
|
|
28
28
|
def cli():
|
29
29
|
make_migrations()
|
30
30
|
|
31
|
-
# Check that the config exists for all commands ran
|
32
|
-
try:
|
33
|
-
Config.load()
|
34
|
-
except FileNotFoundError:
|
35
|
-
_set_config()
|
36
|
-
|
37
31
|
|
38
32
|
def _add_path(existing_paths: list[str]) -> Union[str, None]:
|
39
33
|
try:
|
@@ -68,24 +62,26 @@ def _set_library_export_paths(config: Config):
|
|
68
62
|
Ensures that only valid, unique paths are added. Updates the config in-place.
|
69
63
|
"""
|
70
64
|
while True:
|
71
|
-
if config.library_export_paths:
|
72
|
-
|
73
|
-
choices = ["Add new path", "Remove path", "Done"]
|
74
|
-
else:
|
75
|
-
choices = ["Add new path", "Done"]
|
76
|
-
|
77
|
-
try:
|
78
|
-
user_selection = questionary.select(
|
79
|
-
"What change would you like to make to your library export paths",
|
80
|
-
choices=choices,
|
81
|
-
).ask()
|
82
|
-
except (KeyError, KeyboardInterrupt, TypeError):
|
83
|
-
return
|
65
|
+
if len(config.library_export_paths) > 0:
|
66
|
+
choices = ["Add new path", "Remove path", "Done"]
|
84
67
|
else:
|
85
|
-
|
86
|
-
|
68
|
+
choices = ["Add new path", "Done"]
|
69
|
+
|
70
|
+
try:
|
71
|
+
user_selection = questionary.select(
|
72
|
+
"What change would you like to make to your library export paths",
|
73
|
+
choices=choices,
|
74
|
+
).ask()
|
75
|
+
except (KeyError, KeyboardInterrupt, TypeError):
|
76
|
+
return
|
87
77
|
|
88
78
|
if user_selection == "Done":
|
79
|
+
if not config.library_export_paths:
|
80
|
+
if not click.confirm(
|
81
|
+
"Don't add a GoodReads or StoryGraph export and use wishlist entirely? "
|
82
|
+
"Note: Wishlist checks will still work even if you add your StoryGraph/GoodReads export."
|
83
|
+
):
|
84
|
+
continue
|
89
85
|
return
|
90
86
|
elif user_selection == "Add new path":
|
91
87
|
if new_path := _add_path(config.library_export_paths):
|
@@ -188,7 +184,10 @@ def setup():
|
|
188
184
|
@cli.command()
|
189
185
|
def latest_deals():
|
190
186
|
"""Find book deals from your Library export."""
|
191
|
-
|
187
|
+
try:
|
188
|
+
config = Config.load()
|
189
|
+
except FileNotFoundError:
|
190
|
+
config = _set_config()
|
192
191
|
|
193
192
|
asyncio.run(maybe_enrich_library_exports(config))
|
194
193
|
|
tbr_deal_finder/config.py
CHANGED
@@ -62,10 +62,16 @@ class Config:
|
|
62
62
|
tracked_retailers_str = parser.get('DEFAULT', 'tracked_retailers')
|
63
63
|
locale = parser.get('DEFAULT', 'locale', fallback="us")
|
64
64
|
cls.set_locale(locale)
|
65
|
+
|
66
|
+
if export_paths_str:
|
67
|
+
library_export_paths = [i.strip() for i in export_paths_str.split(",")]
|
68
|
+
else:
|
69
|
+
library_export_paths = []
|
70
|
+
|
65
71
|
return cls(
|
66
72
|
max_price=parser.getfloat('DEFAULT', 'max_price', fallback=8.0),
|
67
73
|
min_discount=parser.getint('DEFAULT', 'min_discount', fallback=35),
|
68
|
-
library_export_paths=
|
74
|
+
library_export_paths=library_export_paths,
|
69
75
|
tracked_retailers=[i.strip() for i in tracked_retailers_str.split(",")]
|
70
76
|
)
|
71
77
|
|
@@ -78,7 +84,9 @@ class Config:
|
|
78
84
|
return ", ".join(self.tracked_retailers)
|
79
85
|
|
80
86
|
def set_library_export_paths(self, library_export_paths: Union[str, list[str]]):
|
81
|
-
if
|
87
|
+
if not library_export_paths:
|
88
|
+
self.library_export_paths = []
|
89
|
+
elif isinstance(library_export_paths, str):
|
82
90
|
self.library_export_paths = [i.strip() for i in library_export_paths.split(",")]
|
83
91
|
else:
|
84
92
|
self.library_export_paths = library_export_paths
|
@@ -7,7 +7,7 @@ from typing import Callable, Awaitable, Optional
|
|
7
7
|
|
8
8
|
from tqdm.asyncio import tqdm_asyncio
|
9
9
|
|
10
|
-
from tbr_deal_finder.book import Book, BookFormat,
|
10
|
+
from tbr_deal_finder.book import Book, BookFormat, get_full_title_str
|
11
11
|
from tbr_deal_finder.config import Config
|
12
12
|
from tbr_deal_finder.retailer import LibroFM, Chirp
|
13
13
|
|
@@ -61,6 +61,9 @@ async def _maybe_set_column_for_library_exports(
|
|
61
61
|
:param column_name:
|
62
62
|
:return:
|
63
63
|
"""
|
64
|
+
if not config.library_export_paths:
|
65
|
+
return
|
66
|
+
|
64
67
|
if not column_name:
|
65
68
|
column_name = attr_name
|
66
69
|
|
@@ -77,7 +80,7 @@ async def _maybe_set_column_for_library_exports(
|
|
77
80
|
|
78
81
|
title = get_book_title(book_dict)
|
79
82
|
authors = get_book_authors(book_dict)
|
80
|
-
key =
|
83
|
+
key = get_full_title_str(title, authors)
|
81
84
|
|
82
85
|
if column_name in book_dict:
|
83
86
|
# Keep state of value for this book/key
|
@@ -136,7 +139,7 @@ async def _maybe_set_column_for_library_exports(
|
|
136
139
|
if is_tbr_book(book_dict):
|
137
140
|
title = get_book_title(book_dict)
|
138
141
|
authors = get_book_authors(book_dict)
|
139
|
-
key =
|
142
|
+
key = get_full_title_str(title, authors)
|
140
143
|
|
141
144
|
if key in book_to_col_val_map:
|
142
145
|
col_val = book_to_col_val_map[key]
|
@@ -0,0 +1,18 @@
|
|
1
|
+
from tbr_deal_finder.book import Book
|
2
|
+
from tbr_deal_finder.config import Config
|
3
|
+
from tbr_deal_finder.retailer import RETAILER_MAP
|
4
|
+
from tbr_deal_finder.retailer.models import Retailer
|
5
|
+
|
6
|
+
|
7
|
+
async def get_owned_books(config: Config) -> list[Book]:
|
8
|
+
owned_books = []
|
9
|
+
|
10
|
+
for retailer_str in config.tracked_retailers:
|
11
|
+
retailer: Retailer = RETAILER_MAP[retailer_str]()
|
12
|
+
await retailer.set_auth()
|
13
|
+
|
14
|
+
owned_books.extend(
|
15
|
+
await retailer.get_library(config)
|
16
|
+
)
|
17
|
+
|
18
|
+
return owned_books
|
@@ -171,3 +171,39 @@ class Audible(Retailer):
|
|
171
171
|
total_pages = math.ceil(int(response.get("total_results", 1))/page_size)
|
172
172
|
|
173
173
|
return wishlist_books
|
174
|
+
|
175
|
+
async def get_library(self, config: Config) -> list[Book]:
|
176
|
+
library_books = []
|
177
|
+
|
178
|
+
page = 1
|
179
|
+
total_pages = 1
|
180
|
+
page_size = 1000
|
181
|
+
while page <= total_pages:
|
182
|
+
response = await self._client.get(
|
183
|
+
"1.0/library",
|
184
|
+
num_results=page_size,
|
185
|
+
page=page,
|
186
|
+
response_groups=[
|
187
|
+
"contributors, product_attrs, product_desc, product_extended_attrs"
|
188
|
+
]
|
189
|
+
)
|
190
|
+
|
191
|
+
for audiobook in response.get("items", []):
|
192
|
+
authors = [author["name"] for author in audiobook["authors"]]
|
193
|
+
library_books.append(
|
194
|
+
Book(
|
195
|
+
retailer=self.name,
|
196
|
+
title=audiobook["title"],
|
197
|
+
authors=", ".join(authors),
|
198
|
+
list_price=1,
|
199
|
+
current_price=1,
|
200
|
+
timepoint=config.run_time,
|
201
|
+
format=self.format,
|
202
|
+
audiobook_isbn=audiobook["isbn"],
|
203
|
+
)
|
204
|
+
)
|
205
|
+
|
206
|
+
page += 1
|
207
|
+
total_pages = math.ceil(int(response.get("total_results", 1))/page_size)
|
208
|
+
|
209
|
+
return library_books
|
@@ -2,6 +2,7 @@ import asyncio
|
|
2
2
|
import json
|
3
3
|
import os
|
4
4
|
from datetime import datetime, timedelta
|
5
|
+
from textwrap import dedent
|
5
6
|
|
6
7
|
import aiohttp
|
7
8
|
import click
|
@@ -9,7 +10,7 @@ import click
|
|
9
10
|
from tbr_deal_finder import TBR_DEALS_PATH
|
10
11
|
from tbr_deal_finder.config import Config
|
11
12
|
from tbr_deal_finder.retailer.models import Retailer
|
12
|
-
from tbr_deal_finder.book import Book, BookFormat, get_normalized_authors
|
13
|
+
from tbr_deal_finder.book import Book, BookFormat, get_normalized_authors, is_matching_authors
|
13
14
|
from tbr_deal_finder.utils import currency_to_float, echo_err
|
14
15
|
|
15
16
|
|
@@ -120,7 +121,7 @@ class Chirp(Retailer):
|
|
120
121
|
normalized_authors = get_normalized_authors([author["name"] for author in book["allAuthors"]])
|
121
122
|
if (
|
122
123
|
book["displayTitle"] == title
|
123
|
-
and
|
124
|
+
and is_matching_authors(target.normalized_authors, normalized_authors)
|
124
125
|
):
|
125
126
|
return Book(
|
126
127
|
retailer=self.name,
|
@@ -180,3 +181,61 @@ class Chirp(Retailer):
|
|
180
181
|
)
|
181
182
|
|
182
183
|
page += 1
|
184
|
+
|
185
|
+
async def get_library(self, config: Config) -> list[Book]:
|
186
|
+
library_books = []
|
187
|
+
page = 1
|
188
|
+
query = dedent("""
|
189
|
+
query AndroidCurrentUserAudiobooks($page: Int!, $pageSize: Int!) {
|
190
|
+
currentUserAudiobooks(page: $page, pageSize: $pageSize, sort: TITLE_A_Z, clientCapabilities: [CHIRP_AUDIO]) {
|
191
|
+
audiobook {
|
192
|
+
id
|
193
|
+
allAuthors{name}
|
194
|
+
displayTitle
|
195
|
+
displayAuthors
|
196
|
+
displayNarrators
|
197
|
+
durationMs
|
198
|
+
description
|
199
|
+
publisher
|
200
|
+
}
|
201
|
+
archived
|
202
|
+
playable
|
203
|
+
finishedAt
|
204
|
+
currentOverallOffsetMs
|
205
|
+
}
|
206
|
+
}
|
207
|
+
""")
|
208
|
+
|
209
|
+
while True:
|
210
|
+
response = await self.make_request(
|
211
|
+
"POST",
|
212
|
+
json={
|
213
|
+
"query": query,
|
214
|
+
"variables": {"page": page, "pageSize": 15},
|
215
|
+
"operationName": "AndroidCurrentUserAudiobooks"
|
216
|
+
}
|
217
|
+
)
|
218
|
+
|
219
|
+
audiobooks = response.get(
|
220
|
+
"data", {}
|
221
|
+
).get("currentUserAudiobooks", [])
|
222
|
+
|
223
|
+
if not audiobooks:
|
224
|
+
return library_books
|
225
|
+
|
226
|
+
for book in audiobooks:
|
227
|
+
audiobook = book["audiobook"]
|
228
|
+
authors = [author["name"] for author in audiobook["allAuthors"]]
|
229
|
+
library_books.append(
|
230
|
+
Book(
|
231
|
+
retailer=self.name,
|
232
|
+
title=audiobook["displayTitle"],
|
233
|
+
authors=", ".join(authors),
|
234
|
+
list_price=1,
|
235
|
+
current_price=1,
|
236
|
+
timepoint=config.run_time,
|
237
|
+
format=self.format,
|
238
|
+
)
|
239
|
+
)
|
240
|
+
|
241
|
+
page += 1
|
@@ -10,7 +10,7 @@ import click
|
|
10
10
|
from tbr_deal_finder import TBR_DEALS_PATH
|
11
11
|
from tbr_deal_finder.config import Config
|
12
12
|
from tbr_deal_finder.retailer.models import Retailer
|
13
|
-
from tbr_deal_finder.book import Book, BookFormat, get_normalized_authors
|
13
|
+
from tbr_deal_finder.book import Book, BookFormat, get_normalized_authors, is_matching_authors
|
14
14
|
from tbr_deal_finder.utils import currency_to_float
|
15
15
|
|
16
16
|
|
@@ -101,7 +101,7 @@ class LibroFM(Retailer):
|
|
101
101
|
|
102
102
|
if (
|
103
103
|
title == b["title"]
|
104
|
-
and
|
104
|
+
and is_matching_authors(book.normalized_authors, normalized_authors)
|
105
105
|
):
|
106
106
|
book.audiobook_isbn = b["isbn"]
|
107
107
|
break
|
@@ -165,7 +165,7 @@ class LibroFM(Retailer):
|
|
165
165
|
response = await self.make_request(
|
166
166
|
f"api/v10/explore/wishlist",
|
167
167
|
"GET",
|
168
|
-
params=dict(page=
|
168
|
+
params=dict(page=page)
|
169
169
|
)
|
170
170
|
wishlist = response.get("data", {}).get("wishlist", {})
|
171
171
|
if not wishlist:
|
@@ -189,3 +189,34 @@ class LibroFM(Retailer):
|
|
189
189
|
total_pages = wishlist["total_pages"]
|
190
190
|
|
191
191
|
return wishlist_books
|
192
|
+
|
193
|
+
async def get_library(self, config: Config) -> list[Book]:
|
194
|
+
library_books = []
|
195
|
+
|
196
|
+
page = 1
|
197
|
+
total_pages = 1
|
198
|
+
while page <= total_pages:
|
199
|
+
response = await self.make_request(
|
200
|
+
f"api/v10/library",
|
201
|
+
"GET",
|
202
|
+
params=dict(page=page)
|
203
|
+
)
|
204
|
+
|
205
|
+
for book in response.get("audiobooks", []):
|
206
|
+
library_books.append(
|
207
|
+
Book(
|
208
|
+
retailer=self.name,
|
209
|
+
title=book["title"],
|
210
|
+
authors=", ".join(book["authors"]),
|
211
|
+
list_price=1,
|
212
|
+
current_price=1,
|
213
|
+
timepoint=config.run_time,
|
214
|
+
format=self.format,
|
215
|
+
audiobook_isbn=book["isbn"],
|
216
|
+
)
|
217
|
+
)
|
218
|
+
|
219
|
+
page += 1
|
220
|
+
total_pages = response["total_pages"]
|
221
|
+
|
222
|
+
return library_books
|
tbr_deal_finder/retailer_deal.py
CHANGED
@@ -8,6 +8,7 @@ from tqdm.asyncio import tqdm_asyncio
|
|
8
8
|
|
9
9
|
from tbr_deal_finder.book import Book, get_active_deals, BookFormat
|
10
10
|
from tbr_deal_finder.config import Config
|
11
|
+
from tbr_deal_finder.owned_books import get_owned_books
|
11
12
|
from tbr_deal_finder.tracked_books import get_tbr_books
|
12
13
|
from tbr_deal_finder.retailer import RETAILER_MAP
|
13
14
|
from tbr_deal_finder.retailer.models import Retailer
|
@@ -41,7 +42,7 @@ def update_retailer_deal_table(config: Config, new_deals: list[Book]):
|
|
41
42
|
# Any remaining values in active_deal_map mean that
|
42
43
|
# it wasn't found and should be marked for deletion
|
43
44
|
for deal in active_deal_map.values():
|
44
|
-
echo_warning(f"{str(deal)} is no longer active")
|
45
|
+
echo_warning(f"{str(deal)} is no longer active\n")
|
45
46
|
deal.timepoint = config.run_time
|
46
47
|
deal.deleted = True
|
47
48
|
df_data.append(deal.dict())
|
@@ -55,21 +56,6 @@ def update_retailer_deal_table(config: Config, new_deals: list[Book]):
|
|
55
56
|
db_conn.unregister("_df")
|
56
57
|
|
57
58
|
|
58
|
-
def _retry_books(found_books: list[Book], all_books: list[Book]) -> list[Book]:
|
59
|
-
response = []
|
60
|
-
found_book_set = {f'{b.title} - {b.authors}' for b in found_books}
|
61
|
-
for book in all_books:
|
62
|
-
if ":" not in book.title:
|
63
|
-
continue
|
64
|
-
|
65
|
-
if f'{book.title} - {book.authors}' not in found_book_set:
|
66
|
-
alt_book = copy.deepcopy(book)
|
67
|
-
alt_book.title = alt_book.title.split(":")[0]
|
68
|
-
response.append(alt_book)
|
69
|
-
|
70
|
-
return response
|
71
|
-
|
72
|
-
|
73
59
|
async def _get_books(config, retailer: Retailer, books: list[Book]) -> list[Book]:
|
74
60
|
"""Get Books with limited concurrency.
|
75
61
|
|
@@ -100,13 +86,9 @@ async def _get_books(config, retailer: Retailer, books: list[Book]) -> list[Book
|
|
100
86
|
elif not book.exists:
|
101
87
|
unresolved_books.append(book)
|
102
88
|
|
103
|
-
|
104
|
-
|
105
|
-
|
106
|
-
elif unresolved_books:
|
107
|
-
click.echo()
|
108
|
-
for book in unresolved_books:
|
109
|
-
echo_info(f"{book.title} by {book.authors} not found")
|
89
|
+
click.echo()
|
90
|
+
for book in unresolved_books:
|
91
|
+
echo_info(f"{book.title} by {book.authors} not found")
|
110
92
|
|
111
93
|
return response
|
112
94
|
|
@@ -145,6 +127,34 @@ def _apply_proper_list_prices(books: list[Book]):
|
|
145
127
|
book.list_price = max(book.current_price, list_price)
|
146
128
|
|
147
129
|
|
130
|
+
def _get_retailer_relevant_tbr_books(
|
131
|
+
retailer: Retailer,
|
132
|
+
books: list[Book],
|
133
|
+
owned_book_title_map: dict[str, dict[BookFormat, Book]],
|
134
|
+
) -> list[Book]:
|
135
|
+
"""
|
136
|
+
Don't check on deals in a specified format that does not match the format the retailer sells.
|
137
|
+
Also, don't check on deals for a book if a copy is already owned in that same format.
|
138
|
+
|
139
|
+
:param retailer:
|
140
|
+
:param books:
|
141
|
+
:param owned_book_title_map:
|
142
|
+
:return:
|
143
|
+
"""
|
144
|
+
|
145
|
+
response = []
|
146
|
+
|
147
|
+
for book in books:
|
148
|
+
owned_versions = owned_book_title_map[book.full_title_str]
|
149
|
+
if (
|
150
|
+
(book.format == BookFormat.NA or book.format == retailer.format)
|
151
|
+
and retailer.format not in owned_versions
|
152
|
+
):
|
153
|
+
response.append(book)
|
154
|
+
|
155
|
+
return response
|
156
|
+
|
157
|
+
|
148
158
|
async def get_latest_deals(config: Config):
|
149
159
|
"""
|
150
160
|
Fetches the latest book deals from all tracked retailers for the user's TBR list.
|
@@ -164,18 +174,21 @@ async def get_latest_deals(config: Config):
|
|
164
174
|
|
165
175
|
books: list[Book] = []
|
166
176
|
tbr_books = await get_tbr_books(config)
|
177
|
+
owned_books = await get_owned_books(config)
|
178
|
+
|
179
|
+
owned_book_title_map: dict[str, dict[BookFormat, Book]] = defaultdict(dict)
|
180
|
+
for book in owned_books:
|
181
|
+
owned_book_title_map[book.full_title_str][book.format] = book
|
167
182
|
|
168
183
|
for retailer_str in config.tracked_retailers:
|
169
184
|
retailer = RETAILER_MAP[retailer_str]()
|
170
185
|
await retailer.set_auth()
|
171
186
|
|
172
|
-
|
173
|
-
|
174
|
-
|
175
|
-
|
176
|
-
|
177
|
-
if book.format == BookFormat.NA or book.format == retailer.format
|
178
|
-
]
|
187
|
+
relevant_tbr_books = _get_retailer_relevant_tbr_books(
|
188
|
+
retailer,
|
189
|
+
tbr_books,
|
190
|
+
owned_book_title_map,
|
191
|
+
)
|
179
192
|
|
180
193
|
echo_info(f"Getting deals from {retailer.name}")
|
181
194
|
click.echo("\n---------------")
|
@@ -1,6 +1,6 @@
|
|
1
1
|
Metadata-Version: 2.4
|
2
2
|
Name: tbr-deal-finder
|
3
|
-
Version: 0.1.
|
3
|
+
Version: 0.1.7
|
4
4
|
Summary: Track price drops and find deals on books in your TBR list across audiobook and ebook formats.
|
5
5
|
License: MIT
|
6
6
|
License-File: LICENSE
|
@@ -9,6 +9,7 @@ Requires-Dist: aiohttp>=3.12.14
|
|
9
9
|
Requires-Dist: audible==0.8.2
|
10
10
|
Requires-Dist: click>=8.2.1
|
11
11
|
Requires-Dist: duckdb>=1.3.2
|
12
|
+
Requires-Dist: levenshtein>=0.27.1
|
12
13
|
Requires-Dist: pandas>=2.3.1
|
13
14
|
Requires-Dist: questionary>=2.1.0
|
14
15
|
Requires-Dist: tqdm>=4.67.1
|
@@ -17,16 +18,17 @@ Description-Content-Type: text/markdown
|
|
17
18
|
|
18
19
|
# tbr-deal-finder
|
19
20
|
|
20
|
-
Track price drops and find deals on books in your TBR (To Be Read)
|
21
|
+
Track price drops and find deals on books in your TBR (To Be Read) and wishlist across digital book retailers.
|
21
22
|
|
22
23
|
## Features
|
23
|
-
-
|
24
|
+
- Use your StoryGraph exports, Goodreads exports, and custom csvs (spreadsheet) to track book deals
|
24
25
|
- Supports multiple of the library exports above
|
25
26
|
- Tracks deals on the wishlist of all your configured retailers like audible
|
26
27
|
- Supports multiple locales and currencies
|
27
|
-
-
|
28
|
+
- Find the latest and active deals from supported sellers
|
28
29
|
- Simple CLI interface for setup and usage
|
29
30
|
- Only get notified for new deals or view all active deals
|
31
|
+
- Filters out books you already own to prevent purchasing the same book on multiple retailers
|
30
32
|
|
31
33
|
## Support
|
32
34
|
|
@@ -67,7 +69,7 @@ Track price drops and find deals on books in your TBR (To Be Read) list across a
|
|
67
69
|
https://docs.astral.sh/uv/getting-started/installation/
|
68
70
|
|
69
71
|
## Configuration
|
70
|
-
This tool
|
72
|
+
This tool can use the csv generated by the app you use to track your TBRs.
|
71
73
|
Here are the steps to get your export.
|
72
74
|
|
73
75
|
### StoryGraph
|
@@ -0,0 +1,23 @@
|
|
1
|
+
tbr_deal_finder/__init__.py,sha256=WCoj0GZrRiCQlrpkLTw1VUeJmX-RtBLdLqnFYn1Es_4,208
|
2
|
+
tbr_deal_finder/book.py,sha256=JUhhDAV_vajhSyaD5begFvX_HPwEiZfojQ2x57qrf5M,4563
|
3
|
+
tbr_deal_finder/cli.py,sha256=iwmbUxwqD6HtKppf2QlDMENFnYxTnPQWSK1WLUpyOW8,7357
|
4
|
+
tbr_deal_finder/config.py,sha256=I69JruWIlnwxNiUMyOFq3K5sMmtXJKQxLKBU98DM008,3662
|
5
|
+
tbr_deal_finder/library_exports.py,sha256=hs2_GE0HP78EQ8GL0Lmalq-ihSp88i1OL-3VLD0Djhk,7163
|
6
|
+
tbr_deal_finder/migrations.py,sha256=6_WV55bm71UCFrcFrfJXlEX5uDrgnNTWZPq6vZTg18o,3733
|
7
|
+
tbr_deal_finder/owned_books.py,sha256=Cf1VeiSg7XBi_TXptJfy5sO1mEgMMQWbJ_P6SzAx0nQ,516
|
8
|
+
tbr_deal_finder/retailer_deal.py,sha256=UGVb8wxv98vEWy9wX6UM5ePhIa00xHPtzJCgngximHc,6949
|
9
|
+
tbr_deal_finder/tracked_books.py,sha256=EKecARSOMPPkmjSSWfWQw9B-TnoSd3-6AQepc2EYTz0,4031
|
10
|
+
tbr_deal_finder/utils.py,sha256=_4wdGFDtqCdMyoMnwTDiHgCR4WQLAcQr8LlZZZUcq6E,1357
|
11
|
+
tbr_deal_finder/queries/get_active_deals.sql,sha256=jILZK5UVNPLbbKWgqMW0brEZyCb9XBdQZJLHRULoQC4,195
|
12
|
+
tbr_deal_finder/queries/get_deals_found_at.sql,sha256=1vAE8PsAvfFi0SbvoUw8pvLwRN9VGYTJ7AVI3rmxXEI,122
|
13
|
+
tbr_deal_finder/queries/latest_deal_last_ran_most_recent_success.sql,sha256=W4cNMAHtcW2DzQyPL8SHHFcbVZQKVK2VfTzazxC3LJU,107
|
14
|
+
tbr_deal_finder/retailer/__init__.py,sha256=WePMSN7vi4EL_uPiAH6ogNNE-kRQe4OHT4CYGTKvBSk,243
|
15
|
+
tbr_deal_finder/retailer/audible.py,sha256=kgDNobu7uYV5IwReTDL_e0J731fMdOiJBipsno7Zv0A,6561
|
16
|
+
tbr_deal_finder/retailer/chirp.py,sha256=8IaVVbUcY-bLV6cy4wKXhKmW2qJy6HksxxG1uLpqSeA,10063
|
17
|
+
tbr_deal_finder/retailer/librofm.py,sha256=wN51UrDVaHb4XwoO0MY1_7ivhAE_BxoBWDavd7MpRxE,7413
|
18
|
+
tbr_deal_finder/retailer/models.py,sha256=vomL99LDP_52r61W1CBE34yxAWteD_QE5NeqSATgnAE,1512
|
19
|
+
tbr_deal_finder-0.1.7.dist-info/METADATA,sha256=nYxkGPCh7SOIg6RRktVidC7YpPfoxaWT6jZJ0JmpR_E,4343
|
20
|
+
tbr_deal_finder-0.1.7.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
|
21
|
+
tbr_deal_finder-0.1.7.dist-info/entry_points.txt,sha256=y_KG1k8xVCY8gngSZ-na2bkK-tTLUdOc_qZ9Djwldv0,60
|
22
|
+
tbr_deal_finder-0.1.7.dist-info/licenses/LICENSE,sha256=rNc0wNPn4d4HHu6ZheJzeUaz_FbJ4rj2Dr2FjAivkNg,1064
|
23
|
+
tbr_deal_finder-0.1.7.dist-info/RECORD,,
|
@@ -1,22 +0,0 @@
|
|
1
|
-
tbr_deal_finder/__init__.py,sha256=WCoj0GZrRiCQlrpkLTw1VUeJmX-RtBLdLqnFYn1Es_4,208
|
2
|
-
tbr_deal_finder/book.py,sha256=ZnwuIU2-rP0UC12fSC_HiTXpmgBp5XrRiFe82OLQ-E0,3786
|
3
|
-
tbr_deal_finder/cli.py,sha256=jIwzyESLGc77Wyxsv4XjEfMHZHjQI_PTmBLamc9tiV0,7284
|
4
|
-
tbr_deal_finder/config.py,sha256=3fgN92sVsQbVqRBc58QK9w5t35zoPX6pP3k4nnJ_YTg,3441
|
5
|
-
tbr_deal_finder/library_exports.py,sha256=Hupx3mJyhvqXEslR2R3ifG9ykSKxkOb-H3gGK_CRx68,7133
|
6
|
-
tbr_deal_finder/migrations.py,sha256=6_WV55bm71UCFrcFrfJXlEX5uDrgnNTWZPq6vZTg18o,3733
|
7
|
-
tbr_deal_finder/retailer_deal.py,sha256=wMziFXCvrJQ_i4IdsXVPlaXnUIeGTRPt_rwbPfqX2FE,6742
|
8
|
-
tbr_deal_finder/tracked_books.py,sha256=EKecARSOMPPkmjSSWfWQw9B-TnoSd3-6AQepc2EYTz0,4031
|
9
|
-
tbr_deal_finder/utils.py,sha256=_4wdGFDtqCdMyoMnwTDiHgCR4WQLAcQr8LlZZZUcq6E,1357
|
10
|
-
tbr_deal_finder/queries/get_active_deals.sql,sha256=jILZK5UVNPLbbKWgqMW0brEZyCb9XBdQZJLHRULoQC4,195
|
11
|
-
tbr_deal_finder/queries/get_deals_found_at.sql,sha256=1vAE8PsAvfFi0SbvoUw8pvLwRN9VGYTJ7AVI3rmxXEI,122
|
12
|
-
tbr_deal_finder/queries/latest_deal_last_ran_most_recent_success.sql,sha256=W4cNMAHtcW2DzQyPL8SHHFcbVZQKVK2VfTzazxC3LJU,107
|
13
|
-
tbr_deal_finder/retailer/__init__.py,sha256=WePMSN7vi4EL_uPiAH6ogNNE-kRQe4OHT4CYGTKvBSk,243
|
14
|
-
tbr_deal_finder/retailer/audible.py,sha256=AY8jippIQe0XqCXk9iLb3CHADIYIG3orlctNQRSv2q8,5315
|
15
|
-
tbr_deal_finder/retailer/chirp.py,sha256=BVtHsrM0nsMmT2fxDnUliXVWfY2xZY8TR3FWZzyaxIA,8042
|
16
|
-
tbr_deal_finder/retailer/librofm.py,sha256=ZiowAIpDYnuH6KREdPK874t-Handlr0jZ9Mj0QMVGis,6428
|
17
|
-
tbr_deal_finder/retailer/models.py,sha256=wAGZtp0BWz9vlZCcWZqll8gwXUP6-6oFtsWv3gCXEHM,1415
|
18
|
-
tbr_deal_finder-0.1.6.dist-info/METADATA,sha256=CbRtsumWOcJ_VaabBoCqzGURzKjCOvvdk5koY11ukZE,4215
|
19
|
-
tbr_deal_finder-0.1.6.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
|
20
|
-
tbr_deal_finder-0.1.6.dist-info/entry_points.txt,sha256=y_KG1k8xVCY8gngSZ-na2bkK-tTLUdOc_qZ9Djwldv0,60
|
21
|
-
tbr_deal_finder-0.1.6.dist-info/licenses/LICENSE,sha256=rNc0wNPn4d4HHu6ZheJzeUaz_FbJ4rj2Dr2FjAivkNg,1064
|
22
|
-
tbr_deal_finder-0.1.6.dist-info/RECORD,,
|
File without changes
|
File without changes
|
File without changes
|