more py3 support

This commit is contained in:
j 2016-08-31 00:35:58 +02:00
parent 2a312940b3
commit 83de14ffea

View file

@ -552,19 +552,19 @@ class Client(object):
example = example_path(self)
print('Files need to be in a folder structure like this:\n%s\n' % example)
print('The following files do not fit into the folder structure and will not be synced:')
print('\t' + '\n\t'.join([f[len(path):].encode('utf-8') for f in unknown]))
print('\t' + '\n\t'.join([f[len(path):] for f in unknown]))
print('')
if unsupported:
files = sorted(set(files) - set(unsupported))
print('The following files are in an unsupported format and will not be synced:')
print('\t' + '\n\t'.join([f[len(path):].encode('utf-8') for f in unsupported]))
print('\t' + '\n\t'.join([f[len(path):] for f in unsupported]))
print('')
'''
'''
deleted_files = filter(lambda f: f not in files, known_files)
new_files = filter(lambda f: f not in known_files, files)
deleted_files = list(filter(lambda f: f not in files, known_files))
new_files = list(filter(lambda f: f not in known_files, files))
conn, c = self._conn()
if deleted_files:
deleted = time.mktime(time.localtime())
@ -1013,7 +1013,7 @@ class API(ox.API):
if os.path.exists(i['media']):
size = ox.format_bytes(os.path.getsize(i['media']))
name = os.path.basename(filename)
print((u"uploading %s of %s (%s)" % (profile, name, size)).encode('utf-8'))
print(u"uploading %s of %s (%s)" % (profile, name, size))
url = self.url + 'upload/?profile=%s&id=%s' % (profile, i['oshash'])
if not self.upload_chunks(url, i['media'], data):
if DEBUG:
@ -1063,7 +1063,7 @@ class API(ox.API):
if uploadUrl.startswith('/'):
u = urlparse(url)
uploadUrl = '%s://%s%s' % (u.scheme, u.netloc, uploadUrl)
f = open(filename)
f = open(filename, 'rb')
fsize = os.stat(filename).st_size
done = 0
start = time.mktime(time.localtime())