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
removed automatic tags being used and tidied up code #13
removed automatic tags being used and tidied up code #13
Conversation
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.
I've got some small suggestions but this looks great.
cptv-download.py
Outdated
|
||
def _download(self, r, api, out_base): | ||
dt = parse(r["recordingDateTime"]) | ||
file_base = dt.strftime("%Y%m%d-%H%M%S") + "-" + r["Device"]["devicename"] | ||
|
||
out_dir = self._get_out_dir(file_base, r) | ||
tracks = api.get_tracks(r["id"]).get("tracks") | ||
r["Tracks"] = tracks |
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.
why not just r["Tracks"] = api.get_tracks(r["id"]).get("tracks")
?
if self.auto_delete: | ||
self._delete_existing(file_base, out_dir) | ||
|
||
os.makedirs(out_dir, exist_ok=True) | ||
print("Processing ", file_base) | ||
|
||
if iter_to_file(fullpath + ".cptv", api.download_raw(r["id"])): | ||
if iter_to_file(fullpath.with_suffix(".cptv"), api.download_raw(r["id"])): |
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
cptv-download.py
Outdated
if self.only_tags and tags_desc not in self.only_tags: | ||
print( | ||
'Ignored file "%s" - tag "%s" is not selected' % (file_base, tags_desc) | ||
) |
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.
Using an f-string would make this more concise and readable:
print(f'Ignored file "{file_base}" - tag "{tags_desc}" is not selected')
No description provided.