Skip to content
Newer
Older
100755 246 lines (240 sloc) 6.53 KB
a01c771 @Oneiroi Files relating to the adventures_in_archiving blog post
authored
1 #!/bin/bash
2
3
4 #some imdb data as xml grabbed from: http://community.mediabrowser.tv/permalinks/4117/imdbrating-from-mymovies-xml
5 PAYLOAD="
6 <Title>
7 <LocalTitle>22 Bullets</LocalTitle>
8 <OriginalTitle>L'immortel</OriginalTitle>
9 <SortTitle>22 Bullets</SortTitle>
10 <Added>16.9.2010 21:15:02</Added>
11 <ProductionYear>2010</ProductionYear>
12 <RunningTime>117</RunningTime>
13 <IMDBrating>6,6</IMDBrating>
14 <MPAARating>NR</MPAARating>
15 <Description>Charly Matte� has turned a new leaf on his past as an outlaw. Since three years he's living a comfortable life and devoting himself to his wife and two kids. However, one winter morning, he's left for dead in the underground parking of Marseille's Old Port with 22 bullets in his body. Against all odds, he will not die.</Description>
16 <Type>XviD</Type>
17 <AspectRatio />
18 <LockData>False</LockData>
19 <IMDB>tt1167638</IMDB>
20 <TMDbId>37645</TMDbId>
21 <Genres>
22 <Genre>Action</Genre>
23 <Genre>Crime</Genre>
24 <Genre>Thriller</Genre>
25 </Genres>
26 <Persons>
27 <Person>
28 <Name>Jean Reno</Name>
29 <Type>Actor</Type>
30 <Role>Charly Matteï</Role>
31 </Person>
32 <Person>
33 <Name>Gabriella Wright</Name>
34 <Type>Actor</Type>
35 <Role>Yasmina Telaa</Role>
36 </Person>
37 <Person>
38 <Name>Richard Berry</Name>
39 <Type>Actor</Type>
40 <Role>Aurelio Rampoli</Role>
41 </Person>
42 <Person>
43 <Name>Kad Merad</Name>
44 <Type>Actor</Type>
45 <Role>Tony Zacchia</Role>
46 </Person>
47 <Person>
48 <Name>Marina Foïs</Name>
49 <Type>Actor</Type>
50 <Role>Marie Goldman</Role>
51 </Person>
52 <Person>
53 <Name>Fani Kolarova</Name>
54 <Type>Actor</Type>
55 <Role>Christelle Mattei</Role>
56 </Person>
57 <Person>
58 <Name>Jean-Pierre Darroussin</Name>
59 <Type>Actor</Type>
60 <Role>Martin Beaudinard</Role>
61 </Person>
62 <Person>
63 <Name>Claude Gensac</Name>
64 <Type>Actor</Type>
65 <Role>Mme Fontarosa</Role>
66 </Person>
67 <Person>
68 <Name>Joséphine Berry</Name>
69 <Type>Actor</Type>
70 <Role>Eva</Role>
71 </Person>
72 <Person>
73 <Name>Venantino Venantini</Name>
74 <Type>Actor</Type>
75 <Role>Padovano</Role>
76 </Person>
77 <Person>
78 <Name>Moussa Maaskri</Name>
79 <Type>Actor</Type>
80 <Role>Karim</Role>
81 </Person>
82 <Person>
83 <Name>Daniel Lundh</Name>
84 <Type>Actor</Type>
85 <Role>Malek Telaa</Role>
86 </Person>
87 <Person>
88 <Name>Denis Braccini</Name>
89 <Type>Actor</Type>
90 <Role>Le Boumian</Role>
91 </Person>
92 <Person>
93 <Name>Catherine Samie</Name>
94 <Type>Actor</Type>
95 <Role>Stella Matteï</Role>
96 </Person>
97 <Person>
98 <Name>Joey Starr</Name>
99 <Type>Actor</Type>
100 <Role>Le Pistachier</Role>
101 </Person>
102 <Person>
103 <Name>Jessica Forde</Name>
104 <Type>Actor</Type>
105 <Role>Clothilde</Role>
106 </Person>
107 <Person>
108 <Name>Dominique Thomas</Name>
109 <Type>Actor</Type>
110 <Role>Papalardo</Role>
111 </Person>
112 <Person>
113 <Name>Philippe Magnan</Name>
114 <Type>Actor</Type>
115 <Role>Pothey</Role>
116 </Person>
117 <Person>
118 <Name>Max Baissette De Malglaive</Name>
119 <Type>Actor</Type>
120 <Role>Anatole Matteï</Role>
121 </Person>
122 <Person>
123 <Name>Lucie Phan</Name>
124 <Type>Actor</Type>
125 <Role>Pat</Role>
126 </Person>
127 <Person>
128 <Name>Carlo Brandt</Name>
129 <Type>Actor</Type>
130 <Role>Fontarosa</Role>
131 </Person>
132 <Person>
133 <Name>Luc Palun</Name>
134 <Type>Actor</Type>
135 <Role>Pascal Vasetto</Role>
136 </Person>
137 <Person>
138 <Name>Guillaume Gouix</Name>
139 <Type>Actor</Type>
140 <Role>Le Morvelous</Role>
141 </Person>
142 <Person>
143 <Name>Martial Bezot</Name>
144 <Type>Actor</Type>
145 <Role>Frank Rabou</Role>
146 </Person>
147 <Person>
148 <Name>Cédric Appietto</Name>
149 <Type>Actor</Type>
150 <Role>Marco Echinard</Role>
151 </Person>
152 <Person>
153 <Name>Boris Baum</Name>
154 <Type>Actor</Type>
155 <Role>Spontini - Fils</Role>
156 </Person>
157 <Person>
158 <Name>Jean-Jérôme Esposito</Name>
159 <Type>Actor</Type>
160 <Role>Rochegude</Role>
161 </Person>
162 <Person>
163 <Name>Charlotte Marcoueille</Name>
164 <Type>Actor</Type>
165 <Role>Serveuse Restaurant</Role>
166 </Person>
167 <Person>
168 <Name>Laurent Casanova</Name>
169 <Type>Actor</Type>
170 <Role>Piéton</Role>
171 </Person>
172 <Person>
173 <Name>Richard Berry</Name>
174 <Type>Director</Type>
175 <Role />
176 </Person>
177 </Persons>
178 <Studios>
179 <Studio>Europa Corp.</Studio>
180 <Studio>TF1 Films Production</Studio>
181 <Studio>Marie Coline Films</Studio>
182 <Studio>SMTS</Studio>
183 <Studio>Canal+</Studio>
184 <Studio>CinéCinéma</Studio>
185 <Studio>Sofica Europacorp</Studio>
186 </Studios>
187 <VideoAspect>2.35:1</VideoAspect>
188 <VideoBitrate>1180</VideoBitrate>
189 <VideoCodec>MPEG-4</VideoCodec>
190 <VideoCodecRaw>MPEG4</VideoCodecRaw>
191 <VideoFileSize>1260638208</VideoFileSize>
192 <VideoHeight>296</VideoHeight>
193 <VideoLength>117</VideoLength>
194 <VideoQuality>Standard</VideoQuality>
195 <VideoWidth>720</VideoWidth>
196 <AudioBitrate>256</AudioBitrate>
197 <AudioChannels>5.1</AudioChannels>
198 <AudioCodec>AC3</AudioCodec>
199 <AudioCodecRaw>AC3</AudioCodecRaw>
200 <AudioFrequency>48000</AudioFrequency>
201 <VideoHasSubtitles>False</VideoHasSubtitles>
202 <IMDbId>tt1167638</IMDbId>
203 <Budget>24000000</Budget>
204 <Revenue></Revenue>
205 <Rating>6,6</Rating>
206 </Title>
207 ";
208
209 #build a larger values payload
210 CHARLIMIT=1000;
211 VALUES='';
212 CVALUES='';
213 PAYLOAD=${PAYLOAD:0:${CHARLIMIT}} #trim the string to fit the field
214 for i in {1..20}; do
215 VALUES+="(\"${PAYLOAD}\"),";
216 CVALUES+="(COMPRESS(\"${PAYLOAD}\")),";
217 done
218 VALUES+="(\"${PAYLOAD}\")";
219 CVALUES+="(COMPRESS(\"${PAYLOAD}\"))";
220
221 echo '' > ./adventures_in_archiving_data.sql
222
223 for i in non_compressed_data compressed_row compressed_data archive_table; do
224 echo "ALTER TABLE ${i} DISABLE KEYS;" >> adventures_in_archiving_data.sql
225 if [ "$i" != "archive_table" ];
226 then
227 #disable auto commit for faster imports
228 echo "SET AUTOCOMMIT = 0;" >> adventures_in_archiving_data.sql;
229 fi
230 for j in {1..50000}; do
231 if [ "$i" == "compressed_data" ];
232 then
233 echo "INSERT INTO compressed_data (dat) VALUES ${CVALUES};" >> adventures_in_archiving_data.sql;
234 else
235 echo "INSERT INTO ${i} (dat) VALUES ${VALUES};" >> adventures_in_archiving_data.sql
236 fi
237 done
238 if [ "$i" != "archive_table" ];
239 then
240 #commit as one set
241 echo "COMMIT;" >> adventures_in_archiving_data.sql;
242 fi
243 echo "ALTER TABLE ${i} ENABLE KEYS;" >> adventures_in_archiving_data.sql
244 echo "Data gen for ${i} completed"
245 done
Something went wrong with that request. Please try again.