Пример #1
0
 def __call__(self):
     strBillyTitle = ""
     hwnds = FindBilly()
     if (hwnds is not None):
         strBillyTitle = GetWindowText(hwnds[0])
         strBillyTitle = strBillyTitle.replace(" - Billy", "")
     return strBillyTitle
Пример #2
0
def path_from_hwnd(vlc_hwnd):

    # VLC Tools -> Preferences -> Show "All" Settings ->
    # Input/Codecs -> Change title according to current media =$F
    # Displays file path to current media in VLC window text

    window_title = GetWindowText(vlc_hwnd)

    translation_dict = {
        " - VLC media player": "",
        "file:///": "",
        "%20": " ",
        "%21": "!",
        "%23": "#",
        "%24": "$",
        "%25": "%",
        "%26": "&",
        "%28": "(",
        "%29": ")",
        "%5B": "[",
        "%5D": "]",
        "%27": "'",
        "%40": "@",
        "%2B": "+",
        "%2C": ",",
        "%5E": "^",
        "%3B": ";",
        "%60": "`"
    }

    for key in translation_dict.keys():
        window_title = window_title.replace(key, translation_dict[key])
    file_path = path.normpath(window_title)

    return file_path
Пример #3
0
 def __call__(self):
     strBillyTitle = ""
     hwnds = FindBilly()
     if ( hwnds is not None ):
         strBillyTitle = GetWindowText(hwnds[0])
         strBillyTitle = strBillyTitle.replace(" - Billy", "")
     return strBillyTitle
Пример #4
0
def watchdog():
    t0 = time.time()
    while True:
        app = GetWindowText(GetForegroundWindow())
        time.sleep(1)
        if app != GetWindowText(GetForegroundWindow()):
            t0 = saveTime(t0, app)
        elif math.floor(time.time() - t0) >= 60:
            t0 = saveTime(t0, app)
        elif Running == False:
            t0 = saveTime(t0, app)
            break
        elif Running == "Paused" or Running == "Afk":
            thrd = threading.Thread(target=DBhandle.DBstore,
                                    args=(app.replace("'", ""),
                                          math.floor(t1 - t0)))
            thrd.start()
            while Running == "Paused" or Running == "Afk":
                time.sleep(1)
            t0 = time.time()