Skip to content

Commit 7dde185

Browse files
committed
Update 0.1.16
New DLC search flag and fixed tests
1 parent 7cd21fb commit 7dde185

File tree

6 files changed

+20
-3
lines changed

6 files changed

+20
-3
lines changed

README.md

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -107,12 +107,16 @@ Apparently in the default search DLCs don't appear (see: [#6](https://github.com
107107

108108
```python
109109
SearchModifiers.NONE
110-
SearchModifiers.INCLUDE_DLC
110+
SearchModifiers.INCLUDE_DLC # Probably unnecessary
111111
SearchModifiers.ISOLATE_DLC
112+
SearchModifiers.HIDE_DLC
112113
```
113114

114115
This optional parameter allow you to specify in the search if you want the default search (no DLCs), to INCLUDE DLCs along with games, or to ISOLATE DLCs (show only DLCs in the result).
115116

117+
**Update January 2020**: Apparently HowLongToBeat re-added DLCs in the default search, so `SearchModifiers.INCLUDE_DLC` should no longer be necessary. It will remain for completeness and compatibility.
118+
A new option has been added instead: `SearchModifiers.HIDE_DLC`, that is basically the opposite of including DLCs.
119+
116120
### Results auto-filter
117121
To ignore games with a very different name, the standard search automatically filter results with a game name that has a similarity with the given name > than `0.4`, not adding the others to the result list.
118122
If you want all the results, or you want to change this value, you can put a parameter in the constructor:

howlongtobeatpy/howlongtobeatpy/HTMLRequests.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,12 @@
1212

1313
class SearchModifiers(Enum):
1414
NONE = ""
15+
# INCLUDE_DLC is left, but should NO LONGER make a difference. HowLongToBeat re-added DLC in standard requests
1516
INCLUDE_DLC = "show_dlc"
17+
# ISOLATE_DLC shows only DLC in the search result
1618
ISOLATE_DLC = "only_dlc"
19+
# HIDE_DLC hide DLCs in the search result
20+
HIDE_DLC = "hide_dlc"
1721

1822

1923
class HTMLRequests:

howlongtobeatpy/setup.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
long_description = fh.read()
55

66
setup(name='howlongtobeatpy',
7-
version='0.1.15',
7+
version='0.1.16',
88
packages=find_packages(exclude=['tests']),
99
description='A Python API for How Long to Beat',
1010
long_description=long_description,

howlongtobeatpy/tests/test_async_request.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,11 @@ async def test_game_with_no_all_values(self):
6767
@async_test
6868
async def test_game_default_dlc_search(self):
6969
results = await HowLongToBeat().async_search("Hearts of Stone")
70+
self.assertEqual(1, len(results))
71+
72+
@async_test
73+
async def test_game_hide_dlc_search(self):
74+
results = await HowLongToBeat().async_search("Hearts of Stone", search_modifiers=SearchModifiers.HIDE_DLC)
7075
self.assertEqual(0, len(results))
7176

7277
@async_test

howlongtobeatpy/tests/test_normal_request.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,10 @@ def test_game_with_no_all_values(self):
8383

8484
def test_game_default_dlc_search(self):
8585
results = HowLongToBeat().search("Hearts of Stone")
86+
self.assertEqual(1, len(results))
87+
88+
def test_game_hide_dlc_search(self):
89+
results = HowLongToBeat().search("Hearts of Stone", search_modifiers=SearchModifiers.HIDE_DLC)
8690
self.assertEqual(0, len(results))
8791

8892
def test_game_include_dlc_search(self):

sonar-project.properties

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ sonar.organization=scrappycocco-github
22
sonar.projectKey=ScrappyCocco_HowLongToBeat-PythonAPI
33

44
sonar.projectName=HowLongToBeat-PythonAPI
5-
sonar.projectVersion=0.1.15
5+
sonar.projectVersion=0.1.16
66

77
# Path is relative to the sonar-project.properties file. Replace "\" by "/" on Windows.
88
# This property is optional if sonar.modules is set.

0 commit comments

Comments
 (0)