From c1e6e032c98f4f67a10696f572e46828b5d6ebaa Mon Sep 17 00:00:00 2001 From: LecygneNoir Date: Tue, 8 May 2018 14:54:25 +0200 Subject: [PATCH] add checks for the jq command and update README --- README.md | 5 +++-- lib/utils.py | 6 ++++++ 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index a4aa283..ecfc62d 100644 --- a/README.md +++ b/README.md @@ -17,6 +17,7 @@ Search in your package manager, otherwise use ``pip install --upgrade`` For Peertube and if you want to use the publishAt option, you also need some utilities on you local system - [atd](https://linux.die.net/man/8/atd) daemon - [curl](https://linux.die.net/man/1/curl) + - [jq](https://stedolan.github.io/jq/) ## Configuration @@ -110,7 +111,7 @@ Options: --publishAt=DATE Publish the video at the given DATE using local server timezone. DATE should be on the form YYYY-MM-DDThh:mm:ss eg: 2018-03-12T19:00:00 DATE should be in the future - For Peertube, requires the "atd" and "curl utilities installed on the system + For Peertube, requires the "atd", "curl" and "jq" utilities installed on the system -h --help Show this help. --version Show version. @@ -147,7 +148,7 @@ Languages: - ~~thumbnail/preview~~ Canceled, waiting for Youtube's API support - [x] Use a config file (NFO) file to retrieve videos arguments - [x] Allow to choose peertube or youtube upload (to resume failed upload for example) -- [x] Add publishAt option to plan your videos (need the [atd](https://linux.die.net/man/8/atd) daemon and [curl](https://linux.die.net/man/1/curl)) +- [x] Add publishAt option to plan your videos (need the [atd](https://linux.die.net/man/8/atd) daemon, [curl](https://linux.die.net/man/1/curl) and [jq](https://stedolan.github.io/jq/)) - [ ] Record and forget: put the video in a directory, and the script uploads it for you - [ ] Usable on Desktop (Linux and/or Windows and/or MacOS) - [ ] Graphical User Interface diff --git a/lib/utils.py b/lib/utils.py index 1f2ab14..bd7b9d8 100644 --- a/lib/utils.py +++ b/lib/utils.py @@ -182,6 +182,12 @@ def publishAt(publishAt, oauth, url, idvideo, secret): except CalledProcessError: logging.error("You need to install the curl command line to use the publishAt option.") exit(1) + try: + FNULL = open(devnull, 'w') + check_call(["jq", "-V"], stdout=FNULL, stderr=STDOUT) + except CalledProcessError: + logging.error("You need to install the jq command line to use the publishAt option.") + exit(1) time = publishAt.split("T") # Remove leading seconds that atd does not manage if time[1].count(":") == 2: