Skip to content

Instantly share code, notes, and snippets.

@pizzapanther
Last active October 6, 2015 03:44
Show Gist options
  • Select an option

  • Save pizzapanther/5a6e44d50998ec02c4b3 to your computer and use it in GitHub Desktop.

Select an option

Save pizzapanther/5a6e44d50998ec02c4b3 to your computer and use it in GitHub Desktop.
Sync Put.io to Local
#!/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