<commit_before>#!/usr/bin/python
#-*- coding: utf-8 -*-

import getpass
import os
import urllib
import urllib2

from bs4 import BeautifulSoup

# Get BingXML file which contains the URL of the Bing Photo of the day
# idx = Number days previous the present day. 0 means current day, 1 means yesterday, etc
# n = Number of images previous the day given by idx
# mkt denotes your location. e.g. en-US means United States. Put in your
# country code
BingXML_URL = "http://www.bing.com/HPImageArchive.aspx?format=xml&idx=0&n=1&mkt=en-US"
page = urllib2.urlopen(BingXML_URL)
BingXML = BeautifulSoup(page, "lxml")

# For extracting complete URL of the image
Images = BingXML.find_all('image')
ImageURL = "https://www.bing.com" + Images[0].url.text
ImageName = Images[0].startdate.text + ".jpg"

# All the images will be saved in '/home/[user]/Pictures/BingWallpapers/'
username = getpass.getuser()
path = '/home/' + username + '/Pictures/BingWallpapers/'<commit_msg>main.py: Download images with resolution that matches your monitor<commit_after>#!/usr/bin/python
#-*- coding: utf-8 -*-

import getpass
import os
import re
import urllib
import urllib2

from bs4 import BeautifulSoup
import gtk

# Get BingXML file which contains the URL of the Bing Photo of the day
# idx = Number days previous the present day. 0 means current day, 1 means yesterday, etc
# n = Number of images previous the day given by idx
# mkt denotes your location. e.g. en-US means United States. Put in your
# country code
BingXML_URL = "http://www.bing.com/HPImageArchive.aspx?format=xml&idx=0&n=1&mkt=en-US"
page = urllib2.urlopen(BingXML_URL)
BingXML = BeautifulSoup(page, "lxml")

# For extracting complete URL of the image
Images = BingXML.find_all('image')
BaseImage = Images[0].url.text
# Get appropriate screen resolution
window = gtk.Window()
screen = window.get_screen()
screen_size = r'%sx%s' % (gtk.gdk.screen_width(), gtk.gdk.screen_height())
# Replace image resolution with the correct resolution from your main monitor
CorrectResolutionImage = re.sub(r'\d+x\d+', screen_size, BaseImage)
ImageURL = "https://www.bing.com" + CorrectResolutionImage
ImageName = Images[0].startdate.text+".jpg"

# All the images will be saved in '/home/[user]/Pictures/BingWallpapers/'
username = getpass.getuser()
path = '/home/' + username + '/Pictures/BingWallpapers/'
{'fraction_non_alphanumeric': 0.11754611754611755, 'fraction_numerical': 0.00858000858000858, 'mean_word_length': 4.74384236453202, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 2, 'lorem ipsum': 0, 'www.': 4, 'xml': 4}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 1, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5113414', 'n_tokens_mistral': 783, 'n_tokens_neox': 747, 'n_words': 247}