コード例 #1
0
def showJobs():
        result = []
        result.append("Cache %i hit%s, %i miss" % ( int(lazylibrarian.CACHE_HIT),
                        plural(int(lazylibrarian.CACHE_HIT)), int(lazylibrarian.CACHE_MISS)))
        myDB = database.DBConnection()
        snatched = myDB.match("SELECT count('Status') as counter from wanted WHERE Status = 'Snatched'")
        wanted = myDB.match("SELECT count('Status') as counter FROM books WHERE Status = 'Wanted'")
        result.append("%i item%s marked as Snatched" % (snatched['counter'], plural(snatched['counter'])))
        result.append("%i item%s marked as Wanted" % (wanted['counter'], plural(wanted['counter'])))
        for job in lazylibrarian.SCHED.get_jobs():
            job = str(job)
            if "search_magazines" in job:
                jobname = "Magazine search"
            elif "checkForUpdates" in job:
                jobname = "Check LazyLibrarian version"
            elif "search_tor_book" in job:
                jobname = "TOR book search"
            elif "search_nzb_book" in job:
                jobname = "NZB book search"
            elif "search_rss_book" in job:
                jobname = "RSS book search"
            elif "processDir" in job:
                jobname = "Process downloads"
            else:
                jobname = job.split(' ')[0].split('.')[2]

            jobinterval = job.split('[')[1].split(']')[0]
            jobtime = job.split('at: ')[1].split('.')[0]
            jobtime = next_run(jobtime)
            jobinfo = "%s: Next run in %s" % (jobname, jobtime)
            result.append(jobinfo)
        return result
コード例 #2
0
ファイル: common.py プロジェクト: Finch106/LazyLibrarian
def showJobs():
        result = []
        result.append("Cache %i hit%s, %i miss" % (
            int(lazylibrarian.CACHE_HIT),
            plural(int(lazylibrarian.CACHE_HIT)),
            int(lazylibrarian.CACHE_MISS)))
        myDB = database.DBConnection()
        snatched = myDB.match("SELECT count('Status') as counter from wanted WHERE Status = 'Snatched'")
        wanted = myDB.match("SELECT count('Status') as counter FROM books WHERE Status = 'Wanted'")
        result.append("%i item%s marked as Snatched" % (snatched['counter'], plural(snatched['counter'])))
        result.append("%i item%s marked as Wanted" % (wanted['counter'], plural(wanted['counter'])))
        for job in lazylibrarian.SCHED.get_jobs():
            job = str(job)
            if "search_magazines" in job:
                jobname = "Magazine search"
            elif "checkForUpdates" in job:
                jobname = "Check LazyLibrarian version"
            elif "search_tor_book" in job:
                jobname = "TOR book search"
            elif "search_nzb_book" in job:
                jobname = "NZB book search"
            elif "search_rss_book" in job:
                jobname = "RSS book search"
            elif "processDir" in job:
                jobname = "Process downloads"
            else:
                jobname = job.split(' ')[0].split('.')[2]

            jobinterval = job.split('[')[1].split(']')[0]
            jobtime = job.split('at: ')[1].split('.')[0]
            jobtime = next_run(jobtime)
            jobinfo = "%s: Next run in %s" % (jobname, jobtime)
            result.append(jobinfo)
        return result
コード例 #3
0
def showJobs():
    result = [
        "Cache %i hit%s, %i miss, " %
        (check_int(lazylibrarian.CACHE_HIT,
                   0), plural(check_int(lazylibrarian.CACHE_HIT, 0)),
         check_int(lazylibrarian.CACHE_MISS, 0)),
        "Sleep %.3f goodreads, %.3f librarything" %
        (lazylibrarian.GR_SLEEP, lazylibrarian.LT_SLEEP)
    ]
    myDB = database.DBConnection()
    snatched = myDB.match(
        "SELECT count(*) as counter from wanted WHERE Status = 'Snatched'")
    wanted = myDB.match(
        "SELECT count(*) as counter FROM books WHERE Status = 'Wanted'")
    result.append("%i item%s marked as Snatched" %
                  (snatched['counter'], plural(snatched['counter'])))
    result.append("%i item%s marked as Wanted" %
                  (wanted['counter'], plural(wanted['counter'])))

    for job in lazylibrarian.SCHED.get_jobs():
        job = str(job)
        if "search_magazines" in job:
            jobname = "Magazine search"
        elif "checkForUpdates" in job:
            jobname = "Check LazyLibrarian version"
        elif "search_book" in job:
            jobname = "Book search"
        elif "search_rss_book" in job:
            jobname = "RSS book search"
        elif "processDir" in job:
            jobname = "Process downloads"
        elif "authorUpdate" in job:
            jobname = "Update authors"
        elif "sync_to_gr" in job:
            jobname = "Goodreads Sync"
        else:
            jobname = job.split(' ')[0].split('.')[2]

        # jobinterval = job.split('[')[1].split(']')[0]
        jobtime = job.split('at: ')[1].split('.')[0]
        jobtime = next_run(jobtime)
        timeparts = jobtime.split(' ')
        if timeparts[0] == '1' and timeparts[1].endswith('s'):
            timeparts[1] = timeparts[1][:-1]
        jobinfo = "%s: Next run in %s %s" % (jobname, timeparts[0],
                                             timeparts[1])
        result.append(jobinfo)

    cmd = 'SELECT AuthorID, AuthorName, DateAdded from authors WHERE Status="Active" or Status="Loading"'
    cmd += 'or Status="Wanted" order by DateAdded ASC'
    author = myDB.match(cmd)
    if author:
        dtnow = datetime.datetime.now()
        diff = datecompare(dtnow.strftime("%Y-%m-%d"), author['DateAdded'])
        result.append('Oldest author info (%s) is %s day%s old' %
                      (author['AuthorName'], diff, plural(diff)))

    return result
コード例 #4
0
ファイル: common.py プロジェクト: kuuratsanik/LazyLibrarian
def showJobs():
    result = [
        "Cache %i hit%s, %i miss" %
        (int(lazylibrarian.CACHE_HIT), plural(int(
            lazylibrarian.CACHE_HIT)), int(lazylibrarian.CACHE_MISS))
    ]
    myDB = database.DBConnection()
    snatched = myDB.match(
        "SELECT count('Status') as counter from wanted WHERE Status = 'Snatched'"
    )
    wanted = myDB.match(
        "SELECT count('Status') as counter FROM books WHERE Status = 'Wanted'")
    result.append("%i item%s marked as Snatched" %
                  (snatched['counter'], plural(snatched['counter'])))
    result.append("%i item%s marked as Wanted" %
                  (wanted['counter'], plural(wanted['counter'])))
    author = myDB.match(
        'SELECT AuthorID, AuthorName, DateAdded from authors WHERE Status="Active" \
                                or Status="Loading" order by DateAdded ASC')
    dtnow = datetime.datetime.now()
    diff = datecompare(dtnow.strftime("%Y-%m-%d"), author['DateAdded'])
    result.append('Oldest author info is %s day%s old' % (diff, plural(diff)))
    for job in lazylibrarian.SCHED.get_jobs():
        job = str(job)
        if "search_magazines" in job:
            jobname = "Magazine search"
        elif "checkForUpdates" in job:
            jobname = "Check LazyLibrarian version"
        elif "search_tor_book" in job:
            jobname = "TOR book search"
        elif "search_nzb_book" in job:
            jobname = "NZB book search"
        elif "search_rss_book" in job:
            jobname = "RSS book search"
        elif "processDir" in job:
            jobname = "Process downloads"
        elif "authorUpdate" in job:
            jobname = "Update authors"
        else:
            jobname = job.split(' ')[0].split('.')[2]

        # jobinterval = job.split('[')[1].split(']')[0]
        jobtime = job.split('at: ')[1].split('.')[0]
        jobtime = next_run(jobtime)
        jobinfo = "%s: Next run in %s" % (jobname, jobtime)
        result.append(jobinfo)
    return result