Translation update done using Pootle.
[gammu.git] / admin / get-se-list
blobedc4c5f32a98bca44933fd26644fc907aefccd46
1 #!/bin/sh
3 # This script downloads list of Sony-Ericsson phones from web and
4 # prepares list suitable for common/gsmphones.c
6 URL=http://homepage.mac.com/alvinmok/ericsson/types.html
8 tmp=`mktemp`
9 wget -O - "$URL" | tr '\r' '\n' > "$tmp"
11 awk 'BEGIN { p = 0; }
12 /Type code orderin/ { p = 1; }
13 /<tr><th>.*<\/th><td>.*<\/td>(<\/tr>)?/ { if (p) print $0; }
14 /<\/table>/ { p = 0;}' < "$tmp" | \
15 sed 's@</td></tr><tr><th>@\n@; s@<tr><th>@@; s@</th><td>@;@g; s@</td></tr>@@; s@</td>@@; s@<!-- @@; s@ -->@@;' | \
16 grep -Ev '&nbsp;|Cancelled' | \
17 gawk -F \; '{
18 delete models;
19 delete ids;
20 models[0] = $1;
21 ids[0] = $2;
22 if (match($2, "(.*)/(.*)/(.*)", a)) {
23 ids[0] = a[1];
24 ids[1] = a[2];
25 ids[2] = a[3];
26 } else
27 if (match($2, "(.*)/(.*)", a)) {
28 ids[0] = a[1];
29 ids[1] = a[2];
31 if (match($1, "(.*)-([^-]*)/(.*)", a)) {
32 models[0] = a[1]"-"a[2];
33 models[1] = a[1]"-"a[3];
35 /* New ID */
36 if (length(models[0]) == 14) {
37 sms = ", F_SUBMIT_SIM_ONLY";
38 } else {
39 sms = "";
41 if (models[0] == "FAE-1021011-BV") {
42 sms = sms", F_SMS_LOCATION_0";
44 if (length(models) == 2 && length(ids) == 2) {
45 print "\t{\""ids[0]"\",\t\""models[0]"\" ,\"\",\t\t\t\t {F_OBEX"sms", 0}},";
46 print "\t{\""ids[1]"\",\t\""models[1]"\" ,\"\",\t\t\t\t {F_OBEX"sms", 0}},";
47 } else {
48 /* Restore IDs, we need to have unique model */
49 if (length(models) == 1) {
50 delete ids;
51 ids[0] = $2;
53 for (model in models) {
54 for (id in ids) {
55 print "\t{\""ids[id]"\",\t\""models[model]"\" ,\"\",\t\t\t\t {F_OBEX"sms", 0}},";
61 rm -f "$tmp"