Skip to content

Dev plot time#6

Open
pmhalvor wants to merge 14 commits into
masterfrom
dev-plot-time
Open

Dev plot time#6
pmhalvor wants to merge 14 commits into
masterfrom
dev-plot-time

Conversation

@pmhalvor

Copy link
Copy Markdown
Owner

start playing with new ways to present the history data I've been gathering

Comment thread radio/worker/parse.py
content = {}

if data and (data.get("currently_playing_type") != "episode"):
if data and (data.get("currently_playing_type") == "track"):

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Handling podcast playbacks

Comment on lines +19 to +37
def load_df(root=None, cleaned=False, end=False) -> pd.DataFrame:
if root is None:
root = ROOT

suffix = "_cleaned" if cleaned else ""

if os.path.exists(f'{root}/data/history{suffix}.csv'):
df = pd.read_csv(f'{root}/data/history{suffix}.csv')
print("loaded from", f'{root}/data/history{suffix}.csv')
else:
df = pd.read_csv(f'~/data/history{suffix}.csv')
print("loaded from", f'~/data/history{suffix}.csv')

max_played_at = max(df["played_at"])

# get cleaned if current df is dirty
if not end:
if ("<<<<<<" in max_played_at) or (">>>>>>>" in max(df["played_at"])) or ("=======" in max(df["played_at"])):
df, max_played_at = load_df(root, cleaned=True, end=True) # break any recursivity

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Needed for safer loading/storing history locally

@pmhalvor pmhalvor force-pushed the master branch 2 times, most recently from a77f563 to 5f6c6e8 Compare March 9, 2025 13:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant