commit a6166d1a2fa4ecaa1e5bd15333a11287c944a969
parent 42564bcca4c81b86c1d41542d726a7d91d5f9117
Author: Isak Lindhé <isak.e.lindhe@gmail.com>
Date: Tue, 19 Mar 2019 15:39:14 +0100
changed name to txtv
Diffstat:
9 files changed, 52 insertions(+), 42 deletions(-)
diff --git a/README.md b/README.md
@@ -1,9 +1,9 @@
-# svtxtv - A client for reading swedish text tv in the terminal
+# txtv - A client for reading swedish text tv in the terminal
Text-tv is great! plaintext and to-the-point news with no bullshit.
Now you can read it without touching your mouse or your tv-remote :)
-
+
## Usage
@@ -25,11 +25,11 @@ You can also give any of these arguments as an argument to run un-interactively.
## Configuration
-txtv.py will automatically generate a config file at `~/.config/svtxtv/svtxtv.conf` with default values.
+txtv.py will automatically generate a config file at `~/.config/txtv/config` with default values.
Right now the most interesting thing there is aliases which work both in CLI mode and interactive mode. You can also change what your interactive prompt looks like if you care about that.
## Links
-Here is the trello for the development of svtxtv: https://trello.com/b/aBI0DpN3/svtxtv
+Here is the trello for the development of txtv: https://trello.com/b/aBI0DpN3/svtxtv
Here is where it's scraping data from: https://www.svt.se/svttext/web/pages/100.html
diff --git a/setup.py b/setup.py
@@ -6,16 +6,16 @@ HERE = Path(__file__).parent
README = (HERE / 'README.md').read_text()
setup(
- name='svtxtv',
+ name='txtv',
version='1.0.0',
description='CLI for reading swedish text-tv',
long_description=README,
long_description_content_type='text/markdown',
- url='https://github.com/voidcase/svtxtv',
+ url='https://github.com/voidcase/txtv',
author='Isak Lindhé',
author_email='isak.e.lindhe@gmail.com',
- license='GPL3', #TODO
- py_modules=['svtxtv'],
+ license='GPLv3+',
+ py_modules=['txtv'],
package_dir={'':'src'},
classifiers=[
'Programming Language :: Python :: 3',
@@ -23,5 +23,11 @@ setup(
'Programming Language :: Python :: 3.7',
'Environment :: Console',
'License :: OSI Approved :: GNU General Public License v3 or later (GPLv3+)',
- ]
+ ],
+ entry_points={
+ 'console_scripts': [
+ 'svtxtv=svtxtv.txtv:run',
+ 'txtv=svtxtv.txtv:run',
+ ],
+ }
)
diff --git a/src/config.py b/src/config.py
@@ -1,33 +0,0 @@
-from pathlib import Path
-import configparser
-
-CONFIG_DIR = Path.home() / '.config' / 'svtxtv'
-
-def get_or_gen_config(config_path: Path = CONFIG_DIR / 'svtxtv.conf'):
- cfg = configparser.ConfigParser()
- if config_path.exists():
- cfg.read_file(open(config_path, 'r'))
- else:
- cfg['alias'] = {
- 'inrikes':'101',
- 'in':'101',
- 'utrikes':'104',
- 'ut':'104',
- 'innehåll':'700',
- }
- cfg['general'] = {
- 'prompt': 'txtv> ',
- }
- if not CONFIG_DIR.exists():
- CONFIG_DIR.mkdir()
- cfg.write(open(config_path, 'w'))
- return cfg
-
-
-def apply_aliases(txt: str, cfg: configparser.ConfigParser) -> str:
- txt = txt.strip()
- if 'alias' in cfg and txt in cfg['alias']:
- return cfg['alias'][txt]
- else:
- return txt
-
diff --git a/txtv/__main__.py b/txtv/__main__.py
@@ -0,0 +1,4 @@
+from svtxtv.txtv import run
+
+if __name__ == '__main__':
+ run()
diff --git a/txtv/config.py b/txtv/config.py
@@ -0,0 +1,33 @@
+from pathlib import Path
+import configparser
+
+CONFIG_DIR = Path.home() / '.config' / 'txtv'
+
+def get_or_gen_config(config_path: Path = CONFIG_DIR / 'config'):
+ cfg = configparser.ConfigParser()
+ if config_path.exists():
+ cfg.read_file(open(config_path, 'r'))
+ else:
+ cfg['alias'] = {
+ 'inrikes':'101',
+ 'in':'101',
+ 'utrikes':'104',
+ 'ut':'104',
+ 'innehåll':'700',
+ }
+ cfg['general'] = {
+ 'prompt': 'txtv> ',
+ }
+ if not CONFIG_DIR.exists():
+ CONFIG_DIR.mkdir()
+ cfg.write(open(config_path, 'w'))
+ return cfg
+
+
+def apply_aliases(txt: str, cfg: configparser.ConfigParser) -> str:
+ txt = txt.strip()
+ if 'alias' in cfg and txt in cfg['alias']:
+ return cfg['alias'][txt]
+ else:
+ return txt
+
diff --git a/src/listing.py b/txtv/listing.py
diff --git a/src/test.py b/txtv/test.py
diff --git a/src/txtv.py b/txtv/txtv.py
diff --git a/src/util.py b/txtv/util.py