Begin work on Mastodon/Pixelfed publishing
This commit is contained in:
parent
71c9675059
commit
41f0a5c31f
@ -1,7 +1,7 @@
|
|||||||
import pyexiv2
|
import pyexiv2
|
||||||
|
|
||||||
def get_image_data(path: str):
|
def get_image_data(path: str):
|
||||||
print(f"Opening file: {path}")
|
print(f"Reading metadata: {path}")
|
||||||
img = pyexiv2.Image(path)
|
img = pyexiv2.Image(path)
|
||||||
xmp = img.read_xmp()
|
xmp = img.read_xmp()
|
||||||
create_date = xmp.get('Xmp.xmp.CreateDate', 'N/A')
|
create_date = xmp.get('Xmp.xmp.CreateDate', 'N/A')
|
||||||
|
@ -2,4 +2,3 @@ import os, toml
|
|||||||
from dotenv import load_dotenv
|
from dotenv import load_dotenv
|
||||||
|
|
||||||
config = toml.load("conf.toml")
|
config = toml.load("conf.toml")
|
||||||
print(config)
|
|
5
main.py
5
main.py
@ -37,9 +37,14 @@ def main():
|
|||||||
file_data.append(item_data)
|
file_data.append(item_data)
|
||||||
|
|
||||||
if load_config.config['flickr']['enable']:
|
if load_config.config['flickr']['enable']:
|
||||||
|
print("Flickr publishing enabled")
|
||||||
import publish_flickr
|
import publish_flickr
|
||||||
publish_flickr.upload(file_data)
|
publish_flickr.upload(file_data)
|
||||||
|
|
||||||
|
if load_config.config['pixelfed']['enable']:
|
||||||
|
print("Pixelfed publishing enabled")
|
||||||
|
import publish_pixelfed
|
||||||
|
|
||||||
def list_files_in_directory(directory):
|
def list_files_in_directory(directory):
|
||||||
top_level_items = os.listdir(directory)
|
top_level_items = os.listdir(directory)
|
||||||
full_paths = [os.path.join(directory, item) for item in top_level_items]
|
full_paths = [os.path.join(directory, item) for item in top_level_items]
|
||||||
|
@ -7,7 +7,6 @@ flickr.authenticate_via_browser(perms='write')
|
|||||||
|
|
||||||
def upload(file_data: list):
|
def upload(file_data: list):
|
||||||
for file in file_data:
|
for file in file_data:
|
||||||
print(file)
|
|
||||||
flickr.upload(
|
flickr.upload(
|
||||||
filename = file['path'],
|
filename = file['path'],
|
||||||
title = file['title'],
|
title = file['title'],
|
||||||
|
8
publish_pixelfed.py
Normal file
8
publish_pixelfed.py
Normal file
@ -0,0 +1,8 @@
|
|||||||
|
import load_config
|
||||||
|
|
||||||
|
from mastodon import Mastodon
|
||||||
|
|
||||||
|
Mastodon.create_app("social_photos", api_base_url=load_config.config['pixelfed']['server'], user_agent="social-photos")
|
||||||
|
Mastodon.log_in(code=load_config['pixelfed']['token'])
|
||||||
|
|
||||||
|
mastodon = Mastodon(access_token = 'pytooter_usercred.secret')
|
Loading…
Reference in New Issue
Block a user