bantammenace2012
Posts: 122
Joined: Mon May 28, 2012 12:18 pm

Where do I find Scratch projects compatible with the RPi

Tue May 21, 2013 5:11 pm

Before Scratch went to version 2.0 I was able to download projects from the Scratch website and run them on the Raspberry Pi.
Now I cannot find any projects on the Scratch website that will run on the Raspberry Pi.
I can't even run the Piano on the makeymakey website anymore.

This is total pants.

Is there anywhere where these old projects can be downloaded ?

User avatar
EasyAsPi
Posts: 3
Joined: Sat May 18, 2013 12:06 pm
Location: Narnia

Re: Where do I find Scratch projects compatible with the RPi

Tue May 21, 2013 5:24 pm

try piprodgect.org.eu/scratch - it works for me :D hope it helps.
EasyAsPi

simplesi
Posts: 2327
Joined: Fri Feb 24, 2012 6:19 pm
Location: Euxton, Lancashire, UK

Re: Where do I find Scratch projects compatible with the RPi

Tue May 21, 2013 10:11 pm

mm- I understood it was the intention that all the old 1.4 projects would still be accesible as .sb files - I've asked the question on the forum as to how to download them as such.

In a worst case scenario, someone could write a 1.4 saved as a 2.0 convertor to get it back to 1.4 file format

Simon
Seeking help with Scratch and I/O stuff for Primary age children
http://cymplecy.wordpress.com/ @cymplecy on twitter

simplesi
Posts: 2327
Joined: Fri Feb 24, 2012 6:19 pm
Location: Euxton, Lancashire, UK

Re: Where do I find Scratch projects compatible with the RPi

Wed May 22, 2013 6:29 am

Panic over :)

http://scratch.mit.edu/discuss/topic/6062/
Just downloaded one of mine and it worked fine :)

Simon
Seeking help with Scratch and I/O stuff for Primary age children
http://cymplecy.wordpress.com/ @cymplecy on twitter

Stateside
Posts: 66
Joined: Sun May 13, 2012 12:26 pm

Re: Where do I find Scratch projects compatible with the RPi

Sat Jun 08, 2013 2:11 am

Young maker says Raspberry Pi is way to go Develops The Great Guinea Pig Escape using Scratch

http://opensource.com/life/13/6/young-maker-lauren-egts

http://scratch.mit.edu/projects/3217710/

mob-i-l
Posts: 362
Joined: Sat Dec 29, 2012 2:45 am
Location: Lund, Skåne/Scania, Sweden

Re: Where do I find Scratch projects compatible with the RPi

Mon Jul 29, 2013 1:14 am

There is a studio called "Scratch the Raspberry Pi" that should contain only projects tested on Raspberry Pi:
http://scratch.mit.edu/studios/219781/

I do prefer the features of Scratch 2.0 but many projects could be backported to Scratch 1.4. It's difficult now because you have to rewrite the program in Scratch 1.4 since 1.4 can't open the 2.0 JSON-format. It would be good if someone wrote a utility to convert 2.0 projects to 1.4, or if someone hacked the Raspberry Pi-edition of Scratch so it could open 2.0-projects. If one uses blocks that doesn't exist in 1.4 one could change those to obsolete blocks, and then write code to replace those blocks (usually by using "broadcast (message) and wait").
Have Pi0&1A&1B&1B+&2B&3B&4B w/ rasPiOS. Started w/ BASIC on ABC80&ZX81 then Forth, Z80… https://scratch.mit.edu/users/mobluse/ https://github.com/mobluse/ https://twitter.com/mobluse/ https://YouTube.com/MOBiL4u/

timrowledge
Posts: 1419
Joined: Mon Oct 29, 2012 8:12 pm
Location: Vancouver Island

Re: Where do I find Scratch projects compatible with the RPi

Thu Aug 01, 2013 5:40 pm

There is active development work going on for the Pi Scratch system, so don't worry about it disappearing. It's getting faster, too.

As for handling 2.0 format project files - I'll add it to the list of things to consider when there is time. Assuming there is a proper definition to work from it ought to be possible. What are the 2.0 features you prefer? We may be able to do something about that as well.
Making Smalltalk on ARM since 1986; making your Scratch better since 2012

mob-i-l
Posts: 362
Joined: Sat Dec 29, 2012 2:45 am
Location: Lund, Skåne/Scania, Sweden

Re: Where do I find Scratch projects compatible with the RPi

Thu Sep 26, 2013 3:45 pm

timrowledge wrote:There is active development work going on for the Pi Scratch system, so don't worry about it disappearing. It's getting faster, too.

As for handling 2.0 format project files - I'll add it to the list of things to consider when there is time. Assuming there is a proper definition to work from it ought to be possible. What are the 2.0 features you prefer? We may be able to do something about that as well.
There is now a website, Retro Converter, that can convert from Scratch 2.0 to Scratch 1.4, see http://kurt.herokuapp.com/20to14
I've converted one project using this and it's the Benchmarks-project in this studio:
http://scratch.mit.edu/studios/244489/
You can download the program by clicking on Share to and then use Download 1.4 Project. There is a glitch right now in the conversion program. You have to open the file from the file system (e.g. double clicking on it) and not try to open it from inside Scratch. You can read about this glitch here: http://scratch.mit.edu/discuss/topic/15523/ . Before you convert a 2.0 project you have to remove 2.0 features such as vector images and procedure calls.

If I can wish 2.0 features in Raspberry Pi Scratch I would like to have floor, ceiling, procedure calls and clones. Vector graphics is not that important to me even though I use it in almost all my Scratch 2-projects.
Have Pi0&1A&1B&1B+&2B&3B&4B w/ rasPiOS. Started w/ BASIC on ABC80&ZX81 then Forth, Z80… https://scratch.mit.edu/users/mobluse/ https://github.com/mobluse/ https://twitter.com/mobluse/ https://YouTube.com/MOBiL4u/

mob-i-l
Posts: 362
Joined: Sat Dec 29, 2012 2:45 am
Location: Lund, Skåne/Scania, Sweden

Re: Where do I find Scratch projects compatible with the RPi

Thu Oct 03, 2013 10:39 pm

I discovered that a file can be opened in Scratch 2 Offline Editor (that cannot run on Raspberry Pi, due to lack of AIR) even if the MD5-codes and extensions for png-files are incorrect (which is an advantage). This bash command-line converts an sb2-file with vector-images to an sb2-file with bitmap-images:

Code: Select all

proj=11488608; mkdir sb2tmp; cd sb2tmp; unzip ../$proj.sb2; ls -1 *.svg | sed ‘s/\..*//’ | while read file; do convert -background none $file.svg $file.png; md5=`md5sum $file.png | cut -d' ' -f1`; done; rm *.svg; zip $proj-bitmap.sb2 *; mv *.sb2 ..; cd ..; rm -r sb2tmp
This then needs to be opened and saved in Scratch 2 Offline Editor to generate a valid file.

I did try to generate a correct file directly and this also seems to work:

Code: Select all

proj=11488608; mkdir sb2tmp; cd sb2tmp; unzip ../$proj.sb2; ls -1 *.svg | sed ‘s/\..*//’ | while read file; do convert -background none $file.svg $file.png; md5=`md5sum $file.png | cut -d' ' -f1`; echo $file $md5.png; sed -i "/baseLayerID\": $file,/ {n;s/\"[0-9a-f]*\.svg\"/\"$md5.png\"/}" project.json; done; rm *.svg; zip $proj-bitmap.sb2 *; mv *.sb2 ..; cd ..; rm -r sb2tmp
(You can do these conversions of sb2-files on Raspberry Pi in Rasbian if you install ImageMagick using sudo apt-get install imagemagick.)

It is also possible to use Inkscape:

Code: Select all

proj=12966341; mkdir sb2tmp; cd sb2tmp; unzip ../$proj.sb2; ls -1 *.svg | sed 's/\..*//' | while read file; do inkscape -z -y 0 -e $file.png $file.svg; md5=`md5sum $file.png | cut -d' ' -f1`; echo $file $md5.png; sed -i "/baseLayerID\": $file,/ {n;s/\"[0-9a-f]*\.svg\"/\"$md5.png\"/}" project.json; done; rm *.svg; zip $proj-bitmap.sb2 *; mv *.sb2 ..; cd ..; rm -r sb2tmp
Install Inkscape using sudo apt-get install inkscape.
The purpose of the vector to bitmap conversion is to be able to convert from Scratch 2 to Scratch 1.4 using Kurt in order to use to use the programs on Raspberry Pi Model A and B. One may also need to convert the block-code manually and use workarounds.

(Warning: Sometimes the forum software phpBB3 converts double-quotes in code-boxes to 66- and 99-quotes and when you paste code containing these the code doesn't work unless the terminal-program is intelligent and corrects them back.)
Last edited by mob-i-l on Sat Oct 05, 2013 5:55 pm, edited 4 times in total.
Have Pi0&1A&1B&1B+&2B&3B&4B w/ rasPiOS. Started w/ BASIC on ABC80&ZX81 then Forth, Z80… https://scratch.mit.edu/users/mobluse/ https://github.com/mobluse/ https://twitter.com/mobluse/ https://YouTube.com/MOBiL4u/

timrowledge
Posts: 1419
Joined: Mon Oct 29, 2012 8:12 pm
Location: Vancouver Island

Re: Where do I find Scratch projects compatible with the RPi

Thu Oct 03, 2013 11:23 pm

That's pretty cool!

Question for you -
when you ask for floor & ceiling I imagine you mean as in floor() & ceiling() per http://en.wikipedia.org/wiki/Floor_and_ ... _functions - yes?
When you ask for cloning, what do you mean? Take a sprite and its associated scripts (and sounds, costumes etc I guess) and makek copies with a new unique name?
Procedure calls might be harder…
Vector graphics… well, that's one of the things I'd like to at least use to make drawing the UI faster via the GPU. We'll see how that goes.
Making Smalltalk on ARM since 1986; making your Scratch better since 2012

mob-i-l
Posts: 362
Joined: Sat Dec 29, 2012 2:45 am
Location: Lund, Skåne/Scania, Sweden

Re: Where do I find Scratch projects compatible with the RPi

Fri Oct 04, 2013 7:14 am

timrowledge wrote:Question for you -
when you ask for floor & ceiling I imagine you mean as in floor() & ceiling() per http://en.wikipedia.org/wiki/Floor_and_ ... _functions - yes?
Yes! They are the only new math-functions in Scratch 2 compared to Scratch 1.4.
timrowledge wrote: When you ask for cloning, what do you mean? Take a sprite and its associated scripts (and sounds, costumes etc I guess) and makek copies with a new unique name?
This is done programmatically and is the same as instantiation in C++ and clone in Java. The sounds and costumes are probably not copied since they are static data (you cannot add sound and costumes at runtime). The code is probably also not copied. It is only the other sprite data such as the image on sćreen, position, direction etc, and the local variables and lists that are copied. It's very useful since you don't have to manage a lot of static sprites.
timrowledge wrote: Procedure calls might be harder…
They are like "broadcast and wait" but are only local to a sprite, and take in-arguments but return no value.
timrowledge wrote: Vector graphics… well, that's one of the things I'd like to at least use to make drawing the UI faster via the GPU. We'll see how that goes.
I don't think it's important for CS-teaching with vector costumes but they look better and are perhaps faster to draw.

The Scratch 2.0 Offline Editor works in at least Ubuntu Linux 10.04 LTS and 12.04 LTS with 32-bit Intel-processor (it uses Adobe AIR). Here are installation instructions:
http://fromscratched.nl/index.php/scrat ... x/?lang=en

BTW I also have a way to download Scratch 2-projects using the command-line in Linux (Bash) and convert the Scratch 2-projects using Python-programs (not written by me) and I've tested this in Rasbian on Raspberry Pi Model A and it works well.

Download Scratch 2-project using project-number proj (should be pasted to one command-line):

Code: Select all

proj=12612306; mkdir sb2tmp; cd sb2tmp; curl -L http://projects.scratch.mit.edu/internalapi/project/$proj/get/ 2> /dev/null | tee project.json | grep -i MD5 | cut -d' ' -f2 | sed 's/[\",]//g' | while read file; do curl -L -o $file http://projects.scratch.mit.edu/internalapi/asset/$file/get/ 2> /dev/null; done; i=1; while [ $i -le `expr $( ls -1 | wc -l ) - 2` ]; do sed -i "{s/ID\": -1/ID\": $i/;t end;b;:end;n;b end}" project.json; i=`expr $i + 1`; done; i=0; ( grep penLayerMD5 project.json; grep '\(baseLayerMD5\|md5\)' project.json ) | cut -d' ' -f2 | sed 's/[",]//g' | while read file; do ext=`echo $file | cut -d. -f2`; mv $file $i.$ext; i=`expr $i + 1`; done; zip $proj.sb2 *; mv *.sb2 ..; cd ..; rm -r sb2tmp
You have to install zip first:

Code: Select all

sudo apt-get install zip
Bash command-line to download Scratch 1.4-project:

Code: Select all

proj=12766255; curl -L -o $proj.sb http://projects.scratch.mit.edu/internalapi/project/$proj/get/
There are different command-lines to download from Scratch depending on version, but you can detect version using Bash:

Code: Select all

proj=12612306; curl -L http://projects.scratch.mit.edu/internalapi/project/$proj/get/ 2> /dev/null | head -1 | sed -n 's/^{.*/20/;t end;s/^ScratchV02.*/14/;t end;s/.*/00/;:end;p'
Prints 14, 20 or 00 (unknown).

Python code to convert from Scratch 2 to Scratch 1.4:

Code: Select all

import kurt
project = kurt.Project.load("in.sb2") # 2.0 file
project.convert("scratch14")
project.save("out.sb") # 1.4 file
See http://scratch.mit.edu/discuss/topic/15523/

This can only convert Scratch 2-projects that doesn't use the new blocks added to Scratch 2 compared to Scratch 1.4. I guess most modern projects need to be manually converted in the Scratch 2 Editor using workarounds before they can be converted to the Scratch 1.4 file-format.

First you have to install kurt in Rasbian on Raspberry Pi:

Code: Select all

sudo apt-get install python-dev
sudo apt-get install python-pip
sudo pip install kurt
Last edited by mob-i-l on Sun Sep 21, 2014 3:30 pm, edited 2 times in total.
Have Pi0&1A&1B&1B+&2B&3B&4B w/ rasPiOS. Started w/ BASIC on ABC80&ZX81 then Forth, Z80… https://scratch.mit.edu/users/mobluse/ https://github.com/mobluse/ https://twitter.com/mobluse/ https://YouTube.com/MOBiL4u/

mob-i-l
Posts: 362
Joined: Sat Dec 29, 2012 2:45 am
Location: Lund, Skåne/Scania, Sweden

Re: Where do I find Scratch projects compatible with the RPi

Sat Oct 05, 2013 11:02 pm

Raspberry Pi Tested

Here are Scratch 1.4 projects that have been tested on Raspberry Pi Model A. In many cases they were automatically converted from Scratch 2-projects in this studio: http://scratch.mit.edu/studios/259231/. They were converted to Scratch 1.4 using Bash- and Python-scripts in Rasbian, see http://www.raspberrypi.org/phpBB3/viewt ... 77&t=44525. The originals are here: http://scratch.mit.edu/studios/259778/. You can download Scartch 1.4 projects from the Bash-command-line in Rasbian using cURL and replace the project-number proj and username user:

Code: Select all

proj=12970187; curl -L -o $proj.sb http://projects.scratch.mit.edu/internalapi/project/$proj/get/
Alternative for old projects:

Code: Select all

user=swampfox; proj=86075; curl -Lo $proj.sb https://scratch.mit.edu/static/projects/$user/$proj.sb
You can also download all using (everything should be on one Bash command-line):

Code: Select all

studio=244489; curl -L http://scratch.mit.edu/site-api/projects/in/$studio/1/ 2> /dev/null | sed -n -e 's|.*data-id=\"\([0-9]*\)\".*|\1|p' -e 's|.*/users/\(.*\)/".*|\1|p' | while read proj; do read user; curl -Lo b-$user-$proj.sb http://scratch.mit.edu/services/download/$proj/; curl -Lo a-$user-$proj.sb https://scratch.mit.edu/static/projects/$user/$proj.sb; file a-$user-$proj.sb b-$user-$proj.sb | sed -n '/:.*data/! {s/:.*//p}' | xargs rm; done
If you have Java in your web-browser you can run some of these online from http://scratch.orbin.se/j/ or if you have JDK (built-in into Rasbian) start them from the command-line:

Code: Select all

appletviewer http://scratch.orbin.se/j/
Have Pi0&1A&1B&1B+&2B&3B&4B w/ rasPiOS. Started w/ BASIC on ABC80&ZX81 then Forth, Z80… https://scratch.mit.edu/users/mobluse/ https://github.com/mobluse/ https://twitter.com/mobluse/ https://YouTube.com/MOBiL4u/

Return to “Scratch”