mirror of
https://github.com/Paillat-dev/FABLE.git
synced 2026-01-02 09:16:20 +00:00
refactor(video.py): remove unnecessary print statement
refactor(montage.py): use os.path.join instead of string concatenation refactor(thumbnail.py): use os.path.join instead of string concatenation refactor(uploader.py): use os.path.join instead of string concatenation refactor(uploader.py): add support for client_secret.json file with different names in credentials folder docs(readme.md): update instructions for openai and unsplash keys docs(readme.md): update instructions for google oauth client id json files docs(readme.md): add information about channel.yaml file in each channel's folder
This commit is contained in:
@@ -39,7 +39,19 @@ VALID_PRIVACY_STATUSES = ('public', 'private', 'unlisted')
|
||||
|
||||
# Authorize the request and store authorization credentials.
|
||||
async def get_authenticated_service(credentialsPath=""):
|
||||
CLIENT_SECRETS_FILE=f'{credentialsPath}/client_secret.json'
|
||||
CLIENT_SECRETS_FILE = ""
|
||||
try:
|
||||
CLIENT_SECRETS_FILE=os.path.join(credentialsPath, "client_secret.json")
|
||||
except:
|
||||
listdir = os.listdir(credentialsPath)
|
||||
for file in listdir:
|
||||
if file.startswith("client_secret"):
|
||||
#rename file to client_secret.json
|
||||
os.rename(os.path.join(credentialsPath, file), os.path.join(credentialsPath, "client_secret.json"))
|
||||
CLIENT_SECRETS_FILE=os.path.join(credentialsPath, "client_secret.json")
|
||||
break
|
||||
if CLIENT_SECRETS_FILE == "":
|
||||
raise FileNotFoundError("No client_secret.json file found in the specified path !")
|
||||
if os.path.exists(f'{credentialsPath}/credentials.json'):
|
||||
with open(f'{credentialsPath}/credentials.json') as json_file:
|
||||
data = json.load(json_file)
|
||||
@@ -143,7 +155,7 @@ async def upload_video(path, title, description, category, keywords, privacyStat
|
||||
print('An HTTP error %d occurred:\n%s' % (e.resp.status, e.content))
|
||||
|
||||
async def upload_thumbnail(video_id, file, credentials_path=""):
|
||||
youtube = get_authenticated_service(credentials_path)
|
||||
youtube = await get_authenticated_service(credentials_path)
|
||||
youtube.thumbnails().set( # type: ignore
|
||||
videoId=video_id,
|
||||
media_body=file
|
||||
|
||||
Reference in New Issue
Block a user