youtubeuploader
youtubeuploader copied to clipboard
client_secrets.json is searched only in the working directory
The README says:
Download the client secrets JSON file [...] and save it as file
client_secrets.json
in the same directory as the utility
However, this is not how it behaves.
My setup is:
- executable:
D:\Programs\youtubeuploader_22.03\youtubeuploader.exe
- secrets file:
D:\Programs\youtubeuploader_22.03\client_secrets.json
- working directory with videos
D:\Upload\
Result:
D:\Upload>D:\Programs\youtubeuploader_22.03\youtubeuploader.exe -filename TestVideo.mkv -metaJSON TestVideo.json -metaJSONout TestVideo_out.json
2022/10/02 11:47:10 Error building OAuth client: Cannot read configuration file:
Please configure OAuth 2.0
To make this sample run, you need to populate the client_secrets.json file
found at:
D:\Upload\client_secrets.json
with information from the {{ Google Cloud Console }}
{{ https://cloud.google.com/console }}
For more information about the client_secrets.json file format, please visit:
https://developers.google.com/api-client-library/python/guide/aaa_client_secrets
My suggestion would be to:
- try reading
client_secrets.json
from the working directory first - if it doesn't exist there (and the path of the
-secrets
parameter is not an absolute path), obtain the executable's path and try readingclient_secrets.json
from there
The README says:
Download the client secrets JSON file [...] and save it as file
client_secrets.json
in the same directory as the utilityHowever, this is not how it behaves.
This is more of a suggestion of where to store the file rather than documenting how the utility works.
My suggestion would be to:
* try reading `client_secrets.json` from the working directory first * if it doesn't exist there (and the path of the `-secrets` parameter is not an absolute path), obtain the executable's path and try reading `client_secrets.json` from there
Why not just specify the secrets file with an absolute path? If -secrets
is not an absolute path, then it is a relative path - this is standard file handling behaviour for Linux/Unix utilities, and I'd rather not introduce special behaviour.
Yeah, that is also true...
The ideal case for me would be this:
- store
client_secrets.json
in the directory of the utility - not passing
-secrets
makes it read it from that location
EDIT: I'll try to explain my usecase here, maybe that makes my request more clear:
- I want to have Youtube Uploader in
PATH
and thus be able to just call it from anywhere. (that works) - At the same time, I'd like to have the secrets file at a global location when
-secrets
is NOT specified, so that Youtube Uploader actually works from anywhere. Having to copy the secrets file into the working directory or having to use-secrets %ytupl_path%\client_secrets.json
it every time removes all the comfort I get from (1).
My suggestion was mainly aiming for an easy-to-implement solution to make (2) work. I agree that the behaviour is weird and non-standard.
On the other hand I think that the current behaviour is already non-standard, as I would expect it to search for the secrets file (which I consider part of the utility's configuration) in the directory of the application itself unless -secrets
is specified.
I would also be fine with the tool trying to read the secrets file from the $HOME
directory.
Anything global would really work for me.
I'm unfortunately not a Go programmer (I mainly work with C++ and Python), else I would make a PR to improve the search paths.
I've pushed release 22.04 which should fix this. On failure to read client_secrets.json from current directory (or whatever filename might be supplied on command line), it will attempt to read file <OS default config dir>/youtubeuploader/client_secrets.json
- on Windows that should be %AppData%\youtubeuploader\client_secrets.json
This works well and simplifies the commandline a lot!
Many thanks!