def main():
    df = pd.read_csv(DATA_PATH)
    os = opensubtitles.OpenSubtitles()
    os.login(secrets.OPENSUBTITLES_USERNAME, secrets.OPENSUBTITLES_PASSWORD)
    sub_entries = []
    for i, row in df.iterrows():
        print(". Processing {} (S{:02}E{:02} ; entry #{})...".format(
            row.series_name, row.season, row.episode, i))
        imdbid = ''.join(c for c in row.imdb_id if c in string.digits)
        results = os.search_subtitles([{
            'sublanguageid': 'eng',
            'imdbid': imdbid
        }])
        if not results:
            print("   ! No results. Ignoring.")
            continue
        dl_link = results[0]['SubDownloadLink']
        srt_string = gzip.decompress(requests.get(dl_link).content).decode(
            'utf8', errors='ignore')
        captions = parse_srt(srt_string)
        sub_entries.append((row.imdb_id, '\n'.join(captions)))
        if i % 20 == 0:
            save_sub_entries(sub_entries)
            print("   (saved to disk)")
        # print("  - Subtitles : {}".format(captions[:5]))
        # print("")
    save_sub_entries(sub_entries)
Example #2
0
    def command(self):

        if "remember " in self.xyz:
            commands.remember(self)

        elif "open " in self.xyz:

            web = commands.open_app(self,
                                    self.xyz)  #open application if specified
            if web == "web":
                commands.open_website(self.xyz, self.xyz)  #open web site

        elif "how are you" in self.xyz:
            Speak("Good how can i help you!!")

        elif "help" in self.xyz or "help me" in self.xyz:
            print("Commands must be like")
            print("Open youtube ")
            print("Search food ")
            print("what is food? ")
            print("Who is Sachin tendulkar?")
            print("Open downloads")
            print("open music")
            print("send Email")
            print("remenber my name is ....")
            print("what is my name?")
            print("what is my phone number?")
            print("what text - for asking what you said to remeber about text")
            print("which user")
            print("get user")

            print("quit or exit for exit")

        elif "send mail" in self.xyz or "send email" in self.xyz:  #send mail
            commands.send_email(self)

        elif "what" in self.xyz or "who" in self.xyz:  #information
            ans = commands.get_info(self)
            if ans == "false":
                if "time" in self.xyz:
                    Speak(datetime.datetime.now())
                else:
                    commands.wiki(self.xyz, self.xyz)

        elif "search" in self.xyz:  #search google
            commands.google_search(self.xyz, self.xyz)
        elif "which" in self.xyz or "get" in self.xyz:
            if "user" in self.xyz:
                print(os.login())
                Speak(os.login())

        elif "quit" in self.xyz or "exit" in self.xyz:  #quit
            Speak("quiting the application ")
            return "quit"

        else:
            Speak(" Could not found the command !!")
Example #3
0
def create_file_error():
    date = worQt_timer.get_today().isoformat()
    login = os.login()
    file_error = '{}_{}_error.log'.format(date, login)
    with open(file_error, 'a') as out_error:
        out_error.close()
    return file_error
Example #4
0
def create_file_log():
    date = worQt_timer.get_today().isoformat()
    login = os.login()
    file_log = '{}_{}.log'.format(date, login)
    with open('{}_{}.log', 'a') as out_log:
        out_log.close()
    return file_log
Example #5
0
}

EXECPATHDICT = {"X!Tandem": "/home/chembio/Proteomics/XTandem/tandem.exe"}

# WATCHDB = 'watchList.db'
QUEUEDB = os.path.join(ROOTDIR, DBDIR, "labqueue.db")
QUEUEDIR = "/workspace/DaQueue"
QUEUETABLE = "queueTable"
WATCHTABLE = "watchTable"

CONFIGEXTENSION = ".cfgXML"  # , '.db']

# 1SRef is a Bruker File Folder Structure that should be ignored
EXCLUDE = [".svn", ".db", ".cfgXML", ".RAW", "~", ".raw"]
INCLUDED = ["1SRef", ".mzXML", ".mzxml", ".mgf"]

DBNAME = QUEUEDB  #'labqueue.db'
ROOTUSER = "******"

XT_EXE_PATH = ""

try:
    USERNAME = os.login()
except:
    USERNAME = "******"


if __name__ == "__main__":
    print QUEUEDB, WATCHDIR
    print os.path.isfile(QUEUEDB), os.path.isdir(WATCHDIR)
Example #6
0
def get_file_error():
    date = worQt_timer.get_today().isoformat()
    login = os.login()
    file_error = '{}_{}_error.log'.format(date, login)
    return file_log if os.path.exists(file_error) else create_file_error()
Example #7
0
# print(sys.argv[0])
# for i in range(1, len(sys.argv)):
#   print(sys.argv[i])
for arg in sys.argv:
    print(arg)

# Print out the OS platform you're using:
# YOUR CODE HERE
print(sys.platform)
# Print out the version of Python you're using:
# YOUR CODE HERE
print(sys.version)

import os
# See the docs for the OS module: https://docs.python.org/3.7/library/os.html

# Print the current process ID
# YOUR CODE HERE
print(os.getpid())

# Print the current working directory (cwd):
# YOUR CODE HERE
print(os.getcwd())
#string
print(os.getcwdb())
#bytestring

# Print out your machine's login name
# YOUR CODE HERE
print(os.login())
# initialise filespace if working on pc, just for convenience
import os
if os.login() is 'Michael':
    os.chdir("C:\\Users\\Michael\\OneDrive\\Desktop\\misc\\prac_02")

#start of actual code

    #1
name = input("Name: ")
file = open("name.txt",'w+')
file.write(name)
file.close()
del name

    #2
file = open("name.txt",'r')
name = file.read()
print("Your name is {:s}".format(name))
file.close()
del name

    #3
numbers=open("numbers.txt",'r')
for line in range(2):
    num_out = float(numbers.readline())
    num_out += float(numbers.readline())
    print(numout)
del num_out
numbers.close()

    #4