139
141
gchar *file_time = g_strdup_printf("sunlight_wallpaper%ld.jpg", time(NULL));
140
142
gchar *fname = g_strconcat(dir_project, "/get_image.sh", NULL);
141
143
gchar *set_wallpaper = g_strdup_printf("%s %s/%s", GCONF_SET_WALLPAPER, dir_wallpapers, file_time);
143
144
gshort gi_map_position = get_map_position(data);
145
//g_print("gd_scale: %.2f, gi_map_position: %d\n\n", data->var.gd_map_scale, gi_map_position);
147
if (data->var.gb_move_map == TRUE)
146
text1 = "#!/bin/bash\n\nCOUNTER=0\nwhile [ $COUNTER -lt 12 ]; do\n\tcurl ";
147
text2 = g_strdup_printf(" > world.jpg\n\ttemp=$(stat -c%%s world.jpg)\n\tif [[ $temp > 1000 ]]\n\tthen rm -f %s/*.jpg\n\t\tmv world.jpg %s/%s\n\t\tcd %s", dir_wallpapers, dir_wallpapers, file_time, dir_wallpapers);
148
text3 = g_strdup_printf("\n\t\tmogrify -crop 1600x710-158+30 %s", file_time);
149
if(is_peters(data)){text4 = g_strdup_printf("\n\t\tcp %s sunlight_wallpaper_right.jpg\n\t\tcp %s sunlight_wallpaper_left.jpg\n\t\tmogrify -crop 1442x%d-%d+0 sunlight_wallpaper_left.jpg\n\t\tmogrify -crop 1442x%d+%d+0 sunlight_wallpaper_right.jpg\n\t\tmontage -geometry +0+0 sunlight_wallpaper_right.jpg sunlight_wallpaper_left.jpg %s", file_time, file_time, data->var.gi_map_height, gi_map_position, data->var.gi_map_height, 1442 - gi_map_position, file_time);}
150
else{text4 = g_strdup_printf("\n\t\tcp %s sunlight_wallpaper_right.jpg\n\t\tcp %s sunlight_wallpaper_left.jpg\n\t\tmogrify -crop 1600x%d-%d+0 sunlight_wallpaper_left.jpg\n\t\tmogrify -crop 1600x%d+%d+0 sunlight_wallpaper_right.jpg\n\t\tmontage -geometry +0+0 sunlight_wallpaper_right.jpg sunlight_wallpaper_left.jpg %s", file_time, file_time, data->var.gi_map_height, gi_map_position, data->var.gi_map_height, 1600 - gi_map_position, file_time);}
151
text5 = "\n\t\texit 0\n\tfi\n\tsleep 5\n\tlet COUNTER=COUNTER+1\ndone";
150
text1 = "#!/bin/bash\n\nCOUNTER=0\nwhile [ $COUNTER -lt 12 ]; do\n\tcurl ";
151
text2 = g_strdup_printf(" > world.jpg\n\ttemp=$(stat -c%%s world.jpg)\n\tif [[ $temp > 1000 ]]\n\tthen rm -f %s/*.jpg\n\t\tmv world.jpg %s/%s\n\t\tcd %s", dir_wallpapers, dir_wallpapers, file_time, dir_wallpapers);
152
text3 = g_strdup_printf("\n\t\tmogrify -crop 1600x710-158+30 %s", file_time);
153
if(is_peters(data)){text4 = g_strdup_printf("\n\t\tcp %s sunlight_wallpaper_right.jpg\n\t\tcp %s sunlight_wallpaper_left.jpg\n\t\tmogrify -crop 1442x%d-%d+0 sunlight_wallpaper_left.jpg\n\t\tmogrify -crop 1442x%d+%d+0 sunlight_wallpaper_right.jpg\n\t\tmontage -geometry +0+0 sunlight_wallpaper_right.jpg sunlight_wallpaper_left.jpg %s", file_time, file_time, data->var.gi_map_height, gi_map_position, data->var.gi_map_height, 1442 - gi_map_position, file_time);}
154
else{text4 = g_strdup_printf("\n\t\tcp %s sunlight_wallpaper_right.jpg\n\t\tcp %s sunlight_wallpaper_left.jpg\n\t\tmogrify -crop 1600x%d-%d+0 sunlight_wallpaper_left.jpg\n\t\tmogrify -crop 1600x%d+%d+0 sunlight_wallpaper_right.jpg\n\t\tmontage -geometry +0+0 sunlight_wallpaper_right.jpg sunlight_wallpaper_left.jpg %s", file_time, file_time, data->var.gi_map_height, gi_map_position, data->var.gi_map_height, 1600 - gi_map_position, file_time);}
155
text5 = "\n\t\texit 0\n\tfi\n\tsleep 5\n\tlet COUNTER=COUNTER+1\ndone";
158
153
switch(data->var.gi_rd1){
159
154
case 1: switch(data->var.gi_rd2){
160
155
case 1: image_address = "http://static.die.net/earth/mercator/1600.jpg";
180
175
else contents = g_strconcat(text1, image_address, text2, text4, text5, NULL);
182
177
}else contents = g_strconcat(text1, image_address, text2, text5, NULL);
184
179
if (g_file_set_contents(fname, contents, -1, NULL)) {
185
180
if (g_chmod(fname, 0750) == 0) {
186
181
if (system(fname) == 0){