* Creating CD contents listings in org mode
@ 2006-05-22 12:31 Charles Cave
2006-05-23 8:45 ` Carsten Dominik
0 siblings, 1 reply; 2+ messages in thread
From: Charles Cave @ 2006-05-22 12:31 UTC (permalink / raw)
To: emacs-orgmode
I used to use Treepad on Windows (www.treepad.com) and wrote a Perl
module to read and write Treepad Files. These were plain text but had
extra information to define each node in the tree.
Now I use ORG mode for my outlining requirements.
Today I adapted a program to create a listing of the contents
of a CD-ROM. The program is written in Perl (not Lisp!).
I use Windows, and my CD-ROM drive is F:
I write a unique number on each CD, for example, C039
To catalogue the disk, I run the command
perl cdcat.pl C039.org F:
Now I can view the file C039.org with Emacs and expand/collapse the
directory names.
Sample output:
* f:
f:
** Australian Piano Concertos
f:/Australian Piano Concertos
01 Piano Concert Movt 1 - Ross Edwards.mp3 (6884786)
02 Piano Concerto Movt 2 - Ross Edwards.mp3 (10772642)
03 Piano Concerto Movt 3 - Ross Edwards.mp3 (4604168)
07 Piano Concerto - Peter Sculthorpe.mp3 (26613776)
Australian Piano Concertos playlist.m3u (746)
** Sun Music
f:/Sun Music
01 Memento Mori - Peter Sculthorpe.mp3 (20459686)
02 Sun Song - Peter Sculthorpe.mp3 (8521866)
03 Sun Music 1 - Peter Sculthorpe.mp3 (14595318)
04 Sun Music 2 - Peter Sculthorpe.mp3 (8466152)
05 Sun Music 3 - Peter Sculthorpe.mp3 (17877436)
06 Sun Music 4 - Peter Sculthorpe.mp3 (12673498)
07 From Uluru - Peter Sculthorpe.mp3 (5337404)
Sun Music playlist.m3u (584)
# Save the remained of the message as a file cdcat.pl
# cdcat.pl Modified on 29th April 2005
use strict;
use warnings;
# parse a directory structure to create an Emacs org mode file
# with a list of files against each node.
my $outfile = shift;
my $root = shift; # start directory for searching, a CD drive: G:
my $info = ""; # the catalogue data being prepared
defined($outfile) or $outfile = "cd.org";
defined($root) or die "Syntax is cdcat cdlabel CDdrive\n";
open (my $fv, ">", $outfile) or die "Cannot create $outfile\n";
my $level = 0;
parse_dir($root, $level, $root);
print $fv $info;
close($fv);
print "Analysis of $root written to $outfile\n";
###############
sub parse_dir {
###############
my $dir = shift;
my $level = shift;
my $fullpath = shift;
my @dirlist = ();
my $filelist = "";
chdir($fullpath) or die "chdir to $fullpath failed\n";
opendir(my $dirfv, ".") or die "Cannot open . in $dir\n";
while (my $file = readdir($dirfv)) {
if ( -f $file ) {
my $size = -s $file;
$filelist .= " $file ($size)\n";
}
next if ($file eq ".");
next if ($file eq "..");
push (@dirlist, $file) if -d $file;
}
$info .= '*' x ( $level + 1 );
$info .= " $dir\n$fullpath\n$filelist";
foreach my $subdir (@dirlist) {
parse_dir($subdir, $level + 1, $fullpath."/".$subdir);
}
}
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: Creating CD contents listings in org mode
2006-05-22 12:31 Creating CD contents listings in org mode Charles Cave
@ 2006-05-23 8:45 ` Carsten Dominik
0 siblings, 0 replies; 2+ messages in thread
From: Carsten Dominik @ 2006-05-23 8:45 UTC (permalink / raw)
To: Charles Cave; +Cc: emacs-orgmode
I like these perl programs popping up! This is why org-mode files are
plain text - to allow to create the easily with external programs, and
to extract information in arbitrary ways.
Charles, at some point in the past you were planning to write a
tutorial on how to use Org-mode for GTD. Is that still your plan? I'd
love to see it.
- Carsten
On May 22, 2006, at 14:31, Charles Cave wrote:
> I used to use Treepad on Windows (www.treepad.com) and wrote a Perl
> module to read and write Treepad Files. These were plain text but had
> extra information to define each node in the tree.
>
> Now I use ORG mode for my outlining requirements.
>
> Today I adapted a program to create a listing of the contents
> of a CD-ROM. The program is written in Perl (not Lisp!).
>
> I use Windows, and my CD-ROM drive is F:
> I write a unique number on each CD, for example, C039
>
> To catalogue the disk, I run the command
> perl cdcat.pl C039.org F:
>
> Now I can view the file C039.org with Emacs and expand/collapse the
> directory names.
>
>
> Sample output:
>
>
> * f:
> f:
> ** Australian Piano Concertos
> f:/Australian Piano Concertos
> 01 Piano Concert Movt 1 - Ross Edwards.mp3 (6884786)
> 02 Piano Concerto Movt 2 - Ross Edwards.mp3 (10772642)
> 03 Piano Concerto Movt 3 - Ross Edwards.mp3 (4604168)
> 07 Piano Concerto - Peter Sculthorpe.mp3 (26613776)
> Australian Piano Concertos playlist.m3u (746)
> ** Sun Music
> f:/Sun Music
> 01 Memento Mori - Peter Sculthorpe.mp3 (20459686)
> 02 Sun Song - Peter Sculthorpe.mp3 (8521866)
> 03 Sun Music 1 - Peter Sculthorpe.mp3 (14595318)
> 04 Sun Music 2 - Peter Sculthorpe.mp3 (8466152)
> 05 Sun Music 3 - Peter Sculthorpe.mp3 (17877436)
> 06 Sun Music 4 - Peter Sculthorpe.mp3 (12673498)
> 07 From Uluru - Peter Sculthorpe.mp3 (5337404)
> Sun Music playlist.m3u (584)
>
>
>
>
> # Save the remained of the message as a file cdcat.pl
>
> # cdcat.pl Modified on 29th April 2005
>
> use strict;
> use warnings;
>
> # parse a directory structure to create an Emacs org mode file
> # with a list of files against each node.
>
> my $outfile = shift;
> my $root = shift; # start directory for searching, a CD drive: G:
> my $info = ""; # the catalogue data being prepared
>
> defined($outfile) or $outfile = "cd.org";
> defined($root) or die "Syntax is cdcat cdlabel CDdrive\n";
>
> open (my $fv, ">", $outfile) or die "Cannot create $outfile\n";
> my $level = 0;
> parse_dir($root, $level, $root);
>
> print $fv $info;
> close($fv);
>
> print "Analysis of $root written to $outfile\n";
>
>
> ###############
> sub parse_dir {
> ###############
> my $dir = shift;
> my $level = shift;
> my $fullpath = shift;
>
> my @dirlist = ();
> my $filelist = "";
>
> chdir($fullpath) or die "chdir to $fullpath failed\n";
> opendir(my $dirfv, ".") or die "Cannot open . in $dir\n";
> while (my $file = readdir($dirfv)) {
> if ( -f $file ) {
> my $size = -s $file;
> $filelist .= " $file ($size)\n";
> }
> next if ($file eq ".");
> next if ($file eq "..");
> push (@dirlist, $file) if -d $file;
> }
>
> $info .= '*' x ( $level + 1 );
> $info .= " $dir\n$fullpath\n$filelist";
>
> foreach my $subdir (@dirlist) {
> parse_dir($subdir, $level + 1, $fullpath."/".$subdir);
> }
> }
>
>
>
>
>
> _______________________________________________
> Emacs-orgmode mailing list
> Emacs-orgmode@gnu.org
> http://lists.gnu.org/mailman/listinfo/emacs-orgmode
>
>
--
Carsten Dominik
Sterrenkundig Instituut "Anton Pannekoek"
Universiteit van Amsterdam
Kruislaan 403
NL-1098SJ Amsterdam
phone: +31 20 525 7477
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2006-05-23 8:45 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2006-05-22 12:31 Creating CD contents listings in org mode Charles Cave
2006-05-23 8:45 ` Carsten Dominik
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.