Compare commits
4 Commits
954b404031
...
42b5c2413c
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
42b5c2413c | ||
|
|
2ce6eb95ed | ||
|
|
734960e0f3 | ||
|
|
17d88ca8fe |
@ -93,6 +93,7 @@ class Config(object):
|
|||||||
REPLACE_FILES_DEFAULT_SOURCE = "/home/kae/music/Singles/tmp"
|
REPLACE_FILES_DEFAULT_SOURCE = "/home/kae/music/Singles/tmp"
|
||||||
RETURN_KEY_DEBOUNCE_MS = 1000
|
RETURN_KEY_DEBOUNCE_MS = 1000
|
||||||
ROOT = os.environ.get("ROOT") or "/home/kae/music"
|
ROOT = os.environ.get("ROOT") or "/home/kae/music"
|
||||||
|
ROW_PADDING = 4
|
||||||
ROWS_FROM_ZERO = True
|
ROWS_FROM_ZERO = True
|
||||||
SCROLL_TOP_MARGIN = 3
|
SCROLL_TOP_MARGIN = 3
|
||||||
SECTION_ENDINGS = ("-", "+-", "-+")
|
SECTION_ENDINGS = ("-", "+-", "-+")
|
||||||
|
|||||||
@ -196,7 +196,7 @@ def get_relative_date(
|
|||||||
days_str = "day"
|
days_str = "day"
|
||||||
else:
|
else:
|
||||||
days_str = "days"
|
days_str = "days"
|
||||||
return f"{weeks} {weeks_str}, {days} {days_str} ago"
|
return f"{weeks} {weeks_str}, {days} {days_str}"
|
||||||
|
|
||||||
|
|
||||||
def get_tags(path: str) -> Dict[str, Any]:
|
def get_tags(path: str) -> Dict[str, Any]:
|
||||||
|
|||||||
@ -376,7 +376,9 @@ class PlaylistModel(QAbstractTableModel):
|
|||||||
if not header_text:
|
if not header_text:
|
||||||
return QVariant(Config.TEXT_NO_TRACK_NO_NOTE)
|
return QVariant(Config.TEXT_NO_TRACK_NO_NOTE)
|
||||||
else:
|
else:
|
||||||
return QVariant(self.header_text(rat))
|
formatted_header = self.header_text(rat)
|
||||||
|
trimmed_header = self.remove_section_timer_markers(formatted_header)
|
||||||
|
return QVariant(trimmed_header)
|
||||||
else:
|
else:
|
||||||
return QVariant("")
|
return QVariant("")
|
||||||
|
|
||||||
@ -1210,6 +1212,8 @@ class PlaylistModel(QAbstractTableModel):
|
|||||||
Return header text witout markers
|
Return header text witout markers
|
||||||
"""
|
"""
|
||||||
|
|
||||||
|
if header_text == '=':
|
||||||
|
return ""
|
||||||
while header_text.endswith(Config.SECTION_STARTS):
|
while header_text.endswith(Config.SECTION_STARTS):
|
||||||
header_text = header_text[0:-1]
|
header_text = header_text[0:-1]
|
||||||
while header_text.endswith(Config.SECTION_ENDINGS):
|
while header_text.endswith(Config.SECTION_ENDINGS):
|
||||||
@ -1261,10 +1265,7 @@ class PlaylistModel(QAbstractTableModel):
|
|||||||
for row_number in range(rat.row_number - 1, -1, -1):
|
for row_number in range(rat.row_number - 1, -1, -1):
|
||||||
row_rat = self.playlist_rows[row_number]
|
row_rat = self.playlist_rows[row_number]
|
||||||
if self.is_header_row(row_number):
|
if self.is_header_row(row_number):
|
||||||
if row_rat.note.endswith("-"):
|
if row_rat.note.endswith(Config.SECTION_STARTS):
|
||||||
# There was no start of section
|
|
||||||
return rat.note
|
|
||||||
if row_rat.note.endswith(("+", "=")):
|
|
||||||
# If we are playing this section, also
|
# If we are playing this section, also
|
||||||
# calculate end time if all tracks are played.
|
# calculate end time if all tracks are played.
|
||||||
end_time_str = ""
|
end_time_str = ""
|
||||||
|
|||||||
@ -212,7 +212,7 @@ class PlaylistDelegate(QStyledItemDelegate):
|
|||||||
doc = QTextDocument()
|
doc = QTextDocument()
|
||||||
doc.setTextWidth(option.rect.width())
|
doc.setTextWidth(option.rect.width())
|
||||||
doc.setDefaultFont(option.font)
|
doc.setDefaultFont(option.font)
|
||||||
doc.setDocumentMargin(0)
|
doc.setDocumentMargin(Config.ROW_PADDING)
|
||||||
doc.setHtml(option.text)
|
doc.setHtml(option.text)
|
||||||
|
|
||||||
# For debugging +++
|
# For debugging +++
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user