Compare commits

...

5 Commits

Author SHA1 Message Date
John Helmert III
eb7f13bc2c Version bump to 1.29.0 2020-04-26 02:40:56 -05:00
John Helmert III
803384da4f Update release checklist 2020-04-26 02:07:33 -05:00
John Helmert III
7acb7e9896 Add get_authors.sh and update AUTHORS.rst 2020-04-26 02:01:13 -05:00
John Helmert III
4e00011c78 Create format_list once per SubredditPage 2020-04-24 21:17:08 -05:00
John Helmert III
790f505d2f Fix mpv arguments in mailcap template 2020-03-18 09:59:45 -05:00
9 changed files with 92 additions and 22 deletions

View File

@@ -1,5 +1,5 @@
================
RTV/TUIR Contributors
RTV Contributors
================
Thanks to the following people for their contributions to this project.
@@ -60,3 +60,15 @@ Thanks to the following people for their contributions to this project.
* `geheimnisse <https://github.com/geheimnisse>`_
* `Alexander Terry <https://github.com/mralext20>`_
* `peterpans01 <https://github.com/peterpans01>`_
=================
TUIR Contributors
=================
* `John Helmert III <jchelmertt3@gmail.com>`_
* `capnhawkbill <captain@stoarmfugel.localdomain>`_
* `armandg <armandg@gmail.com>`_
* `OKelt <oakelton@gmail.com>`_
* `Francesco Turco <fturco@fastmail.fm>`_
* `John Helmert <jchelmertt3@gmail.com>`_
* `geeseven <2251985-geeseven@users.noreply.gitlab.com>`_

View File

@@ -1,7 +1,8 @@
=============
==================
RTV/TUIR Changelog
=============
==================
.. _1.29.0: https://gitlab.com/ajak/tuir/tree/v1.29.0
.. _1.28.3: https://gitlab.com/ajak/tuir/tree/v1.28.3
.. _1.28.2: https://gitlab.com/ajak/tuir/tree/v1.28.2
.. _1.28.1: https://gitlab.com/ajak/tuir/tree/v1.28.1
@@ -45,6 +46,21 @@ RTV/TUIR Changelog
.. _1.2.1: http://github.com/michael-lazar/rtv/releases/tag/v1.2.1
.. _1.2: http://github.com/michael-lazar/rtv/releases/tag/v1.2
--------------------
1.29.0_ (2020-04-26)
--------------------
Features
* Links to twitch.tv can now be opened using the video/x-youtube mailcap entry
* TUIR now supports using a mailcap in `~/.config/tuir/mailcap`, and this is
the new default path for `tuir --copy-mailcap`
* Experimental support for new config settings
"look_and_feel" and
"subreddit_format". These enable users to have greater control over the
formatting of SubredditPages. More detailed information is available in the
default config file.
--------------------
1.28.3_ (2019-09-02)
--------------------

View File

@@ -4,11 +4,10 @@ Release Checklist
1. Switch to the master branch and stash/commit any uncommited changes.
2. Bump the version number in [tuir/\_\_version\_\_.py](tuir/__version__.py).
3. Update the release notes in the [CHANGELOG.rst](CHANGELOG.rst).
<!-- TODO: Fix the build_authors script. For now it is good enough to edit manually. -->
4. Update the contributor list by running [``scripts/build_authors.py``](scripts/build_authors.py).
5. Re-generate the manpage by running [``scripts/build_manpage.py``](scripts/build_manpage.py).
6. Commit all changes to the correct branch and tag the correct commit with its version.
7. Smoke test the new release on Python 2 and Python 3.
5. Commit all changes to the correct branch and tag the correct commit with its version.
6. Re-generate the manpage by running [``scripts/build_manpage.py``](scripts/build_manpage.py).
7. Smoke test the new release on Python 3.
8. Push the unpublished changes and the tag.
9. Clean out any old build/release files by running [``scripts/pip_clean.py``](scripts/pip_clean.py).
10. Build the source tarball and binary wheel: ``$ python3 setup.py sdist bdist_wheel``

31
scripts/build_authors.sh Executable file
View File

@@ -0,0 +1,31 @@
#!/usr/bin/env bash
# TODO - this only links to users' emails, change this to linking to profiles
# like Michael's script
ROOT="$(dirname $0)/.."
AUTHORS="${ROOT}/AUTHORS.rst"
die() {
echo $@
exit 1
}
[[ -f "${AUTHORS}" ]] || die "AUTHORS.rst doesn't exist in source dir"
# Clean off the old list of contributors
sed -i '/TUIR Contributors/{n;n;Q}' ${AUTHORS}
# Add new ones
# Get a list of the "Author" fields from the commits since I took over
# maintainence of TUIR, dedupe those and format for the AUTHORS.rst file
CONTRIBUTORS=$(git log v1.27.0..HEAD |
awk '$1 ~ /Author:/' |
awk '!a[$0]++' |
sed 's/Author: /* `/; s/$/`_/g')
# TODO - Surely there's a way to compress these awks and sed into a single
# command...
# Add a space between the heading and contributors
echo "" >> ${AUTHORS}
echo "${CONTRIBUTORS}" >> ${AUTHORS}

View File

@@ -781,6 +781,7 @@ def test_subreddit_page__draw_item_format(terminal, subreddit_page):
# Loop through each individual format specifier and check for the desired behavior.
for fmt in filter(None, '%i %t %s %v %c %r %e %a %S %u %U %A %h %T %g %n %f %F'.split()):
subreddit_page.config['subreddit_format'] = fmt
subreddit_page.FORMAT_LIST = subreddit_page._create_format_list()
subreddit_page._draw_item_format(win, data, 0, 0)
try:
@@ -829,6 +830,7 @@ def test_subreddit_page__draw_item_format(terminal, subreddit_page):
# Ensure spaces aren't printed consecutively if data is absent
data['gold'] = 0
subreddit_page.config['subreddit_format'] = ' %g '
subreddit_page.FORMAT_LIST = subreddit_page._create_format_list()
subreddit_page._draw_item_format(win, data, 0, 0)
assert terminal.add_line.call_count == 1
@@ -837,6 +839,7 @@ def test_subreddit_page__draw_item_format(terminal, subreddit_page):
# Test for correct handling of separators
subreddit_page.config['subreddit_format'] = ' | '
subreddit_page.FORMAT_LIST = subreddit_page._create_format_list()
subreddit_page._draw_item_format(win, data, 0, 0)
# Should be called thrice - ' ', '|', ' '

2
tuir.1
View File

@@ -1,4 +1,4 @@
.TH "TUIR" "1" "June 13, 2019" "Version 1.28.2" "Usage and Commands"
.TH "TUIR" "1" "April 26, 2020" "Version 1.29.0" "Usage and Commands"
.SH NAME
TUIR - Terminal UI for Reddit
.SH SYNOPSIS

View File

@@ -1,4 +1,4 @@
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
__version__ = '1.28.3'
__version__ = '1.29.0'

View File

@@ -26,8 +26,9 @@ class SubredditPage(Page):
# Format separators, used by _create_format and _draw_item_format for
# attribute handling logic
FORMAT_SEP = r"<>/{}[]()|_-~"
FORMAT_SEP = r'<>/{}[]()|_-~'
FORMAT_LIST = ''
name = 'subreddit'
def __init__(self, reddit, term, config, oauth, name):
@@ -42,6 +43,23 @@ class SubredditPage(Page):
self.nav = Navigator(self.content.get)
self.toggled_subreddit = None
self.FORMAT_LIST = self._create_format_list()
# Split this out to a function mostly to simplify testing
def _create_format_list(self):
if self.config['subreddit_format']:
# Split the list between %., newlines, and separator characters to
# treat them separately
format_list = re.split(r'(%.|[\n' + re.escape(self.FORMAT_SEP) + '])',
self.config['subreddit_format'], re.DOTALL)
# Clean the list of null items. We don't need to join this list
# together again, so this is safe.
# https://stackoverflow.com/q/2197451
return [item for item in format_list if item != '']
else:
return None
def handle_selected_page(self):
"""
Open all selected pages in subwindows except other subreddit pages.
@@ -278,20 +296,11 @@ class SubredditPage(Page):
def _draw_item_format(self, win, data, valid_rows, offset):
first = True
# Split the list between %., newlines, and separator characters to
# treat them separately
format_list = re.split(r'(%.|[\n' + re.escape(self.FORMAT_SEP) + '])', self.config['subreddit_format'], re.DOTALL)
# Clean the list of null items. We don't need to join this list
# together again, so this is safe.
# https://stackoverflow.com/q/2197451
format_list = [item for item in format_list if item != '']
# Remember whether or not the last character printed was a space. If it
# was, printing more spaces should be avoided.
last_was_space = False
for item in format_list:
for item in self.FORMAT_LIST:
col = 1 if first else None
# We don't want to print consecutive spaces, so check if a space
@@ -598,7 +607,7 @@ class SubredditPage(Page):
valid_rows = range(0, n_rows)
offset = 0 if not inverted else - (data['n_rows'] - n_rows)
# FIXME - this assumes default doesn't have a subreddit_format. In the
# TODO - this assumes default doesn't have a subreddit_format. In the
# future it should, and when it does it will break this if
if self.config['subreddit_format']:
self._draw_item_format(win, data, valid_rows, offset)

View File

@@ -26,7 +26,7 @@
# Note that tuir returns a list of urls for imgur albums, so we don't put quotes
# around the `%s`
image/x-imgur-album; feh -g 640x480 -. %s; test=test -n "$DISPLAY"
image/gif; mpv '%s' --autofit 640x480 --loop=inf; test=test -n "$DISPLAY"
image/gif; mpv '%s' --autofit=640x480 --loop=inf; test=test -n "$DISPLAY"
image/*; feh -g 640x480 -. '%s'; test=test -n "$DISPLAY"
# Youtube videos are assigned a custom mime-type, which can be streamed with