cleanup screenshot html

add location to screenshot metadata
This commit is contained in:
Chris Danford
2004-02-22 10:10:00 +00:00
parent 26f438bf65
commit e8347d25e4
4 changed files with 43 additions and 11 deletions
+9 -4
View File
@@ -660,8 +660,9 @@ void Profile::LoadGeneralDataFromNode( const XNode* pNode )
CString sStyle;
if( !style->GetAttrValue( "Style", sStyle ) )
WARN_AND_CONTINUE;
Style s = GAMEMAN->GameAndStringToStyle( g, sStyle );
if( s == STYLE_INVALID )
WARN_AND_CONTINUE;
style->GetValue( m_iNumSongsPlayedByStyle[s] );
}
@@ -1355,13 +1356,16 @@ void Profile::LoadScreenshotDataFromNode( const XNode* pNode )
Screenshot ss;
if( !(*screenshot)->GetChildValue("FileName",ss.sFileName) )
WARN_AND_CONTINUE;
WARN;
if( !(*screenshot)->GetChildValue("MD5",ss.sMD5) )
WARN_AND_CONTINUE;
WARN;
if( !(*screenshot)->GetChildValue("Time",(int&)ss.time) ) // time_t is a signed long on Win32. Is this ok on other platforms?
WARN_AND_CONTINUE;
WARN;
if( !(*screenshot)->GetChildValue("Location",ss.sLocation) )
WARN;
m_vScreenshots.push_back( ss );
}
@@ -1386,6 +1390,7 @@ XNode* Profile::SaveScreenshotDataCreateNode() const
pScreenshotNode->AppendChild( "FileName", ss.sFileName );
pScreenshotNode->AppendChild( "MD5", ss.sMD5);
pScreenshotNode->AppendChild( "Time", (int) ss.time);
pScreenshotNode->AppendChild( "Location", ss.sLocation);
}
return pNode;
+3 -2
View File
@@ -155,8 +155,9 @@ public:
struct Screenshot
{
CString sFileName; // no directory part - just the file name
CString sMD5; // MD5 hash of the screenshot file
time_t time; // return value of time() when screenshot was taken
CString sMD5; // MD5 hash of the screenshot file
time_t time; // return value of time() when screenshot was taken
CString sLocation; // location name where this screenshot was taken
};
vector<Screenshot> m_vScreenshots;
void AddScreenshot( Screenshot screenshot );
+30 -5
View File
@@ -911,6 +911,7 @@ void PrintScreenshot( RageFile &f, const Profile::Screenshot &ss )
TABLE_LINE2( "File", ss.sFileName );
TABLE_LINE2( "MD5", ss.sMD5 );
TABLE_LINE2( "Time", (CString)ctime(&ss.time) );
TABLE_LINE2( "Location", ss.sLocation );
END_TABLE;
@@ -923,15 +924,39 @@ void PrintScreenshots( RageFile &f, const Profile *pProfile, CString sTitle, CSt
{
PRINT_OPEN(f, sTitle );
{
PRINT_OPEN(f, "Less Than 1 Month Old" );
CString sCurrentMonth;
bool bFirstMonth = true;
for( int i = (int)pProfile->m_vScreenshots.size()-1; i >= 0; i-- )
{
for( unsigned i=0; i<pProfile->m_vScreenshots.size(); i++ )
Profile::Screenshot ss = pProfile->m_vScreenshots[i];
tm* new_time = localtime( &ss.time );
int iYear = new_time->tm_year+1900;
int iMonth = new_time->tm_mon+1;
CString sNewMonth = ssprintf("%02d/%d", iMonth, iYear );
if( sNewMonth != sCurrentMonth )
{
const Profile::Screenshot &ss = pProfile->m_vScreenshots[i];
PrintScreenshot( f, ss );
if( !bFirstMonth )
PRINT_CLOSE(f);
PRINT_OPEN(f, sNewMonth, bFirstMonth);
}
PrintScreenshot( f, ss );
sCurrentMonth = sNewMonth;
bFirstMonth = false;
}
if( pProfile->m_vScreenshots.empty() )
{
BEGIN_TABLE(1);
TABLE_LINE1("empty");
END_TABLE;
}
else
{
PRINT_CLOSE(f);
}
PRINT_CLOSE(f);
}
PRINT_CLOSE(f);
}
+1
View File
@@ -1284,6 +1284,7 @@ void ScreenEvaluation::Input( const DeviceInput& DeviceI, const InputEventType t
screenshot.sFileName = sFileName;
screenshot.sMD5 = CRYPTMAN->GetMD5( sPath );
screenshot.time = time(NULL);
screenshot.sLocation = PREFSMAN->m_sMachineName;
pProfile->AddScreenshot( screenshot );
}