git push
This commit is contained in:
parent
86f4865ac7
commit
8a6502bf45
|
@ -2,7 +2,7 @@ from musicutil.utils.do_replaygain import do_replaygain
|
||||||
from ..types import File
|
from ..types import File
|
||||||
from ..utils.scan_for_music import scan_for_music
|
from ..utils.scan_for_music import scan_for_music
|
||||||
from ..utils.load_tag_information import load_tag_information
|
from ..utils.load_tag_information import load_tag_information
|
||||||
from ..transcode_presets import print_transcode_presets, transcode_presets_list
|
from ..transcode_presets import print_transcode_presets
|
||||||
from ..utils.transcoder import TranscodeConfig, transcode, get_transcode_config
|
from ..utils.transcoder import TranscodeConfig, transcode, get_transcode_config
|
||||||
|
|
||||||
from os import makedirs as make_directories
|
from os import makedirs as make_directories
|
||||||
|
@ -10,7 +10,6 @@ from os.path import exists as path_exists
|
||||||
from shutil import copy as copy_file
|
from shutil import copy as copy_file
|
||||||
from copy import deepcopy as deep_copy
|
from copy import deepcopy as deep_copy
|
||||||
|
|
||||||
|
|
||||||
class CopyCommandState:
|
class CopyCommandState:
|
||||||
files: list[File] = []
|
files: list[File] = []
|
||||||
transcoded_files: list[File] = []
|
transcoded_files: list[File] = []
|
||||||
|
|
|
@ -1,3 +1,4 @@
|
||||||
|
from musicutil.types import File
|
||||||
from musicutil.utils.load_tag_information import load_tag_information
|
from musicutil.utils.load_tag_information import load_tag_information
|
||||||
from musicutil.utils.scan_for_music import scan_for_music
|
from musicutil.utils.scan_for_music import scan_for_music
|
||||||
|
|
||||||
|
@ -36,6 +37,43 @@ def get_genhtml_args(args) -> GenHTMLArgs:
|
||||||
command_args.description = args.description
|
command_args.description = args.description
|
||||||
return command_args
|
return command_args
|
||||||
|
|
||||||
|
def make_table_for_files(files: list[File]) -> str:
|
||||||
|
html_content = ""
|
||||||
|
html_content += """
|
||||||
|
<table class="pure-table pure-table-horizontal">
|
||||||
|
<thead>
|
||||||
|
<tr>
|
||||||
|
<th>Path</th>
|
||||||
|
<th>Title</th>
|
||||||
|
<th>Artist</th>
|
||||||
|
<th>Format</th>
|
||||||
|
</tr>
|
||||||
|
</thead>
|
||||||
|
<tbody>
|
||||||
|
"""
|
||||||
|
isOdd = True
|
||||||
|
for file in files:
|
||||||
|
tdClass = "pure-table-odd" if isOdd else "pure-table-even"
|
||||||
|
data_path = escape_html(file.path_from_src)
|
||||||
|
data_title = escape_html(file.tags.title)
|
||||||
|
data_artist = escape_html(file.tags.artist)
|
||||||
|
data_extension = escape_html(file.extension)
|
||||||
|
html_content += f"""
|
||||||
|
<tr class="{tdClass}">
|
||||||
|
<td>{data_path}</td>
|
||||||
|
<td>{data_title}</td>
|
||||||
|
<td>{data_artist}</td>
|
||||||
|
<td>{data_extension}</td>
|
||||||
|
</tr>
|
||||||
|
"""
|
||||||
|
isOdd = not isOdd
|
||||||
|
html_content += """
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
"""
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
class GenHTMLCommand():
|
class GenHTMLCommand():
|
||||||
def __init__(self, args: GenHTMLArgs):
|
def __init__(self, args: GenHTMLArgs):
|
||||||
self.args = args
|
self.args = args
|
||||||
|
@ -66,42 +104,14 @@ class GenHTMLCommand():
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
"""
|
"""
|
||||||
html_content += """
|
|
||||||
<table class="pure-table pure-table-horizontal">
|
|
||||||
<thead>
|
|
||||||
<tr>
|
|
||||||
<th>Path</th>
|
|
||||||
<th>Title</th>
|
|
||||||
<th>Artist</th>
|
|
||||||
<th>Format</th>
|
|
||||||
</tr>
|
|
||||||
</thead>
|
|
||||||
<tbody>
|
|
||||||
"""
|
|
||||||
isOdd = True
|
|
||||||
for file in files:
|
|
||||||
tdClass = "pure-table-odd" if isOdd else "pure-table-even"
|
|
||||||
|
|
||||||
data_path = escape_html(file.path_from_src)
|
html_content += make_table_for_files(files)
|
||||||
data_title = escape_html(file.tags.title)
|
|
||||||
data_artist = escape_html(file.tags.artist)
|
|
||||||
data_extension = escape_html(file.extension)
|
|
||||||
|
|
||||||
html_content += f"""
|
|
||||||
<tr class="{tdClass}">
|
|
||||||
<td>{data_path}</td>
|
|
||||||
<td>{data_title}</td>
|
|
||||||
<td>{data_artist}</td>
|
|
||||||
<td>{data_extension}</td>
|
|
||||||
</tr>
|
|
||||||
"""
|
|
||||||
isOdd = not isOdd
|
|
||||||
html_content += """
|
html_content += """
|
||||||
</tbody>
|
|
||||||
</table>
|
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
"""
|
"""
|
||||||
|
|
||||||
print("Writing HTML...")
|
print("Writing HTML...")
|
||||||
with open(self.args.dest, "w+") as html_file:
|
with open(self.args.dest, "w+") as html_file:
|
||||||
html_file.write(html_content)
|
html_file.write(html_content)
|
||||||
|
|
|
@ -44,11 +44,11 @@ class StatsCommand():
|
||||||
lossless_percent = (lossless_files_count/total_files_count)
|
lossless_percent = (lossless_files_count/total_files_count)
|
||||||
|
|
||||||
print("Stats:")
|
print("Stats:")
|
||||||
print(f"Total Files: {total_files_count}")
|
print(f" Total Files: {total_files_count}")
|
||||||
print(f"Lossy#: {lossy_files_count}/{total_files_count}")
|
print(f" Lossy#: {lossy_files_count}/{total_files_count}")
|
||||||
print(f"Lossless#: {lossless_files_count}/{total_files_count}")
|
print(f" Lossless#: {lossless_files_count}/{total_files_count}")
|
||||||
print(f"Lossy%: {lossy_percent:.2%}")
|
print(f" Lossy%: {lossy_percent:.2%}")
|
||||||
print(f"Lossless%: {lossless_percent:.2%}")
|
print(f" Lossless%: {lossless_percent:.2%}")
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue