Skip to content

Commit

Permalink
only download video.sb3 if it doesn't exist
Browse files Browse the repository at this point in the history
  • Loading branch information
ego-lay-atman-bay committed Jun 29, 2022
1 parent 9eb8acf commit d24ce88
Showing 1 changed file with 18 additions and 12 deletions.
30 changes: 18 additions & 12 deletions scratchVideo.py
Original file line number Diff line number Diff line change
Expand Up @@ -252,6 +252,13 @@ def exportVideo(videoPath, fps=10, costumeName='video'):
setVar('costume name', costumeName + '-')

def loadProject():
def extractProject():
print('extracting video.sb3')
with zipfile.ZipFile(file, 'r') as zip:
zip.printdir()
zip.extractall('project')
print('Done!')

try:
print('loading project.json')
loadJson('project/project.json')
Expand All @@ -262,19 +269,18 @@ def loadProject():
except:
print('project folder already exists')
pass

url = "https://ego-lay-atman-bay.github.io/scratch-video/project/video.sb3"
print('downloading ' + url)
file = root + '/project/video.sb3'
wget.download(url, file)
print('\nsuccessfully downloaded video.sb3')

print('extracting video.sb3')
with zipfile.ZipFile(file, 'r') as zip:
zip.printdir()
zip.extractall('project')
print('Done!')

try:
extractProject()
except:
print('project does not exist:')
url = "https://ego-lay-atman-bay.github.io/scratch-video/project/video.sb3"
print('downloading ' + url)
file = root + '/project/video.sb3'
wget.download(url, file)
print('\nsuccessfully downloaded video.sb3')
extractProject()

print('loading project.json')
loadJson('project/project.json')

Expand Down

0 comments on commit d24ce88

Please sign in to comment.