Last active
October 6, 2015 03:44
-
-
Save pizzapanther/5a6e44d50998ec02c4b3 to your computer and use it in GitHub Desktop.
Sync Put.io to Local
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/usr/bin/env python | |
| import os | |
| import putio | |
| OAUTH_TOKEN = 'XXXXXX' | |
| SECRET = 'XXXXXX' | |
| APPID = 'XXXXX' | |
| FOLDER_ID = 123456 | |
| def do_sync (): | |
| os.chdir('/plex') | |
| local_files = os.listdir('.') | |
| client = putio.Client(OAUTH_TOKEN) | |
| files = client.File.list(parent_id=FOLDER_ID) | |
| for file in files: | |
| if file.name not in local_files: | |
| print("Downloading: {}".format(file.name)) | |
| file.download(delete_after_download=True) | |
| else: | |
| print("Skipping: {}".format(file.name)) | |
| if __name__ == "__main__": | |
| do_sync() | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment