Dead weblocs

For one of my projects I checked in my .webloc files into my subversion repository. It was a really bad idea. The web locations are stored in the resource fork which will be lost after check-in. No chance to recover them :(

If you wish to share your web shortcuts you should use .url files that are common in Windows. Safari is able to read them too. So there’s no obstacle anymore to share your web shortcuts.

The format of the content of such a file is very simple:
[InternetShortcut]
URL=http://www.example.com

You should add a closing line feed, otherwise some browsers open an empty tab.
I found a script written by Joachim Bondo that converts .webloc into .url files.

property devToolsPath : "/Developer/Tools/" -- path to free Apple Developer Tools

on open draggedFiles
  local theFile, weblocPath, urlPath, theURL, cmd
  repeat with theFile in draggedFiles
    if (theFile as string) ends with ".webloc" then
      -- get full paths
      set weblocPath to quoted form of POSIX path of theFile
      set urlPath to text 1 thru -9 of weblocPath & ".url'"
      -- 1) get URL from .webloc file
      set cmd to devToolsPath & "DeRez -e -only 'url ' " & weblocPath & ¬
        " | grep '/* .* */' | sed 's/^.*/* //;s/ */$//' | tr -d 'n'"
      set theURL to do shell script cmd
      if theURL begins with "http" then
        -- 2) write URL to file
        set cmd to "echo '[InternetShortcut]" & (ASCII character 10) & ¬
          "URL=" & theURL & "' > " & weblocPath
        do shell script cmd
        -- 3) rename file using MvMac now that we have Developer Tools anyway
        set cmd to devToolsPath & "MvMac " & weblocPath & " " & urlPath
        do shell script cmd
      end if
    end if
  end repeat
end open

If you just want to get the address from the .webloc file you can use the script from this site:

set the_file to choose file
try
    tell application "Finder"
        set the_location to location of file the_file
        display dialog the_location buttons {"OK"} default button 1
    end tell
end try
DeliciousDiggTechnorati FavoritesRedditLinkedInFacebookSpurlTwitterWebnewsYiGGMySpaceYahoo BookmarksFriendFeedGoogle BookmarksLiveJournalShare

Video conversion

This is a little howto (in fact it’s only a note for me :-D ) concerning conversion from one type into another using ffmpeg in the shell. You should have already installed ffmpeg ;-)

ffmpeg -i original.mpg -f flv -b 400000 -ac 1 -r 23 -s 320x240 video.flv

  • i: input file
  • f: output format
  • b: bit rate (video)
  • ac: number of audio channels
  • r: frame rate
  • s: size (widthxheight)

Update: There’s a video tutorial about ffmpeg here

DeliciousDiggTechnorati FavoritesRedditLinkedInFacebookSpurlTwitterWebnewsYiGGMySpaceYahoo BookmarksFriendFeedGoogle BookmarksLiveJournalShare