From a7fb5ed5f292dc65c4a1ba4c178c472da128b024 Mon Sep 17 00:00:00 2001 From: Michael Lazar Date: Tue, 19 Apr 2016 00:16:01 -0700 Subject: [PATCH 1/6] Add ascii logo --- rtv/__init__.py | 28 +++++++++++++++++++++++++++- 1 file changed, 27 insertions(+), 1 deletion(-) diff --git a/rtv/__init__.py b/rtv/__init__.py index fc0048d..fd24762 100644 --- a/rtv/__init__.py +++ b/rtv/__init__.py @@ -1,4 +1,30 @@ # -*- coding: utf-8 -*- +""" +________ __________________________ +___ __ \__________ /_____ /__(_)_ /_ +__ /_/ / _ \ __ /_ __ /__ /_ __/ +_ _, _// __/ /_/ / / /_/ / _ / / /_ +/_/ |_| \___/\__,_/ \__,_/ /_/ \__/ + + +________ _____ ______ +___ __/__________________ ______(_)____________ ___ / +__ / _ _ \_ ___/_ __ `__ \_ /__ __ \ __ `/_ / +_ / / __/ / _ / / / / / / _ / / / /_/ /_ / +/_/ \___//_/ /_/ /_/ /_//_/ /_/ /_/\__,_/ /_/ + + +___ ______ +__ | / /__(_)_______ ______________ +__ | / /__ /_ _ \_ | /| / / _ \_ ___/ +__ |/ / _ / / __/_ |/ |/ // __/ / +_____/ /_/ \___/____/|__/ \___//_/ + + +(RTV) +""" + + from __future__ import unicode_literals from .__version__ import __version__ @@ -6,4 +32,4 @@ from .__version__ import __version__ __title__ = 'Reddit Terminal Viewer' __author__ = 'Michael Lazar' __license__ = 'The MIT License (MIT)' -__copyright__ = '(c) 2015 Michael Lazar' +__copyright__ = '(c) 2016 Michael Lazar' From 013f2727230b3cb16f77646b64a692cdb414fc40 Mon Sep 17 00:00:00 2001 From: Johnathan Jenkins Date: Tue, 19 Apr 2016 13:01:32 -0700 Subject: [PATCH 2/6] [readme] add steps for archlinux installation --- README.rst | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/README.rst b/README.rst index e00e824..f0cce7f 100644 --- a/README.rst +++ b/README.rst @@ -42,6 +42,21 @@ or clone the repository. $ cd rtv $ python3 setup.py install +Arch Linux or Arch based distros... + +.. code:: bash + + $ yaourt -S rtv + +This includes Arch Linux, Antergos, Manjaro, etc. `List`_ +You will need an aur helper such as yaourt shown above. If you are not fimilar with aur helper's, +you can find a list `here`_. There is also a *rtv-git* package if you wish to keep up to date with current code +before any releases are made. + +.. _List: https://wiki.archlinux.org/index.php/Arch_based_distributions_(active) +.. _here: https://wiki.archlinux.org/index.php/AUR_helpers#AUR_search.2Fbuild_helpers + + ===== Usage ===== From 5879234b9722f76bcaa2c65c2fc0309bf099adeb Mon Sep 17 00:00:00 2001 From: Michael Lazar Date: Tue, 19 Apr 2016 23:13:09 -0700 Subject: [PATCH 3/6] Update README.rst Shortened Arch Linux section --- README.rst | 16 +++++----------- 1 file changed, 5 insertions(+), 11 deletions(-) diff --git a/README.rst b/README.rst index f0cce7f..6d9cd75 100644 --- a/README.rst +++ b/README.rst @@ -28,13 +28,13 @@ RTV is built in **python** using the **curses** library. Installation ============ -Install using pip... +Install using pip (**recommended**)... .. code-block:: bash $ pip install rtv -or clone the repository. +or clone the repository .. code-block:: bash @@ -42,20 +42,14 @@ or clone the repository. $ cd rtv $ python3 setup.py install -Arch Linux or Arch based distros... +on Arch Linux or Arch based distros (Antergos, Manjaro, `etc.`_) you can install directly using an `aur helper`_ such as yaourt. There's also an *rtv-git* package if you wish to keep up to date with the latest development code. .. code:: bash $ yaourt -S rtv -This includes Arch Linux, Antergos, Manjaro, etc. `List`_ -You will need an aur helper such as yaourt shown above. If you are not fimilar with aur helper's, -you can find a list `here`_. There is also a *rtv-git* package if you wish to keep up to date with current code -before any releases are made. - -.. _List: https://wiki.archlinux.org/index.php/Arch_based_distributions_(active) -.. _here: https://wiki.archlinux.org/index.php/AUR_helpers#AUR_search.2Fbuild_helpers - +.. _etc.: https://wiki.archlinux.org/index.php/Arch_based_distributions_(active) +.. _aur helper: https://wiki.archlinux.org/index.php/AUR_helpers#AUR_search.2Fbuild_helpers ===== Usage From 88c9a65bf67d8e6a5fac8799317bea48726e45cc Mon Sep 17 00:00:00 2001 From: Michael Lazar Date: Tue, 19 Apr 2016 23:15:10 -0700 Subject: [PATCH 4/6] Update README.rst --- README.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.rst b/README.rst index 6d9cd75..4213bed 100644 --- a/README.rst +++ b/README.rst @@ -28,7 +28,7 @@ RTV is built in **python** using the **curses** library. Installation ============ -Install using pip (**recommended**)... +Install using pip (**recommended**) .. code-block:: bash From 775fa04353462f4ca3c6ecab9249d6cf51a22b72 Mon Sep 17 00:00:00 2001 From: Michael Lazar Date: Tue, 19 Apr 2016 23:18:50 -0700 Subject: [PATCH 5/6] Update README.rst --- README.rst | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/README.rst b/README.rst index 4213bed..32309e2 100644 --- a/README.rst +++ b/README.rst @@ -71,16 +71,16 @@ Move the cursor using either the arrow keys or *Vim* style movement - Press **right** to view the selected submission and **left** to return. - Press **?** to open the help screen. -See `CONTROLS.rst `_ for the complete list of available commands. +See `CONTROLS `_ for the complete list of available commands. -------------- Authentication -------------- -RTV enables you to login to your reddit account in order to perform actions like voting and leave comments. +RTV enables you to login to your reddit account in order to perform actions like voting and leaving comments. The login process uses OAuth [#]_ and follows these steps: -1. Initiate a login by pressing the ``u`` key. +1. Initiate the login by pressing the ``u`` key. 2. Open a new webpage where reddit will ask you to authorize the application. 3. Click **Accept**. @@ -189,7 +189,7 @@ How do I run the tests? ========= Changelog ========= -Please see `CHANGELOG.rst `_. +Please see `CHANGELOG `_ ======= License From e0550a5eabc9fc86bdd89385672a3098f5e16391 Mon Sep 17 00:00:00 2001 From: Michael Lazar Date: Tue, 19 Apr 2016 23:38:38 -0700 Subject: [PATCH 6/6] Fix bug where submission indicies were duplicated when paging. #209 --- rtv/content.py | 4 ++-- tests/test_content.py | 5 ++++- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/rtv/content.py b/rtv/content.py index dba2570..e3ee69f 100644 --- a/rtv/content.py +++ b/rtv/content.py @@ -439,9 +439,9 @@ class SubredditContent(Content): raise IndexError else: data = self.strip_praw_submission(submission) - data['index'] = index + data['index'] = len(self._submission_data) + 1 # Add the post number to the beginning of the title - data['title'] = '{0}. {1}'.format(index+1, data['title']) + data['title'] = '{0}. {1}'.format(data['index'], data['title']) self._submission_data.append(data) # Modifies the original dict, faster than copying diff --git a/tests/test_content.py b/tests/test_content.py index 7f0f147..0cdf783 100644 --- a/tests/test_content.py +++ b/tests/test_content.py @@ -216,13 +216,16 @@ def test_content_subreddit_load_more(reddit, terminal): assert content.get(50)['type'] == 'Submission' assert len(content._submission_data) == 51 - for data in islice(content.iterate(0, 1), 0, 50): + for i, data in enumerate(islice(content.iterate(0, 1), 0, 50)): assert all(k in data for k in ('object', 'n_rows', 'offset', 'type', 'index', 'title', 'split_title')) # All text should be converted to unicode by this point for val in data.values(): assert not isinstance(val, six.binary_type) + # Index be appended to each title, starting at "1." and incrementing + assert data['index'] == i + 1 + assert data['title'].startswith(six.text_type(i + 1)) def test_content_subreddit_from_name(reddit, terminal):