forked from hooram/ownphotos
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
nextcloud integration, multi user with sharing / public
- Loading branch information
Hooram Nam
committed
Jul 11, 2018
1 parent
1412ed8
commit d4a4ac0
Showing
15 changed files
with
632 additions
and
119 deletions.
There are no files selected for viewing
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -36,4 +36,5 @@ protected_media | |
.vscode | ||
.coverage | ||
htmlcov | ||
samplephotos | ||
samplephotos | ||
nextcloud_media |
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
from api.models import * | ||
import owncloud as nextcloud | ||
import ipdb | ||
import time | ||
|
||
def login(user): | ||
nc = nextcloud.Client(user.nextcloud_server_address) | ||
nc.login(user.nextcloud_username, user.nextcloud_app_password) | ||
|
||
def path_to_dict(path): | ||
print(path) | ||
d = {'title': os.path.basename(path), 'absolute_path': path} | ||
try: | ||
d['children'] = [ | ||
path_to_dict(os.path.join(path, x.path)) for x in nc.list(path) | ||
if x.is_dir() | ||
] | ||
except: | ||
pass | ||
|
||
return d | ||
|
||
|
||
|
||
def list_dir(user,path): | ||
nc = nextcloud.Client(user.nextcloud_server_address) | ||
nc.login(user.nextcloud_username, user.nextcloud_app_password) | ||
return [p.path for p in nc.list(path) if p.is_dir()] | ||
|
||
|
||
|
This file contains 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
Oops, something went wrong.