Tuesday, June 3, 2008

Applescripts for Delicious Library 2

Here are a few applescripts I threw together for Delicious Library 2. Applescripts go into ~/Library/Scripts/Applications/Delicious Library 2/.

1) Mass import from a list of ISBNs.


-- Menu Path: [2], "Import", "Import Scripts"
-- Get a file name
tell application "Finder"
set isbnList to paragraphs of (read (choose file with prompt "Pick text file containing ISBNs to import"))
end tell

-- Statistic variables
set numIsbn to 0
set existingIsbn to 0
set lookedup to 0

tell first document of application "Delicious Library 2"
set isbnListRef to a reference to isbnList
repeat with isbnItem in isbnListRef
set numIsbn to numIsbn + 1
-- Check to see if book with this ISBN is already in the library
if (every book whose isbn is isbnItem) is {} then
set lookedup to lookedup + 1
-- DL2 call to look up ISBN on Amazon
look up isbnItem
-- Delay is to prevent flooding DL2s look up mechanism
delay 0.01
else
set existingIsbn to existingIsbn + 1
end if
end repeat
end tell

-- Report stats
display dialog "Done: " & numIsbn & " ISBN in list. " & lookedup & " ISBN looked up. " & existingIsbn & " ISBN already in DB."


I set this up to let me import my OpenDb list. In this case, the script will be located under the File|Import menu.
Use the "Export my Items" action in OpenDb. You will need to specify Books specifically to be able to export ISBNs.

2) Renaming titles based on series and number in series fields.


tell first document of application "Delicious Library 2"
set selectedItems to selected media
if selectedItems is {} then
display dialog "No entry is selected. Run on all entries in the library? (This may take a while.)"
set bookNames to every book whose series is not missing value and number in series > 0
else
set bookNames to selectedItems
end if
set bookNamesRef to a reference to bookNames
repeat with bookItem in bookNamesRef
set bookName to name of bookItem
set bookSeries to series of bookItem
set bookNumber to number in series of bookItem
if bookSeries is not missing value and bookNumber > 0 then
set name of bookItem to bookSeries & ": v. " & bookNumber
end if
end repeat
end tell


I collect lots of manga which tend to run multiple volumes. Unfortunately, sorting by title runs into problems when jumping from single digit volumes to multiple digit volumes (v.10 coming before v.2, for instance). Also, importing the information from Amazon can be wildly inconsistent with formatting.

This script will make use of the "series" and "number in series" fields to rewrite the "name" field.

An improvement would be if DL2 added an "on update" script that could automatically run this script when changes are made.

3) Pulling the volume number from a title.


tell first document of application "Delicious Library 2"
set selectedItems to selected media
if selectedItems is {} then
display dialog "No entry is selected. Run on all entries in the library? (This may take a while.)"
set bookNames to every book whose series is not missing value and number in series is 0
else
set bookNames to selectedItems
end if
set bookNamesRef to a reference to bookNames
repeat with bookItem in bookNamesRef
set bookName to name of bookItem
set bookSeries to series of bookItem
set bookNumber to number in series of bookItem
if bookSeries is not missing value and bookNumber = 0 then
set testlist to (a reference to characters of bookName)
set validChars to "0123456789"
set numberFound to false
set foundNums to ""
repeat with i from length of testlist to 1 by -1
if validChars contains item i of testlist then
set numberFound to true
set foundNums to item i of testlist & foundNums
else
if numberFound then
exit repeat
end if
end if
end repeat
if numberFound then
set foundNums to foundNums as number
set number in series of bookItem to foundNums
end if
end if
end repeat
end tell


Of course, filling the "series" and "number in series" fields is a bit of a pain itself. This script will assume that the last number in a title is the volume number and assign that to the "number in series" field.

It will only process items that have a "series" field set. It is fairly easy to batch set a group of items to the same series and then run this script to pull the volume numbers out. Afterwards, I run script 2 to format all of the titles.


These scripts are set to deal specifically with book items but they should work well enough for DVDs with a minor modification.

The last step for me is to figure out a way to reliably and automatically set the "series" field from the "name" field. This is much more difficult due to the inconsistency with how Amazon lists manga though it seems to be more consistent with recent titles.

Monday, November 12, 2007

Phase Review

Introduction
I'd like to think I'm well-versed in rhythm games having played my fair share of Guitar Hero, Karaoke Revolution, Ouendan, Band Brothers, Donkey Konga and DDR. I've even gone in with my share of Samba de Amigo, Taiko Drum Master, Parappa, Gitaroo-man and Amplitude. Shakka de Tambourine has eluded me sadly. Harmonix, the maker of Karaoke Revolution and Guitar Hero, has recently released an iPod rhythm game called Phase.

Phase is only available for the new iPod Nanos, Classic and 5th gen iPods (no iPod Touch or iPhone). Once it's installed (in iTunes 7.5), you'll have a Phase Playlist that you can drag your favorite tracks to. iTunes will spend a few seconds per track calculating game data from the music.

Gameplay
The game itself has a receding 3-d track reminiscent of Guitar Hero. Notes scroll towards you on 3 tracks corresponding to previous, select and next buttons (left, center, right). There is also a slider effect where you sweep your finger along the touch wheel to catch notes.

Each song starts with Easy, Middle, and Hard modes. Apparently more can be unlocked as you clear marathon mode - a series of 5 songs. I have yet to clear marathon mode so I'm just going off one of the random loading screen tips here. High scores are stored for each individual song.

The game is a decent rhythmer that makes good use of the platform. I don't find the side graphics (random 2d bitmaps) or sound effects (cheers and hit confirmations) particularly interesting and I've turned the sound effects off. As is with the case with most rhythm games, you'll probably be too busy concentrating on the notes to see the side graphics anyways.

On my own 5th gen iPod, the game eats the battery about as badly as video playback. My battery life was never good to begin with and I managed about an hour on a charge. The newer iPods should hopefully manage better. I also had an intermittent problem where loading my entire playlist of 150 songs caused the iPod to reboot. I wasn't able to reproduce this later so I'm unsure what the exact cause was.

Takeaways
Phase (or iTunes) does a good job of calculating the game data from the song. And this data generation makes Phase more compelling than it probably would be otherwise. A common weakness for most rhythm games is the song selection. Regardless of the game controllers or graphics quality, the "quality" of the song list tends to be a large factor as to whether or not people like a particular rhythm game. No matter how cool the controller, if a person (me) isn't that big a fan of rock music, he's probably not getting Guitar Hero (I played my sister's copy instead of getting my own).

Phase allows me to tap away to my favorite J-Pop or anime themes which are hard to come by in US rhythm game releases. The guaranteed ability to play to your favorite songs is a definite point (I would say strongest) in Phase's favor.

The creation of game data lends itself to some tantalizing home-brew possibilities. I haven't investigated how the game data is stored, but it could in principle lend itself to game clients on PC and Mac platforms. Given the availability of various game controllers for home computers, one could potentially unlock all of one's song collection for a larger and more immersing interface.

Thursday, August 9, 2007

Origami Starcraft figures

Saw this link over on boardgamegeek.com. I like the reaver that's off to the bottom.

Wednesday, June 13, 2007

Leopard's New Finder

I've been thinking about GUI design for a while and I came up with a few conclusions about file managers. I believe that the tasks a user performs in the file manager can be divided into three tasks.

  • The one I will focus on in this article is document management. What I place into this term is essentially the navigation or actions involved with finding, organizing and opening documents.
  • The second task is application launching. There's a little overlap with document management as media-related applications are usually launched by their associated documents instead of by the executable directly. Apple's Dock is a fairly underpowered, but effective handler of application launching. Various third party apps also give alternatives to more effective application launching.
  • The last is actual file/folder management. In this case, I mean moving, copying or deleting files and folders around on a system or to shared file systems.
Apple unveiled a new finder for Leopard at their WWDC based around iTunes. While not doing much for file management, I think using an iTunes model is a good idea towards providing a document management aspect in the finder. However, I'm disappointed because I feel that Apple didn't take the idea far enough and the result is mostly a lot of flash without that much substance.

The disclaimer for the entire article is that it is based on what has been publicly shown for Leopard. There's a possibility that Apple has elements that they haven't shown or have planned and not yet completed.



Originally and continuing into today, document management consists primarily of folders/subdirectories. A person might dump all of their school papers for 2005 into a 2005 folder. All of their history papers might further go into 2005/History. The purpose of this organization is to reduce clutter and to make it easier to find a document later. Thus, also, the traditional encapsulation of document management by file management.

There's been a minor shift recently towards using search to either replace or augment the need for this type of organization. Spotlight and other similar technologies on other OSs make it easier to find specific files without having to delve through trees of folders. I'm not that fond of this shift myself, but it appears to work well for some people as a few keystrokes gets them to their document.

However, search is direct. In the case of Spotlight, it's really to open documents as there are a few extra steps needed if you want to do file management on something it finds. Additionally, I think there's still a lot of benefit to being able to browse through documents. This is presumably the principle behind preview icons and Cover Flow which is about as flashy a browsing method as one can get. Browsing also is needed if you want to do file management. If you are looking to copy a bunch of files to a flash drive or onto an NFS.

I believe an iTunes-like interface makes the most sense for this kind of operation. And when I think iTunes, I'm thinking of meta-data management which unfortunately appears to not be something that's going to appear in Leopard. Meta-data is what people are really applying via their folder hierarchies and file naming schemes. Much like how an mp3 in iTunes could be named 01-dontdownloadthissong.mp3, but have artist, genre, album and other information associated in iTunes, any random file could have some set of meta-data that would help organize it.

OS X currently has minor support for this in the way of Spotlight comments that can be set on the information view for a file. But it doesn't appear that Apple is taking it any further at this time.



So what would extended meta-data handling in the finder give you? For starters, if it followed the iTunes interface, setting meta-data on mulitple files would become very easy. Just select a group of files and you would be able to change the information on all of them in one dialogue. Another benefit would be even more powerful smart folders/smart lists.

A killer feature I'm thinking of would be the ability to specify specific meta-data columns to use for a specific folder. Let's say you made an e-book folder to hold various pdfs or text files. Then in addition to whatever standard generic meta-data tags a file would have, you could define publisher, author, genre, rating. That folder would then turn into a mini-iTunes for ebooks.



I will cut Apple some slack as there's a big problem that would put a damper on all this meta-data tagging. That is namely that there is no good way to transfer meta-data around the internet. Locally, meta-data can be stored in the resource fork, but without a reliable and/or standardized way to transfer the resource fork, any meta-data on your system gets lost once it's off your system. But all the same, the ability to have it on the local system would still have a lot of utility.

Here's hoping for 10.5.x or 10.6 I guess.

Thursday, January 18, 2007

Total Off-the-wall Random Speculation

I'm a fan of shows like Lost, Heroes and 24 where there's the big conspiracy or mystery and part of the show is finding out what the twists are. It seems like a popular pasttime is to try to figure out the twists before they happen. I find myself falling into this also, but, lately, it seems like people are just coming up with absurd theories for the sake of making theories.

"What's with the numbers?" "Who is Sylar?" "Who's the CTU mole?"

Have we seen so much TV - are ideas so recycled - that it's necessary to try and guess the plot before it happens? Part of me feels that people who make up outlandish theories just want the satisfaction of being able to say "I was right" on the off-chance that it comes to pass. Part of me is starting to want people to shut up and see what happens as it unfolds.

Anyhow, in season 6 of 24, Wayne Palmer is now president. He is the brother of former president David Palmer. I recently read a side-comment on TWOP that questioned how he managed to become president and what his qualifications were for running a country.

So, in a fit of free-association from that thought, my uber-outlandish theory is that it doesn't make any sense for Wayne to be president. Season 6 actually isn't real. Jack isn't free and is actually still in a Chinese prison. The events of season 6 are all in his head as a fantasy to deal with his incarceration and torture. Or alternately, it's a kind of hypnosis by the Chinese to get him to spill State secrets. Oh yeah, and Patrick Duffy is in the shower and Roseanne's an aspiring novelist.

There you go. In 4 months, I'll have a very small, but non-zero chance of saying, "Called it."

Friday, January 12, 2007

Axiotron Modbook

A company called Axiotron has created a Mac tablet called the Modbook. The previews and reviews from MacWorld look promising. It is an Apple Macbook that the company has modified with a new case and screen. The internals are all Apple. The tablet functionality is from Wacom. It looks like it would certainly fulfill a market that Apple has decided to skip for now.

From the various descriptions I've read, it sounds like Axiotron is buying completed Macbooks from Apple, maybe getting a bulk discount, and then disassembling and using the appropriate parts to create the Modbook.

Here's my question. What are they doing with the leftover parts? Are the old keyboard and screen being sold as spare parts? This looks like a great product, but buying whole Macbooks (as opposed to motherboards or what not) just seems so wasteful.

Wednesday, January 10, 2007

Apple's iPhone: Caveats, Concerns and Ideas

Everyone's covering Apple's iPhone so I won't bother to repeat what they're saying. Instead, I'm going to first address things people should have learned from previous Apple dealings. In the second half, I'm going to go over my personal concerns about the phone's design and give some ideas on how to get around those concerns. If anyone from Apple's listening, no charge for these ideas. I promise I won't sue if you use them.

Standard Apple Operating Procedure
The iPhone is a new product, but at the same time it's also an iPod. And anyone who's followed the iPod since its launch should take into consideration Apple's actions with regards to that device. The big issue I'm focusing on has been Apple's unwillingness to back-port features to earlier generation iPods.

For example, people have been working PDA-like functions onto the iPod since the beginning. To my memory, the first-gen iPod supported just played music. And so people made empty mp3 files with contact information in the song tags. The 10 gig iPod then came out and provided contact information as a feature which was also applied to the 5 gig. Unfortunately, this was about it for the free upgrades.

People quickly co-opted the new contact feature to store general data by making dummy vcards. In the second-gen iPod, Apple added its own notes system. However, this new feature was not back-ported to the first-gen.

Along came the third-gen with on-the-go playlists. It was a really nice, new feature, but older iPod owners had to upgrade or get nothing.

Then came along came iTMS. Amazingly, all iPods received an upgrade. iPods that couldn't support the seemingly simple notes system had no problems dealing with the new DRM system.

This behavior has continued where anything that might make Apple money can be implemented on older iPods without issue, but features that seem like they could be provided through a firmware upgrade are reserved for newer iPods only. If one wanted to give Apple the benefit of the doubt, maybe some of the new features genuinely couldn't work on earlier models, but the pattern is rather apparent.

Now, given that the iPhone is advertised as running some version of OSX, hopefully this trend will not continue and we won't end up with first-gen/second-gen/n-th-gen firmware revisions adding new features that are "incapable" of being run on earlier models. Of course, we may end up with paid OS upgrades instead (coming June 2008, OSX 10.6 for Macs and iPhones!), but at least that's better than having to buy an entirely new device.

Batteries Permanently Included
This leads to a second issue which I haven't seen covered too much yet. The battery life of the device has raised a few eyebrows, but I haven't seen too many people question the, yet again, non-user-replaceable battery.

From a design perspective, the permanent battery allows for a level of integration and form factor that's not possible otherwise. However, unlike with a degraded-battery iPod where there's still uses (permanent use in car docks, boom boxes), an iPhone that suddenly only has 2 hours of talk time is significantly less useful. And while your cheap cellphones don't typically have a life greater than 2 years, I wouldn't think that would apply to smartphones. Regardless, I'm not crazy about planning to replace a $500 device that often.

Will Apple provide a reasonable battery replacement service? Remember also that an iPhone is a phone and people would be less willing to part with their phone for a few days compared to their iPod.

So Close Yet So Far
The iPhone truly is packed with a cool combination of technology that makes me drool with the best of them. The multitude of sensors; the slick interface; the next-gen multi-touch control.

And yet, there's a lot of "but"s that make me wonder why I don't want it more. The price, the memory, the battery life. There's also the carrier, but that's more a business problem and I don't have any rationalizations for that.

This Didn't Go So Well for Sony
First off, the price. There's definite sticker shock. At the keynote, Jobs led up with "how much would you pay? A Nano is $199. A typical smartphone is $299." I was hoping he was going to do a "$499? *red line through that* $449? *red line through that* No! Yours for $399!" Too bad that's just in my fantasy world.

It seems expensive compared to smartphones. It seems expensive compared to Nanos. But consider that the original iPod was $400. Consider the (hopeful) strong integration with OSX (and this would definitely be a feature for me). I'd rather pay $400. But I can drag myself up. More easily than I can for PS3s at any rate.

Is There A Zero Missing?
My next big concern (as with many) is the memory. 4 gigs/8 gigs doesn't seem like very much. But if one considers that the iPhone most likely would be docked every night, then it allows for the possibility (at least in my usage) to have frequent content loads and unloads ala the shuffle.

Audio or video podcasts could be synced and then removed after viewing. A cool usage would be for my EyeTV to automatically record, say, The Tonight Show, automatically encode and upload for me to watch during lunch the next day. And then when I get home and dock, automatically unload. This solution wouldn't work for everyone as some people really just want to have all their media available at any time. But for a good percentage, I think it would effectively manage the amount of space provided.

PSP Flashbacks
Lastly, there's the battery life. My concern here isn't so much from the iPod perspective, but from the phone. I shudder at a scenario of getting on a plane, watching 5 hours of video and then landing at the airport with my battery almost dead and myself unable to make a call. Having to charge nightly doesn't phase me too much, but the possibility that the charge wouldn't make it through the day and leave me without a phone really holds me back. It makes me want to have a phone separate from a wide-touchscreen-wifi iPod.

Luckily for Apple, I've got a solution! One of the rumors I've heard is that the iPhone has two batteries. One for the phone and one for the other functions. I hope this rumor isn't true as it's a ridiculously stupid idea. But it did get me on the path to a better solution.

What Apple should do is allow a user to configure reserve battery cutoffs. If the battery has only 1 hour of talk time left, then disable or give a warning for all functions except phone use. Or phone calls and browsing. Let the user configure what they want their buffer to be and what can be used at each level.

So in my above flight scenario, I'd watch video for 4 hours and then the iPod would pop up a warning, "1 hour of power left. Reserving for phone calls," and hopefully have an easy option to override.

On The Bright Side
Let me say that I'm excited about the iPhone. The combination of technologies makes me think of the Wii. It presents real Star Trek or Minority Report feel into a hand-held device. And I own Apple stock so I'm certainly happy as a shareholder. But as a consumer, I'm hesitant because of these various issues and past history.

Most of my issues can be handled in software design so hopefully Apple will implement something like them to make the iPhone even more attractive.