Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Dev plot time #6

Open
wants to merge 14 commits into
base: master
Choose a base branch
from
Open

Dev plot time #6

wants to merge 14 commits into from

Conversation

pmhalvor
Copy link
Owner

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

@@ -27,15 +27,15 @@ def parse_recents(data = None) -> list:
def parse_current(data = None) -> dict:
content = {}

if data and (data.get("currently_playing_type") != "episode"):
if data and (data.get("currently_playing_type") == "track"):
Copy link
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
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

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.

None yet

1 participant