Submit Hint Search The Forums LinksStatsPollsHeadlinesRSS
14,000 hints and counting!


Click here to return to the 'Saving iTunes4 videos' hint
The following comments are owned by whoever posted them. This site is not responsible for what they say.
Saving iTunes4 videos
Authored by: MostlyHarmless on May 05, '03 02:26:15PM

Many moons ago I wrote a very spiffy (IMO) little Perl script
for snagging those temporary QT files:

--- cut ---
#!/usr/bin/perl -w

$uid = qx(id -u); chop $uid;
$tmpdir = "/tmp/$uid/Temporary Items/";
$outdir = glob ("~/Movies/");

opendir(DIR, "$tmpdir") or die "Can't open $tmpdir: $!";
@files = grep { /^QT/ && -f "$tmpdir/$_" } readdir(DIR);
closedir DIR;

foreach $file (@files) {

$size = (stat("$tmpdir/$file"))[7]/1024/1024;
printf ("\nFound: %s, %5.2f MB\n", $file, $size);

print ("New name? ");
$name = <STDIN>; chop $name;
$name = "${name}.mov" unless grep {/.mov$/} "$name";

print ("\nMoving $file to ${outdir}$name\n\n");
rename "${tmpdir}$file", "${outdir}$name" or die "Can't
move file: $!";
}
--- cut ---
(that last line "can't move file" isn't supposed to wrap...)

Save that file (with Unix linefeeds) into /usr/local/bin/ and
make it executable (chmod 755 ...).

When you run it it will list all the QT temp files and let you
rename them before it moves them to your Movies
directory.



[ Reply to This | # ]
Saving iTunes4 videos - Safari version
Authored by: haighy on May 08, '03 04:18:22PM

Spiffy indeed. I tried this one out, but it failed silently. Upon
further investigation, it seems as though Safari saves its
temporary QuickTime movies with the prefix
'SafariPlugInStream' in the directory /tmp (i.e. no user id). I
guess MostlyHarmless isn't using Safari...in any case, here's a
modified version for Safari users. Same treatment as above
(and thanks to MostlyHarmless for the original script).

#!/usr/bin/perl -w
# Safari version

$tmpdir = "/tmp/";
$outdir = glob ("~/Movies/");
$ignorefilesunder = 100; # ignore files under this size (KB)

opendir(DIR, "$tmpdir") or die "Can't open $tmpdir: $!";
@files = grep { /^SafariPlugInStream\./ && -f "$tmpdir/$_" }
readdir(DIR);
closedir DIR;

foreach $file (@files) {

next unless ((stat("$tmpdir/$file"))[7] > 1024 *
$ignorefilesunder);
$size = (stat("$tmpdir/$file"))[7]/1024/1024;
printf ("\nFound: %s, %5.2f MB\n", $file, $size);

print ("New name? ");
$name = ; chop $name;
$name = "${name}.mov" unless grep {/.mov$/}
"$name";

print ("\nMoving $file to ${outdir}$name\n\n");
rename "${tmpdir}$file", "${outdir}$name" or die "Can't
move file: $!";
}



[ Reply to This | # ]
Saving iTunes4 videos - Safari version
Authored by: haighy on May 08, '03 04:35:40PM

Oh dear, seems as though the escaped characters in the original
have become unescaped. Sorry about that. It applies to the
newline characters (e.g. "nFound" should be "\nFound") and to
the period in the regexp. Just let me know if you'd like me to
send a copy or repost it...otherwise I'll just be brushing up on
my macosxhints-comments quoting rules...



[ Reply to This | # ]