This patch replaces the previous broken approach to TOC string decoding
that used `.encode().decode('unicode_escape')` with proper parsing of
the escape sequences cdrdao is known to generate.
The new parser is also lenient with invalid escape sequences, that can
occur due to improper escaping in cdrdao. See:
https://github.com/cdrdao/cdrdao/issues/32
Latin-1:
This new parsing method should work for Latin-1 strings for both old and
new versions of cdrdao, as long as those strings don't trigger the
improper escaping issues in upstream cdrdao.
This has been verified with the album Diorama from the Danish black
metal band MØL.
MS-JIS:
This new parsing method should also work for MS-JIS strings as long as
the .toc file was generated by cdrdao 1.2.5+ and the strings don't
trigger improper escaping issues in upstream cdrdao.
Unfortunately, I don't have any CD with CD-Text in MS-JIS, so I could
not verify this.
cdrdao versions before 1.2.5 will still cause whipper to produce
mojibake (garbled characters) when reading MS-JIS CD-Text, as those
versions do not encode strings in UTF-8.
Other encodings:
As far as I know, CD-Text only supports officially ASCII, Latin-1 and
MS-JIS, but I wouldn't be surprised if there are unofficial encodings
out there, given the strange strings I've seen in some bug reports.
If you have a CD with garbled CD-Text, please submit a bug report
indicating the performer, album name, language and attach the .toc file
so that the produced strings can be compared to the expected text.
Fixes https://github.com/whipper-team/whipper/issues/169
Signed-off-by: Alicia Boya García <ntrrgc@gmail.com>
Added `os.path.basename()` to `skipped_tracks` comparison in
`ImageVerifyTask`. When `OUTPUT_DIRECTORY` is at its default '.'
`./` is prepended to the file path of `index.path`, causing the error.
Signed-off-by: blueblots <63152708+blueblots@users.noreply.github.com>
Added conditional to `program.write_m3u()` to
ignore skipped tracks.
Added skipped_tracks support to the `Program` and
`image.ImageVerifyTask` classes to avoid crashing
when a file for a skipped track doesn't exist.
Added conditional to `accurip.calculate_checksums`
to check if a path exists before trying to calculate
checksums, this prevents `accuraterip-checksum.c` from
emitting an error message (`sf_open failed!`) when a
path doesn't exist (as when a track is skipped).
Signed-off-by: blueblots <63152708+blueblots@users.noreply.github.com>
Fixed some bugs:
- MusicBrainz submit URL always has https as protocol: hardcoded, even when
inappropriate. It's just a graphical issue.
- Whipper appears to always communicate with MusicBrainz using musicbrainzngs
over http. The musicbrainzngs.set_hostname(server).
- `musicbrainzngs.set_hostname(server)` always defaults to http. Since musicbrainzngs
version 0.7 the method `set_hostname` takes an optional argument named `use_https`
(defaults to False) which whipper never passes.
Changed behaviour of `server` option (`musicbrainz` section of whipper's configuration file).
Now it expects an URL with a valid scheme (scheme must be `http` or `http`, empty scheme isn't allowed anymore).
Only the scheme and netloc parts of the URL are taken into account.
Fixes#437.
Signed-off-by: JoeLametta <JoeLametta@users.noreply.github.com>
Since whipper's own "musicbrainz id calculation" fails on CDs with data
tracks on special places, the disc id calculation code is replaced with
libdiscid.
Gives a new way to calculate disc leadout or sectors (last sector of last
audio track) depends on whether the data track is placed last or not.
`discid` requires `len(track_offsets) != last - first + 1`.Which means
there can be only one data track in the disc and the lastTrack number is
deceptive.
For example: a disc (data audio audio audio) has firstTrack=1 lastTrack=3
which is wrong since according to the discid code :
"last **audio** track as :obj:`int"
it should be 4 but the firstTrack is always 1.
The code is duplicated with _getMusicBrainzValues function.
Signed-off-by: ABCbum <kimlong221002@gmail.com>
More details about the fix to the testDuration failure (regression):
```
FAIL: testDuration (whipper.test.test_image_toc.CapitalMergeTestCase)
testDuration
----------------------------------------------------------------------
Traceback (most recent call last):
File "/home/travis/virtualenv/python3.5.6/lib/python3.5/site-packages/twisted/internet/defer.py", line 151, in maybeDeferred
result = f(*args, **kw)
File "/home/travis/virtualenv/python3.5.6/lib/python3.5/site-packages/twisted/internet/utils.py", line 221, in runWithWarningsSuppressed
reraise(exc_info[1], exc_info[2])
File "/home/travis/virtualenv/python3.5.6/lib/python3.5/site-packages/twisted/python/compat.py", line 464, in reraise
raise exception.with_traceback(traceback)
File "/home/travis/virtualenv/python3.5.6/lib/python3.5/site-packages/twisted/internet/utils.py", line 217, in runWithWarningsSuppressed
result = f(*a, **kw)
File "/home/travis/build/whipper-team/whipper/whipper/test/test_image_toc.py", line 271, in testDuration
self.assertEqual(self.table.getFrameLength(), 173530)
File "/home/travis/virtualenv/python3.5.6/lib/python3.5/site-packages/twisted/trial/_synctest.py", line 432, in assertEqual
super(_Assertions, self).assertEqual(first, second, msg)
File "/opt/python/3.5.6/lib/python3.5/unittest/case.py", line 829, in assertEqual
assertion_func(first, second, msg=msg)
File "/opt/python/3.5.6/lib/python3.5/unittest/case.py", line 822, in _baseAssertEqual
raise self.failureException(msg)
twisted.trial.unittest.FailTest: 184930 != 173530
```
The test fails because if either nextTrack.session or thisTrack.session are None the if is false and the instructions inside it aren't executed. The check for None is needed because Python 3 doesn't allow NoneType comparisons (in Python 2 that was possible).
IIRC correctly in that test nextTrack.session has value 2 while thisTrack.session is None. That means the Python 2 version evaluates the if condition to true, while the Python 3 version in the first commit does not.
With this change both of the values of nextTrack.session and thisTrack.session are compared as int (if None, the value 1 is used for the comparison - as in disc session 1).
Regression introduced in 64dd9d843a.
Signed-off-by: JoeLametta <JoeLametta@users.noreply.github.com>
- Removed unused code not portable due to buffer() use
- raw_input() does not exist in Python 3
- Fixed octal constant syntax for Python 3
- Fixed TypeError
- Replace if not exists: makedirs(path) with single call: using makedirs(path, exist_ok=True)
- Class inherits from object, can be safely removed from bases in python3: pylint's useless-object-inheritance (W0235) check
Signed-off-by: JoeLametta <JoeLametta@users.noreply.github.com>
- Replace print statement with function call
- Replace except ..., ...: syntax with except ... as ...:
- Simplify obsolete try ... except ... code block
- Replace some unicode calls with u-prefixed strings
- Do not use `len(SEQUENCE)` to determine if a sequence is empty
- Replace dictionary creation
- Drop support for GObject static bindings
- Fix PEP8's line too long warning
- Remove useless parentheses
- Use triple quotes for docstring
- Address pylint's 'inconsistent-return-statements'
- Specify string format arguments as logging function parameters
- Comment out already disabled block of code
- Remove useless else (after return)
- Remove useless statement
- Do not import already imported module
* freedb: Import from python-audio-tools 660ee2c
License: GPL-2.0+
* freedb: Remove unused code and set client name to whipper.
The removed functions depend on other classes of python-audio-tools,
but aren't needed here.
* cddb-py: replace with newer freedb implementation
The last release of cddb-py was 15 years ago. The freedb code taken
from python-audio-tools speaks protocol version 6 (Unicode) and is
compatible to both Python 2 and 3.
* freedb: Don't allow the pedantic CI test to fail
This commit also includes:
- whitespace / code formatting fixes
- slight syntax related changes: except <exception_name>, e -> except <exception_name> as e
- 3 pointless instructions instances have been rewritten [sorted] (spotted by semi-automatic check)
The unrelated changes shouldn't have any real impact on whipper's behaviour.
- output path no longer has fallbacks
- refactor accuraterip cache
- use requests to download accuraterip entries
- add tests for accuraterip functionality
- remove gobject support from accuraterip-checksum calculation
- default track template now includes extension
- begin to remove support for continuing rip
- begin to use print instead of sys.stdout.write() throughout
Some of this seems to be debug code which has been left in, some of it
seems to just be old code that was commented out and never put back in
and probably just forgotten about. Either way, we use git for a reason,
so there's no need for these code snippets to stick around. The code
history can be inspected and old code retrieved that way.
Make MusicBrainz consistently written as "MusicBrainz" and not
"musicbrainz" or "Musicbrainz".
Doesn't change instances that refer to the Python module or similar.