Cynagen Posted October 17, 2006 Posted October 17, 2006 I've been tracking Pandora's bad habits about where it's saving the temp files to, and well, guess what? No surpise that it's all over the place. Both files in plugtmp-1 and plugtmp-1-1,-1-2,-1-3,etc files. I think an overall scan of the temporary folder looking for new items in plugtmp folders, and possible plugtmp files hanging around in plain temp should do the trick. Anyone else think this is a good idea? Of course check if the file is still being downloaded, and then check for the second-to-last/last updated if it's the same as last time? Actually, would anyone be willing to participate in a test? And be willing to manually type in the name if it meant the files were sent to the correct place with the correct name? Quote
Zoltan Posted October 17, 2006 Posted October 17, 2006 Uhm... You didn't check what PandorasJar actually does, did ya? ;) Because it actually does what you described since it exists... It grabs the plugtmp-files and the files in the plugtmp-folders and renames them (well it used to rename them, now it stopped... but the coding-skilled guys are working to fix that! ;))! Quote
Cynagen Posted October 17, 2006 Author Posted October 17, 2006 Uhm... You didn't check what PandorasJar actually does, did ya? ;)Because it actually does what you described since it exists... It grabs the plugtmp-files and the files in the plugtmp-folders and renames them (well it used to rename them, now it stopped... but the coding-skilled guys are working to fix that! ;))! I am well aware, but it's doing it CRAPPILY, and because it can't do what it's suppost to f'n do, i'm writing up a tool to just aid me and enable me to do the same thing WITHOUT the Jar. Yeah, you heard me right, it's based on the Jar, but it's standalone. Why? I already said, PJ isn't doing it's job, nor does it do it properly half the time, so it's time to replace it in my mind. Heed the saying "If it's not broken, don't fix it, but for the love of all that is sane, if it is, FIX IT." Now with that said, who want's to help me track how Pandora is handling it's files so I can better prepare my application for public usage with proper checking. Quote
Extreme_One Posted October 17, 2006 Posted October 17, 2006 I'll help you if I can. I think the jar was good whilst it worked but I was always hopeful that a better solution was a possibilty. I sincerely hope you're able to turn this dream into a reality. PM me or post instructions here and we'll see if we can get this road on the show ;) Quote
cooper Posted October 17, 2006 Posted October 17, 2006 Now that the delivery of song and artist name to the Javascript methods has been dealt with, I can get back to doing what I actually indended to do when I came back to this little project: this java backend is now steadily in my crosshairs. Already some code cleanup has been done and (*gasp*) documentation has been written. Once this cleanup and restructuring done (I'm hoping before the weekend, but no promises. It's a *MESS* in there) I'll put up a nice 8.0 release and we'll see where this leads us. Quote
spamking1 Posted October 17, 2006 Posted October 17, 2006 Now that the delivery of song and artist name to the Javascript methods has been dealt with, I can get back to doing what I actually indended to do when I came back to this little project: this java backend is now steadily in my crosshairs.Already some code cleanup has been done and (*gasp*) documentation has been written. Once this cleanup and restructuring done (I'm hoping before the weekend, but no promises. It's a *MESS* in there) I'll put up a nice 8.0 release and we'll see where this leads us. Sounds great. I can't wait. :) Quote
wetelectric Posted October 17, 2006 Posted October 17, 2006 Now that the delivery of song and artist name to the Javascript methods has been dealt with, I can get back to doing what I actually indended to do when I came back to this little project: this java backend is now steadily in my crosshairs.Already some code cleanup has been done and (*gasp*) documentation has been written. Once this cleanup and restructuring done (I'm hoping before the weekend, but no promises. It's a *MESS* in there) I'll put up a nice 8.0 release and we'll see where this leads us. ooo have you done a c++ port yet? for what reason?...none really.... i'd like to do it as a mini project... what do u think? Quote
cooper Posted October 18, 2006 Posted October 18, 2006 I'm more familiar with Java, so I'm sticking to that for now. But I'm pretty sure that once I'm done cleaning this beast up you'll have no problem figuring out what the Java program is doing, making the creation of a C++ version a lot easier. Quote
Aerol33t Posted October 18, 2006 Posted October 18, 2006 I cant wait for a cleaned up version... one that I can maybe actually read and understand... Keep up the good work Cooper. Quote
mward Posted October 20, 2006 Posted October 20, 2006 Here's a perl script which sits in the background waiting for new mp3 files to appear in the various plugtemp places. When it finds one, it waits for it to stop growing and then copies it to $HOME/pandora with a name based on the date and time. Now all you need to do is work out the artist and title :D #!/usr/local/bin/perl # Look for mp3 files in $HOME/tmp/plugtmp* # use strict; use warnings; use File::Copy; $SIG{CHLD} = 'IGNORE'; # Automatically reap terminated child processes my $HOME = $ENV{'HOME'} || $ENV{'LOGDIR'} || (getpwuid($<))[7] || die "You're homeless!n"; my $D = 0; # debug my $dest = "$HOME/pandora"; my %seen = (); my @dirs = ("$HOME/tmp", "/tmp"); my $i = 0; my $buf; while (1) { my $base = $dirs[$i]; $i++; $i = 0 if ($i == @dirs); chdir($base); opendir(DIR, ".") or die; foreach my $dir (grep { /^plugtmp/ } readdir(DIR)) { print "Scanning: $base/$dirn" if $D; my @files = (); if (-f $dir) { @files = ($dir); } else { opendir(SUB, $dir) or next; @files = map { "$dir/$_" } grep { !/^..?$/ } readdir(SUB); closedir(SUB); } foreach my $file (@files) { next if $seen{$file}++; PrivoxyWindowOpen(IN, $file) or next; read(IN, $buf, 2); close(IN); next unless $buf eq "xFFxFB"; print "New file: $file n" if $D; unless (fork) { # Child waits for file to stop growing and then copies it my $old = 0; while (1) { my $size = -s $file; print "$file size = $sizen" if $D; if ($size > $old) { $old = $size; sleep(60); } else { if ($size > 1000000) { # Grab this file my ($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) = localtime(time); $year += 1900; $mon++; my $copy = sprintf("%04i%02i%02i.%02i.%02i.%02i.mp3", $year, $mon, $mday, $hour, $min, $sec); print "copying $file to $dest/$copyn" if $D; copy($file, "$dest/$copy"); } exit(0); } } } } } sleep(10); } Cooper: Made it a code block for improved readability (indentation). Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.