Skip to content

Commit

Permalink
Pulled some code from dropbox client
Browse files Browse the repository at this point in the history
  • Loading branch information
trap000d committed Dec 8, 2016
1 parent 31b1ae4 commit c4f6312
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 21 deletions.
29 changes: 15 additions & 14 deletions KUAL/seafile/bin/sfcli.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,8 @@
import os
import sys
import shutil
from subprocess import call
from subprocess import call, Popen, PIPE
from re import findall

def spinning_cursor():
while True:
Expand Down Expand Up @@ -386,24 +387,24 @@ def sf_push():
h.writelines(('\n'.join(hashlist) + '\n').encode('utf-8'))
return;

def screen_size():
cmd = Popen('eips 99 99 " "', shell=True, stdout=PIPE)
#eips: pixel_in_range> (1600, 2400) pixel not in range (0..1072, 0..1448)
for line in cmd.stdout:
l = findall(r'\d+', line)
x = 1 + int(l[3])/( int(l[0])/100 )
y = int(l[5])/( int(l[1])/100 )
return x,y;

### --- Main start

if __name__ == '__main__':
requests.packages.urllib3.disable_warnings(SubjectAltNameWarning)
config_defaults = { 'url' :'http://seafile.example.com',
'library' :'MyLibrary',
'user' :'user',
'password' :'password',
'cert' :'True',
'local' : '/mnt/us/documents/Seafile',
'upload' : '/MyKindle',
'width' : '68',
'heigh' : '60'
}

### Some hardcoded path
cfg_dir='/mnt/us/extensions/seafile'

config = ConfigParser.RawConfigParser(config_defaults)
config = ConfigParser.RawConfigParser()
cfg_file = cfg_dir + '/seafile.cfg'
config.read( cfg_file )

Expand All @@ -414,8 +415,8 @@ def sf_push():
cert = config.get('server', 'cert')
dir_local = config.get('kindle', 'local')
dir_push = config.get('kindle', 'upload')
max_x = int(config.get('kindle', 'width'))
max_y = int(config.get('kindle', 'height'))

max_x, max_y = screen_size()

if cert == 'False':
ca_verify = False
Expand Down
Binary file modified KUAL/seafile/seafile.cfg
Binary file not shown.
4 changes: 0 additions & 4 deletions KUAL/seafile/seafile.cfg.example
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,3 @@ cert = False
[kindle]
local = /mnt/us/documents/Seafile
upload = /MyKindle_1
; screen dimensions in chars: 68x60 for PW3/KV, 48x42 for PW2
width = 68
height = 60

3 changes: 0 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,6 @@ cert = False
[kindle]
local = /mnt/us/documents/Seafile
upload = /MyKindle_1
; screen dimensions in chars: 68x60 for PW3/KV, 48x42 for PW2
width = 68
height = 60
```
Run it via KUAL menu:
- KUAL -> Seafile Sync -> Synchronize
Expand Down

0 comments on commit c4f6312

Please sign in to comment.