<commit_before>import common
import time
import sys

if len(sys.argv) < 2:
    common.log('ERROR input file is required')
    time.sleep(3)
    exit()

inputfile = sys.argv[1]

with open(inputfile, 'r') as f:
    api = common.open_api()
    for line in f:
        fields = line.strip().split('\t')
        artist_name = fields[0]
        album_name = fields[1]

        results = api.search_all_access(album_name)

        print ''
        print '=========='
        print 'Checking %s by %s' % (album_name, artist_name)

        for album in results['album_hits']:
            name = album['album']['name']
            artist = album['album']['albumArtist']
            album_id = album['album']['albumId']
            if name.startswith(album_name) and artist_name == artist:
                aresults = api.get_album_info(album_id)
                if aresults:
                    tracks = len(aresults['tracks'])
                    print "   * Album: %s  Artist: %s  Tracks: %s" % (name, artist, tracks)
                else:
                    print "   * Album: %s  Artist: %s  Tracks: unknown" % (name, artist)

    common.close_api()<commit_msg>added year and number of tracks to input<commit_after>import common
import time
import sys

if len(sys.argv) < 2:
    common.log('ERROR input file is required')
    time.sleep(3)
    exit()

inputfile = sys.argv[1]

with open(inputfile, 'r') as f:
    api = common.open_api()
    for line in f:
        fields = line.strip().split('\t')
        input_artist = fields[0]
        input_album = fields[1]
        input_year = fields[2]
        input_tracks = int(fields[3])

        results = api.search_all_access(input_album)

        print ''
        print '=========='
        print "Checking '%s' by '%s' from %s with %s tracks" % (input_album, input_artist, input_year, input_tracks)

        for album in results['album_hits']:
            name = album['album']['name']
            artist = album['album']['albumArtist']
            album_id = album['album']['albumId']
            if name.startswith(input_album) and input_artist == artist:
                aresults = api.get_album_info(album_id)
                if aresults:
                    tracks = len(aresults['tracks'])
                    year = aresults['year']
                    if tracks >= input_tracks:
                        print "   * ALBUM: %s  ARTIST: %s  YEAR: %s  TRACKS: %s" % (name, artist, year, tracks)
                    else:
                        print "   - ALBUM: %s  ARTIST: %s  YEAR: %s  TRACKS: %s" % (name, artist, year, tracks)
                else:
                    print "   * ALBUM: %s  ARTIST: %s  YEAR: unknown  TRACKS: unknown" % (name, artist)

    common.close_api()
{'fraction_non_alphanumeric': 0.13049853372434017, 'fraction_numerical': 0.004398826979472141, 'mean_word_length': 1.9598698481561823, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 4, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4848060', 'n_tokens_mistral': 861, 'n_tokens_neox': 831, 'n_words': 217}