Module Expr Str Import alias Import alias Import alias Import alias ImportFrom alias ImportFrom alias ImportFrom alias ClassDef bases NameLoad body Expr Str FunctionDef arguments args NameParam NameParam defaults body Expr Str TryExcept body If Call AttributeLoad AttributeLoad NameLoad attr attr NameLoad body Return NameLoad orelse Expr Call AttributeLoad NameLoad attr NameLoad Return NameLoad handlers ExceptHandler type NameLoad body Pass Return NameLoad decorator_list FunctionDef arguments args NameParam NameParam defaults body Expr Str TryExcept body Expr Call AttributeLoad NameLoad attr NameLoad Return NameLoad handlers ExceptHandler type NameLoad body Pass Return NameLoad decorator_list FunctionDef arguments args NameParam NameParam NameParam defaults NameLoad body Expr Str Assign NameStore ListLoad For TupleStore NameStore NameStore NameStore Call AttributeLoad NameLoad attr NameLoad body For NameStore NameLoad body If BoolOpOr CompareIs NameLoad NameLoad Call AttributeLoad Call AttributeLoad NameLoad attr attr NameLoad body Expr Call AttributeLoad NameLoad attr Call AttributeLoad AttributeLoad NameLoad attr attr NameLoad NameLoad Return NameLoad decorator_list FunctionDef arguments args NameParam defaults body Expr Str Return Call AttributeLoad NameLoad attr decorator_list FunctionDef arguments args NameParam NameParam defaults body Expr Str If UnaryOpNot Call AttributeLoad NameLoad attr body Return NameLoad Assign NameStore Call AttributeLoad NameLoad attr If CompareIs NameLoad NameLoad body Return NameLoad Assign NameStore Call AttributeLoad NameLoad attr Str Str SubscriptLoad NameLoad Index Str If CompareEq Call NameLoad NameLoad Num body Assign NameStore SubscriptLoad NameLoad Index Str If BoolOpAnd CompareIn Str NameLoad CompareIsNot SubscriptLoad NameLoad Index Str NameLoad CompareGt Call NameLoad SubscriptLoad NameLoad Index Str Num body Assign NameStore Call AttributeLoad NameLoad attr Str Str Call AttributeLoad SubscriptLoad NameLoad Index Str attr Assign NameStore Call AttributeLoad NameLoad attr BinOpMod Str NameLoad Str Assign NameStore BinOpMod Str TupleLoad NameLoad NameLoad Assign NameStore BinOpMod Str TupleLoad Call AttributeLoad NameLoad attr Str SubscriptLoad NameLoad Index Str NameLoad SubscriptLoad NameLoad Index Str Return Call AttributeLoad NameLoad attr decorator_list FunctionDef arguments args NameParam NameParam defaults body Expr Str Return Call AttributeLoad NameLoad attr Str NameLoad decorator_list FunctionDef arguments args NameParam NameParam defaults body Expr Str Assign NameStore ListLoad If CompareIsNot SubscriptLoad NameLoad Index Str NameLoad body Expr Call AttributeLoad NameLoad attr Call AttributeLoad NameLoad attr Str SubscriptLoad NameLoad Index Str If CompareIsNot SubscriptLoad NameLoad Index Str NameLoad body Expr Call AttributeLoad NameLoad attr SubscriptLoad NameLoad Index Str orelse If BoolOpAnd CompareIsNot SubscriptLoad NameLoad Index Str NameLoad CompareIsNot SubscriptLoad NameLoad Index Str NameLoad body Assign NameStore Call AttributeLoad NameLoad attr SubscriptLoad NameLoad Index Str SubscriptLoad NameLoad Index Str If CompareIsNot NameLoad NameLoad body Expr Call AttributeLoad NameLoad attr NameLoad If CompareLt Call NameLoad NameLoad Num body Expr Call AttributeLoad NameLoad attr Str Return Call AttributeLoad AttributeLoad NameLoad attr attr NameLoad decorator_list FunctionDef arguments args NameParam NameParam NameParam NameParam defaults kwarg body Assign NameStore NameLoad If CompareIn Str NameLoad body Assign NameStore SubscriptLoad NameLoad Index Str Assign NameStore NameLoad If CompareIn Str NameLoad body Assign NameStore SubscriptLoad NameLoad Index Str If UnaryOpNot Call AttributeLoad NameLoad attr body Print BinOpMod Str NameLoad Return Assign NameStore Call AttributeLoad NameLoad attr Assign NameStore Call AttributeLoad NameLoad attr NameLoad Assign NameStore Call AttributeLoad AttributeLoad NameLoad attr attr NameLoad NameLoad Assign NameStore Call AttributeLoad NameLoad attr NameLoad Assign NameStore Call AttributeLoad AttributeLoad NameLoad attr attr NameLoad NameLoad Assign NameStore Call NameLoad Assign NameStore Call AttributeLoad NameLoad attr NameLoad If CompareIs NameLoad NameLoad body If CompareIs AttributeLoad NameLoad attr NameLoad body Print BinOpMod Str NameLoad Return If BoolOpAnd CompareIs NameLoad NameLoad CompareIs Call AttributeLoad NameLoad attr NameLoad NameLoad body If CompareIs AttributeLoad NameLoad attr NameLoad body Print BinOpMod Str TupleLoad NameLoad Call AttributeLoad NameLoad attr NameLoad Return Expr Call AttributeLoad NameLoad attr NameLoad If CompareIs NameLoad NameLoad body Assign NameStore Call AttributeLoad NameLoad attr NameLoad Expr Call AttributeLoad NameLoad attr NameLoad NameLoad Expr Call AttributeLoad NameLoad attr NameLoad TupleLoad AttributeLoad NameLoad attr AttributeLoad NameLoad attr orelse Expr Call AttributeLoad NameLoad attr NameLoad NameLoad Expr Call AttributeLoad NameLoad attr NameLoad NameLoad Expr Call AttributeLoad NameLoad attr Return NameLoad decorator_list FunctionDef arguments args NameParam NameParam defaults body Expr Str Assign NameStore NameLoad Assign NameStore Call AttributeLoad NameLoad attr Assign TupleStore NameStore NameStore NameStore BinOpMult ListLoad NameLoad Num Assign NameStore Call AttributeLoad AttributeLoad NameLoad attr attr NameLoad Assign NameStore Call AttributeLoad NameLoad attr Str NameLoad If CompareIsNot NameLoad NameLoad body Assign TupleStore NameStore NameStore Call AttributeLoad NameLoad attr Assign NameStore Call AttributeLoad NameLoad attr Str Call AttributeLoad AttributeLoad NameLoad attr attr Call AttributeLoad NameLoad attr If CompareIsNot NameLoad NameLoad body Assign NameStore Call AttributeLoad NameLoad attr Num If BoolOpAnd CompareIsNot NameLoad NameLoad CompareIsNot NameLoad NameLoad body If CompareIsNot NameLoad NameLoad body Assign NameStore Call AttributeLoad NameLoad attr Call AttributeLoad Str attr NameLoad NameLoad NameLoad Str orelse Assign NameStore Call AttributeLoad NameLoad attr Call AttributeLoad Str attr NameLoad NameLoad Str Expr Call AttributeLoad NameLoad attr NameLoad TupleLoad Call AttributeLoad NameLoad attr Call AttributeLoad NameLoad attr NameLoad decorator_list decorator_list
N/A N/A 
General file system methods.

.. moduleauthor:: Jaisen Mathai <jaisen@jmathai.com>
 N/A os N/A re N/A shutil N/A time elodie geolocation elodie constants elodie.localstorage Db FileSystem N/A object N/A N/A A class for interacting with the file system. create_directory N/A N/A self directory_path N/A N/A N/A Create a directory if it does not already exist.

        :param str directory_name: A fully qualified path of the
            to create.
        :returns: bool
         N/A N/A N/A N/A N/A N/A os path exists directory_path N/A N/A True N/A N/A N/A N/A os makedirs directory_path N/A True N/A N/A N/A OSError N/A N/A N/A False N/A delete_directory_if_empty N/A N/A self directory_path N/A N/A N/A Delete a directory only if it's empty.

        Instead of checking first using `len([name for name in
        os.listdir(directory_path)]) == 0`, we catch the OSError exception.

        :param str directory_name: A fully qualified path of the directory
            to delete.
         N/A N/A N/A N/A N/A os rmdir directory_path N/A True N/A N/A N/A OSError N/A N/A N/A False N/A get_all_files N/A N/A self path extensions N/A None N/A N/A Recursively get all files which match a path and extension.

        :param str path string: Path to start recursive file listing
        :param tuple(str) extensions: File extensions to include (whitelist)
         N/A files N/A N/A N/A dirname dirnames filenames N/A N/A os walk path N/A N/A filename filenames N/A N/A N/A N/A extensions None N/A N/A N/A N/A filename lower endswith extensions N/A N/A N/A N/A files append N/A N/A N/A os path join dirname filename N/A files N/A get_current_directory N/A N/A self N/A N/A N/A Get the current working directory.

        :returns: str
         N/A N/A N/A os getcwd N/A get_file_name N/A N/A self media N/A N/A N/A Generate file name for a photo or video using its metadata.

        We use an ISO8601-like format for the file name prefix. Instead of
        colons as the separator for hours, minutes and seconds we use a hyphen.
        https://en.wikipedia.org/wiki/ISO_8601#General_principles

        :param media: A Photo or Video instance
        :type media: :class:`~elodie.media.photo.Photo` or
            :class:`~elodie.media.video.Video`
        :returns: str or None for non-photo or non-videos
         N/A N/A N/A N/A media is_valid N/A N/A None N/A metadata N/A N/A media get_metadata N/A N/A metadata None N/A N/A None N/A base_name N/A N/A re sub ^\d{4}-\d{2}-\d{2}_\d{2}-\d{2}-\d{2}- N/A metadata N/A base_name N/A N/A N/A len base_name 0 N/A N/A base_name N/A metadata N/A base_name N/A N/A N/A title metadata N/A N/A metadata N/A title None N/A N/A len N/A metadata N/A title 0 N/A N/A title_sanitized N/A N/A re sub \W+ - N/A N/A N/A metadata N/A title strip N/A base_name N/A N/A base_name replace N/A -%s title_sanitized N/A base_name N/A %s-%s N/A base_name title_sanitized N/A file_name N/A %s-%s.%s N/A N/A N/A time strftime %Y-%m-%d_%H-%M-%S N/A metadata N/A date_taken base_name N/A metadata N/A extension N/A N/A N/A file_name lower N/A get_folder_name_by_date N/A N/A self time_obj N/A N/A N/A Get date based folder name.

        :param time time_obj: Time object to be used to determine folder name.
        :returns: str
         N/A N/A N/A time strftime %Y-%m-%b time_obj N/A get_folder_path N/A N/A self metadata N/A N/A N/A Get folder path by various parameters.

        :param time time_obj: Time object to be used to determine folder name.
        :returns: str
         N/A path N/A N/A N/A N/A metadata N/A date_taken None N/A N/A N/A N/A path append N/A N/A time strftime %Y-%m-%b N/A metadata N/A date_taken N/A N/A N/A metadata N/A album None N/A N/A N/A N/A path append N/A metadata N/A album N/A N/A N/A N/A N/A metadata N/A latitude None N/A N/A metadata N/A longitude None N/A N/A place_name N/A N/A geolocation place_name N/A metadata N/A latitude N/A metadata N/A longitude N/A N/A place_name None N/A N/A N/A N/A path append place_name N/A N/A N/A len path 2 N/A N/A N/A N/A path append Unknown Location N/A N/A N/A N/A os path join path N/A process_file N/A N/A self _file destination media N/A kwargs N/A N/A move False N/A N/A move kwargs N/A N/A move N/A kwargs N/A move N/A allow_duplicate False N/A N/A allowDuplicate kwargs N/A N/A allow_duplicate N/A kwargs N/A allowDuplicate N/A N/A N/A N/A media is_valid N/A N/A N/A %s is not a valid media file. Skipping... _file N/A N/A metadata N/A N/A media get_metadata N/A directory_name N/A N/A self get_folder_path metadata N/A dest_directory N/A N/A N/A os path join destination directory_name N/A file_name N/A N/A self get_file_name media N/A dest_path N/A N/A N/A os path join dest_directory file_name N/A db N/A Db N/A checksum N/A N/A db checksum _file N/A N/A checksum None N/A N/A N/A N/A constants debug True N/A N/A N/A Could not get checksum for %s. Skipping... _file N/A N/A N/A N/A allow_duplicate False N/A N/A N/A db check_hash checksum True N/A N/A N/A N/A constants debug True N/A N/A N/A %s already exists at %s. Skipping... N/A _file N/A N/A db get_hash checksum N/A N/A N/A N/A self create_directory dest_directory N/A N/A move True N/A N/A stat N/A N/A os stat _file N/A N/A N/A shutil move _file dest_path N/A N/A N/A os utime dest_path N/A N/A stat st_atime N/A stat st_mtime N/A N/A N/A N/A shutil copy2 _file dest_path N/A N/A N/A db add_hash checksum dest_path N/A N/A N/A db update_hash_db N/A dest_path N/A set_date_from_path_video N/A N/A self video N/A N/A N/A Set the modification time on the file based on the file path.

        Noop if the path doesn't match the format YYYY-MM/DD-IMG_0001.JPG.

        :param elodie.media.video.Video video: An instance of Video.
         N/A date_taken None N/A video_file_path N/A N/A video get_file_path N/A N/A year month day N/A N/A None 3 N/A directory N/A N/A N/A os path dirname video_file_path N/A year_month_match N/A N/A re search (\d{4})-(\d{2}) directory N/A N/A year_month_match None N/A N/A N/A year month N/A N/A year_month_match groups N/A day_match N/A N/A re search ^(\d{2}) N/A N/A N/A os path basename N/A N/A video get_file_path N/A N/A day_match None N/A N/A day N/A N/A day_match group 1 N/A N/A N/A year None N/A month None N/A N/A N/A day None N/A N/A date_taken N/A N/A time strptime N/A N/A {}-{}-{} format year month day %Y-%m-%d N/A N/A date_taken N/A N/A time strptime N/A N/A {}-{} format year month %Y-%m N/A N/A N/A os utime video_file_path N/A N/A N/A time time N/A N/A time mktime date_taken N/A N/A