Пример #1
0
destinationLocation = 'V:/backupdata'


def zip(src, dst):
    zf = zipfile.ZipFile("%s.zip" % (dst), "w", zipfile.ZIP_DEFLATED)

    for dirname, subdirs, files in os.walk(src):
        for filename in files:
            absname = os.path.abspath(os.path.join(dirname, filename))
            arcname = absname[len(os.path.abspath(src)):]
            lf.write("Zipping %s \n" % arcname)
            zf.write(absname, arcname)  #Comment this line during testing!
    zf.close()


try:
    zip(sourceLocation, destinationLocation)
    elapsedTime = datetime.datetime.now() - startTime
    lf.write("End backup " + strftime("%a, %d %b %Y %H:%M:%S", localtime()) +
             "\n")
    lf.write("Total time elapsed %s" % str(elapsedTime))
    btMessage = ("Backup successful!\nTotal time elapsed %s" %
                 str(elapsedTime))
except:
    e = sys.exc_info()[0]
    lf.write("Error: %s" % e)
    btMessage = ("Backup failed!\nError: %s" % e)

lf.close()
bt.balloon_tip('Backup script', btMessage)
Пример #2
0
                if not self.fileRaw[i].isspace():
                    end = i
                    break
            start = end

            end = self.fileRaw.find('\n', start, len(self.fileRaw))
            cite = self.fileRaw[start:end]
            for i in range(end, len(self.fileRaw)):
                if not self.fileRaw[i].isspace():
                    end = i
                    break
            self.clippingList.append((book, date, cite))

        print('data preparation finished')
        time.sleep(1)

    def returnRandomCite(self):
        randomPick = random.randint(0, len(self.clippingList))
        return self.clippingList[randomPick][0], self.clippingList[randomPick][
            2]


if __name__ == "__main__":
    clip = Clipping("Kindle_Clippings")
    for x in clip.clippingList:
        print(x)
    while True:
        print(clip.returnRandomCite())
        book, cite = clip.returnRandomCite()
        ballTip.balloon_tip(book, cite)
        Sleep(300)
Пример #3
0
from urllib.request import urlopen, urlretrieve
from time import time, sleep, ctime

from bs4 import BeautifulSoup

from balloontip import balloon_tip

starttime = time()
interval = 300.0


while True:
    url = "http://www.espncricinfo.com/series/8048/game/1136572/kings-xi-" +
    "punjab-vs-chennai-super-kings-12th-match-indian-premier-league-2018"
    source_code = BeautifulSoup(urlopen(url).read(), "html.parser")
    t = source_code.title.string
    t = t.replace("Match Summary", "")
    t = t.replace("ESPNCricinfo", "")
    t = t.replace("|", "", 2)
    print(ctime(), t)
    balloon_tip("CricScore", t)
    sleep(interval - ((time() - starttime) % interval))
Пример #4
0
def set_wallpaper_permanent(picPath, SHOW_DEBUG):
    if SHOW_DEBUG:
        print('Setting the wallpaper')
    win32gui.SystemParametersInfo(0x0014, picPath, 1 + 2)
    balloon_tip("Desktop Wallpaper Changer", "Wallpaper Updated!")
Пример #5
0
    _lists = [['', '', '', '', '', '', '', ''] for _ in range(23)]

    try:
        while True:
            html = requests.get('http://iwork.hrcglobal.com/')
            soup = BeautifulSoup(html.content, 'html.parser')
            trs = soup.select('#body > section > table:nth-child(4) > tr')
            try:
                for i, r in enumerate(trs):
                    tds = r.select('td')
                    for j, d in enumerate(tds):
                        if _lists[i][j] != d.text.strip():
                            raise EOFError
            except EOFError:
                for i, r in enumerate(trs):
                    tds = r.select('td')
                    for j, d in enumerate(tds):
                        _lists[i][j] = d.text.strip()

                if _first_start:
                    balloon_tip('{}님 환영합니다!!'.format(_name),
                                '오늘 하루도 즐거운 하루 되세요.')
                    _first_start = False
                else:
                    balloon_tip('새로운 업무가 업데이트되었습니다.', '홈페이지를 확인해주세요.')

                url = 'http://iwork.hrcglobal.com/'
                webbrowser.open(url)
            time.sleep(10)
    except KeyboardInterrupt:
        pass
Пример #6
0
def notify(msg, duration=20, title="Pomodoro"):
    if platform.system() != 'Windows':
        notifier.Notification(title=title, description=msg,
                              duration=duration).send()
    else:
        notifier.balloon_tip(title=title, msg=msg)
Пример #7
0
def show_win10_notif(title, msg, duration=5):
    """Windows tooltip notification"""
    balloontip.balloon_tip(title, msg)
Пример #8
0
from balloontip import balloon_tip

title = "COM port change"
message = ""

serial_devices = []

while True:
    message = ""
    for dev_name in serial_devices:
        if dev_name not in response:
            message += '\n' + dev_name + ' removed.'
            serial_devices.remove(dev_name)

    if message != "":
        balloon_tip(title, message)

    message = ""
    response = popen("mode").read()

    for line in response.split('\n'):
        temp = line.split('device')

        if len(temp) > 1:
            if ':' in temp[1]:
                dev_name = temp[1].split(':')[0]
                if 'COM' in dev_name:
                    # valid device name
                    if dev_name not in serial_devices:
                        serial_devices.append(dev_name)
                        message += '\n' + dev_name + ' connected.'
Пример #9
0
        response = requests.get(url + pincode + "/", headers=headers)
        respText = str(response.content)
        tables = pd.read_html(respText)
        sp500_table = tables[0]
        df = pd.DataFrame(sp500_table)
        state = lookup_fn(df, 1, 0)  # df.iloc[1,0]
        city = lookup_fn(df, 1, 1)  # df.iloc[1,1]
        if state == 0:
            response = requests.get(alternateUrl + pincode, headers=headers)
            respText = str(response.content)
            bs = BeautifulSoup(respText,"lxml")
            rows = bs.find_all("table", class_="view_codes")
            for tag in rows:
                trTags = tag.find_all("a")
                print(str(i) + " : " + alternateUrl + pincode)
                index = 0
                for tag in trTags:
                    if index == 0:
                        state = tag.text
                    if index == 2:
                        city = tag.text
                    index += 1

        w_sheet.write(i, 7, state)
        w_sheet.write(i, 8, city)

endTime = datetime.datetime.now()
wb.save(output_file_path + "data.csv" + os.path.splitext(output_file_path)[-1])
print("\n================== Time Taken: "  + str(endTime - startTime) + "===================")
balloontip.balloon_tip("Pincode lookup","Finished lookup in " + str(endTime))