diff --git a/config.json.example b/config.json.example index 1b116fe..f8cab2c 100644 --- a/config.json.example +++ b/config.json.example @@ -4,5 +4,8 @@ "instance": "pixel.nogafam.es", // maximum video size in MB (depends MAX_PHOTO_SIZE Pixelfed) - "max_video_size": 30 + "max_video_size": 30, + + // time to sleep between posts successfull updates + "timeout_btw_posts": 0 } diff --git a/igmirror.py b/igmirror.py index b51eb66..d008d65 100644 --- a/igmirror.py +++ b/igmirror.py @@ -234,11 +234,11 @@ def pixelfed_dlposts(acc_id, data): if size_in_mb > config()['max_video_size']: # hack, we "add" it on posts so it doesn't try it again! accposts.append(item['shortcode']) - print('W| image exceeds the configured Maximum of "{}MB"'.format(config()['max_video_size'])) + print('W| video exceeds the configured Maximum of "{}MB"'.format(config()['max_video_size'])) continue # try to upload to Pixelfed, it might failed depending on MAX_PHOTO_SIZE setting - print('I| fetching video for {}:{}... '.format(acc_id, item['shortcode']), end='') + print('I| fetching VIDO for {}:{}... '.format(acc_id, item['shortcode']), end='') _token, jsdata = pixelfed_postvideo(acc_id, item['video_url']) if not jsdata: print('err') @@ -249,7 +249,7 @@ def pixelfed_dlposts(acc_id, data): print('done') else: - print('I| uploading media for {}:{}... '.format(acc_id, item['shortcode']), end='') + print('I| uploading IMAGES for {}:{}... '.format(acc_id, item['shortcode']), end='') media2iterate = [a['node']['display_url'] for a in multmedia] if multiple else [item['display_url']] # we add support to multiple media here for media in media2iterate: @@ -313,11 +313,13 @@ def pixelfed_dlposts(acc_id, data): print('done') accposts.append(item['shortcode']) print('I| uploaded post {}:{} : OK'.format(acc_id, item['shortcode'])) + time.sleep(int(config()['timeout_btw_posts'])) else: print(r.text) print(r.headers) return + print('I| done updating "{}" account'.format(acc_id)) db_set('posts', acc_id, accposts) # upload media and return data