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

removed automatic tags being used and tidied up code #13

Merged
merged 3 commits into from May 31, 2019

Conversation

gferraro
Copy link
Contributor

No description provided.

Copy link
Member

@mjs mjs left a 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
Copy link
Member

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"])):
Copy link
Member

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)
)
Copy link
Member

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')

@gferraro gferraro merged commit 9e8ff6e into TheCacophonyProject:master May 31, 2019
@gferraro gferraro deleted the remove-automatic-tags branch May 31, 2019 04:18
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

2 participants