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

Support Spotify #68

Closed
wants to merge 929 commits into from
Closed

Support Spotify #68

wants to merge 929 commits into from

Conversation

zjgcjy
Copy link
Contributor

@zjgcjy zjgcjy commented Oct 7, 2022

see #67

github_poster/loader/config.py Show resolved Hide resolved
Comment on lines +60 to +67
def _parse_spotify_history(self):
if os.path.exists(self.spotify_file):
with open(self.spotify_file, "r") as f:
self.number_by_date_dict = json.load(f)

def _writeback_spotify_history(self):
with open(self.spotify_file, "w") as f:
json.dump(self.number_by_date_dict, f, sort_keys=True)
Copy link
Owner

Choose a reason for hiding this comment

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

This two functions seems same as bilibili can we refactor them to one?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Maybe I can put it in BaseLoader. When needed in SpotifyLoader, use self._type to get the name of history file. If other loader needs the function to save history data, call it in the same way.

Copy link
Owner

Choose a reason for hiding this comment

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

its fine.

dest="spotify_client_id",
type=str,
required=optional,
help="",
Copy link
Owner

Choose a reason for hiding this comment

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

some helper message?

Comment on lines +70 to +79
now = datetime.datetime.now()
yesterday = now - datetime.timedelta(
1,
hours=now.hour,
minutes=now.minute,
seconds=now.second,
microseconds=now.microsecond,
)
last_yesterday = yesterday + datetime.timedelta(
hours=23, minutes=59, seconds=59
Copy link
Owner

Choose a reason for hiding this comment

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

use pendulum
maybe better?

Comment on lines +133 to +135
if before >= after:
return self.get_api_data(next_url, after, limit, data_list)
return data_list
Copy link
Owner

Choose a reason for hiding this comment

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

nice code/

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.

4 participants