Skip to content

Free Motion Capture for Everyone πŸ’€βœ¨

TypeScript

changes for v.0.1.0

aaroncherian6a50fbee1bc2
diff --git a/freemocap/__init__.py b/freemocap/__init__.py
index b2ca9c89..d089c90c 100644
--- a/freemocap/__init__.py
+++ b/freemocap/__init__.py
@@ -42,5 +42,5 @@ def RunDemo():
Will (eventually) download sample data from Figshare, and run the animation for it
"""
sample_data_location, sample_data_name = fmc_demo.DemoSetup() #run a bunch of GUIs, get the location of the directory where the data folder with the sample data is
- fmc_runme.RunMe(sessionID = sample_data_name,stage = 5,useOpenPose = False, useMediaPipe = True,useDLC = True, userDataPath = sample_data_location)
+ #fmc_runme.RunMe(sessionID = sample_data_name,stage = 5,useOpenPose = False, useMediaPipe = True,useDLC = True, userDataPath = sample_data_location)
diff --git a/freemocap/fmc_demo.py b/freemocap/fmc_demo.py
index 70fd679d..f9eada68 100644
--- a/freemocap/fmc_demo.py
+++ b/freemocap/fmc_demo.py
@@ -13,44 +13,59 @@ def DemoSetup():
download_data = runDataDownloadGUI() #ask for user input on downloading
zip_file_url = "https://ndownloader.figshare.com/files/28927743"
- sample_session_name = 'sesh_21-07-20_165209'
+ sample_session_name = 'sesh_21-07-20_165209_noOpenPose'
sample_session_zip = sample_session_name + '.zip'
if download_data: #if they want to download
+ download_it = True
#code to download stuff from online will go here
destinationPath = runDemoGUI()
-
+
+ if destinationPath == None:
+ print('Please choose where to save your sample data')
+ download_it = False
+ extractToPath = None
#error seems to expect the sample session to still be a zip file even though it is unzipped below
+ if download_it == True:
+ currentPath = Path(destinationPath)/sample_session_name
-
if 'FreeMocap_Data' in str(destinationPath):
- print('using a freemocap data folder')
+ if currentPath.exists():
+ extractToPath = None
+ print('There is already a sample data folder at: ' + str(currentPath))
+ download_it = False
#extractToPath = destinationPath/sample_session_zip
extractToPath = destinationPath
else:
extractToFolder = Path(destinationPath)/recordingconfig.dataFolder #append the name of the data folder to the destination path
extractToFolder.mkdir(exist_ok=True) #make the data folder if it doesn't current exist
- #extractToPath = extractToFolder/sample_session_name
extractToPath = extractToFolder
+
+ checkPath = extractToFolder/sample_session_name
+ if checkPath.exists():
+ print('There is already a sample data folder at: ' + str(checkPath))
+ extractToPath = None
+ download_it = False
+ #extractToPath = extractToFolder/sample_session_name
+
#run the GUI to get the directory locations of the zipped folder, and where to extract it to
#locationPath, destinationPath = runDemoGUI()
#zipPath = Path(locationPath)/'sesh_21-07-18_170130.zip' #append the name of the zipped sample file to the path to find it
-
- print('Starting demo session download')
- r = requests.get(zip_file_url)
- z = zipfile.ZipFile(io.BytesIO(r.content))
- z.extractall(extractToPath)
-
- print('Demo session downloaded to: ' + str(destinationPath) + '/' + str(sample_session_zip))
+ if download_it:
+ print('Starting demo session download')
+ r = requests.get(zip_file_url)
+ z = zipfile.ZipFile(io.BytesIO(r.content))
+ z.extractall(extractToPath)
+ print('Demo session downloaded to: ' + str(extractToPath) + '/' + str(sample_session_name))
#with zipfile.ZipFile(zipPath,'r') as zip_ref:
# zip_ref.extractall(extractToPath) #extract stuff to the data folder
- else:
- root = tk.Tk() #bring up a window to select the data folder directory
- root.withdraw()
- destinationPath = filedialog.askdirectory( title='Select the directory where the Freemocap_data folder with the sample data is located',
- initialdir= Path.cwd())
+ # else:
+ # root = tk.Tk() #bring up a window to select the data folder directory
+ # root.withdraw()
+ # destinationPath = filedialog.askdirectory( title='Select the directory where the Freemocap_data folder with the sample data is located',
+ # initialdir= Path.cwd())
return extractToPath, sample_session_name #take the path to the directory where the data folder is located
@@ -59,6 +74,8 @@ class DemoGUI(): #GUI to pick the location and the destination directories for t
def __init__(self, master):
self.master = master
+ self.destinationPath = None
+
sampleDestinationText = "If a {} folder already exists, choose the directory where it is located. \n Otherwise, choose a directory to create a {} folder".format(recordingconfig.dataFolder,recordingconfig.dataFolder)
sampleDestinationLabel = Label(master, text=sampleDestinationText)
sampleDestinationLabel.pack()