From dfaa9478cfa80296775e8945872b978c282a65fc Mon Sep 17 00:00:00 2001
From: Dan Sazonov
Date: Tue, 3 Oct 2023 14:26:20 +0300
Subject: [PATCH 01/11] Fix vulnerable dependencie
---
requirements.txt | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/requirements.txt b/requirements.txt
index ceb446b..54eda4a 100644
--- a/requirements.txt
+++ b/requirements.txt
@@ -2,7 +2,7 @@ colorama==0.4.5
mutagen==1.45.1
pyperclip~=1.8.2
-requests~=2.28.1
+requests~=2.31.0
beautifulsoup4~=4.11.1
deep_translator~=1.8.3
Unidecode~=1.3.6
\ No newline at end of file
From 8191c6710af59d23140f3dbf201a5f38f1b129cd Mon Sep 17 00:00:00 2001
From: Dan Sazonov
Date: Wed, 4 Oct 2023 10:33:29 +0300
Subject: [PATCH 02/11] Copy to the clipboard the min log
---
features.py | 26 ++++++++++++++++++++++----
main.py | 7 ++++++-
2 files changed, 28 insertions(+), 5 deletions(-)
diff --git a/features.py b/features.py
index 16462b5..d5f48d7 100644
--- a/features.py
+++ b/features.py
@@ -42,15 +42,21 @@ def get_track_title(track: EasyID3) -> list[str, str]:
return clip
-def get_title_pairs(track: EasyID3) -> str:
+def get_title_pairs(all_log: list) -> str:
+ # todo ебись как хочешь но разнеси
"""
Get nice string from the data of file
- :param track: mutagen object, metadata of this track
+ :param all_log: mutagen object, metadata of this track (ДА НИХУЯ)
:return: "artist - title"
"""
- track_title = get_track_title(track)
- return f'{track_title[0]} - {track_title[1]}'
+ out = ''
+ for track in all_log:
+ track_title = get_track_title(track)
+ out += f'{track_title[0]} - {track_title[1]}\n'
+
+ pyperclip.copy(out)
+ return out
def copy_track_title(track: EasyID3) -> None:
@@ -108,3 +114,15 @@ def read_json(file_name: str) -> dict:
with open(file_name, 'r', encoding='utf-8') as read_file:
return json.load(read_file)
+
+# def get_min_log(track: EasyID3, do_copy=False) -> str:
+# """
+# Get nice string from the data of file
+#
+# :param track: mutagen object, metadata of this track
+# :return: "artist - title"
+# """
+#
+# out = get_title_pairs(tmp_log)
+# pyperclip.copy(out)
+# return out
diff --git a/main.py b/main.py
index a843fab..8630664 100644
--- a/main.py
+++ b/main.py
@@ -178,6 +178,7 @@ def main():
:return: None
"""
logger.create_log()
+ _all_log = [] # todo optimize
# set the local variables
mp3_files, path = select_files()
@@ -200,7 +201,11 @@ def main():
logger.update_log(file_title, tmp_log)
if cli.min_scan:
- print(features.get_title_pairs(tmp_log))
+ _all_log.append(tmp_log)
+
+ if cli.min_scan:
+ out = features.get_title_pairs(_all_log)
+ print(out)
if cli.parse_mode:
logger.parse_log()
From 85dd780d7010214fc39c932f2b687048a9b9136c Mon Sep 17 00:00:00 2001
From: Dan Sazonov
Date: Wed, 4 Oct 2023 10:35:22 +0300
Subject: [PATCH 03/11] On/off copying
---
features.py | 6 ++++--
main.py | 2 +-
2 files changed, 5 insertions(+), 3 deletions(-)
diff --git a/features.py b/features.py
index d5f48d7..a2dde2f 100644
--- a/features.py
+++ b/features.py
@@ -42,11 +42,12 @@ def get_track_title(track: EasyID3) -> list[str, str]:
return clip
-def get_title_pairs(all_log: list) -> str:
+def get_title_pairs(all_log: list, do_copy=False) -> str:
# todo ебись как хочешь но разнеси
"""
Get nice string from the data of file
+ :param do_copy:
:param all_log: mutagen object, metadata of this track (ДА НИХУЯ)
:return: "artist - title"
"""
@@ -55,7 +56,8 @@ def get_title_pairs(all_log: list) -> str:
track_title = get_track_title(track)
out += f'{track_title[0]} - {track_title[1]}\n'
- pyperclip.copy(out)
+ if do_copy:
+ pyperclip.copy(out)
return out
diff --git a/main.py b/main.py
index 8630664..86e602c 100644
--- a/main.py
+++ b/main.py
@@ -204,7 +204,7 @@ def main():
_all_log.append(tmp_log)
if cli.min_scan:
- out = features.get_title_pairs(_all_log)
+ out = features.get_title_pairs(_all_log, True)
print(out)
if cli.parse_mode:
From 8b70e2e8ca48f85cb52cdd0148dc61d1405d73dd Mon Sep 17 00:00:00 2001
From: Dan Sazonov
Date: Sun, 8 Oct 2023 23:00:03 +0300
Subject: [PATCH 04/11] Add todo
---
main.py | 1 +
1 file changed, 1 insertion(+)
diff --git a/main.py b/main.py
index 86e602c..3e5c7d3 100644
--- a/main.py
+++ b/main.py
@@ -204,6 +204,7 @@ def main():
_all_log.append(tmp_log)
if cli.min_scan:
+ # todo вынести отдельно
out = features.get_title_pairs(_all_log, True)
print(out)
From 623e202d30755e832b072ee59e899018e2bc1d29 Mon Sep 17 00:00:00 2001
From: Dan Sazonov
Date: Wed, 11 Oct 2023 21:12:15 +0300
Subject: [PATCH 05/11] Update all modules
---
requirements.txt | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/requirements.txt b/requirements.txt
index 54eda4a..bb4322d 100644
--- a/requirements.txt
+++ b/requirements.txt
@@ -1,8 +1,8 @@
-colorama==0.4.5
-mutagen==1.45.1
+colorama==0.4.6
+mutagen==1.47.0
pyperclip~=1.8.2
requests~=2.31.0
-beautifulsoup4~=4.11.1
-deep_translator~=1.8.3
+beautifulsoup4==4.12.2
+deep_translator==1.11.4
Unidecode~=1.3.6
\ No newline at end of file
From 07e777b3f2b57b30f788fba4b2c57b8ce3b55c31 Mon Sep 17 00:00:00 2001
From: Dan Sazonov
Date: Sat, 21 Oct 2023 08:42:32 +0300
Subject: [PATCH 06/11] On/off copying with min-scan
---
config.py | 3 +++
features.py | 2 +-
main.py | 2 +-
3 files changed, 5 insertions(+), 2 deletions(-)
diff --git a/config.py b/config.py
index 269ddfd..3fe3297 100644
--- a/config.py
+++ b/config.py
@@ -42,6 +42,9 @@
# if True, the data entered by user won't be validated
SKIP_VALIDATION = False
+# in 'min-scan' mode, data from the output is copied to the clipboard if True
+DO_OUTPUT_COPY = True
+
class ColorMethods:
def __init__(self):
diff --git a/features.py b/features.py
index a2dde2f..8987f04 100644
--- a/features.py
+++ b/features.py
@@ -42,7 +42,7 @@ def get_track_title(track: EasyID3) -> list[str, str]:
return clip
-def get_title_pairs(all_log: list, do_copy=False) -> str:
+def get_title_pairs(all_log: list, do_copy: bool) -> str:
# todo ебись как хочешь но разнеси
"""
Get nice string from the data of file
diff --git a/main.py b/main.py
index 3e5c7d3..bb0f962 100644
--- a/main.py
+++ b/main.py
@@ -205,7 +205,7 @@ def main():
if cli.min_scan:
# todo вынести отдельно
- out = features.get_title_pairs(_all_log, True)
+ out = features.get_title_pairs(_all_log, config.DO_OUTPUT_COPY)
print(out)
if cli.parse_mode:
From 7e2b1c7dd4c4192c7ac6186e8f916d7ee9dca0c0 Mon Sep 17 00:00:00 2001
From: Dan Sazonov
Date: Sun, 22 Oct 2023 19:41:38 +0300
Subject: [PATCH 07/11] Update readme
---
README.md | 2 +-
README_ru.md | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/README.md b/README.md
index cc3c373..09fb0a9 100644
--- a/README.md
+++ b/README.md
@@ -62,7 +62,7 @@ them all. Run the program with the `-p` or `--parse` flag, set the log file and
Also, you can write the current unchanged metadata to a json file. To do this, run the program with the `-s` or `--scan` flag. I call this **manual mode** - at first you
create a json file with the unchanged metadata, then you edit them and apply it by running the program with the `-p` or `--parse` flag.
-If you need to print artist-title pairs for all tracks, use the `--min_scan` flag.
+If you need to print artist-title pairs for all tracks, use the `--min_scan` flag. The output information will be copied to the clipboard. The `DO_OUTPUT_COPY` flag in the file `config.py` is responsible for this behavior.
More Features
diff --git a/README_ru.md b/README_ru.md
index 3e0ce8b..c4930b7 100644
--- a/README_ru.md
+++ b/README_ru.md
@@ -65,7 +65,7 @@ $ python3 main.py
это **ручным режимом** - сначала ты создаешь файл с текущими метаданными, затем редактируешь его и применяешь данные к
файлам, запустив программу с флагом `-p` или `--parse`.
-Если вам нужно распечатать пары вида "артист - название" для всех треков, используйте флаг `--min_scan`.
+Если вам нужно распечатать пары вида "артист - название" для всех треков, используйте флаг `--min_scan`. Выведенная информация будет скопирована в буфер обмена. За это поведение отвечает флаг `DO_OUTPUT_COPY` в файле `config.py`.
Больше возможностей
From 02a0562f0f3a16f25ed1048924c5105b7b1edc7e Mon Sep 17 00:00:00 2001
From: Dan Sazonov
Date: Sun, 22 Oct 2023 19:50:15 +0300
Subject: [PATCH 08/11] Add info about refactoring
---
README.md | 2 ++
README_ru.md | 2 ++
2 files changed, 4 insertions(+)
diff --git a/README.md b/README.md
index 09fb0a9..4a797b5 100644
--- a/README.md
+++ b/README.md
@@ -6,6 +6,8 @@
**The simplest console tool for batch editing of mp3 metadata in interactive or manual mode**
+> Now this version of the project is in the active stage of refactoring. A roadmap of planned changes will be added later. If you want to contribute to the project already at this stage, please contact the author.
+
## 📦 Installation
Clone this repo, change the directory and install the necessary requirements:
```
diff --git a/README_ru.md b/README_ru.md
index c4930b7..df7872a 100644
--- a/README_ru.md
+++ b/README_ru.md
@@ -6,6 +6,8 @@
**Простейшая консольная тулза для редактирования метаданных mp3 файлов в интерактивном режиме**
+> Сейчас данная версия проекта находится в активной стадии рефакторинга. Позже будет добавлена дорожная карта планируемых изменений. Если вы хотите внести вклад в проект уже на данном этапе, пожалуйста, свяжитесь с автором.
+
## 📦 Установка
Склонируй этот репозиторий, перейди в новую директорию и установи нужные пакеты:
```
From 01c13c48b55e346ea007350884a7299a3496c1bd Mon Sep 17 00:00:00 2001
From: Dan Sazonov
Date: Sun, 22 Oct 2023 19:55:46 +0300
Subject: [PATCH 09/11] Improve docstrings
---
features.py | 5 ++---
main.py | 3 +--
scrap.py | 4 ++--
3 files changed, 5 insertions(+), 7 deletions(-)
diff --git a/features.py b/features.py
index 8987f04..2624c3f 100644
--- a/features.py
+++ b/features.py
@@ -43,12 +43,11 @@ def get_track_title(track: EasyID3) -> list[str, str]:
def get_title_pairs(all_log: list, do_copy: bool) -> str:
- # todo ебись как хочешь но разнеси
"""
Get nice string from the data of file
- :param do_copy:
- :param all_log: mutagen object, metadata of this track (ДА НИХУЯ)
+ :param all_log: list of mutagen object, metadata of this track
+ :param do_copy: output will be added to the clipboard, if this True
:return: "artist - title"
"""
out = ''
diff --git a/main.py b/main.py
index bb0f962..f51353d 100644
--- a/main.py
+++ b/main.py
@@ -178,7 +178,7 @@ def main():
:return: None
"""
logger.create_log()
- _all_log = [] # todo optimize
+ _all_log = []
# set the local variables
mp3_files, path = select_files()
@@ -204,7 +204,6 @@ def main():
_all_log.append(tmp_log)
if cli.min_scan:
- # todo вынести отдельно
out = features.get_title_pairs(_all_log, config.DO_OUTPUT_COPY)
print(out)
diff --git a/scrap.py b/scrap.py
index ef1e096..0505c40 100644
--- a/scrap.py
+++ b/scrap.py
@@ -12,7 +12,7 @@ def _has_cyrillic(text: str) -> bool:
Checking for Cyrillic characters in a string
:param text: the string being checked
- :return: True, if has Cyrillic
+ :return: True, if it has Cyrillic
"""
return bool(re.search('[\u0400-\u04FF]', text))
@@ -33,7 +33,7 @@ def get_album_title(artist, track):
Parse genius.com and return album title. 'Artist' and 'track' will be validated and translated to English
:param artist: name of the artist
- :param track: track title
+ :param track: title of the track
:return: title of the album
"""
data = validate_for_url((_translate(artist), _translate(track)))
From 80832b94bef985645f6ca81ab4ab39754f48776f Mon Sep 17 00:00:00 2001
From: Dan Sazonov
Date: Sun, 22 Oct 2023 19:57:43 +0300
Subject: [PATCH 10/11] Refactor colorama methods
---
config.py | 11 ++++++-----
1 file changed, 6 insertions(+), 5 deletions(-)
diff --git a/config.py b/config.py
index 3fe3297..fa77974 100644
--- a/config.py
+++ b/config.py
@@ -49,8 +49,9 @@
class ColorMethods:
def __init__(self):
colorama.init()
- self.reset = colorama.Style.RESET_ALL
- self.red = colorama.Fore.RED
- self.green = colorama.Fore.GREEN
- self.bright = colorama.Style.BRIGHT
- self.dim = colorama.Style.DIM
+
+ reset = colorama.Style.RESET_ALL
+ red = colorama.Fore.RED
+ green = colorama.Fore.GREEN
+ bright = colorama.Style.BRIGHT
+ dim = colorama.Style.DIM
From 7b6f9ce0c82057375ce8e8bfff424e186c2fa93a Mon Sep 17 00:00:00 2001
From: Dan Sazonov
Date: Sun, 22 Oct 2023 20:05:17 +0300
Subject: [PATCH 11/11] Change the version
---
config.py | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/config.py b/config.py
index fa77974..e373bbd 100644
--- a/config.py
+++ b/config.py
@@ -5,7 +5,7 @@
VERSION = {
'major': 1,
'minor': 6,
- 'micro': 1
+ 'micro': 2
}
AUTHOR = 'Dan Sazonov'