showtime-cli 0.3.22__tar.gz → 0.3.25__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 (26) hide show
  1. showtime_cli-0.3.25/PKG-INFO +46 -0
  2. showtime_cli-0.3.25/pyproject.toml +123 -0
  3. {showtime_cli-0.3.22 → showtime_cli-0.3.25}/showtime/api.py +35 -5
  4. {showtime_cli-0.3.22 → showtime_cli-0.3.25}/showtime/output.py +4 -2
  5. {showtime_cli-0.3.22 → showtime_cli-0.3.25}/showtime/showtime.py +1 -1
  6. showtime_cli-0.3.25/showtime_cli.egg-info/PKG-INFO +46 -0
  7. {showtime_cli-0.3.22 → showtime_cli-0.3.25}/showtime_cli.egg-info/SOURCES.txt +0 -3
  8. showtime_cli-0.3.25/showtime_cli.egg-info/requires.txt +16 -0
  9. showtime_cli-0.3.22/MANIFEST.in +0 -4
  10. showtime_cli-0.3.22/PKG-INFO +0 -49
  11. showtime_cli-0.3.22/pyproject.toml +0 -55
  12. showtime_cli-0.3.22/requirements.txt +0 -7
  13. showtime_cli-0.3.22/setup.py +0 -55
  14. showtime_cli-0.3.22/showtime_cli.egg-info/PKG-INFO +0 -49
  15. showtime_cli-0.3.22/showtime_cli.egg-info/requires.txt +0 -10
  16. {showtime_cli-0.3.22 → showtime_cli-0.3.25}/LICENSE +0 -0
  17. {showtime_cli-0.3.22 → showtime_cli-0.3.25}/README.md +0 -0
  18. {showtime_cli-0.3.22 → showtime_cli-0.3.25}/setup.cfg +0 -0
  19. {showtime_cli-0.3.22 → showtime_cli-0.3.25}/showtime/__init__.py +0 -0
  20. {showtime_cli-0.3.22 → showtime_cli-0.3.25}/showtime/command.py +0 -0
  21. {showtime_cli-0.3.22 → showtime_cli-0.3.25}/showtime/config.py +0 -0
  22. {showtime_cli-0.3.22 → showtime_cli-0.3.25}/showtime/database.py +0 -0
  23. {showtime_cli-0.3.22 → showtime_cli-0.3.25}/showtime/types.py +0 -0
  24. {showtime_cli-0.3.22 → showtime_cli-0.3.25}/showtime_cli.egg-info/dependency_links.txt +0 -0
  25. {showtime_cli-0.3.22 → showtime_cli-0.3.25}/showtime_cli.egg-info/entry_points.txt +0 -0
  26. {showtime_cli-0.3.22 → showtime_cli-0.3.25}/showtime_cli.egg-info/top_level.txt +0 -0
@@ -0,0 +1,46 @@
1
+ Metadata-Version: 2.4
2
+ Name: showtime-cli
3
+ Version: 0.3.25
4
+ Summary: Command line show tracker using the TVMaze public API
5
+ Author-email: Evgeniy Vasilev <aquilax@gmail.com>
6
+ License: MIT
7
+ Project-URL: Homepage, https://github.com/aquilax/showtime
8
+ Project-URL: Repository, https://github.com/aquilax/showtime
9
+ Keywords: tv,commandline,application,show,tvmaze
10
+ Classifier: Development Status :: 5 - Production/Stable
11
+ Classifier: Environment :: Console
12
+ Classifier: Intended Audience :: End Users/Desktop
13
+ Classifier: License :: OSI Approved :: MIT License
14
+ Classifier: Natural Language :: English
15
+ Classifier: Programming Language :: Python :: 3 :: Only
16
+ Classifier: Programming Language :: Python :: 3.12
17
+ Classifier: Topic :: Utilities
18
+ Requires-Python: >=3.12
19
+ Description-Content-Type: text/markdown
20
+ License-File: LICENSE
21
+ Requires-Dist: cmd2==4.2.2
22
+ Requires-Dist: ratelimit==2.2.1
23
+ Requires-Dist: tinydb==4.9.0
24
+ Requires-Dist: terminaltables==3.1.10
25
+ Requires-Dist: python-dateutil==2.9.0.post0
26
+ Requires-Dist: typing-extensions==4.16.0
27
+ Provides-Extra: test
28
+ Requires-Dist: pytest>=7.0; extra == "test"
29
+ Requires-Dist: pytest-cov>=4.0; extra == "test"
30
+ Requires-Dist: mypy>=1.0; extra == "test"
31
+ Requires-Dist: ratelimit-stubs>=0.2; extra == "test"
32
+ Requires-Dist: types-python-dateutil>=2.8; extra == "test"
33
+ Requires-Dist: types-requests>=2.28; extra == "test"
34
+ Requires-Dist: tox>=4.0; extra == "test"
35
+ Requires-Dist: interrogate>=1.5; extra == "test"
36
+ Dynamic: license-file
37
+
38
+ # showtime
39
+
40
+ Small command line interactive tv show tracker using the TvMaze API.
41
+
42
+ ## Installation
43
+
44
+ ```sh
45
+ pip install showtime-cli
46
+ ```
@@ -0,0 +1,123 @@
1
+ [build-system]
2
+ requires = ["setuptools>=68.0.0", "wheel"]
3
+ build-backend = "setuptools.build_meta"
4
+
5
+ [project]
6
+ name = "showtime-cli"
7
+ version = "0.3.25"
8
+ description = "Command line show tracker using the TVMaze public API"
9
+ readme = "README.md"
10
+ requires-python = ">=3.12"
11
+ license = {text = "MIT"}
12
+ authors = [{name = "Evgeniy Vasilev", email = "aquilax@gmail.com"}]
13
+ keywords = ["tv", "commandline", "application", "show", "tvmaze"]
14
+ classifiers = [
15
+ "Development Status :: 5 - Production/Stable",
16
+ "Environment :: Console",
17
+ "Intended Audience :: End Users/Desktop",
18
+ "License :: OSI Approved :: MIT License",
19
+ "Natural Language :: English",
20
+ "Programming Language :: Python :: 3 :: Only",
21
+ "Programming Language :: Python :: 3.12",
22
+ "Topic :: Utilities",
23
+ ]
24
+ dependencies = [
25
+ "cmd2==4.2.2",
26
+ "ratelimit==2.2.1",
27
+ "tinydb==4.9.0",
28
+ "terminaltables==3.1.10",
29
+ "python-dateutil==2.9.0.post0",
30
+ "typing-extensions==4.16.0",
31
+ ]
32
+
33
+ [project.urls]
34
+ Homepage = "https://github.com/aquilax/showtime"
35
+ Repository = "https://github.com/aquilax/showtime"
36
+
37
+ [project.scripts]
38
+ showtime = "showtime.command:main"
39
+
40
+ [project.optional-dependencies]
41
+ test = [
42
+ "pytest>=7.0",
43
+ "pytest-cov>=4.0",
44
+ "mypy>=1.0",
45
+ "ratelimit-stubs>=0.2",
46
+ "types-python-dateutil>=2.8",
47
+ "types-requests>=2.28",
48
+ "tox>=4.0",
49
+ "interrogate>=1.5",
50
+ ]
51
+
52
+ [tool.setuptools]
53
+ packages = ["showtime"]
54
+
55
+ [tool.pytest.ini_options]
56
+ testpaths = ["tests"]
57
+ norecursedirs = "tests/helpers"
58
+ addopts = "-v --tb=short"
59
+
60
+ [tool.coverage.run]
61
+ source = ["showtime"]
62
+ branch = true
63
+
64
+ [tool.coverage.report]
65
+ exclude_lines = [
66
+ "pragma: no cover",
67
+ "def __repr__",
68
+ "raise AssertionError",
69
+ "raise NotImplementedError",
70
+ "if __name__ == .__main__.:",
71
+ "if TYPE_CHECKING:",
72
+ "class .*\\bProtocol\\):",
73
+ "@(abc\\.)?abstractmethod",
74
+ ]
75
+ precision = 2
76
+
77
+ [tool.mypy]
78
+ python_version = "3.12"
79
+ warn_return_any = true
80
+ warn_unused_configs = true
81
+ disallow_untyped_defs = false
82
+ disallow_incomplete_defs = false
83
+ check_untyped_defs = true
84
+ no_implicit_optional = true
85
+ warn_redundant_casts = true
86
+ warn_unused_ignores = true
87
+ warn_no_return = true
88
+ strict_optional = true
89
+ plugins = "tinydb.mypy_plugin"
90
+
91
+ [tool.ruff]
92
+ target-version = "py312"
93
+ line-length = 120
94
+ lint.select = [
95
+ "E", # pycodestyle errors
96
+ "W", # pycodestyle warnings
97
+ "F", # Pyflakes
98
+ "I", # isort
99
+ "B", # flake8-bugbear
100
+ "C4", # flake8-comprehensions
101
+ "UP", # pyupgrade
102
+ ]
103
+ lint.ignore = [
104
+ "E501", # Line too long (handled by formatter)
105
+ ]
106
+
107
+ [tool.ruff.lint.isort]
108
+ known-first-party = ["showtime"]
109
+
110
+ [tool.ruff.format]
111
+ line-length = 120
112
+
113
+ [tool.interrogate]
114
+ ignore-init-method = true
115
+ ignore-init-module = false
116
+ ignore-magic = false
117
+ ignore-semiprivate = false
118
+ ignore-private = false
119
+ ignore-module = false
120
+ fail-under = 95
121
+ exclude = ["setup.py", "docs"]
122
+ verbose = 0
123
+ quiet = false
@@ -1,8 +1,10 @@
1
1
  """API client module"""
2
2
 
3
+ from dataclasses import dataclass
3
4
  import json
4
- from typing import Dict, List, Optional
5
- import urllib3
5
+ from urllib.parse import urlencode, urlparse, urlunparse
6
+ import urllib.request
7
+ from typing import Any, Dict, List, Optional
6
8
 
7
9
  from showtime.types import ShowId, TVMazeEpisode, TVMazeShow
8
10
 
@@ -31,10 +33,36 @@ def show_to_model(show: Dict) -> TVMazeShow:
31
33
  )
32
34
 
33
35
 
36
+ def search_to_model(show_wrapped) -> TVMazeShow:
37
+ return show_to_model(show_wrapped['show'])
38
+
39
+
40
+ @dataclass
41
+ class HTTPResponse:
42
+ data: str
43
+
44
+
45
+ class HTTPClient():
46
+ """HTTP Client"""
47
+
48
+ def request(self, _method: str, url: str, fields: dict[str, str]={}) -> Any:
49
+ headers = {
50
+ "User-Agent": "showtime-cli",
51
+ "Accept": "application/json"
52
+ }
53
+
54
+ url_parts = list(urlparse(url))
55
+ url_parts[4] = urlencode(fields)
56
+ final_url = urlunparse(url_parts)
57
+ request = urllib.request.Request(final_url, headers=headers)
58
+ with urllib.request.urlopen(request) as response:
59
+ return HTTPResponse(data=response.read())
60
+
61
+
34
62
  class Api():
35
63
  """API Client"""
36
64
 
37
- def __init__(self, http: urllib3.PoolManager) -> None:
65
+ def __init__(self, http: HTTPClient) -> None:
38
66
  self.http = http
39
67
 
40
68
  def episodes_list(self, show_id: ShowId) -> List[TVMazeEpisode]:
@@ -53,8 +81,10 @@ class Api():
53
81
  """returns list of shows matching search string"""
54
82
  response = self.http.request('GET', f"{API_BASE_URL}/search/shows", fields={'q': query})
55
83
  raw_shows = json.loads(response.data.decode('utf-8'))
56
- return list(map(show_to_model, raw_shows))
84
+ return list(map(search_to_model, raw_shows))
57
85
 
58
86
 
59
87
  def get_default_pool_manager():
60
- return urllib3.PoolManager(maxsize=1, block=True, headers={'user-agent': 'showtime-cli'})
88
+ return HTTPClient()
89
+
90
+
@@ -77,7 +77,7 @@ class Output():
77
77
  show.status,
78
78
  show.url
79
79
  ])
80
- return Table(data, title='Search Results').table
80
+ return str(Table(data, title='Search Results').table)
81
81
 
82
82
  def format_episodes(self, show: Show, episodes: List[Episode]) -> str:
83
83
  """Formats as table list of episodes"""
@@ -162,7 +162,8 @@ class Output():
162
162
  'Premiered',
163
163
  'Status',
164
164
  'Episodes',
165
- 'Watched'
165
+ 'Watched',
166
+ 'Unwatched',
166
167
  ])
167
168
  for show in shows:
168
169
  data.append([
@@ -172,6 +173,7 @@ class Output():
172
173
  show['status'],
173
174
  str(show['total']),
174
175
  str(show['seen']),
176
+ str(show['total']-show['seen'])
175
177
  ])
176
178
  title = 'Unfinished shows'
177
179
  return str(Table(data, title=title).table)
@@ -16,7 +16,7 @@ from showtime.types import (DecoratedEpisode, Episode, EpisodeId, Show, ShowId,
16
16
  @limits(calls=20, period=10)
17
17
  def _get_episodes(api: Api, show_id: ShowId) -> List[TVMazeEpisode]:
18
18
  """Downloads show information from API"""
19
- return cast(List[TVMazeEpisode], api.episodes_list(show_id))
19
+ return api.episodes_list(show_id)
20
20
 
21
21
 
22
22
  def needs_update(episode: Episode, tv_maze_episode: TVMazeEpisode):
@@ -0,0 +1,46 @@
1
+ Metadata-Version: 2.4
2
+ Name: showtime-cli
3
+ Version: 0.3.25
4
+ Summary: Command line show tracker using the TVMaze public API
5
+ Author-email: Evgeniy Vasilev <aquilax@gmail.com>
6
+ License: MIT
7
+ Project-URL: Homepage, https://github.com/aquilax/showtime
8
+ Project-URL: Repository, https://github.com/aquilax/showtime
9
+ Keywords: tv,commandline,application,show,tvmaze
10
+ Classifier: Development Status :: 5 - Production/Stable
11
+ Classifier: Environment :: Console
12
+ Classifier: Intended Audience :: End Users/Desktop
13
+ Classifier: License :: OSI Approved :: MIT License
14
+ Classifier: Natural Language :: English
15
+ Classifier: Programming Language :: Python :: 3 :: Only
16
+ Classifier: Programming Language :: Python :: 3.12
17
+ Classifier: Topic :: Utilities
18
+ Requires-Python: >=3.12
19
+ Description-Content-Type: text/markdown
20
+ License-File: LICENSE
21
+ Requires-Dist: cmd2==4.2.2
22
+ Requires-Dist: ratelimit==2.2.1
23
+ Requires-Dist: tinydb==4.9.0
24
+ Requires-Dist: terminaltables==3.1.10
25
+ Requires-Dist: python-dateutil==2.9.0.post0
26
+ Requires-Dist: typing-extensions==4.16.0
27
+ Provides-Extra: test
28
+ Requires-Dist: pytest>=7.0; extra == "test"
29
+ Requires-Dist: pytest-cov>=4.0; extra == "test"
30
+ Requires-Dist: mypy>=1.0; extra == "test"
31
+ Requires-Dist: ratelimit-stubs>=0.2; extra == "test"
32
+ Requires-Dist: types-python-dateutil>=2.8; extra == "test"
33
+ Requires-Dist: types-requests>=2.28; extra == "test"
34
+ Requires-Dist: tox>=4.0; extra == "test"
35
+ Requires-Dist: interrogate>=1.5; extra == "test"
36
+ Dynamic: license-file
37
+
38
+ # showtime
39
+
40
+ Small command line interactive tv show tracker using the TvMaze API.
41
+
42
+ ## Installation
43
+
44
+ ```sh
45
+ pip install showtime-cli
46
+ ```
@@ -1,9 +1,6 @@
1
1
  LICENSE
2
- MANIFEST.in
3
2
  README.md
4
3
  pyproject.toml
5
- requirements.txt
6
- setup.py
7
4
  showtime/__init__.py
8
5
  showtime/api.py
9
6
  showtime/command.py
@@ -0,0 +1,16 @@
1
+ cmd2==4.2.2
2
+ ratelimit==2.2.1
3
+ tinydb==4.9.0
4
+ terminaltables==3.1.10
5
+ python-dateutil==2.9.0.post0
6
+ typing-extensions==4.16.0
7
+
8
+ [test]
9
+ pytest>=7.0
10
+ pytest-cov>=4.0
11
+ mypy>=1.0
12
+ ratelimit-stubs>=0.2
13
+ types-python-dateutil>=2.8
14
+ types-requests>=2.28
15
+ tox>=4.0
16
+ interrogate>=1.5
@@ -1,4 +0,0 @@
1
- include README.md
2
- include LICENSE
3
- include *.txt
4
- recursive-include docs *.txt
@@ -1,49 +0,0 @@
1
- Metadata-Version: 2.4
2
- Name: showtime-cli
3
- Version: 0.3.22
4
- Summary: Command line show tracker using the TVMaze public API
5
- Home-page: https://github.com/aquilax/showtime
6
- Author: Evgeniy Vasilev
7
- Author-email: aquilax@gmail.com
8
- License: MIT
9
- Keywords: tv commandline application show tvmaze
10
- Classifier: Development Status :: 5 - Production/Stable
11
- Classifier: Environment :: Console
12
- Classifier: Intended Audience :: End Users/Desktop
13
- Classifier: License :: OSI Approved :: MIT License
14
- Classifier: Natural Language :: English
15
- Classifier: Programming Language :: Python :: 3 :: Only
16
- Classifier: Topic :: Utilities
17
- Description-Content-Type: text/markdown
18
- License-File: LICENSE
19
- Requires-Dist: cmd2==2.5.11
20
- Requires-Dist: urllib3==2.5.0
21
- Requires-Dist: ratelimit==2.2.1
22
- Requires-Dist: tinydb==4.8.2
23
- Requires-Dist: terminaltables==3.1.10
24
- Requires-Dist: python-dateutil==2.9.0.post0
25
- Requires-Dist: typing-extensions==4.12.2
26
- Provides-Extra: test
27
- Requires-Dist: tox; extra == "test"
28
- Dynamic: author
29
- Dynamic: author-email
30
- Dynamic: classifier
31
- Dynamic: description
32
- Dynamic: description-content-type
33
- Dynamic: home-page
34
- Dynamic: keywords
35
- Dynamic: license
36
- Dynamic: license-file
37
- Dynamic: provides-extra
38
- Dynamic: requires-dist
39
- Dynamic: summary
40
-
41
- # showtime
42
-
43
- Small command line interactive tv show tracker using the TvMaze API.
44
-
45
- ## Installation
46
-
47
- ```sh
48
- pip install showtime-cli
49
- ```
@@ -1,55 +0,0 @@
1
- [build-system]
2
- requires = ["setuptools>=40.8.0", "wheel"]
3
- build-backend = "setuptools.build_meta"
4
-
5
- [tool.pytest.ini_options]
6
- norecursedirs = "tests/helpers"
7
-
8
- [tool.pylint.format]
9
- max-line-length = 120
10
-
11
- [tool.autopep8]
12
- max_line_length = 120
13
-
14
- [tool.tox]
15
- legacy_tox_ini = """
16
- [tox]
17
- env_list = py311,mypy,doc
18
-
19
- [testenv]
20
- deps =
21
- pytest
22
- pytest-cov
23
- cmd2_ext_test
24
- commands = pytest
25
-
26
- [testenv:mypy]
27
- deps =
28
- mypy
29
- ratelimit-stubs
30
- types-python-dateutil
31
- types-requests
32
- types-urllib3
33
- commands = mypy -p showtime
34
-
35
- [testenv:doc]
36
- deps = interrogate
37
- skip_install = true
38
- commands = interrogate --quiet --fail-under 80 showtime
39
- """
40
-
41
- [tool.interrogate]
42
- ignore-init-method = true
43
- ignore-init-module = false
44
- ignore-magic = false
45
- ignore-semiprivate = false
46
- ignore-private = false
47
- ignore-module = false
48
- fail-under = 95
49
- exclude = ["setup.py", "docs"]
50
- verbose = 0
51
- quiet = false
52
-
53
-
54
- [tool.mypy]
55
- plugins = "tinydb.mypy_plugin"
@@ -1,7 +0,0 @@
1
- cmd2==2.5.11
2
- urllib3==2.5.0
3
- ratelimit==2.2.1
4
- tinydb==4.8.2
5
- terminaltables==3.1.10
6
- python-dateutil==2.9.0.post0
7
- typing-extensions==4.12.2
@@ -1,55 +0,0 @@
1
- from setuptools import setup
2
- from os import path
3
-
4
- here = path.abspath(path.dirname(__file__))
5
-
6
- module_data = {}
7
- with open(path.join(here, "showtime", "__init__.py")) as fp:
8
- exec(fp.read(), module_data)
9
-
10
- # Get the long description from the README file
11
- with open(path.join(here, 'README.md'), encoding='utf-8') as f:
12
- long_description = f.read()
13
-
14
- setup(
15
- name='showtime-cli',
16
- version=module_data['__version__'],
17
- packages=[
18
- 'showtime',
19
- ],
20
- author='Evgeniy Vasilev',
21
- author_email='aquilax@gmail.com',
22
- license='MIT',
23
- description='Command line show tracker using the TVMaze public API',
24
- long_description=long_description,
25
- long_description_content_type='text/markdown',
26
- url=module_data['__url__'],
27
- keywords='tv commandline application show tvmaze',
28
- classifiers=[
29
- 'Development Status :: 5 - Production/Stable',
30
- 'Environment :: Console',
31
- 'Intended Audience :: End Users/Desktop',
32
- 'License :: OSI Approved :: MIT License',
33
- 'Natural Language :: English',
34
- 'Programming Language :: Python :: 3 :: Only',
35
- 'Topic :: Utilities',
36
- ],
37
- install_requires=[
38
- 'cmd2==2.5.11',
39
- 'urllib3==2.5.0',
40
- 'ratelimit==2.2.1',
41
- 'tinydb==4.8.2',
42
- 'terminaltables==3.1.10',
43
- 'python-dateutil==2.9.0.post0',
44
- 'typing-extensions==4.12.2',
45
- ],
46
- extras_require={
47
- 'test': ['tox'],
48
- },
49
- entry_points={
50
- 'console_scripts':
51
- [
52
- 'showtime = showtime.command:main'
53
- ]
54
- }
55
- )
@@ -1,49 +0,0 @@
1
- Metadata-Version: 2.4
2
- Name: showtime-cli
3
- Version: 0.3.22
4
- Summary: Command line show tracker using the TVMaze public API
5
- Home-page: https://github.com/aquilax/showtime
6
- Author: Evgeniy Vasilev
7
- Author-email: aquilax@gmail.com
8
- License: MIT
9
- Keywords: tv commandline application show tvmaze
10
- Classifier: Development Status :: 5 - Production/Stable
11
- Classifier: Environment :: Console
12
- Classifier: Intended Audience :: End Users/Desktop
13
- Classifier: License :: OSI Approved :: MIT License
14
- Classifier: Natural Language :: English
15
- Classifier: Programming Language :: Python :: 3 :: Only
16
- Classifier: Topic :: Utilities
17
- Description-Content-Type: text/markdown
18
- License-File: LICENSE
19
- Requires-Dist: cmd2==2.5.11
20
- Requires-Dist: urllib3==2.5.0
21
- Requires-Dist: ratelimit==2.2.1
22
- Requires-Dist: tinydb==4.8.2
23
- Requires-Dist: terminaltables==3.1.10
24
- Requires-Dist: python-dateutil==2.9.0.post0
25
- Requires-Dist: typing-extensions==4.12.2
26
- Provides-Extra: test
27
- Requires-Dist: tox; extra == "test"
28
- Dynamic: author
29
- Dynamic: author-email
30
- Dynamic: classifier
31
- Dynamic: description
32
- Dynamic: description-content-type
33
- Dynamic: home-page
34
- Dynamic: keywords
35
- Dynamic: license
36
- Dynamic: license-file
37
- Dynamic: provides-extra
38
- Dynamic: requires-dist
39
- Dynamic: summary
40
-
41
- # showtime
42
-
43
- Small command line interactive tv show tracker using the TvMaze API.
44
-
45
- ## Installation
46
-
47
- ```sh
48
- pip install showtime-cli
49
- ```
@@ -1,10 +0,0 @@
1
- cmd2==2.5.11
2
- urllib3==2.5.0
3
- ratelimit==2.2.1
4
- tinydb==4.8.2
5
- terminaltables==3.1.10
6
- python-dateutil==2.9.0.post0
7
- typing-extensions==4.12.2
8
-
9
- [test]
10
- tox
File without changes
File without changes
File without changes