mirror of
https://github.com/nathom/streamrip.git
synced 2025-05-13 22:54:55 -04:00
Add option to not truncate filname #340
This commit is contained in:
parent
e86e560ce0
commit
26da00f1a2
3 changed files with 13 additions and 5 deletions
|
@ -153,6 +153,9 @@ folder_format = "{albumartist} - {title} ({year}) [{container}] [{bit_depth}B-{s
|
||||||
track_format = "{tracknumber}. {artist} - {title}{explicit}"
|
track_format = "{tracknumber}. {artist} - {title}{explicit}"
|
||||||
# Only allow printable ASCII characters in filenames.
|
# Only allow printable ASCII characters in filenames.
|
||||||
restrict_characters = false
|
restrict_characters = false
|
||||||
|
# Truncate the filename if it is greater than 120 characters
|
||||||
|
# Setting this to false may cause downloads to fail on some systems
|
||||||
|
truncate = true
|
||||||
|
|
||||||
|
|
||||||
# Last.fm playlists are downloaded by searching for the titles of the tracks
|
# Last.fm playlists are downloaded by searching for the titles of the tracks
|
||||||
|
@ -169,4 +172,4 @@ progress_bar = "dainty"
|
||||||
|
|
||||||
[misc]
|
[misc]
|
||||||
# Metadata to identify this config file. Do not change.
|
# Metadata to identify this config file. Do not change.
|
||||||
version = "1.9.2"
|
version = "1.9.6"
|
||||||
|
|
|
@ -216,6 +216,7 @@ class RipCore(list):
|
||||||
concurrency = session["downloads"]["concurrency"]
|
concurrency = session["downloads"]["concurrency"]
|
||||||
return {
|
return {
|
||||||
"restrict_filenames": filepaths["restrict_characters"],
|
"restrict_filenames": filepaths["restrict_characters"],
|
||||||
|
"truncate_filenames": filepaths["truncate"],
|
||||||
"parent_folder": session["downloads"]["folder"],
|
"parent_folder": session["downloads"]["folder"],
|
||||||
"folder_format": filepaths["folder_format"],
|
"folder_format": filepaths["folder_format"],
|
||||||
"track_format": filepaths["track_format"],
|
"track_format": filepaths["track_format"],
|
||||||
|
|
|
@ -1516,7 +1516,9 @@ class Album(Tracklist, Media):
|
||||||
parent_folder = kwargs.get("parent_folder", "StreamripDownloads")
|
parent_folder = kwargs.get("parent_folder", "StreamripDownloads")
|
||||||
if self.folder_format:
|
if self.folder_format:
|
||||||
self.folder = self._get_formatted_folder(
|
self.folder = self._get_formatted_folder(
|
||||||
parent_folder, restrict=kwargs.get("restrict_filenames", False)
|
parent_folder,
|
||||||
|
restrict=kwargs.get("restrict_filenames", False),
|
||||||
|
truncate=kwargs.get("truncate_filenames", True),
|
||||||
)
|
)
|
||||||
else:
|
else:
|
||||||
self.folder = parent_folder
|
self.folder = parent_folder
|
||||||
|
@ -1660,7 +1662,9 @@ class Album(Tracklist, Media):
|
||||||
logger.debug("Formatter: %s", fmt)
|
logger.debug("Formatter: %s", fmt)
|
||||||
return fmt
|
return fmt
|
||||||
|
|
||||||
def _get_formatted_folder(self, parent_folder: str, restrict: bool = False) -> str:
|
def _get_formatted_folder(
|
||||||
|
self, parent_folder: str, restrict: bool = False, truncate: bool = True
|
||||||
|
) -> str:
|
||||||
"""Generate the folder name for this album.
|
"""Generate the folder name for this album.
|
||||||
|
|
||||||
:param parent_folder:
|
:param parent_folder:
|
||||||
|
@ -1675,8 +1679,8 @@ class Album(Tracklist, Media):
|
||||||
self._get_formatter(),
|
self._get_formatter(),
|
||||||
restrict=restrict,
|
restrict=restrict,
|
||||||
)
|
)
|
||||||
if len(formatted_folder) > 120:
|
if truncate and len(formatted_folder) > 120:
|
||||||
formatted_folder = f"{formatted_folder[:120]}..."
|
formatted_folder = formatted_folder[:120]
|
||||||
|
|
||||||
return os.path.join(parent_folder, formatted_folder)
|
return os.path.join(parent_folder, formatted_folder)
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue