-
-
Notifications
You must be signed in to change notification settings - Fork 311
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
2 changed files
with
33 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,29 @@ | ||
from xiaomusic.utils import ( | ||
remove_common_prefix, | ||
) | ||
import re | ||
|
||
|
||
def removepre(filename): | ||
match = re.search(r"^(\d+)\s+\d*(.+?)\.(.*$)", filename.strip()) | ||
new_filename = filename | ||
if match: | ||
num = match.group(1) | ||
name = match.group(2).replace(".", " ").strip() | ||
suffix = match.group(3) | ||
# print(name) | ||
# print(num) | ||
# print(suffix) | ||
new_filename = f"{num}.{name}.{suffix}" | ||
|
||
print(filename, "=>", new_filename) | ||
|
||
|
||
if __name__ == "__main__": | ||
remove_common_prefix( | ||
"./tmp/【无损音质】2024年9月酷狗热歌榜TOP100合集(只选热歌最高的)首首王炸,分P合集!" | ||
) | ||
removepre(" 17 《白色风车》.mp3") | ||
removepre(" 17 《白色风车》.mp3") | ||
removepre(" 17 17 《白色风车》.mp3") | ||
removepre(" 17 17 《白色风车》.mp3") | ||
|
||
removepre(" 18 风车.mp3") | ||
removepre(" 18 色风车.mp3") | ||
removepre(" 18 18 你好.mp3") | ||
removepre(" 18 18 我好.mp3") | ||
removepre("09 009. 梁静茹-亲亲.mp3") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters