mirror of
https://github.com/rakuri255/UltraSinger.git
synced 2026-11-20 13:07:52 +09:00
Merge branch 'main' into Remove_silance
# Conflicts: # ReleaseNotes.md
This commit is contained in:
commit
aa0eb432ec
4 files changed
+63
-5
No files matched your search
+8
-2
@@ -1,10 +1,16 @@
|
||||
Version: 0.0.5
|
||||
Date: 2023.12.16
|
||||
Version: 0.0.6
|
||||
Date: 2023.12.28
|
||||
Changes:
|
||||
- Optimized the removing of silence in transcription data
|
||||
- Mute the processing audio in parts where no singing is detected
|
||||
- Plot muted audio
|
||||
|
||||
Version: 0.0.5
|
||||
Date: 2023.12.23
|
||||
Changes:
|
||||
- Format GENRE string
|
||||
- Extract year from date
|
||||
|
||||
Version: 0.0.4
|
||||
Date: 2023.12.16
|
||||
Changes:
|
||||
|
||||
@@ -0,0 +1,24 @@
|
||||
"""Tests for UltraSinger.py"""
|
||||
|
||||
import unittest
|
||||
from src.UltraSinger import format_separated_string
|
||||
from src.UltraSinger import extract_year
|
||||
|
||||
class TestUltraSinger(unittest.TestCase):
|
||||
def test_format_separated_string(self):
|
||||
|
||||
self.assertEqual(format_separated_string('rock,pop,rock-pop,'), 'Rock, Pop, Rock-Pop')
|
||||
self.assertEqual(format_separated_string('rock;pop;rock-pop,'), 'Rock, Pop, Rock-Pop')
|
||||
self.assertEqual(format_separated_string('rock/pop/rock-pop,'), 'Rock, Pop, Rock-Pop')
|
||||
self.assertEqual(format_separated_string('rock,pop/rock-pop;80s,'), 'Rock, Pop, Rock-Pop, 80s')
|
||||
self.assertEqual(format_separated_string('rock, pop, rock-pop, '), 'Rock, Pop, Rock-Pop')
|
||||
|
||||
def test_extract_year(self):
|
||||
years = {extract_year("2023-12-31"), extract_year("2023-12-31 23:59:59"), extract_year("2023/12/31"),
|
||||
extract_year("2023\\12\\31"), extract_year("2023.12.31"), extract_year("2023 12 31"),
|
||||
extract_year("12-31-2023"), extract_year("12/31/2023"), extract_year("12\\31\\2023"),
|
||||
extract_year("12.31.2023"), extract_year("12 31 2023"), extract_year("12-2023"),
|
||||
extract_year("12/2023"), extract_year("2023")}
|
||||
|
||||
for year in years:
|
||||
self.assertEqual(year, "2023")
|
||||
+1
-1
@@ -1,5 +1,5 @@
|
||||
class Settings:
|
||||
APP_VERSION = "0.0.4"
|
||||
APP_VERSION = "0.0.5"
|
||||
|
||||
create_midi = True
|
||||
create_plot = False
|
||||
|
||||
+30
-2
@@ -4,6 +4,7 @@ import copy
|
||||
import getopt
|
||||
import os
|
||||
import sys
|
||||
import re
|
||||
|
||||
import Levenshtein
|
||||
import librosa
|
||||
@@ -621,9 +622,9 @@ def create_ultrastar_txt_from_automation(
|
||||
if artist is not None:
|
||||
ultrastar_header.artist = artist
|
||||
if year is not None:
|
||||
ultrastar_header.year = year
|
||||
ultrastar_header.year = extract_year(year)
|
||||
if genre is not None:
|
||||
ultrastar_header.genre = genre
|
||||
ultrastar_header.genre = format_separated_string(genre)
|
||||
|
||||
real_bpm = get_bpm_from_file(ultrastar_audio_input_path)
|
||||
ultrastar_file_output = os.path.join(
|
||||
@@ -654,6 +655,33 @@ def create_ultrastar_txt_from_automation(
|
||||
)
|
||||
return real_bpm, ultrastar_file_output
|
||||
|
||||
def extract_year(date: str) -> str:
|
||||
match = re.search(r'\b\d{4}\b', date)
|
||||
if match:
|
||||
return match.group(0)
|
||||
else:
|
||||
return date
|
||||
|
||||
def format_separated_string(data: str) -> str:
|
||||
temp = re.sub(r'[;/]', ',', data)
|
||||
words = temp.split(',')
|
||||
words = [s for s in words if s.strip()]
|
||||
|
||||
for i, word in enumerate(words):
|
||||
if "-" not in word:
|
||||
words[i] = word.strip().capitalize() + ', '
|
||||
else:
|
||||
dash_words = word.split('-')
|
||||
capitalized_dash_words = [dash_word.strip().capitalize() for dash_word in dash_words]
|
||||
formatted_dash_word = '-'.join(capitalized_dash_words) + ', '
|
||||
words[i] = formatted_dash_word
|
||||
|
||||
formatted_string = ''.join(words)
|
||||
|
||||
if formatted_string.endswith(', '):
|
||||
formatted_string = formatted_string[:-2]
|
||||
|
||||
return formatted_string
|
||||
|
||||
def infos_from_audio_input_file() -> tuple[str, str, str, tuple[str, str, str, str]]:
|
||||
"""Infos from audio input file"""
|
||||
|
||||
Reference in new issue
Block a user