From 5968045ece1a755def6b9cb3ca39efef021e0989 Mon Sep 17 00:00:00 2001 From: Stefano Pigozzi Date: Sun, 14 Apr 2019 18:58:06 +0200 Subject: [PATCH] Add a few more properties --- royalnet/audio/youtubedl.py | 10 +++++----- royalnet/commands/videoinfo.py | 13 +++++++++++-- 2 files changed, 16 insertions(+), 7 deletions(-) diff --git a/royalnet/audio/youtubedl.py b/royalnet/audio/youtubedl.py index 715f8bef..89d83054 100644 --- a/royalnet/audio/youtubedl.py +++ b/royalnet/audio/youtubedl.py @@ -61,14 +61,14 @@ class YtdlInfo: self.channel_id: typing.Optional[str] = info.get("channel_id") self.channel_url: typing.Optional[str] = info.get("channel_url") self.upload_date: typing.Optional[str] = info.get("upload_date") - self.license: typing.Optional[...] = info.get("license") + self.license: typing.Optional[str] = info.get("license") self.creator: typing.Optional[...] = info.get("creator") self.title: typing.Optional[str] = info.get("title") self.alt_title: typing.Optional[...] = info.get("alt_title") self.thumbnail: typing.Optional[str] = info.get("thumbnail") self.description: typing.Optional[str] = info.get("description") - self.categories: typing.Optional[list] = info.get("categories") - self.tags: typing.Optional[list] = info.get("tags") + self.categories: typing.Optional[typing.List[str]] = info.get("categories") + self.tags: typing.Optional[typing.List[str]] = info.get("tags") self.subtitles: typing.Optional[dict] = info.get("subtitles") self.automatic_captions: typing.Optional[dict] = info.get("automatic_captions") self.duration: typing.Optional[int] = info.get("duration") @@ -81,7 +81,7 @@ class YtdlInfo: self.dislike_count: typing.Optional[int] = info.get("dislike_count") self.average_rating: typing.Optional[...] = info.get("average_rating") self.formats: typing.Optional[list] = info.get("formats") - self.is_live: typing.Optional[...] = info.get("is_live") + self.is_live: typing.Optional[bool] = info.get("is_live") self.start_time: typing.Optional[...] = info.get("start_time") self.end_time: typing.Optional[...] = info.get("end_time") self.series: typing.Optional[...] = info.get("series") @@ -94,7 +94,7 @@ class YtdlInfo: self.extractor_key: typing.Optional[str] = info.get("extractor_key") self.playlist: typing.Optional[...] = info.get("playlist") self.playlist_index: typing.Optional[...] = info.get("playlist_index") - self.thumbnails: typing.Optional[list] = info.get("thumbnails") + self.thumbnails: typing.Optional[typing.List[typing.Dict[str, str]]] = info.get("thumbnails") self.display_id: typing.Optional[str] = info.get("display_id") self.requested_subtitles: typing.Optional[...] = info.get("requested_subtitles") self.requested_formats: typing.Optional[tuple] = info.get("requested_formats") diff --git a/royalnet/commands/videoinfo.py b/royalnet/commands/videoinfo.py index 7315fd20..6ca9c4ba 100644 --- a/royalnet/commands/videoinfo.py +++ b/royalnet/commands/videoinfo.py @@ -16,9 +16,18 @@ class VideoinfoCommand(Command): for info in info_list: info_dict = info.__dict__ message = f"🔍 Dati di [b]{info}[/b]:\n" - for key in __dict__: + for key in info_dict: + # Skip description + if key == "description": + continue + # Skip formats + if key == "formats": + continue + if key == "requested_formats": + continue + # Skip empty keys if info_dict[key] is None: continue - message += f"{key}: [b]{info_dict[key]}[/b]\n" + message += f"[c]{key}[/c]: {info_dict[key]}\n" await call.reply(message) await asyncio.sleep(0.2)