-
Notifications
You must be signed in to change notification settings - Fork 1
Sourcery refactored main branch #2
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -18,10 +18,8 @@ def get_api_key() -> str: | |
| """ | ||
| url = 'https://acoustid.org/webservice' | ||
| html = requests.get(url) | ||
| match = re.search(table_pattern, html.text) | ||
| if match: | ||
| match = re.search(id_section_pattern, match.group()) | ||
| if match: | ||
| if match := re.search(table_pattern, html.text): | ||
| if match := re.search(id_section_pattern, match.group()): | ||
|
Comment on lines
-21
to
+22
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Function
|
||
| return match.group().replace("<td>", "").replace("</td>", "") | ||
| else: | ||
| print("No API Key found", file=sys.stderr) | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -8,9 +8,7 @@ class AudioFileLocator: | |
|
|
||
| def __init__(self, root_dir: str, *excluded_dirs): | ||
| self.root = root_dir | ||
| self.excluded_items = [] | ||
| for i in list(excluded_dirs[0]): | ||
| self.excluded_items.append(os.path.abspath(i)) | ||
| self.excluded_items = [os.path.abspath(i) for i in list(excluded_dirs[0])] | ||
|
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Function
|
||
|
|
||
| def locate_files(self) -> list: | ||
| """ | ||
|
|
@@ -31,7 +29,7 @@ def locate_files(self) -> list: | |
| return files | ||
|
|
||
| def __get_files_recursive(self): | ||
| result = glob.glob(self.root + "/**/*.*", recursive=True) | ||
| result = glob.glob(f"{self.root}/**/*.*", recursive=True) | ||
|
Comment on lines
-34
to
+32
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Function
|
||
| return [element for element in result if os.path.isfile(element)] | ||
|
|
||
| @staticmethod | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -15,7 +15,7 @@ | |
|
|
||
| identifier = AudioFileIdentifier(files[0]) | ||
| id = identifier.identify | ||
| print('http://musicbrainz.org/recording/%s' % id) | ||
| print(f'http://musicbrainz.org/recording/{id}') | ||
|
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Lines
|
||
|
|
||
| data = MetadataLookup.lookup(str(id)) | ||
| metadata = MetadataParser(data, TerminalAlbumChooser(files[0])).parse_metadata() | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Function
FileRestructurer.moverefactored with the following changes:use-fstring-for-concatenation)