Skip to content

Commit

Permalink
- refactoring command line usage
Browse files Browse the repository at this point in the history
  • Loading branch information
Johannes Habel authored and Johannes Habel committed Apr 10, 2024
1 parent 42f3b42 commit 95eb4ff
Showing 1 changed file with 14 additions and 6 deletions.
20 changes: 14 additions & 6 deletions hqporner_api/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -350,16 +350,23 @@ def get_brazzers_videos(cls, pages=5) -> Generator[Video, None, None]:

def main():
parser = argparse.ArgumentParser(description="API Command Line Interface")
parser.add_argument("--download", type=str, help="URL to download from")
parser.add_argument("--quality", type=str, help="The video quality (best,half,worst)")
parser.add_argument("--file", type=str, help="(Optional) Specify a file with URLs (separated with new lines)")
parser.add_argument("--output", type=str, help="The output path (with filename)")
parser.add_argument("--download", metavar="URL (str)", type=str, help="URL to download from")
parser.add_argument("--quality", metavar="best,half,worst", type=str, help="The video quality (best,half,worst)",
required=True)
parser.add_argument("--file", metavar="Source to .txt file", type=str,
help="(Optional) Specify a file with URLs (separated with new lines)")
parser.add_argument("--output", metavar="Output directory", type=str, help="The output path (with filename)",
required=True)
parser.add_argument("--use-title", metavar="True,False", type=bool,
help="Whether to apply video title automatically to output path or not", required=True)

args = parser.parse_args()

if args.download:
client = Client()
video = client.get_video(args.download)
video.download(quality=args.quality, path=args.output)
path = Core().return_path(args=args, video=video)
video.download(quality=args.quality, path=path)

if args.file:
videos = []
Expand All @@ -372,7 +379,8 @@ def main():
videos.append(client.get_video(url))

for video in videos:
video.download(quality=args.quality, path=args.output)
path = Core().return_path(args=args, video=video)
video.download(quality=args.quality, path=path)


if __name__ == "__main__":
Expand Down

0 comments on commit 95eb4ff

Please sign in to comment.