Fix stripping AccurateRip URL in accurip command

Using lstrip() to remove initial part of the URL results in removing too
many characters when AccurateRip identifier has hex digits a, c or e in
the beginning (e.g. e/e/d/dBAR-006-000aadee-003920f8-4d0a3d06.bin
becomes d/dBAR-006-000aadee-003920f8-4d0a3d06.bin).

Signed-off-by: arcctgx <arcctgx@o2.pl>
This commit is contained in:
arcctgx
2022-07-09 15:18:45 +02:00
parent 8445e28f55
commit c47abef5a1

View File

@@ -35,8 +35,13 @@ retrieves and display accuraterip data from the given URL
self.parser.add_argument('url', action='store',
help="accuraterip URL to load data from")
def _strip_url_prefix(self, url):
if self.options.url.startswith(ACCURATERIP_URL):
return self.options.url[len(ACCURATERIP_URL):]
return url
def do(self):
responses = get_db_entry(self.options.url.lstrip(ACCURATERIP_URL))
responses = get_db_entry(self._strip_url_prefix(self.options.url))
count = responses[0].num_tracks