BaroqueW

BaroqueW

and his sidekick nikkitaa

BaroqueW RSS Feed
 
 
 
 

Posts tagged Mac

iPhoto et tags EXIF

Adapté d’un script par Andrew Turner, ce script Applescript permet d’ajouter des tags Exif (commentaires, titre, date, etc.) à vos photos à partir des méta-données que vous aurez saisies dans iPhoto. Pour ce faire, sélectionnez vos photos dans iPhoto (pas des albums mais bien des photos) et exécutez ce script. Voir plus bas pour quelques commentaires et le script à télécharger.

  1. – This applescript will set the exif keywords, name, and comments of all selected iPhoto
  2. –   images using the information current in iPhoto.
  3. – Author: Andrew Turner (http://highearthorbit.com)
  4. – Editor: BaroqueW (http://www.baroquew.net)
  5. property copyright : ""
  6. property URL : ""
  7. property exifToolOriginal : "_original"
  8.  
  9. – True retains copyright, False means Public Domain
  10. property Copyrighted : "False"
  11.  
  12. tell application "iPhoto"
  13.         activate
  14.         try
  15.                 copy (my selected_images()) to these_images
  16.                 if these_images is false or (the count of these_images) is 0 then ¬
  17.                         error "Please select a single image."
  18.  
  19.                 set counter to 0
  20.  
  21.                 repeat with i from 1 to the count of these_images
  22.                         set the keywordslist to ""
  23.                         set this_photo to item i of these_images
  24.                         tell this_photo
  25.                                 set the image_file to the image path
  26.                                 set the image_title to the title
  27.                                 set the image_filename to the image filename
  28.                                 set the image_comment to the comment
  29.                                 set the assigned_keywords to the name of keywords
  30.                                 set the image_date to the date
  31.                                 set date_step1 to do shell script "echo " & image_date & " | sed ’s/,//g’ | sed ’s/\\([A-Z][a-z][a-z]\\)\\([a-z]\\)*/\\1/g’ | sed ’s/[0-9][0-9]\\([0-9][0-9]\\)/\\1/’"
  32.                                 set date_step2 to do shell script "date -j -f ‘%a %b %d %y %I:%M:%S %p’ " & quoted form of date_step1 & " ‘+%y:%m:%d %H:%M:%S’  | sed ’s/^0/200/’ | sed ’s/^9/199/’"
  33.                         end tell
  34.                         repeat with j from 1 to the count of assigned_keywords
  35.                                 set the keywordslist to keywordslist & " -keywords+=" & item j of assigned_keywords
  36.                         end repeat
  37.                         set the command to "exiftool -m -PL -title=\"" & image_title & ¬
  38.                                 "\" " & keywordslist & ¬
  39.                                 " " & " -comment=’" & image_comment & ¬
  40.                                 "’ " & " -CreateDate=’" & date_step2 & ¬
  41.                                 "’ " & " -DateTimeOriginal=’" & date_step2 & ¬
  42.                                 "’ " & " -Copyright=’" & copyright & ¬
  43.                                 "’ " & " -CopyrightNotice=’" & copyright & ¬
  44.                                 "’ " & " -Rights=’" & copyright & ¬
  45.                                 "’ " & " -Marked=’" & Copyrighted & ¬
  46.                                 "’ " & "\"" & image_file & "\""
  47.                         set output to do shell script command
  48.                         do shell script "rm \"" & image_file & "\"" & exifToolOriginal
  49.                         set counter to counter + 1
  50.                 end repeat
  51.                 display dialog "Exif writing complete for " & (counter as string) & " files."
  52.         on error error_message number error_number
  53.                 if the error_number is not -128 then
  54.                         display dialog error_message & " Exif writing complete for " & (counter as string) & " files." buttons {"Cancel"} default button 1
  55.                 end if
  56.         end try
  57. end tell
  58.  
  59. on selected_images()
  60.         tell application "iPhoto"
  61.                 try
  62.                         – get selection
  63.                         set these_items to the selection
  64.                         – check for single album selected
  65.                         if the class of item 1 of these_items is album then error
  66.                         – return the list of selected photos
  67.                         return these_items
  68.                 on error
  69.                         return false
  70.                 end try
  71.         end tell
  72. end selected_images

J’ai amélioré le script pour le rendre compatible avec les inévitables accents et apostrophes de la langue française. J’ai aussi ajouté le support pour les dates (cf. les expressions régulières et ’sed’ plus haut, lignes 33 et 34) – à noter que mes locales sont en anglais sur MacOSX donc il y aura peut-être des adaptations à faire pour retomber sur vos pieds (notamment l’usage de AM/PM serait surprenant avec des locales françaises, voir ligne 34). Petite cerise sur le gâteau, le programme retourne le nombre de fichiers modifiés (ligne 53) et éventuellement le fichier qui a causé une erreur en cas de plantage (ligne 56).

Attention : par choix personnel, j’ai décidé d’ignorer les erreurs mineures (modificateur ‘-m’ dans la commande ‘exiftool’ à la ligne 39). Il est recommandé d’essayer le script sans ce modificateur et de le rajouter si vous rencontrez des problèmes et que vous voulez tenter votre chance.

Vous pouvez télécharger le script ici : Set Exif Data

Category: Articles en français, Tech >> Computer | Leave a comment

A GPS on your Mac

I just bought a no-name USB GPS receiver in the Swedish store Teknikmagasinet and it’s up and running on my Mac (Leopard 10.5.1 or Ubuntu via Parallels). Story of an installation.

The device is just a small box, the size of a matchbox, that you can connect using the built-in PS2 cable or using the USB cable extension provided in the package (convenient to place the receiver outside or by the window). The package also contains a CD, note really useful (especially the test application) but it gives a very exhaustive list of the NMEA commands the receiver understands. The GPS chip is a Nemerix (not a Garmin, not a SiRF). For $40 to $60, you can find on Amazon similar USB GPS receivers with various chips and features (waterproof, number of channels, etc.).

Ubuntu
Ubuntu
First of all, Ubuntu with Parallels. My install is the installation that can be found on the website of Parallels. Remember to connect the USB port to Parallels (Devices>USB>USB-Serial controller) before going any further. Next, go in System>Administration>Synaptics Package Manager under Ubuntu. You can do a search on the string “GPS” and install the packages you feel interested in. At least, you need to install the GPS daemon gpsd and a client: xgps or gpsdrive. Then, start gpsd with ‘gpsd -n -D 3 -p /dev/ttyUSB0‘. If you want to push the envelope any further, go and visit the gpsd web site, otherwise, I provide all the basic informations here. To check your GPS receiver is working, start xgps or gpsdrive. If you see a sort of constellation in xgps representing the various satellites of the GPS system, or if your position shows up properly in gpsdrive, you’re good. If you have a display in xgps but not coordinates on the left side of the screen, it means the signal is too weak. Get the receiver outside or closer to a window, or try to get a clear horizon. To do some debugging, stop gpsd and start it again with ‘gpsd -n -N -D 3 -p /dev/ttyUSB0} to check the messages exchanged between the receiver and the computer. If you see a message saying “satellite data no good”, it means there is no proper reception. See below to screenshots: first, a screen of xgps with a poor reception (”n/a” on the left of the screen) and a screen of gpsdrive with a proper signal (I removed the bottom of the screen that included my coordinates). I didn’t test but this whole setup should be compatible with Kismet.

MacOSX
MacOSX
Now, let’s have a look at MacOSX. The easiest is to start installing the driver for PL2303 (the USB controller for many GPS receivers) on Prolific’s website. Then, install gpsdX, the OSX version of gpsd. Then start the start the application called ‘gpsdX Config’ and choose ‘/dev/tty.usbserial’, the peripheral created by the driver downloaded on Prolific (obviously if you GPS receiver is bluetooth-enabled, just select one of the /dev/tty.Bluetooth devices from the list). Apply the new settings and you now have a gpsd server running under MacOSX! Next step, finding a client. You have two options: gps2geX that interfaces gpsd with Google Earth (even in its free version), or the MacOSX port of GpsDrive developed by VASS-Softwareentwicklung. The first one obviously needs to have Google Earth installed on your computer. To use gps2geX, start GE, then start gps2geX, next click on “Start gps2geX” and here you are: Google Earth is kept updated regularly with your position! On the other hand, GpsDrive requires the installation of X11 from your copy of the DVD of MacOSX Leopard (or Tiger). Note that Gpsdrive is a PPC binary (but runs on Intel computers via Rosetta). The rest is just like under Ubuntu. Last precision, the use of gpsX is compatible (tested) with KisMAC (Kismet and KisMAC are two tools for wireless networks).

Category: Articles in English, Tech >> Computer | Leave a comment

Un GPS sur votre Mac

Je viens récemment d’acquérir un récepteur GPS USB d’entrée de gamme (comprendre, no-name) chez les Suédois de Teknikmagasinet et il tourne sur mon Mac (Leopard 10.5.1 ou Ubuntu via Parallels). Récit d’une installation.

L’appareil se présente sous la forme d’une petite boîte (taille boîte d’allumettes) qui peut se connecter avec un cable PS2 ou USB via la rallonge fournie (pratique pour laisser le recepteur a la fenetre ou dehors dans le jardin). Il y a aussi un CD d’install, anecdotique au niveau des applications mais avec plusieurs guides qui renseignent sur les commandes NMEA que le récepteur reconnaît. Au passage, la puce GPS est une puce Nemerix (pas Garmin ni SiRF).

Ubuntu
Ubuntu
Tout d’abord, sous Ubuntu avec Parallels. Mon installation est celle qu’on trouve à télécharger sur le site de Parallels. Rappelez-vous de connecter le port USB à Parallels (Devices>USB>USB-Serial controller) avant de commencer. Ensuite, allez dans System>Administration>Synaptics Package Manager sous Ubuntu. Faites une recherche sur GPS et installez les packages qui vous intéressent (au moins gpsd pour le daemon GPS indispensable et probablement un client: xgps ou gpsdrive sont une bonne idée). Lancez ensuite gpsd avec ‘gpsd -n -D 3 -p /dev/ttyUSB0‘. Si vous voulez pousser plus loin, regardez sur le site de gpsd, pour une utilisation normale, vous avez toutes les explications ici. Pour vérifier que votre GPS marche, lancez xgps ou gpsdrive. Si vous voyez une espece de constellation dans xgps représentant les satellites du système GPS ou bien si votre position s’affiche sur la carte de gpsdrive, c’est gagné. Si vous avez un affichage dans xgps mais pas de coordonnées (partie gauche de l’écran), cela signifie que le signal est trop faible. Rapprochez-vous d’une fenêtre ou tâchez d’obtenir une ligne d’horizon plus dégagée. Si vraiment vous n’obtenez rien, lancez gpsd avec ‘gpsd -n -N -D 3 -p /dev/ttyUSB0‘ pour avoir l’affichage des messages reçus et échangés par le récepteur et l’ordinateur, ça peut aider (notamment “satellite data no good” qui signifie que la réception est mauvaise). Ci-dessous, un aperçu de xgps avec une mauvaise réception (”n/a” à gauche de l’écran) et un aperçu de gpsdrive en fonctionnement (moins le bas de l’écran qui indique les coordonnées précises du récepteur). Dernière précision, a priori ce montage est compatible avec Kismet mais je ne l’ai pas testé.


gpsdrive
gpsdrive

MacOSX
MacOSX
Pour MacOSX maintenant. Le plus simple est d’installer le driver pour PL2303 (controleur USB de nombreux récepteurs GPS) depuis le site de Prolific. Ensuite, installez gpsdX, version OSX de gpsd. Lancez le programme appelé ‘gpsdX Config’ et choisissez ‘/dev/tty.usbserial‘, périphérique créé par le driver de Prolific (si votre récepteur USB est bluetooth, pas besoin d’installer le driver de Prolific, sélectionnez juste un des /dev/tty.Bluetooth). Appliquez ce changement et vous avez un serveur gpsd qui tourne sur votre Mac ! Maintenant, pour l’utiliser, deux options : soit gps2geX qui interface gpsd avec Google Earth (même en version gratuite), ou le port pour MacOSX de GpsDrive réalisé par VASS-Softwareentwicklung. Le premier nécessite l’installation de Google Earth au préalable. Ensuite il ne reste plus qu’à installer gps2geX, lancer GE puis gps2geX, cliquer sur “Start gps2geX” et vous voilà avec votre position actuelle (et mise-à-jour régulièrement) dans Google Earth ! L’installation de GpsDrive nécessite l’installation de X11 depuis votre DVD de MacOSX Leopard (ou pas Leopard d’ailleurs). À noter que GpsDrive tourne sur PPC (et donc sur Intel via Rosetta). Le reste se déroule comme sous Ubuntu. Dernière précision, l’utilisation de gpsX est compatible (testé) avec KisMAC (Kismet et KisMAC sont deux outils de visualisation de réseaux WiFi).

P.S. : Pour aller plus loin, OpenStreetMap qui fournira à terme les cartes de gpsdrive et qui réunit une communauté d’utilisateurs façon Wikipedia autour de l’édition d’une carte du monde.

Category: Articles en français, Tech >> Computer | Comments (2)

SL Widget: update

I would like to notify you of the recent update of widget SL maintained by Niklas Frykholm. This update suppresses the need to my modifications, maybe some of them were added (cf. this previous article), I don’t know… Any way, I strongly recommend upgrading to this new version.

Screenshot SL
Screenshot SL

Category: Articles in English, Suède / Sweden, Tech >> Computer | Leave a comment

SL Widget : mise à jour

Je tiens à signaler la mise à jour du widget SL maintenu par Niklas Frykholm. Cette mise à jour rend caduque mes modifications (cf. cet ancien article), peut-être certaines ont-elles été incorporées, je ne sais pas… En tout cas, je recommande le téléchargement de la mise à jour.

Screenshot SL
Screenshot SL

Category: Articles en français, Suède / Sweden, Tech >> Computer | Leave a comment