|
|
|
@ -27,7 +27,7 @@ from facebook_scraper import get_posts
|
|
|
|
|
from mastodon import Mastodon |
|
|
|
|
from vendor import split_tweet |
|
|
|
|
|
|
|
|
|
logging.basicConfig(filename='mastaface.log',level=logging.ERROR) |
|
|
|
|
logging.basicConfig(filename='mastaface.log',level=logging.INFO) |
|
|
|
|
|
|
|
|
|
# Global variables |
|
|
|
|
database_filename = 'database.pkl' |
|
|
|
@ -48,12 +48,12 @@ logging.info('Loaded config from ' + config_filename)
|
|
|
|
|
# Get history-database |
|
|
|
|
# Check if database file exists |
|
|
|
|
if path.exists(database_filename): |
|
|
|
|
logging.info('found briding-history-database at ' + database_filename) |
|
|
|
|
logging.info('Found briding-history-database at ' + database_filename) |
|
|
|
|
try: |
|
|
|
|
database = pickle.load( open( database_filename, "rb" ) ) |
|
|
|
|
except Exception as e: |
|
|
|
|
logging.error(e) |
|
|
|
|
logging.info('Loaded bridging-history-database') |
|
|
|
|
logging.debug('Loaded bridging-history-database') |
|
|
|
|
else: |
|
|
|
|
logging.warning('No bridging-history-database found at' + database_filename) |
|
|
|
|
# initialize database |
|
|
|
@ -123,7 +123,7 @@ for bridge in config['bridges']:
|
|
|
|
|
database[bridge['facebook_page']]['last_edited'] = post['time'] |
|
|
|
|
database[bridge['facebook_page']]['mastodon_statuses'] = statuses |
|
|
|
|
else: |
|
|
|
|
logging.info('No updates to bridge for'+ bridge['facebook_page'] ) |
|
|
|
|
logging.info('No updates to bridge for https://www.facebook.com/'+ bridge['facebook_page'] ) |
|
|
|
|
except Exception as e: |
|
|
|
|
logging.error('Error bridging' + bridge['facebook_page']) |
|
|
|
|
logging.debug(e) |
|
|
|
|