-
Notifications
You must be signed in to change notification settings - Fork 289
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
Support Spotify #68
Conversation
save bilibili_history with json
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) |
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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="", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
some helper message?
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 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
use pendulum
maybe better?
if before >= after: | ||
return self.get_api_data(next_url, after, limit, data_list) | ||
return data_list |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nice code/
see #67