Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Signed-off-by: BigRetroMike <[email protected]>
  • Loading branch information
bigretromike committed Aug 29, 2021
1 parent 3151c8a commit 79683c2
Show file tree
Hide file tree
Showing 3 changed files with 66 additions and 103 deletions.
78 changes: 4 additions & 74 deletions .idea/workspace.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

66 changes: 39 additions & 27 deletions api3.py
Original file line number Diff line number Diff line change
Expand Up @@ -539,6 +539,7 @@ def import_folder_update(data):

def import_folder_by_id(id):
from models import ImportFolder
# TODO PATCH
response = _import_folder_api(command='/{}'.format(int(id)), call_type=Api.PATCH)
return json.loads(response, object_hook=ImportFolder.Decoder)

Expand All @@ -565,14 +566,12 @@ def _init_api(command='', call_type=Api.GET, data={}):

def version():
from models import Version

response = _init_api(command='Version')
return json.loads(response, object_hook=Version.Decoder)


def status():
from models import Status

response = _init_api(command='status')
return json.loads(response, object_hook=Status.Decoder)

Expand Down Expand Up @@ -604,7 +603,7 @@ def database_test():


def database_instance():
response = _init_api(command='database/sqlserverinstance')
return _init_api(command='database/sqlserverinstance')

# endregion

Expand Down Expand Up @@ -960,11 +959,13 @@ def series_starts_with(query):
# x = file_path_regex('naruto')
# print(x)

x = recent_file(10)
print(x)
# ok, but slowdown
# x = recent_file(10)
# print(x)

x = unrecognized_file()
print(x)
# ok, but slowdown
# x = unrecognized_file()
# print(x)

# endregion

Expand All @@ -983,20 +984,25 @@ def series_starts_with(query):
x = import_folder()
print(x)

x = import_folder_add(data)
print(x)
# TODO not right now
# x = import_folder_add(data)
# print(x)

x = import_folder_update(data)
print(x)
# TODO not right now
# x = import_folder_update(data)
# print(x)

x = import_folder_by_id(id)
print(x)
# TODO this one need patch and body
# x = import_folder_by_id(4)
# print(x)

x = delete_import_folder_by_id(id, removeRecords=True, updateMyList=True)
print(x)
# TODO not right now
# x = delete_import_folder_by_id(2, removeRecords=True, updateMyList=True)
# print(x)

x = scan_import_folder_by_id(id)
print(x)
# b'' ok
# x = scan_import_folder_by_id(4)
# print(x)

# endregion

Expand All @@ -1011,20 +1017,26 @@ def series_starts_with(query):
x = inuse()
print(x)

x = default_user()
print(x)
# TODO HTTP Error 403: Forbidden (only in firstrun ?)
# x = default_user()
# print(x)

x = create_default_user(username, password)
print(x)
# TODO not needed now
# x = create_default_user(username, password)
# print(x)

x = start_server()
print(x)
# TODO HTTP Error 400: Bad Request
# TODO NOT NEEDED NOW
# x = start_server()
# print(x)

x = database_test()
print(x)
# TODO HTTP Error 403: Forbidden (only in firstrun ?)
# x = database_test()
# print(x)

x = database_instance()
print(x)
# TODO HTTP Error 403: Forbidden (only in firstrun ?)
# x = database_instance()
# print(x)

# endregion
# endregion
25 changes: 23 additions & 2 deletions models.py
Original file line number Diff line number Diff line change
Expand Up @@ -634,8 +634,29 @@ def Decoder(obj):


class ImportFolder:
def __init__(self):
pass
def __init__(self, id, dropfoldertype, path, filesszie, name, size):
# b'[{"ID":2,"DropFolderType":2,"Path":"\\\\\\\\AKIRA\\\\anime\\\\","FileSize":18158552044584,"Name":"NA","Size":3976},{"ID":4,"DropFolderType":1,"Path":"\\\\\\\\AKIRA\\\\photo\\\\NewNew\\\\","FileSize":20485918470,"Name":"NA","Size":2}]'
self.id = id
self.dropfoldertype = dropfoldertype
self.path = path
self.filessize = filesszie
self.name = name
self.size = size

def __repr__(self):
return '<ImportFolder({})>'.format(self.path)

class Encoder(JSONEncoder):
def default(self, o):
return o.__dict__

@staticmethod
def Decoder(obj):
if 'Path' in obj:
return ImportFolder(obj.get('ID', None), obj.get('DropFolderType', None), obj.get('Path', None),
obj.get('FileSize', None), obj.get('Name', None), obj.get('Size', None))
return obj

# endregion


Expand Down

0 comments on commit 79683c2

Please sign in to comment.