Skip to content

Commit

Permalink
Allow localized date from exif data to be obtained by skin
Browse files Browse the repository at this point in the history
This changeset add the ability for a skin to request a localized
date (no time) for the currently active slideshow picture. This
will be used to show the date a picture was taken based on the exif
data embedded by most digital cameras into .jpg files.
  • Loading branch information
Ross Stutterheim authored and spiff committed Aug 5, 2012
1 parent e48a897 commit d9ce56e
Show file tree
Hide file tree
Showing 4 changed files with 60 additions and 51 deletions.
1 change: 1 addition & 0 deletions xbmc/GUIInfoManager.cpp
Expand Up @@ -532,6 +532,7 @@ const infomap slideshow[] = {{ "ispaused", SLIDESHOW_ISPAUSED },
{ "israndom", SLIDESHOW_ISRANDOM }}; { "israndom", SLIDESHOW_ISRANDOM }};


const int picture_slide_map[] = {/* LISTITEM_PICTURE_RESOLUTION => */ SLIDE_RESOLUTION, const int picture_slide_map[] = {/* LISTITEM_PICTURE_RESOLUTION => */ SLIDE_RESOLUTION,
/* LISTITEM_PICTURE_DATE => */ SLIDE_EXIF_DATE,
/* LISTITEM_PICTURE_DATETIME => */ SLIDE_EXIF_DATE_TIME, /* LISTITEM_PICTURE_DATETIME => */ SLIDE_EXIF_DATE_TIME,
/* LISTITEM_PICTURE_COMMENT => */ SLIDE_COMMENT, /* LISTITEM_PICTURE_COMMENT => */ SLIDE_COMMENT,
/* LISTITEM_PICTURE_CAPTION => */ SLIDE_IPTC_CAPTION, /* LISTITEM_PICTURE_CAPTION => */ SLIDE_IPTC_CAPTION,
Expand Down
101 changes: 51 additions & 50 deletions xbmc/GUIInfoManager.h
Expand Up @@ -461,57 +461,58 @@ namespace INFO
// the ordering of LISTITEM_PICTURE_* is important as they're mapped to SLIDE_* items in GUIInfoManager.cpp // the ordering of LISTITEM_PICTURE_* is important as they're mapped to SLIDE_* items in GUIInfoManager.cpp
#define LISTITEM_PICTURE_START (LISTITEM_START + 30) #define LISTITEM_PICTURE_START (LISTITEM_START + 30)
#define LISTITEM_PICTURE_RESOLUTION (LISTITEM_PICTURE_START) // => SLIDE_RESOLUTION #define LISTITEM_PICTURE_RESOLUTION (LISTITEM_PICTURE_START) // => SLIDE_RESOLUTION
#define LISTITEM_PICTURE_DATETIME (LISTITEM_START + 31) // => SLIDE_EXIF_DATE_TIME #define LISTITEM_PICTURE_DATE (LISTITEM_START + 31) // => SLIDE_EXIF_DATE
#define LISTITEM_PICTURE_COMMENT (LISTITEM_START + 32) // => SLIDE_COMMENT #define LISTITEM_PICTURE_DATETIME (LISTITEM_START + 32) // => SLIDE_EXIF_DATE_TIME
#define LISTITEM_PICTURE_CAPTION (LISTITEM_START + 33) // => SLIDE_IPTC_CAPTION #define LISTITEM_PICTURE_COMMENT (LISTITEM_START + 33) // => SLIDE_COMMENT
#define LISTITEM_PICTURE_DESC (LISTITEM_START + 34) // => SLIDE_EXIF_DESCRIPTION #define LISTITEM_PICTURE_CAPTION (LISTITEM_START + 34) // => SLIDE_IPTC_CAPTION
#define LISTITEM_PICTURE_KEYWORDS (LISTITEM_START + 35) // => SLIDE_IPTC_KEYWORDS #define LISTITEM_PICTURE_DESC (LISTITEM_START + 35) // => SLIDE_EXIF_DESCRIPTION
#define LISTITEM_PICTURE_CAM_MAKE (LISTITEM_START + 36) // => SLIDE_EXIF_CAMERA_MAKE #define LISTITEM_PICTURE_KEYWORDS (LISTITEM_START + 36) // => SLIDE_IPTC_KEYWORDS
#define LISTITEM_PICTURE_CAM_MODEL (LISTITEM_START + 37) // => SLIDE_EXIF_CAMERA_MODEL #define LISTITEM_PICTURE_CAM_MAKE (LISTITEM_START + 37) // => SLIDE_EXIF_CAMERA_MAKE
#define LISTITEM_PICTURE_APERTURE (LISTITEM_START + 38) // => SLIDE_EXIF_APERTURE #define LISTITEM_PICTURE_CAM_MODEL (LISTITEM_START + 38) // => SLIDE_EXIF_CAMERA_MODEL
#define LISTITEM_PICTURE_FOCAL_LEN (LISTITEM_START + 39) // => SLIDE_EXIF_FOCAL_LENGTH #define LISTITEM_PICTURE_APERTURE (LISTITEM_START + 39) // => SLIDE_EXIF_APERTURE
#define LISTITEM_PICTURE_FOCUS_DIST (LISTITEM_START + 40) // => SLIDE_EXIF_FOCUS_DIST #define LISTITEM_PICTURE_FOCAL_LEN (LISTITEM_START + 40) // => SLIDE_EXIF_FOCAL_LENGTH
#define LISTITEM_PICTURE_EXP_MODE (LISTITEM_START + 41) // => SLIDE_EXIF_EXPOSURE_MODE #define LISTITEM_PICTURE_FOCUS_DIST (LISTITEM_START + 41) // => SLIDE_EXIF_FOCUS_DIST
#define LISTITEM_PICTURE_EXP_TIME (LISTITEM_START + 42) // => SLIDE_EXIF_EXPOSURE_TIME #define LISTITEM_PICTURE_EXP_MODE (LISTITEM_START + 42) // => SLIDE_EXIF_EXPOSURE_MODE
#define LISTITEM_PICTURE_ISO (LISTITEM_START + 43) // => SLIDE_EXIF_ISO_EQUIV #define LISTITEM_PICTURE_EXP_TIME (LISTITEM_START + 43) // => SLIDE_EXIF_EXPOSURE_TIME
#define LISTITEM_PICTURE_GPS_LAT (LISTITEM_START + 44) // => SLIDE_EXIF_GPS_LATITUDE #define LISTITEM_PICTURE_ISO (LISTITEM_START + 44) // => SLIDE_EXIF_ISO_EQUIV
#define LISTITEM_PICTURE_GPS_LON (LISTITEM_START + 45) // => SLIDE_EXIF_GPS_LONGITUDE #define LISTITEM_PICTURE_GPS_LAT (LISTITEM_START + 45) // => SLIDE_EXIF_GPS_LATITUDE
#define LISTITEM_PICTURE_GPS_ALT (LISTITEM_START + 46) // => SLIDE_EXIF_GPS_ALTITUDE #define LISTITEM_PICTURE_GPS_LON (LISTITEM_START + 46) // => SLIDE_EXIF_GPS_LONGITUDE
#define LISTITEM_PICTURE_GPS_ALT (LISTITEM_START + 47) // => SLIDE_EXIF_GPS_ALTITUDE
#define LISTITEM_PICTURE_END (LISTITEM_PICTURE_GPS_ALT) #define LISTITEM_PICTURE_END (LISTITEM_PICTURE_GPS_ALT)
#define LISTITEM_STUDIO (LISTITEM_START + 47) #define LISTITEM_STUDIO (LISTITEM_START + 48)
#define LISTITEM_MPAA (LISTITEM_START + 48) #define LISTITEM_MPAA (LISTITEM_START + 49)
#define LISTITEM_CAST (LISTITEM_START + 49) #define LISTITEM_CAST (LISTITEM_START + 50)
#define LISTITEM_CAST_AND_ROLE (LISTITEM_START + 50) #define LISTITEM_CAST_AND_ROLE (LISTITEM_START + 51)
#define LISTITEM_WRITER (LISTITEM_START + 51) #define LISTITEM_WRITER (LISTITEM_START + 52)
#define LISTITEM_TAGLINE (LISTITEM_START + 52) #define LISTITEM_TAGLINE (LISTITEM_START + 53)
#define LISTITEM_TOP250 (LISTITEM_START + 53) #define LISTITEM_TOP250 (LISTITEM_START + 54)
#define LISTITEM_RATING_AND_VOTES (LISTITEM_START + 54) #define LISTITEM_RATING_AND_VOTES (LISTITEM_START + 55)
#define LISTITEM_TRAILER (LISTITEM_START + 55) #define LISTITEM_TRAILER (LISTITEM_START + 56)
#define LISTITEM_STAR_RATING (LISTITEM_START + 56) #define LISTITEM_STAR_RATING (LISTITEM_START + 57)
#define LISTITEM_FILENAME_AND_PATH (LISTITEM_START + 57) #define LISTITEM_FILENAME_AND_PATH (LISTITEM_START + 58)
#define LISTITEM_SORT_LETTER (LISTITEM_START + 58) #define LISTITEM_SORT_LETTER (LISTITEM_START + 59)
#define LISTITEM_ALBUM_ARTIST (LISTITEM_START + 59) #define LISTITEM_ALBUM_ARTIST (LISTITEM_START + 60)
#define LISTITEM_FOLDERNAME (LISTITEM_START + 60) #define LISTITEM_FOLDERNAME (LISTITEM_START + 61)
#define LISTITEM_VIDEO_CODEC (LISTITEM_START + 61) #define LISTITEM_VIDEO_CODEC (LISTITEM_START + 62)
#define LISTITEM_VIDEO_RESOLUTION (LISTITEM_START + 62) #define LISTITEM_VIDEO_RESOLUTION (LISTITEM_START + 63)
#define LISTITEM_VIDEO_ASPECT (LISTITEM_START + 63) #define LISTITEM_VIDEO_ASPECT (LISTITEM_START + 64)
#define LISTITEM_AUDIO_CODEC (LISTITEM_START + 64) #define LISTITEM_AUDIO_CODEC (LISTITEM_START + 65)
#define LISTITEM_AUDIO_CHANNELS (LISTITEM_START + 65) #define LISTITEM_AUDIO_CHANNELS (LISTITEM_START + 66)
#define LISTITEM_AUDIO_LANGUAGE (LISTITEM_START + 66) #define LISTITEM_AUDIO_LANGUAGE (LISTITEM_START + 67)
#define LISTITEM_SUBTITLE_LANGUAGE (LISTITEM_START + 67) #define LISTITEM_SUBTITLE_LANGUAGE (LISTITEM_START + 68)
#define LISTITEM_IS_FOLDER (LISTITEM_START + 68) #define LISTITEM_IS_FOLDER (LISTITEM_START + 69)
#define LISTITEM_ORIGINALTITLE (LISTITEM_START + 69) #define LISTITEM_ORIGINALTITLE (LISTITEM_START + 70)
#define LISTITEM_COUNTRY (LISTITEM_START + 70) #define LISTITEM_COUNTRY (LISTITEM_START + 71)
#define LISTITEM_PLAYCOUNT (LISTITEM_START + 71) #define LISTITEM_PLAYCOUNT (LISTITEM_START + 72)
#define LISTITEM_LASTPLAYED (LISTITEM_START + 72) #define LISTITEM_LASTPLAYED (LISTITEM_START + 73)
#define LISTITEM_FOLDERPATH (LISTITEM_START + 73) #define LISTITEM_FOLDERPATH (LISTITEM_START + 74)
#define LISTITEM_DISC_NUMBER (LISTITEM_START + 74) #define LISTITEM_DISC_NUMBER (LISTITEM_START + 75)
#define LISTITEM_FILE_EXTENSION (LISTITEM_START + 75) #define LISTITEM_FILE_EXTENSION (LISTITEM_START + 76)
#define LISTITEM_IS_RESUMABLE (LISTITEM_START + 76) #define LISTITEM_IS_RESUMABLE (LISTITEM_START + 77)
#define LISTITEM_PERCENT_PLAYED (LISTITEM_START + 77) #define LISTITEM_PERCENT_PLAYED (LISTITEM_START + 78)
#define LISTITEM_DATE_ADDED (LISTITEM_START + 78) #define LISTITEM_DATE_ADDED (LISTITEM_START + 79)
#define LISTITEM_DBTYPE (LISTITEM_START + 79) #define LISTITEM_DBTYPE (LISTITEM_START + 80)
#define LISTITEM_DBID (LISTITEM_START + 80) #define LISTITEM_DBID (LISTITEM_START + 81)


#define LISTITEM_PROPERTY_START (LISTITEM_START + 200) #define LISTITEM_PROPERTY_START (LISTITEM_START + 200)
#define LISTITEM_PROPERTY_END (LISTITEM_PROPERTY_START + 1000) #define LISTITEM_PROPERTY_END (LISTITEM_PROPERTY_START + 1000)
Expand Down
7 changes: 6 additions & 1 deletion xbmc/pictures/PictureInfoTag.cpp
Expand Up @@ -306,6 +306,7 @@ const CStdString CPictureInfoTag::GetInfo(int info) const
value = m_exifInfo.Comments; value = m_exifInfo.Comments;
break; break;
case SLIDE_EXIF_DATE_TIME: case SLIDE_EXIF_DATE_TIME:
case SLIDE_EXIF_DATE:
if (m_exifInfo.DateTime && strlen(m_exifInfo.DateTime) >= 19 && m_exifInfo.DateTime[0] != ' ') if (m_exifInfo.DateTime && strlen(m_exifInfo.DateTime) >= 19 && m_exifInfo.DateTime[0] != ' ')
{ {
CStdString dateTime = m_exifInfo.DateTime; CStdString dateTime = m_exifInfo.DateTime;
Expand All @@ -316,7 +317,10 @@ const CStdString CPictureInfoTag::GetInfo(int info) const
int min = atoi(dateTime.Mid(14,2).c_str()); int min = atoi(dateTime.Mid(14,2).c_str());
int sec = atoi(dateTime.Mid(17,2).c_str()); int sec = atoi(dateTime.Mid(17,2).c_str());
CDateTime date(year, month, day, hour, min, sec); CDateTime date(year, month, day, hour, min, sec);
value = date.GetAsLocalizedDateTime(); if(SLIDE_EXIF_DATE_TIME == info)
value = date.GetAsLocalizedDateTime();
else
value = date.GetAsLocalizedDate();
} }
break; break;
case SLIDE_EXIF_DESCRIPTION: case SLIDE_EXIF_DESCRIPTION:
Expand Down Expand Up @@ -512,6 +516,7 @@ int CPictureInfoTag::TranslateString(const CStdString &info)
else if (info.Equals("colour")) return SLIDE_COLOUR; else if (info.Equals("colour")) return SLIDE_COLOUR;
else if (info.Equals("process")) return SLIDE_PROCESS; else if (info.Equals("process")) return SLIDE_PROCESS;
else if (info.Equals("exiftime")) return SLIDE_EXIF_DATE_TIME; else if (info.Equals("exiftime")) return SLIDE_EXIF_DATE_TIME;
else if (info.Equals("exifdate")) return SLIDE_EXIF_DATE;
else if (info.Equals("exifdescription")) return SLIDE_EXIF_DESCRIPTION; else if (info.Equals("exifdescription")) return SLIDE_EXIF_DESCRIPTION;
else if (info.Equals("cameramake")) return SLIDE_EXIF_CAMERA_MAKE; else if (info.Equals("cameramake")) return SLIDE_EXIF_CAMERA_MAKE;
else if (info.Equals("cameramodel")) return SLIDE_EXIF_CAMERA_MODEL; else if (info.Equals("cameramodel")) return SLIDE_EXIF_CAMERA_MODEL;
Expand Down
2 changes: 2 additions & 0 deletions xbmc/pictures/PictureInfoTag.h
Expand Up @@ -35,6 +35,8 @@
#define SLIDE_COLOUR 907 #define SLIDE_COLOUR 907
#define SLIDE_PROCESS 908 #define SLIDE_PROCESS 908


#define SLIDE_EXIF_DATE 919 /* Implementation only to just get
localized date */
#define SLIDE_EXIF_DATE_TIME 920 #define SLIDE_EXIF_DATE_TIME 920
#define SLIDE_EXIF_DESCRIPTION 921 #define SLIDE_EXIF_DESCRIPTION 921
#define SLIDE_EXIF_CAMERA_MAKE 922 #define SLIDE_EXIF_CAMERA_MAKE 922
Expand Down

3 comments on commit d9ce56e

@pieh
Copy link
Contributor

@pieh pieh commented on d9ce56e Aug 5, 2012

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this adds 2nd row for exif date in picture info dialog (one without heading is SLIDE_EXIF_DATE added in this commit): https://dl.dropbox.com/u/28792047/xbmc/screenshot002.png

I think we shouldn't show 2x same info. Here's proposed "fix": http://pastebin.com/4pEFbS2n

@jmarshallnz
Copy link
Contributor

@jmarshallnz jmarshallnz commented on d9ce56e Aug 5, 2012 via email

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@pieh
Copy link
Contributor

@pieh pieh commented on d9ce56e Aug 6, 2012

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

committed 1b51796

Please sign in to comment.