Exemple #1
0
def by_volume(volume_number):
    sql = "SELECT article_id FROM articles WHERE volume_number = {} ORDER BY full_number ASC".format(
        volume_number)
    c = executor.select(sql)
    article_list = []
    for item in c:
        article_id = item[0]
        sql = "SELECT needs_login FROM articles WHERE article_id = {}".format(
            article_id)
        d = executor.select(sql)
        for it in d:
            if (it[0] == 1 and var.isLogged) or it[0] == 0:
                article_list.append(article_id)
    return article_list
Exemple #2
0
def by_article_id(article_id):
    sql = "SELECT article_url FROM articles WHERE article_id = {}".format(
        article_id)
    c = executor.select(sql)
    if len(c) > 0:
        url = c[0][0]
        webbrowser.open(url)
def by_article_id(article_id):
    sql = "SELECT author_id FROM linker WHERE article_id = {}".format(
        article_id)
    c = executor.select(sql)
    author_id_list = []
    for lis in c:
        author_id_list.append(lis[0])
    return author_id_list
Exemple #4
0
def volumes():
    if var.isLogged:
        sql = "SELECT volume_number FROM articles"
    else:
        sql = "SELECT volume_number FROM articles WHERE needs_login = 0"
    c = executor.select(sql)
    volume_list = []
    for item in c:
        if not item[0] in volume_list:
            volume_list.append(item[0])
    return volume_list
Exemple #5
0
def all():
    """
    Get all the titles

    Returns:
    titles (list): a list of all the titles in the table
    """
    titles = []
    sql = "SELECT article_title, full_number FROM articles"
    c = executor.select(sql)
    for x in c:
        titles.append((x[0], x[1]))
    return titles
Exemple #6
0
def issues_in_volume(volume_number):
    if var.isLogged:
        sql = "SELECT issue_number FROM articles WHERE Volume_number = {}".format(
            volume_number)
    else:
        sql = "SELECT issue_number FROM articles WHERE volume_number = {} AND needs_login = 0".format(
            volume_number)
    c = executor.select(sql)
    issue_list = []
    for item in c:
        if not item[0] in issue_list:
            issue_list.append(item[0])
    return issue_list
Exemple #7
0
def all():
    """
    Get all the author names

    Locations: rename.get_old_name()

    Returns:
    names (list): a list of all the author names
    """
    names = []
    sql = "SELECT author_name FROM authors"
    c = executor.select(sql)
    for x in c:
        names.append(x[0])
    return names
Exemple #8
0
def by_article_id(article_id):
    """
    Get the title based on article id

    Locations: display.display_articles(), rename.rename()

    Parameters:
    article_id (int)

    Returns:
    title (string)
    """
    sql = "SELECT article_title FROM articles WHERE article_id = {}".format(article_id)
    c = executor.select(sql)
    return c[0][0]
Exemple #9
0
def full(article_id):
    """
    Gets the full number based on article id

    Current locations: display.display_articles()

    Parameters:
    article_id (int)

    Returns:
    full_number (string)
    """
    sql = "SELECT full_number FROM articles WHERE article_id = {}".format(
        article_id)
    c = executor.select(sql)
    return c[0][0]
Exemple #10
0
def by_volume(volume_number):
    """
    Gets article_id based on volume number

    Locations: remove_article.by_article_id

    Parameters:
    volume_number (integer)
    """
    sql = "SELECT article_id FROM articles WHERE volume_number = {}".format(
        volume_number)
    c = executor.select(sql)
    article_id_list = []
    for lis in c:
        article_id_list.append(lis[0])
    return article_id_list
Exemple #11
0
def by_full_number(full_number):
    """
    Gets article_id based on full_number

    Locations: rename.rename(), downloader.download()

    Parameters:
    full_number (string) : Vol.issue.article (##.##.##)
    """
    sql = "SELECT article_id FROM articles WHERE full_number = '{}'".format(
        full_number)
    c = executor.select(sql)
    if len(c) == 0:
        return False
    else:
        return c[0][0]
def by_name(author_name):
    """
    Gets the author ID

    Locations: rename.change()

    Parameters:
    author_name(string)

    Returns:
    c[0][0] (int): technically is the author_id
    """
    sql = "SELECT author_id FROM authors WHERE author_name = '{}'".format(
        author_name)
    c = executor.select(sql)
    return c[0][0]
Exemple #13
0
def articles_table(full_number):
    """
    Search the articles table for a specific article

    Parameters:
    full_number (string): if the full_number is in the table, gets information

    Returns:
    True  : the article number was found, item in table
    False : article number was not found, item not in table
    """
    sql = "SELECT * FROM articles WHERE full_number = '{}'".format(full_number)
    data = executor.select(sql)
    if len(data) == 0:
        return False
    else:
        return True
Exemple #14
0
def author_table(author_name):
    """
    Search the author table for a specific author

    Parameters:
    author_name (string): the author name to search

    Returns:
    True  : the author was found, item in table
    False : author was not found, item not in table
    """
    sql = "SELECT * FROM authors WHERE author_name = '{}'".format(author_name)
    data = executor.select(sql)
    if len(data) == 0:
        return False
    else:
        return True
Exemple #15
0
def by_author(author_name):
    """
    gets article_ids based on author name

    Parameters:
    author_name (string)

    Returns:
    article_id_list (list)
    """
    author_id = get_author_id.by_name(author_name)
    sql = "SELECT article_id FROM linker WHERE author_id = {}".format(
        author_id)
    c = executor.select(sql)
    article_id_list = []
    for lis in c:
        article_id_list.append(lis[0])
    return article_id_list
Exemple #16
0
def year(volume_number):
    sql = "SELECT year FROM volume WHERE volume_number = {}".format(
        volume_number)
    c = executor.select(sql)
    for item in c:
        return item[0]
Exemple #17
0
def by_author_id(author_id):
    sql = "SELECT author_name FROM authors WHERE author_id = {}".format(
        author_id)
    c = executor.select(sql)
    return c[0][0]