[ New messages · Members · Forum rules · Search · Login ]  
  • Page 1 of 1
  • 1
Award dump script
remoDate: Thursday, 2015/May/07, 1:07 AM | Message # 1
Thursday, February 12th, 2015
Group: Administrators
Messages: 1010
Status: Offline
Code
cat ugen.txt | cut -d'|' -f1,2 | while read userNumPair ; do grep "^[0-9*|[0-9]*|"$(echo $userNumPair | cut -d'|' -f1 )"|" awards.txt | while read encodedAward ; do echo $userNumPair | cut -d'|' -f2 | tr '\n' '|' ; echo $encodedAward ; done ; done | sed 's/\(^[a-zA-Z0-9]*|[0-9]*|\)10|/\1Medal of Honor|/' | sed 's/\(^[a-zA-Z0-9]*|[0-9]*|\)9|/\1Purple Heart|/' |sed 's/\(^[a-zA-Z0-9]*|[0-9]*|\)8|/\1Service Cross|/' | sed 's/\(^[a-zA-Z0-9]*|[0-9]*|\)7|/\1Service Medal 1|/' | sed 's/\(^[a-zA-Z0-9]*|[0-9]*|\)6|/\1Service Medal 2|/' | sed 's/\(^[a-zA-Z0-9]*|[0-9]*|\)5|/\1Combat Pin 1|/' | sed 's/\(^[a-zA-Z0-9]*|[0-9]*|\)4|/\1Combat Pin 2|/' | sed 's/\(^[a-zA-Z0-9]*|[0-9]*|\)3|/\1Confederation Star|/' | sed 's/\(^[a-zA-Z0-9]*|[0-9]*|\)1|/\1Medal of Shame|/' | while read awardLine ; do echo $awardLine | cut -d'|' -f1 | tr '\n' '|' ; echo $awardLine | cut -d'|' -f3 | tr '\n' '|' ; date -d "@$(echo $awardLine | cut -d'|' -f6 | tr -d '\n')" | tr '\n' '|';  echo $awardLine | cut -d'|' -f7 | tr '\n' '|' ;echo ; done


There are 3998 awards as of this last run.

I have exported them in a format like:

Laurent|Confederation Star|Wed Feb 25 21:59:33 EST 2015|ConFed vs GinR - 2/21/15|
Laurent|Confederation Star|Sun Mar 1 19:40:23 EST 2015|ConFed vs InGt - 2/26/15|
Liqht|Confederation Star|Sun Feb 22 13:28:16 EST 2015|ConFed vs TAsc - 02/20/15|
Liqht|Combat Pin 1|Sun Feb 22 13:31:02 EST 2015|ConFed vs GinR - 02/21/15|
Liqht|Combat Pin 1|Wed Feb 25 21:59:15 EST 2015|ConFed vs GinR - 2/21/15|

http://aws.ballerterran.com/awards_exported.csv

http://aws.ballerterran.com/exportAwards.sh

I think I'm getting the hang of these proprietary pipe delimited database dumps.
 
remoDate: Friday, 2015/May/08, 1:09 AM | Message # 2
Thursday, February 12th, 2015
Group: Administrators
Messages: 1010
Status: Offline
Ok, so we have a way to get the awards *out* of ucoz, what about a way to get them *into* ldap?

Code
cat exportedAwards050815.csv | grep Gigglesmirk |  while read award ; do curl "http://autoroster.the-confederation.net/rosters_arg.php?mode=appendAward&uid=$(echo $award | cut -d'|' -f1)&password=REDACTED&type=$(echo $award | cut -d'|' -f2 | sed 's/\ /\+/g')&date=$(echo $award | cut -d'|' -f3 | sed 's/\ /\+/g' | sed 's/\:/\%3A/g')&reason=$(echo $award | cut -d'|' -f4 | sed 's/\ /\+/g' | tr -d '<>#%{}[]|\/^~`;?:@=&$')" ; done


And here you can see the results:

http://autoroster.the-confederation.net/rosters....lesmirk

There are a couple of rough spots here. I'm not sure I like the date formatting. It does not agree with the default dates filled by the add award form and it is probably not the easiest to parse in the future. It is a fairly simple matter to change this date format in the export script, we just need to pick a standard format and stick with it.

Likewise, I need to be careful about funky characters in the reason field. As such I'm simply stripping out all of these:

<>#%{}[]|\/^~`;?:@=&$

I can go to the effort to carefully escape and preserve these but it doesn't seem like a good use of time.

Also there are currently two different forms of combat pin and service cross. We need to decide to merge them or formalize the difference in the lore.
 
remoDate: Friday, 2015/May/08, 12:39 PM | Message # 3
Thursday, February 12th, 2015
Group: Administrators
Messages: 1010
Status: Offline
<03:49:57> "Tyrael": The Service medal and combat pins have two seperate images but were not two independant awards. Same applied to the confed stars but the bronze and silver have dissappeared it seems.
<03:53:20> "Tyrael": Ultimately it is a tier in order to prevent a million medals appearing on the old website. 12 blue service was the equivalent to 1 yellow. 5 silver pins was equivalent to a gold.
 
CrunChyDate: Friday, 2015/May/08, 12:52 PM | Message # 4
Saturday, July 10th, 2010
Group: Elder's Board
Messages: 1510
Status: Offline
For the Combat Pin, only use the Silver one. We changed from the tier format with this award some time ago. As for the Service Medal, 1 Blue Service Medal for each month a member is a part of ConFed. Once a member reaches 12 months, they should all be replaced with 1 Gold Service Medal.



Website Administrator | TeamSpeak Administrator | ConFed Legend

Strength, Pride, Unity!
 
remoDate: Friday, 2015/May/08, 3:39 PM | Message # 5
Thursday, February 12th, 2015
Group: Administrators
Messages: 1010
Status: Offline
Ok! Everything has been imported.
 
  • Page 1 of 1
  • 1
Search:

Free website builderuCoz