Flickr upload feature complete

This commit is contained in:
Fred Boniface 2023-11-05 14:42:08 +00:00
parent b2edd16356
commit 71c9675059
4 changed files with 9 additions and 10 deletions

1
.gitignore vendored
View File

@ -1,5 +1,6 @@
include include
bin bin
conf.toml
# ---> Python # ---> Python
# Byte-compiled / optimized / DLL files # Byte-compiled / optimized / DLL files

View File

@ -1,7 +1,5 @@
import os import os, toml
from dotenv import load_dotenv from dotenv import load_dotenv
load_dotenv() config = toml.load("conf.toml")
print(config)
flickr_key = os.getenv('FLICKR_KEY')
flickr_secret = os.getenv('FLICKR_SECRET')

View File

@ -1,7 +1,5 @@
import load_config import load_config
import image_processing import image_processing
import load_config
import publish_flickr
import os, sys import os, sys
@ -38,7 +36,8 @@ def main():
item_data = image_processing.get_image_data(item) item_data = image_processing.get_image_data(item)
file_data.append(item_data) file_data.append(item_data)
print(file_data) if load_config.config['flickr']['enable']:
import publish_flickr
publish_flickr.upload(file_data) publish_flickr.upload(file_data)
def list_files_in_directory(directory): def list_files_in_directory(directory):

View File

@ -2,7 +2,7 @@ import flickrapi
import load_config import load_config
print("Authenticating with Flickr") print("Authenticating with Flickr")
flickr = flickrapi.FlickrAPI(load_config.flickr_key, load_config.flickr_secret) flickr = flickrapi.FlickrAPI(load_config.config['flickr']['app_api'], load_config.config['flickr']['app_secret'])
flickr.authenticate_via_browser(perms='write') flickr.authenticate_via_browser(perms='write')
def upload(file_data: list): def upload(file_data: list):
@ -16,6 +16,7 @@ def upload(file_data: list):
is_public = 1, is_public = 1,
format = 'rest' format = 'rest'
) )
print("Uploading to Flickr")
def prepareTags(input_list: list): def prepareTags(input_list: list):
output_list = [] output_list = []