Permalink
Commits on Jun 23, 2011
  1. Break out Message as a class (start of code cleanup).

    The Gist I based this project on was basically a big script; I haven't spent the time to clean up the code and should have long ago. Starting out on that by making a Campfire::Message class.
    precipice committed Jun 23, 2011
Commits on Jun 22, 2011
  1. Track the number of existing files found during export.

    Since this is the core of the export problem -- making sure we're getting everything -- tracking possible file overwrites matters a lot.
    precipice committed Jun 22, 2011
  2. Fix bad url generation.

    precipice committed Jun 22, 2011
  3. Error checking and cleanup.

    * Make sure a file doesn't already exist before writing it.
    
    * Report serious exceptions as full stack traces.
    
    * Test, but don't require, a regex to identify filename mismatch problems.
    
    * Ensure lines are <= 80 characters.
    precipice committed Jun 22, 2011
Commits on Jun 21, 2011
  1. Report exception backtraces.

    precipice committed Jun 21, 2011
  2. Break out an api_url method.

    precipice committed Jun 21, 2011
  3. Add a license (Apache license).

    Since I didn't write all the code, the copyright only applies to my own commits, as reflected by the GitHub diffs.
    precipice committed Jun 21, 2011
Commits on Jun 20, 2011
  1. Added export verification, and tests for filename mismatches.

    For export verification, I treat the XML transcript as authoritative, and compare files exported to disk versus the count of files expected from the XML transcript. Any difference is reported as an error at the end of the export session.
    
    To track down the filename mismatch Campfire API bug, also added a regular expression that tests the mismatch pattern as I understand it, and squawks if the test fails. This will be removed once I report the bug.
    precipice committed Jun 20, 2011
  2. Minor README tweaks.

    precipice committed Jun 20, 2011
  3. Fix serious name collisions in exported files.

    It appears there's a bug in the Campfire API, causing the filenames of uploaded files to be reported incorrectly. Files of the form 'filename-#+.ext' are being reported as 'filename.ext'. If the transcript had the same filename uploaded multiple times, Campfire renames subsequent copies as 'filename-1.ext', 'filename-2.ext', and so on, which would cause all of them to be saved as 'filename.ext'. This would overwrite the original upload with each subsequent upload using that naming pattern, destroying one or more copies in the process.
    
    The transcript XML (and the transcript HTML) both report the original filename correctly; only the `/upload` method is affected. As a result, this uses the transcript XML's version of the filename to save out each file.  With this approach no data is overwritten.
    
    I'm collecting examples of the problem and then will report it to 37signals. Hopefully they can fix it and this can be undone. That said, some checking of the export's accuracy is probably a really good idea, since I imagine some people who use this script will destroy their Campfire accounts after running it.
    precipice committed Jun 20, 2011
Commits on Jun 18, 2011
  1. README updates.

    precipice committed Jun 18, 2011
  2. Shrink the size of the main loop and add error handling and reporting.

    This is only a small step in the direction of readable code, but a step, at least. HTTP and IO errors should now be reported and logged, without aborting the script.
    precipice committed Jun 18, 2011
Commits on Jun 17, 2011
  1. Add more message types, and make plaintext versions more consistent.

    The Lock and Unlock messages probably won't (shouldn't) appear in the transcripts, but they are documented in the API, so I'm including them for completeness.
    precipice committed Jun 17, 2011
  2. Correct and clean up error reporting for upload exports.

    Campfire's API returns a 404 if an upload in the transcript was later deleted. 404s are now logged but otherwise ignored. Non-404 errors are logged as errors.
    precipice committed Jun 17, 2011
  3. README updates.

    precipice committed Jun 17, 2011
  4. Clean up file export and log export errors; add HTML export.

    This mostly just refactors the export loop to be a little tighter and cleaner, while adding some error handling and reporting. Uploaded files are now downloaded using the 'upload' API method, instead of scraping them out of the HTML transcript.
    
    The transcript is exported in three formats: XML, HTML (which is new), and plaintext.
    
    The export path now includes the Campfire site subdomain, so the script could be run non-destructively on several sites from the same directory.
    precipice committed Jun 17, 2011
  5. Clean up the plaintext log construction a bit.

    Paste messages are now indented four spaces for clarity. Unknown message types use error logging now.
    
    This is still ugly.
    precipice committed Jun 17, 2011
  6. Add an error logging method.

    precipice committed Jun 17, 2011
  7. Add a few more comments.

    precipice committed Jun 17, 2011
  8. Simplify zero-padding.

    precipice committed Jun 17, 2011
  9. Mark the script configuration section more clearly.

    Also, add slightly clearer explanations for what's needed.
    precipice committed Jun 17, 2011
  10. Modifications to make the exports easier to manage.

    Each day for each room is now exported into a separate directory. If you have a large number of uploads (say, from back when LOLcats were extra-popular), this places the files uploads into a single day's directory for easier access.
    
    Both XML and plaintext transcripts are now saved.
    
    Directories are skipped if there were no messages posted that day.
    
    Room names, instead of ID numbers, are used for the top of the export directory tree.
    
    There is both a start and end date, and the latter is now inclusive, for better export control.
    
    The progress messages are a little more informative.
    
    While the 37signals' API limits are generous, I added a 1/10th of a second sleep between each days' requests to ensure we don't go over.
    precipice committed Jun 17, 2011
  11. Add some super-old message types.

    Found these in a 2006 transcript; I don't know if they're used any more.
    precipice committed Jun 17, 2011
Commits on Feb 10, 2011
  1. Add additional message types and not crash, and some instructions

    benjamin fleischer committed Feb 10, 2011
Commits on Jan 27, 2011
  1. Added a very primitive support to get the uploaded files.

    Bruno Mattarollo committed Jan 27, 2011
Commits on Jan 25, 2011
  1. No commit message

    pat committed Jan 25, 2011