Skip to content

Commit

Permalink
removed commented code
Browse files Browse the repository at this point in the history
  • Loading branch information
Strandgaard96 committed May 24, 2024
1 parent 18b8bc4 commit 8cf27a8
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 41 deletions.
8 changes: 6 additions & 2 deletions data.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Module for doing playlist manipulations."""

import json
from collections import Counter, defaultdict
from io import BytesIO
Expand Down Expand Up @@ -110,6 +111,11 @@ def get_wordcloud_image(playlist_name=None):


def get_comic():
"""Get the latest xkcd comic.
Returns:
img
"""
try:
with requests.Session() as s:
content = s.get("https://xkcd.com/info.0.json").content.decode()
Expand All @@ -129,6 +135,4 @@ def get_comic():
img = Image.open(BytesIO(res.content))
except requests.ConnectionError:
img = Image.open("data/comic.png")
# error_image = Image.open("assets/xkcd_404.jpg")
# error_image.show()
return img
39 changes: 0 additions & 39 deletions streaming_data.py
Original file line number Diff line number Diff line change
Expand Up @@ -104,45 +104,6 @@ def get_streaming_df():
return df


# Old version
# @st.cache_data
# def get_streaming_df_remote():
# dtypes = {
# "ms_played": "int",
# "trackName": "str",
# "artistName": "str",
# "reason_start": "str",
# "reason_end": "str",
# "skipped": "float",
# }
#
# # Username of your GitHub account
#
# username = "Strandgaard96"
#
# # Personal Access Token (PAO) from your GitHub account
#
# token = st.secrets["GITHUB_TOKEN"]
#
# # Creates a re-usable session object with your creds in-built
# github_session = requests.Session()
# github_session.auth = (username, token)
#
# # Downloading the csv file from your GitHub
# url = "https://raw.githubusercontent.com/Strandgaard96/data_files/master/total_streaming_data.csv" # Make sure the url is the raw version of the file on GitHub
# download = github_session.get(url).content
#
# # Reading the downloaded content and making it a pandas dataframe
# df = pd.read_csv(
# io.StringIO(download.decode("utf-8")),
# dtype=dtypes,
# parse_dates=["endTime"],
# index_col=False,
# )
#
# return df


def get_streaming_df_remote():
from st_files_connection import FilesConnection

Expand Down

0 comments on commit 8cf27a8

Please sign in to comment.