Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
M
MCC Flow
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Deploy
Releases
Package registry
Container registry
Model registry
Operate
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Köllőd Csaba
MCC Flow
Commits
4e79b9c9
Commit
4e79b9c9
authored
Jan 6, 2023
by
Köllőd Csaba
Browse files
Options
Downloads
Patches
Plain Diff
Update: Language
- switching to english and rename file
parent
a38a7d93
No related branches found
No related tags found
No related merge requests found
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
mcc-flow/__main__.py
+2
-2
2 additions, 2 deletions
mcc-flow/__main__.py
mcc-flow/file_downloader.py
+69
-0
69 additions, 0 deletions
mcc-flow/file_downloader.py
with
71 additions
and
2 deletions
mcc-flow/__main__.py
+
2
−
2
View file @
4e79b9c9
from
download
FilesOfNeuroFlowDevic
e
import
download_data
from
file_
downloade
r
import
download_data
from
merge_records
import
process_data_files_in_dir
from
merge_records
import
process_data_files_in_dir
from
gui
import
show_message
,
select_folder_in_explorer
from
gui
import
show_message
,
select_folder_in_explorer
...
@@ -13,7 +13,7 @@ def main():
...
@@ -13,7 +13,7 @@ def main():
)
)
show_message
(
'
Give credentials in terminal!
'
,
TITLE
)
show_message
(
'
Give credentials in terminal!
'
,
TITLE
)
path
=
download_data
(
path
)
path
=
download_data
(
path
)
out_file
=
input
(
'
Type
output file format ( edf / fif )
'
)
out_file
=
input
(
'
Select
output file format ( edf / fif )
'
)
process_data_files_in_dir
(
path
,
out_file
)
process_data_files_in_dir
(
path
,
out_file
)
print
(
f
'
Processed files are available in
{
path
}
'
)
print
(
f
'
Processed files are available in
{
path
}
'
)
...
...
This diff is collapsed.
Click to expand it.
mcc-flow/download
FilesOfNeuroFlowDevic
e.py
→
mcc-flow/
file_
downloade
r
.py
+
69
−
0
View file @
4e79b9c9
...
@@ -5,43 +5,43 @@ from pathlib import Path
...
@@ -5,43 +5,43 @@ from pathlib import Path
import
requests
import
requests
class
tc
olors
:
class
C
olors
:
HEADER
=
'
\033
[93m
'
HEADER
=
'
\033
[93m
'
OK
=
'
\033
[92m
'
OK
=
'
\033
[92m
'
FAIL
=
'
\033
[91m
'
FAIL
=
'
\033
[91m
'
END
C
=
'
\033
[0m
'
END
=
'
\033
[0m
'
def
download_data
(
path
=
'
.
'
):
def
download_data
(
path
=
'
.
'
):
path
=
Path
(
path
)
path
=
Path
(
path
)
print
(
"
\n
"
+
tc
olors
.
HEADER
+
"
================================
"
+
tc
olors
.
END
C
)
print
(
f
'
\n
{
C
olors
.
HEADER
}
================================
{
C
olors
.
END
}
'
)
print
(
tc
olors
.
HEADER
+
"
NeuroFlow Lab
Kutatói Alkalmazás
"
+
tc
olors
.
END
C
)
print
(
f
'
{
C
olors
.
HEADER
}
NeuroFlow Lab
File Downloader
{
C
olors
.
END
}
'
)
print
(
tc
olors
.
HEADER
+
"
================================
"
+
tc
olors
.
END
C
+
"
\n
"
)
print
(
f
'
{
C
olors
.
HEADER
}
================================
{
C
olors
.
END
}
\n
'
)
email
=
input
(
"
Kutató email címe
:
"
)
email
=
input
(
"
email address
:
"
)
password
=
getpass
(
"
Kutató jelszava
:
"
)
password
=
getpass
(
"
password
:
"
)
device
ID
=
input
(
"
Eszköz egyedi azonosítója
:
"
)
device
_id
=
input
(
"
NeuroFlow device ID
:
"
)
path
=
path
.
joinpath
(
device
ID
)
path
=
path
.
joinpath
(
device
_id
)
headers
=
{
'
Content-Type
'
:
'
application/json
'
}
headers
=
{
'
Content-Type
'
:
'
application/json
'
}
payload
=
{
'
email
'
:
email
,
'
password
'
:
password
,
'
deviceID
'
:
device
ID
}
payload
=
{
'
email
'
:
email
,
'
password
'
:
password
,
'
deviceID
'
:
device
_id
}
r
=
requests
.
post
(
'
https://europe-west3-neuroflowtest.cloudfunctions.net/testListFilesByScript
'
,
headers
=
headers
,
r
=
requests
.
post
(
'
https://europe-west3-neuroflowtest.cloudfunctions.net/testListFilesByScript
'
,
headers
=
headers
,
data
=
json
.
dumps
(
payload
))
data
=
json
.
dumps
(
payload
))
if
r
.
status_code
==
200
:
if
r
.
status_code
==
200
:
list
OfF
iles
=
r
.
json
()[
'
files
'
]
list
_of_f
iles
=
r
.
json
()[
'
files
'
]
print
(
f
'
\n
Le fogok tölteni
{
len
(
list
OfF
iles
)
}
darab fájl-t a
{
path
}
könyvtárba...
'
)
print
(
f
'
\n
{
len
(
list
_of_f
iles
)
}
files will be downloaded to
{
path
}
'
)
if
not
path
.
exists
():
if
not
path
.
exists
():
path
.
mkdir
(
parents
=
True
,
exist_ok
=
True
)
path
.
mkdir
(
parents
=
True
,
exist_ok
=
True
)
print
(
tc
olors
.
OK
+
"
Létrehoztam a
'"
+
str
(
path
)
+
"'
könytárat.
"
+
tc
olors
.
END
C
)
print
(
f
'
{
C
olors
.
OK
}{
path
}
was created
{
C
olors
.
END
}
'
)
print
(
""
)
print
(
""
)
for
i
,
file
in
enumerate
(
list
OfF
iles
):
for
i
,
file
in
enumerate
(
list
_of_f
iles
):
print
(
"
Indítom a
'"
+
file
+
"'
nevű fájl letöltését...
"
)
print
(
f
'
Downloading file
{
file
}
'
)
headers
=
{
'
Content-Type
'
:
'
application/json
'
}
headers
=
{
'
Content-Type
'
:
'
application/json
'
}
payload
=
{
'
email
'
:
email
,
'
password
'
:
password
,
'
deviceID
'
:
device
ID
,
'
fileName
'
:
file
}
payload
=
{
'
email
'
:
email
,
'
password
'
:
password
,
'
deviceID
'
:
device
_id
,
'
fileName
'
:
file
}
r
=
requests
.
post
(
'
https://europe-west3-neuroflowtest.cloudfunctions.net/testDownloadByScript
'
,
r
=
requests
.
post
(
'
https://europe-west3-neuroflowtest.cloudfunctions.net/testDownloadByScript
'
,
headers
=
headers
,
data
=
json
.
dumps
(
payload
))
headers
=
headers
,
data
=
json
.
dumps
(
payload
))
...
@@ -50,18 +50,19 @@ def download_data(path='.'):
...
@@ -50,18 +50,19 @@ def download_data(path='.'):
with
open
(
save_path
,
"
wb
"
)
as
binary_file
:
with
open
(
save_path
,
"
wb
"
)
as
binary_file
:
binary_file
.
write
(
r
.
content
)
binary_file
.
write
(
r
.
content
)
print
(
tc
olors
.
OK
+
"
LETÖLTVE
"
+
tc
olors
.
END
C
,
f
'
{
100.
*
i
/
len
(
list
OfF
iles
)
:
.
2
f
}
%
'
)
print
(
f
'
{
C
olors
.
OK
}
DONE
{
C
olors
.
END
}
{
100.
*
(
i
+
1
)
/
len
(
list
_of_f
iles
)
:
.
2
f
}
%
'
)
else
:
else
:
print
(
tc
olors
.
FAIL
+
"
HIBA
"
+
tc
olors
.
END
C
)
print
(
f
'
{
C
olors
.
FAIL
}
ERROR
{
C
olors
.
END
}
'
)
print
(
print
(
f
'
Files, corresponding to device
{
device_id
}
are stored in
{
device_id
}
folder.
\n
'
)
"
\n
A
'"
+
deviceID
+
"'
eszközhöz tartozó fájlok letöltésre kerültek a
'"
+
deviceID
+
"'
nevű könyvtárba.
\n
"
)
return
path
elif
r
.
status_code
in
(
401
,
444
,
445
):
elif
r
.
status_code
in
(
401
,
444
,
445
):
print
(
"
\n
"
+
tc
olors
.
FAIL
+
"
Hibás email cím vagy jelszó!
"
+
tc
olors
.
END
C
+
"
\n
"
)
print
(
f
'
\n
{
C
olors
.
FAIL
}
Wrong email or password!
{
C
olors
.
END
}
\n
'
)
elif
r
.
status_code
==
446
:
elif
r
.
status_code
==
446
:
print
(
"
\n
"
+
tcolors
.
FAIL
+
"
Hibás eszköz azonosító!
"
+
tcolors
.
ENDC
+
"
\n
"
)
print
(
f
'
\n
{
Colors
.
FAIL
}
Wrong device ID!
{
Colors
.
END
}
\n
'
)
return
path
exit
()
if
__name__
==
'
__main__
'
:
if
__name__
==
'
__main__
'
:
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment