Browse files

make dateadded available to skins as ListItem.DateAdded (closes #12965)

  • Loading branch information...
1 parent bb614c7 commit cd2e1c1e9cc6a8d00dd913a7c26dd2d23e7778d6 @Montellese committed May 5, 2012
Showing with 11 additions and 1 deletion.
  1. +7 −1 xbmc/GUIInfoManager.cpp
  2. +1 −0 xbmc/GUIInfoManager.h
  3. +3 −0 xbmc/interfaces/python/xbmcmodule/listitem.cpp
View
8 xbmc/GUIInfoManager.cpp
@@ -490,7 +490,8 @@ const infomap listitem_labels[]= {{ "thumb", LISTITEM_THUMB },
{ "originaltitle", LISTITEM_ORIGINALTITLE },
{ "lastplayed", LISTITEM_LASTPLAYED },
{ "playcount", LISTITEM_PLAYCOUNT },
- { "discnumber", LISTITEM_DISC_NUMBER }};
+ { "discnumber", LISTITEM_DISC_NUMBER },
+ { "dateadded", LISTITEM_DATE_ADDED }};
const infomap visualisation[] = {{ "locked", VISUALISATION_LOCKED },
{ "preset", VISUALISATION_PRESET },
@@ -4223,7 +4224,12 @@ CStdString CGUIInfoManager::GetItemLabel(const CFileItem *item, int info, CStdSt
str.Format("%d", val);
return str;
}
+ break;
}
+ case LISTITEM_DATE_ADDED:
+ if (item->HasVideoInfoTag() && item->GetVideoInfoTag()->m_dateAdded.IsValid())
+ return item->GetVideoInfoTag()->m_dateAdded.GetAsLocalizedDate();
+ break;
}
return "";
}
View
1 xbmc/GUIInfoManager.h
@@ -508,6 +508,7 @@ namespace INFO
#define LISTITEM_FILE_EXTENSION (LISTITEM_START + 75)
#define LISTITEM_IS_RESUMABLE (LISTITEM_START + 76)
#define LISTITEM_PERCENT_PLAYED (LISTITEM_START + 77)
+#define LISTITEM_DATE_ADDED (LISTITEM_START + 78)
#define LISTITEM_PROPERTY_START (LISTITEM_START + 200)
#define LISTITEM_PROPERTY_END (LISTITEM_PROPERTY_START + 1000)
View
3 xbmc/interfaces/python/xbmcmodule/listitem.cpp
@@ -366,6 +366,7 @@ namespace PYXBMC
" artist : list (['U2'])\n"
" votes : string (12345 votes)\n"
" trailer : string (/home/user/trailer.avi)\n"
+ " dateadded : string (%Y-%m-%d %h:%m:%s = 2009-04-05 23:16:04)\n"
"\n"
"Music Values:\n"
" tracknumber : integer (8)\n"
@@ -536,6 +537,8 @@ namespace PYXBMC
if (strlen(tmp) == 10)
self->item->m_dateTime.SetDate(atoi(tmp.Right(4).c_str()), atoi(tmp.Mid(3,4).c_str()), atoi(tmp.Left(2).c_str()));
}
+ else if (strcmpi(PyString_AsString(key), "dateadded") == 0)
+ self->item->GetVideoInfoTag()->m_dateAdded.SetFromDBDateTime(tmp);
}
}
else if (strcmpi(cType, "music") == 0)

0 comments on commit cd2e1c1

Please sign in to comment.