README update, code linting changes

- PEP8 fix
- Remove useless parens
- Docstring fixes
- RegEX: remove unneeded escape character
- accuraterip-checksum: output usage to stderr in case of wrong invocation

Signed-off-by: JoeLametta <JoeLametta@users.noreply.github.com>
This commit is contained in:
JoeLametta
2021-05-26 08:07:07 +00:00
parent 2d34d53539
commit 06356fc40f
8 changed files with 16 additions and 12 deletions

View File

@@ -95,7 +95,7 @@ alias whipper="docker run -ti --rm --device=/dev/cdrom \
whipperteam/whipper"
```
You should put this e.g. into your `.bash_aliases`. Also keep in mind to substitute the path definitions to something that fits to your needs (e.g. replace `… -v ${PWD}/output:/output …` with `… -v ${HOME}/ripped:/output \ …`).
You should put this e.g. into your `.bash_aliases`. Also keep in mind to replace the path definitions to something that fits to your needs (e.g. replace `… -v ${PWD}/output:/output …` with `… -v ${HOME}/ripped:/output \ …`).
Essentially, what this does is to map the /home/worker/.config/whipper and ${PWD}/output (or whatever other directory you specified) on your host system to locations inside the Docker container where the files can be written and read. These directories need to exist on your system before you can run the container:
@@ -103,7 +103,7 @@ Essentially, what this does is to map the /home/worker/.config/whipper and ${PWD
Please note that the example alias written above only provides access to a single disc drive: if you've got many you will need to customise it in order to use all of them in whipper's Docker container.
Finally you can test the correct installation as such:
Finally, you can test the correct installation as such:
```
whipper -v
@@ -362,7 +362,7 @@ To make a good faith effort to ensure licensing criteria are met, this project r
The Developer Certificate of Origin (DCO) is a document that certifies you own and/or have the right to contribute the work and license it appropriately. The DCO is used instead of a _much more annoying_
[CLA (Contributor License Agreement)](https://en.wikipedia.org/wiki/Contributor_License_Agreement). With the DCO, you retain copyright of your own work :). The DCO originated in the Linux community, and is used by other projects like Git and Docker.
The DCO agreement is shown below and it's also available online: [HERE](https://developercertificate.org/).
The DCO agreement is shown below, and it's also available online: [HERE](https://developercertificate.org/).
```
Developer Certificate of Origin
@@ -425,7 +425,7 @@ WHIPPER_DEBUG=DEBUG WHIPPER_LOGFILE=whipper.log whipper offset find
gzip whipper.log
```
And attach the gzipped log file to your bug report.
Finally, attach the gzipped log file to your bug report.
Without `WHIPPER_LOGFILE` set, logging messages will go to stderr. `WHIPPER_DEBUG` accepts a string of the [default python logging levels](https://docs.python.org/3/library/logging.html#logging-levels).

View File

@@ -3,7 +3,7 @@ line tool provided by the Python `docutils` project:
rst2man whipper.rst whipper.1
Alternatively, you can also build all of the man pages in this directory at the
Alternatively, you can also build all the man pages in this directory at the
same time by running (requires `make`):
make

View File

@@ -21,7 +21,9 @@ elif len(sys.argv) == 5:
use_v1 = False
if use_v1 is None:
print('Syntax: accuraterip-checksum [--version / --accuraterip-v1 / --accuraterip-v2 (default)] filename track_number total_tracks')
print('Syntax: accuraterip-checksum [--version / --accuraterip-v1 / '
'--accuraterip-v2 (default)] filename track_number total_tracks',
file=sys.stderr)
raise SystemExit(1)
filename = sys.argv[offset + 1]

View File

@@ -37,7 +37,7 @@ class Config:
self._path = path or directory.config_path()
self._parser = configparser.ConfigParser(
inline_comment_prefixes=(';'))
inline_comment_prefixes=';')
self.open()

View File

@@ -88,7 +88,7 @@ def get_cdrom_drive_status(drive_path):
- https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/include/uapi/linux/cdrom.h # noqa: E501
:param drive_path: path to the disc drive
:type device: str
:type drive_path: str
:returns: return code of the 'CDROM_DRIVE_STATUS' ioctl
:rtype: int
"""

View File

@@ -47,9 +47,9 @@ class PathFilter:
if path[:1] == '.': # Slicing tolerant to empty strings
path = R_CH + path[1:]
if self._posix:
path = re.sub(r'[\/\x00]', R_CH, path)
path = re.sub(r'[/\x00]', R_CH, path)
if self._vfat:
path = re.sub(r'[\x00-\x1F\x7F\"\*\/\:\<\>\?\\\|]', R_CH, path)
path = re.sub(r'[\x00-\x1F\x7F\"*/:<>?\\|]', R_CH, path)
if self._whitespace:
path = re.sub(r'\s', R_CH, path)
if self._printable:

View File

@@ -578,6 +578,8 @@ class Program:
:type overread: bool
:param what: a string representing what's being read; e.g. Track
:type what: str or None
:param coverArtPath: path to the downloaded cover art file
:type coverArtPath: str or None
"""
if trackResult.number == 0:
start, stop = self.getHTOA()

View File

@@ -147,7 +147,7 @@ class LoggerTestCase(unittest.TestCase):
]
created_by_re = re.compile((
r'Log created by: whipper '
r'[\d]+\.[\d]+\.[\d]+(\+d\d{8}|\.dev[\w\.\+]+)? '
r'[\d]+\.[\d]+\.[\d]+(\+d\d{8}|\.dev[\w.+]+)? '
r'\(internal logger\)'
))
for versionScheme in versionSchemes:
@@ -156,7 +156,7 @@ class LoggerTestCase(unittest.TestCase):
actualLines[1],
re.compile((
r'Log creation date: '
r'20[\d]{2}\-[\d]{2}\-[\d]{2}T[\d]{2}:[\d]{2}:[\d]{2}Z'
r'20[\d]{2}-[\d]{2}-[\d]{2}T[\d]{2}:[\d]{2}:[\d]{2}Z'
))
)