<commit_before>from __future__ import print_function
import os
import sys
from movie_util import filenames_to_search_strings, print_movies
from filmtipset_util import get_grades

def is_proper_movie_file(filename):
    FILE_ENDINGS = [".mkv", ".mp4", ".avi", ".iso", "mpeg", ]
    if filename[-4:] in FILE_ENDINGS:
        return True
    elif (filename.find(".") == -1 and not filename.endswith("-ignore")):
        return True
    return False

def get_movies(dir):
    movies = os.listdir(dir)
    movies = [movie for movie in movies if is_proper_movie_file(movie)]
    return movies

def main(directory, debug=False):
    print("Loading movies from: %s" % directory)
    movies = get_movies(directory)
    movies = filenames_to_search_strings(movies)
    graded = get_grades(movies, debug=debug)

    print_movies("Movies seen, by grade", sorted(filter(lambda x: x[1] == u'seen', graded), reverse=True))
    print_movies("Movies not seen, by grade", sorted(filter(lambda x: x[1] != u'seen', graded), reverse=True))

# Possible calls:
# lookup_from_filesystem.py /My-Movies/
# lookup_from_filesystem.py /My-Movies/ --verbose
if __name__ == "__main__":
    directory = sys.argv[1]
    debug = False
    if len(sys.argv) == 3:
        if sys.argv[2] == "--verbose":
            debug = True
    main(directory=directory, debug=debug)<commit_msg>Add .mov as proper movie file ending.<commit_after>from __future__ import print_function
import os
import sys
from movie_util import filenames_to_search_strings, print_movies
from filmtipset_util import get_grades

def is_proper_movie_file(filename):
    FILE_ENDINGS = [".mkv", ".mp4", ".avi", ".iso", ".mov", "mpeg"]  # Note: needs to be length 4
    if filename[-4:] in FILE_ENDINGS:
        return True
    elif (filename.find(".") == -1 and not filename.endswith("-ignore")):
        return True
    return False

def get_movies(dir):
    movies = os.listdir(dir)
    movies = [movie for movie in movies if is_proper_movie_file(movie)]
    return movies

def main(directory, debug=False):
    print("Loading movies from: %s" % directory)
    movies = get_movies(directory)
    movies = filenames_to_search_strings(movies)
    graded = get_grades(movies, debug=debug)

    print_movies("Movies seen, by grade", sorted(filter(lambda x: x[1] == u'seen', graded), reverse=True))
    print_movies("Movies not seen, by grade", sorted(filter(lambda x: x[1] != u'seen', graded), reverse=True))

# Possible calls:
# lookup_from_filesystem.py /My-Movies/
# lookup_from_filesystem.py /My-Movies/ --verbose
if __name__ == "__main__":
    directory = sys.argv[1]
    debug = False
    if len(sys.argv) == 3:
        if sys.argv[2] == "--verbose":
            debug = True
    main(directory=directory, debug=debug)
{'fraction_non_alphanumeric': 0.1282703488372093, 'fraction_numerical': 0.0061773255813953485, 'mean_word_length': 3.9514388489208634, 'pattern_counts': {'":': 4, '<': 3, '<?xml version=': 0, '>': 3, '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': '2611845', 'n_tokens_mistral': 926, 'n_tokens_neox': 897, 'n_words': 242}