Skip to content

Commit

Permalink
tweek title breaks for PyOhio
Browse files Browse the repository at this point in the history
  • Loading branch information
CarlFK committed Jul 18, 2024
1 parent aba23dc commit 597eb0c
Showing 1 changed file with 32 additions and 8 deletions.
40 changes: 32 additions & 8 deletions dj/scripts/enc.py
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,27 @@ def get_title_text(self, episode):
elif episode.id in [13741, ]: # black list - don't touch this.
title2 = ''

elif episode.id in [15458, ]: # break this one on comma
pos = title.index(", ")
# +1 include the comma, + 2 skip space after it
# title1, title2 = title[:pos+1], title[pos + 2:]
# (don't keep the comma.. I think.)
title1, title2 = title[:pos], title[pos + 2:]

elif "…" in title:
if len(title) < 180:
pos = title.index("…") + 1
title1, title2 = title[:pos], title[pos:].strip()
else:
title1, title2 = title, ""

elif "! " in title:
if len(title) < 180:
pos = title.index("! ") + 1
title1, title2 = title[:pos], title[pos:].strip()
else:
title1, title2 = title, ""

elif ": " in title: # the space keeps 9:00 from breaking
if len(title) < 180:
pos = title.index(":") + 1
Expand Down Expand Up @@ -130,10 +151,6 @@ def get_title_text(self, episode):
pos = title.index(" (")
# +1 skip space in " ("
title1, title2 = title[:pos], title[pos + 1:]
elif False and ", " in title:
pos = title.index(", ")
# +1 include the comma, + 2 skip space after it
title1, title2 = title[:pos+1], title[pos + 2:]
elif " with " in title:
pos = title.index(" with ")
# +1 skip the space before the word "with"
Expand Down Expand Up @@ -201,10 +218,17 @@ def get_title_text(self, episode):
# parse into list
# strip the spaces
# padd to 3 items
l = [a.strip() for a in authors.split(',')]
authors = " and ".join(l)
l += [''] * (3-len(l))
author1, author2, author3 = l
# (I don't understand what I am doing here...)
# I guess we get one big string (authors) and 3 smaller ones.

if episode.id in [15447, ]: # black list - don't "and" this.
author1, author2, author3 = authors, "", ""
else:

l = [a.strip() for a in authors.split(',')]
authors = " and ".join(l)
l += [''] * (3-len(l))
author1, author2, author3 = l

if episode.conf_meta:
print(f"{episode.conf_meta=}")
Expand Down

0 comments on commit 597eb0c

Please sign in to comment.