From c47abef5a17d1dd37f449f216241c6dd16e3af5a Mon Sep 17 00:00:00 2001 From: arcctgx Date: Sat, 9 Jul 2022 15:18:45 +0200 Subject: [PATCH] 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 --- whipper/command/accurip.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/whipper/command/accurip.py b/whipper/command/accurip.py index 8ea666b..c529211 100644 --- a/whipper/command/accurip.py +++ b/whipper/command/accurip.py @@ -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