2009 102: Difference between revisions

From XPUB & Lens-Based wiki
 
(43 intermediate revisions by the same user not shown)
Line 1: Line 1:
[[Image:Construction.gif]]
== Command Line Media / "Media Bashing" ==
this page is under construction ;)


== Command Line Media ==
While the command line, or shell, is a text-based interface, this does not mean that manipulating other kinds of media, image, sound, video, is excluded. Far from it, many command line tools offer extremely useful and uniquely powerful functionality difficult to achieve with [[GUI]] programs. In addition, by applying the basics of [[pipeline | pipelining]] and [[abstraction]] (through creating your own scripts with parameters), the command line enables highly particular and personal media tools to be created by pulling existing tools together in novel ways.
 
Considering the difference between graphical / interactive software and textual / non-interactive, you could compare:
 
{| class=border
|graphical / interactive
|command-line / non-interactive
|-
|the [[GIMP]] or Photoshop
|[[ImageMagick]]
|-
|[[FireFox]]
|[[wget]]
|-
|Cinelerra or Final Cut
|[[ffmpeg]]
|}


While the command line, or shell, is a text-based interface, this does not mean that manipulating other kinds of media, image, sound, video, is excluded. Far from it, many command line tools offer extremely useful and uniquely powerful functionality difficult to achieve with [[GUI]] programs. In addition, by applying the basics of [[pipeline | pipelining]] and [[abstraction]] (through creating your own scripts with parameters), the command line enables highly particular and personal media tools to be created by pulling existing tools together in novel ways.
So the difference is not simply whether a program uses graphics or not -- Command-line programs are designed to perform a very specific task, and typically are specified textually according to a strict syntax (command-line options, etc.) They are non-interactive in the sense that you start them up, they do their thing, and you get the result -- you don't typically influence them while they are running. However, you often can work interactively with these programs through cycles of making changes to a script, running it, observing the result and repeating.


== Making a "frontpage" snapshot tool ==
== Making a "frontpage" snapshot tool ==


An exercise to build a simple tool to support visual comparison of front pages newssites a la Sarah Charlesworth's [http://www.sarahcharlesworth.net/series-view.php?album_id=34&subalbum_id=53 Modern History] (1978). The work, among many other works of interest, can be seen as part of the [http://www.muhka.be/toont_beeldende_kunst_detail.php?la=en&id=2590&subbase=actueel&jaartal= Order Of Things] exhibition, through the end of the year at the MuKHA, Antwerp.
An exercise to build a simple tool to support visual comparison of front pages newssites a la Sarah Charlesworth's [http://www.sarahcharlesworth.net/series-view.php?album_id=34&subalbum_id=53 Modern History] (1978). The work, among many other works of interest, can be seen as part of the [http://www.muhka.be/toont_beeldende_kunst_detail.php?la=en&id=2590&subbase=actueel&jaartal= Order Of Things] exhibition until Jan 4, 2009 at the MuKHA, Antwerp.


Exercise explores the principle of:
Exercise explores the principle of:
Line 16: Line 31:
* cron jobs to automate a process over a long time period
* cron jobs to automate a process over a long time period


Start with example of how to rip the above page with wget.
== Tutorial ==
& re-assemble with montage...


Using the date tool for automatically naming a file.
=== Getting a grip on a tool ===


In general build up from really simple CL exercises of using imagemagick, file manipulations (moving, renaming, copying, deleting)... Introducing public_html...
Command line programs, as focused and "simple" as they may be, often take some time to get used to. The initial man-page dump of possible options may seem overwhelming at first, but if you simply have a little discipline to try some variations, and above all to record your successes (in a text file and/or by taking notes on a printed copy of a man page), you can soon feel comfortable to use the new program.  


Necessary Tools:
We start with the tool [[wget]].
* basics: cd, pwd, mv, cp
* ssh
* wget
* imagemagick: convert, mogrify, montage
* find
* crontab
* date


Concepts:
First, simply try to run it:
* variable
* backquoting
* reading man pages
* setting options


a sample:
<source lang="bash">
<source lang="bash">
wget -r -l1 --no-parent -A "*.jpg" "http://www.sarahcharlesworth.net/series-view.php?album_id=34&subalbum_id=53"
wget
mkdir images
find www.sarahcharlesworth.net -iname "*.jpg" -exec mv {} images \;
montage images/* modern.png
</source>
</source>


== Turtle Graphics ==
<source lang="bash">
wget --help
</source>


[[Seymour Papert]]
Too much information! A [[pipeline]] to the rescue!


* http://www.computerhistory.org/timeline/?year=1967
<source lang="bash">
* http://www.bfoit.org/itp/IntroCmds.html
wget --help | less
</source>


== Adventures in Command Line ==
<source lang="bash">
man wget
</source>


* http://www.ir.bbn.com/~bschwart/adventure.html
Man has an option to output print-friendly postscript output. It's described on the "man" man page. (That's right: "man man"!)


<source lang="bash">
man -t wget
</source>


== Chat bots ==
<source lang="bash">
man -t wget > wget.ps
</source>
 
Now you can print the postscript file, or view with a viewer like evince:
 
<source lang="bash">
evince wget.ps
</source>
 
=== Necessary Tools / Topics ===
* Shell basics: cd, pwd, mv, cp
* Connecting to a "remote" server with ssh
* public_html
* scp
* [[wget]]
* [[ImageMagick]]: montage
 
=== Concepts ===
* man pages
* command line options


Eliza... tie in with Python callbacks...
=== Examples of wget ===


* [http://news.bbc.co.uk/2/hi/science/nature/7666836.stm Turing tests continue]
Start from these examples, culled from the web. Try the examples out, alter the options. Find the options used in the (printed) man page of wget. Collect working (or interesting non-working) commands in a text file, and add comments to remind yourself why they were noteworthy.


----
* http://linuxgazette.net/issue70/chung.html
* http://tipotheday.com/2007/10/11/wget-some-quick-tips/
* http://ubuntuforums.org/showthread.php?t=718549&page=2
 
To download all the files in a "directory listing":
<source lang="bash">
wget -r -np -nd http://example.com/packages/
</source>


Necessary Tools:
=== Solutions ===
* ssh program (look up for those on windows)


<source lang="bash">
wget -r -nd -np --follow-tags=img http://www.colourlovers.com -A.jpg,.jpeg
montage *.jpg ../public_html/montage.jpg
</source>


* text adventures == early intersection of narrative and computational forms
Blurps out this file: http://pzwart2.wdka.hro.nl/~tklok/montage.jpg
* multi-person / time sharing / interaction vs. batch
* getting comfortable with the command line
* command line == programming
* pipeline VS. sealed case "suites"


(Notice the wget is run from a different directory the where the picture is placed)


pragmatic exercises / "puzzles" involving:
*http://pzwart2.wdka.hro.nl/~ebonetti/Emanuele/montage.png
* wget for some spidering
* ffmpeg for some media manipulation?
* imagemagick for some xxzzy ?!


Maybe cool to keep in the spirit of group / network activities / timing.
*http://pzwart2.wdka.hro.nl/~svilayphiou/techdaze/102/montage.jpg
How to communicate between users logged into the network.
... too complex for now


Exercises could take the form of puzzles with a description of a desired end result, like:
*http://pzwart2.wdka.hro.nl/~cbaronavski/static/hate.jpg
* Produce a single image made up of images collected from the homepage of a particular website.
(wget => montage)


* Produce an animated gif made up of the headlines from a particular news site
== Assignment for next week ==
? CL feedreader ?? => image => movie ?


(?! find command / wildcards as a prelimary way to loop )
* Chapters 3 & 4 from [[Think Python]]
By creating a single (or more) variables, create a basic tool.
* Exercises from the book plus the [[Think Python X3 | additional exercise]]


!! show how copying images / animation to public_html allows for instant web "publishing"
Chapter 4 introduces some [[Turtle Graphics]]!

Latest revision as of 15:21, 3 December 2008

Command Line Media / "Media Bashing"

While the command line, or shell, is a text-based interface, this does not mean that manipulating other kinds of media, image, sound, video, is excluded. Far from it, many command line tools offer extremely useful and uniquely powerful functionality difficult to achieve with GUI programs. In addition, by applying the basics of pipelining and abstraction (through creating your own scripts with parameters), the command line enables highly particular and personal media tools to be created by pulling existing tools together in novel ways.

Considering the difference between graphical / interactive software and textual / non-interactive, you could compare:

graphical / interactive command-line / non-interactive
the GIMP or Photoshop ImageMagick
FireFox wget
Cinelerra or Final Cut ffmpeg

So the difference is not simply whether a program uses graphics or not -- Command-line programs are designed to perform a very specific task, and typically are specified textually according to a strict syntax (command-line options, etc.) They are non-interactive in the sense that you start them up, they do their thing, and you get the result -- you don't typically influence them while they are running. However, you often can work interactively with these programs through cycles of making changes to a script, running it, observing the result and repeating.

Making a "frontpage" snapshot tool

An exercise to build a simple tool to support visual comparison of front pages newssites a la Sarah Charlesworth's Modern History (1978). The work, among many other works of interest, can be seen as part of the Order Of Things exhibition until Jan 4, 2009 at the MuKHA, Antwerp.

Exercise explores the principle of:

  • simple command line tools focused on doing a simple task
  • the idea of a pipeline to join various commands together
  • introducing the concept of a variable to make a personal "tool"
  • cron jobs to automate a process over a long time period

Tutorial

Getting a grip on a tool

Command line programs, as focused and "simple" as they may be, often take some time to get used to. The initial man-page dump of possible options may seem overwhelming at first, but if you simply have a little discipline to try some variations, and above all to record your successes (in a text file and/or by taking notes on a printed copy of a man page), you can soon feel comfortable to use the new program.

We start with the tool wget.

First, simply try to run it:

wget
wget --help

Too much information! A pipeline to the rescue!

wget --help | less
man wget

Man has an option to output print-friendly postscript output. It's described on the "man" man page. (That's right: "man man"!)

man -t wget
man -t wget > wget.ps

Now you can print the postscript file, or view with a viewer like evince:

evince wget.ps

Necessary Tools / Topics

  • Shell basics: cd, pwd, mv, cp
  • Connecting to a "remote" server with ssh
  • public_html
  • scp
  • wget
  • ImageMagick: montage

Concepts

  • man pages
  • command line options

Examples of wget

Start from these examples, culled from the web. Try the examples out, alter the options. Find the options used in the (printed) man page of wget. Collect working (or interesting non-working) commands in a text file, and add comments to remind yourself why they were noteworthy.

To download all the files in a "directory listing":

wget -r -np -nd http://example.com/packages/

Solutions

wget -r -nd -np --follow-tags=img http://www.colourlovers.com -A.jpg,.jpeg 
montage *.jpg ../public_html/montage.jpg

Blurps out this file: montage.jpg

(Notice the wget is run from a different directory the where the picture is placed)

  • montage.png
  • montage.jpg
  • hate.jpg

Assignment for next week

Chapter 4 introduces some Turtle Graphics!