Ejemplo n.º 1
0
def get_anime_by_status(status=''):
    mal_user = os.environ['MAL_USER']
    global cached_anime_list
    if cached_anime_list == 0:
        cached_anime_list = spice.get_list(
            spice.get_medium('anime'), mal_user,
            spice.init_auth(mal_user, os.environ['MAL_PASS']))

    watching_list = filter_anime_by_status(cached_anime_list.get_mediums(),
                                           status)

    db = get_db()
    json_watching_list = []
    for anime in watching_list:
        print anime.title.encode('utf-8'), anime.image_url
        json_watching_list.append({
            'id': anime.id,
            'title': anime.title.encode('utf-8'),
            'image_url': anime.image_url,
            'reasons': get_reasons(db, anime.id),
            'status': anime.status
        })

    db.close()
    json_dump = json.dumps(json_watching_list)
    print json_dump
    return json_dump
Ejemplo n.º 2
0
def get_mal_list():
    logger.info('[MAL] Retrieving list...')
    user = mal_settings['username']
    mal_list = spice.get_list(spice.get_medium('anime'), user,
                              mal_credentials).get_mediums()
    items = len(mal_list) if mal_list else 0
    logger.info('[MAL] Found {} shows on list'.format(items))
    return mal_list
Ejemplo n.º 3
0
Archivo: test.py Proyecto: skxu/spice
def main():
    creds = spice.load_auth_from_file('auth')
    print(creds)
    results = spice.search('Re:Zero Kara Hajimeru Isekai Seikatsu',
                           spice.get_medium('anime'), creds)
    print(results[0].title)
    souma = spice.search_id(1, spice.get_medium('manga'), creds)
    print(souma.raw_data)
    print(souma.title)
    print(souma.chapters)
    print(souma.volumes)
    re_zero_data = spice.get_blank(spice.get_medium('anime'))
    re_zero_data.episodes = 0
    re_zero_data.status = spice.get_status('reading')
    re_zero_data.score = 8
    re_zero_data.tags = ['this the first time a show that made me cringe']

    shokugeki_data = spice.get_blank(spice.get_medium('manga'))
    shokugeki_data.chapters = 13
    shokugeki_data.volumes = 1
    shokugeki_data.status = 1
    shokugeki_data.score = 8
    spice.update(shokugeki_data, 45757, spice.get_medium('manga'), creds)

    anime_list = spice.get_list(spice.get_medium('ANIME'), 'Utagai-', creds)
    print(anime_list.avg_score())
    print(anime_list.median_score())
    print(anime_list.mode_score())
    print(anime_list.extremes())
    print(anime_list.p_stddev())
    print(anime_list.p_var())
    print(anime_list.get_num_status(1))
    print(anime_list.get_total())
    print(anime_list.get_days())
    print(anime_list.exists(11734))
    print(len(anime_list.get_ids()))
    print(len(anime_list.get_titles()))
    print(anime_list.get_status(1))
    print(anime_list.get_score(10))
    print(anime_list.exists_as_status(11734, 1))
    print(anime_list.score_diff())
    anime_list2 = spice.get_list(spice.get_medium('ANIME'), 'Pickleplatter',
                                 creds)
    print("Similarity coefficient: {}".format(
        anime_list.compatibility(anime_list2)))
Ejemplo n.º 4
0
def main():
    creds = spice.load_auth_from_file('auth')
    print(creds)
    results = spice.search('Spice and Wolf', spice.get_medium('anime'))
    print(results[0].title)
    saw_novel = spice.search_id(9115, spice.get_medium('manga'))
    print(saw_novel.raw_data)
    print(saw_novel.title)
    print(saw_novel.chapters)
    print(saw_novel.volumes)

    saw_data = spice.get_blank(spice.get_medium('anime'))
    saw_data.episodes = 10
    saw_data.status = spice.get_status('watching')
    saw_data.score = 9
    saw_data.tags = ['holo is the best']
    spice.update(saw_data, 2966, spice.get_medium('anime'))

    #shokugeki_data = spice.get_blank(spice.get_medium('manga'))
    #shokugeki_data.chapters = 13
    #shokugeki_data.volumes = 1
    #shokugeki_data.status = 1
    #shokugeki_data.score = 8
    #spice.update(shokugeki_data, 45757, spice.get_medium('manga'))

    anime_list = spice.get_list(spice.get_medium('ANIME'))
    print(anime_list.avg_score())
    #print(anime_list.median_score())
    #print(anime_list.mode_score())
    #print(anime_list.extremes())
    #print(anime_list.p_stddev())
    print(anime_list.p_var())
    print(anime_list.get_num_status(spice.get_status_num('reading')))
    #print(anime_list.get_total())
    #print(anime_list.get_days())
    #print(anime_list.exists(11734))
    #print(len(anime_list.get_ids()))
    #print(len(anime_list.get_titles()))
    #print(anime_list.get_status(1))
    #print(anime_list.get_score(10))
    #print(anime_list.exists_as_status(11734, 1))
    #print(anime_list.score_diff())
    anime_list2 = spice.get_list(spice.get_medium('ANIME'), 'Pickleplatter')
    print("Similarity coefficient: {}".format(
        anime_list.compatibility(anime_list2)))
Ejemplo n.º 5
0
def get_mal_list():
  logger.info('[MAL] Retrieving list...')
  mal_list = spice.get_list(spice.get_medium('anime'), mal_username, mal_credentials).get_mediums()
  item_count = 0
  if(mal_list is not None):
    item_count = len(mal_list)

  logger.info('[MAL] Found %s shows on list' % (str(item_count)))
  return mal_list
Ejemplo n.º 6
0
def test_spice():
    creds = spice.init_auth(os.environ['USERNAME'], os.environ['PASSWORD'])
    results = spice.search('Re:Zero Kara Hajimeru Isekai Seikatsu', 
            spice.get_medium('anime'), creds)
    print(results[0].title)
    souma = spice.search_id(1, spice.get_medium('manga'), creds)
    print(souma.raw_data)
    print(souma.title)
    print(souma.chapters)
    print(souma.volumes)
    re_zero_data = spice.get_blank(spice.get_medium('anime'))
    re_zero_data.episodes = 0
    re_zero_data.status = spice.get_status('reading')
    re_zero_data.score = 8
    re_zero_data.tags = ['this the first time a show that made me cringe']

    shokugeki_data = spice.get_blank(spice.get_medium('manga'))
    shokugeki_data.chapters = 13
    shokugeki_data.volumes = 1
    shokugeki_data.status = 1
    shokugeki_data.score = 8
    spice.update(shokugeki_data, 45757, spice.get_medium('manga'), creds)

    anime_list = spice.get_list(spice.get_medium('ANIME'), 'Utagai-', creds)
    print(anime_list.avg_score())
    print(anime_list.median_score())
    print(anime_list.mode_score())
    print(anime_list.extremes())
    print(anime_list.p_stddev())
    print(anime_list.p_var())
    print(anime_list.get_num_status(1))
    print(anime_list.get_total())
    print(anime_list.get_days())
    print(anime_list.exists(11734))
    print(len(anime_list.get_ids()))
    print(len(anime_list.get_titles()))
    print(anime_list.get_status(1))
    print(anime_list.get_score(10))
    print(anime_list.exists_as_status(11734, 1))
    print(anime_list.score_diff())
    anime_list2 = spice.get_list(spice.get_medium('ANIME'), 'Pickleplatter', creds)
    print("Similarity coefficient: {}".format(anime_list.compatibility(anime_list2)))
Ejemplo n.º 7
0
def get_mal_list():
    mal_list = spice.get_list(spice.get_medium(
        'anime'), mal_username, mal_credentials).get_mediums()

    return mal_list