Freitag, 13. August 2010

lastfm / twitter terminal / Geektool python script

I use Geektool (a Mac Program that can displays terminal output on your desktop) and
i use it for my ips, top and lastfm (just look at the site ^^).

i always had a little buggy bash script that parses the website for the last played song,
it needed lynx and didn't work that well.

lynx -dump | grep -i -E '\â\ \[[0-9][0-9]\]' | head -n 1 | sed -e 's/\[[0-9][0-9]\]//g' -e 's/[ ][ ][ ]*/ /g' -e 's/\[icon_eq.gif\]\ //g' -e 's/\[asterisk_small.png\]//g' -e 's/Hört\ gerade/Now/g' -e 's/in\ voller \Länge//g'

note: it might work for you thou

i noticed that the played songs at lastfm are available as a rss feed and as we know that something very common.
in fact so common that people already made a feedparser in python, which i use :)
at his point i want to thank you very much for the great work !!

what you need to do if you want to use it:

1. download
2. unpack somewhere you will keep it, i will call this path "thePath"
3. (testing) open a terminal an and type "cd thePath" hit enter and then ./ and hit enter
- in the terminal it should work and show the last 3 songs i played and 10 post from the Engadet twitter account
this is my output:
hannah:~ lad1337$ cd Desktop/pythonRss/
hannah:pythonRss lad1337$ ./
Me : The Offspring - The End of the Line............... Now
: The Offspring - Neocon............................ 1 minute ago
: The Offspring - Forever and a Day................. 3 minutes ago
- Samsung and Seagate to jointly improve SSDs, give each other noogies behind the barn
- Axon Logic's Haptic tablet can run a desktop's OS, has a desktop's price
- Sony Dash update brings Shoutcast, app shortcuts and the true meaning of life
- Editorial: Waiter, there's a Nazi theme in my Android Market
- Older Apple iOS devices must jailbreak to be secure -- oh the irony
- Pentax K-x introduced in four new colors, double rainbow now fully complete
- Japanese researchers develop robotic wheelchair that can follow humans
- EFO rolls out credit card-sized iPazzPort mini Bluetooth keyboard
- Ask Engadget: best FM transmitter out there?
- Motorola Droid 2 ripped to shreds, where's an astromech when you need one

- if this dosen't work you might want to make the script executable with by typing in the terminal "chmod +x"
- you need internet for this to work and python, i think thats it :S
4. if the test went well you want to costemize it open the script in your favorite text editor
- in line 10 you will see this:
accounts.append({'name':'lad1337', 'url':''})

this line adds one rss feed with the name "lad1337" to the list of feeds to watch
if you want something else there just change the url, but it has to look like this:


same goes for the name both have to bee there but name can be empty.
now the next one(Engadet twitter account) has a lot of more options
• firstItemSkin -> path to the skin to use for the first item
• folowItemSkin -> path to the skin to use for the next items
• remove -> string to remove
• removeWith -> string to replace the removed with
• items -> how many items to display
now all these are optional but in fact give you a lot of customization
for the Engadet twitter account i used a different skin than on my lastfm account
and it displays 10 items instead of only 3 (why 3 ? you will see latter)
and removes the "engadget:" that every post would have

5. you want set skin paths now to rel path instead of relatives paths otherwise it wont work in geektool(not only it wont work in geektool but it wont work at all if you haven't cd to thePath).
just change "firstItemSkin" from "./" to "thePath/" in the accounts and in line 17 to 19 where the default ski is set (its the lasfm skin for now)

6. you could use it just like that if you want so the normal stuff ends here :)

but fyi

• howManyItems -> defauld items to display of each feed
• normalizeTitlesLenght -> the lenght a title should be expanded to
• normalizeTitlesAndCut -> if longer than normalizeTitlesLenght, make it sorter ?
• nameFillerString -> in a skin there you can use @@@namePartialFiller@@@ and @@@nameFullFiller@@@ these will be in a calculated length according to the longest name you entered for a feed and the nameFillerString is the one char that is used to build this string
• titleFillerString -> like nameFillerString but for the title
the "skins"
the skin files are plain text files wit place holders
one file for the first item and one for ever next one
i did this so you can have something like a header for every feed like the "lad1337:" in the first line of the feed but not in the foloving
• @@@name@@@ -> replaced with the name of the feed
• @@@title@@@ -> replaced with the title of a feed post
• @@@time@@@ -> replaced with the time when the item was posted
• @@@niceTime@@@ -> like @@@time@@@ but in a format like "3 minutes ago"
• @@@newsText@@@ -> replaced with the contend of a post
• @@@namePartialFiller@@@ -> replaced with a string made of "nameFillerString" and the delta of the length of the longest name and the current name
• @@@nameFullFiller@@@ -> replaced with a string made of "nameFillerString" and a length of the longest name
• @@@titleFiller@@@ -> replaced with a string made of "titleFillerString" and the delta of the "normalizeTitlesLenght" and the length of the current title
known bugs:
- wont look nice when the rss has html content, tags get stript but there is a lot of white space
- if path to skins is wrong scripts dies with error
- if offline no output, no default offline msg
- no output of none ascii characters !!
- length is misspelled in the script -.-

more features to come!

Samstag, 15. August 2009

The ShuffleRemote

ok ... i'll just suspect that you are familiar with the apple remote and the ipod shuffle (2nd Gen)

well you might have noticed that they both happen to have the same controls...
and i always carry the remote around ... so it would be perfect if i could use it on the go and at home for music.

after two days i got a shuffleRemote ... the remote is always on (even when it's on the docking station)... the ipod is switched on by connecting headphones ... but/and its always on shuffle

it could have been done to shut the remote part off wen headphones are connected... but i don't think that's so important .. and it is quite funny getting ready and putting headphones on and then press play/pause and the stereo goes off and the shuffle starts playing...

well here are some photos:

Donnerstag, 23. Juli 2009

bla bla ... ^^.. its in bremen - germany

Dienstag, 21. Juli 2009

uuhhh pretty ...
butterflys ... well the size ... donno ... max about 5 cm wide:
(check the full size !!)

Spider (NSFC) = Not Suited For Cute
well a spider ... about 2 cm long :
ok .. i will post closeup(or not) pictures off stuff i(or someone else) notice in daily life...
see notes of the pictures
for now:a baby frog ... about 1 cm long

ps all pictures i post are under the Creative Commons License .. blabla

Dienstag, 9. Dezember 2008

i will publish my projects here