Coder Social home page Coder Social logo

Comments (7)

D3Zyre avatar D3Zyre commented on June 26, 2024

so, in filesystem.py, there's a method process_checksum(). This method is supposed to return the checksum of the file to import, but can return None as well. If the file being imported already exists in the destination folder and has the same checksum, this method returns None.

The caller of this method is another method, process_file(), as pasted below

        checksum = self.process_checksum(_file, allow_duplicate)
        if(checksum is None):
            log.info('Original checksum returned None for %s. Skipping...' %
                     _file)
            return

This is all fine, we should skip the file if it has already been imported. However, it ends up reporting that file as having encountered an error on import, when this is not actually the case. It should either report that it was successfully imported, or that it was not imported because it already existed, not "error".

from elodie.

D3Zyre avatar D3Zyre commented on June 26, 2024

to continue the comment above,
The import() method in elodie.py calls process_file(), and this is supposed to return the destination path as well, but will return None if process_file() returned None, which is the case when the file to be imported has already been imported.
The import_file() method is called in the _import() method. When the destination path is None, _import() will make has_errors equal to True:

    for current_file in files:
        dest_path = import_file(current_file, destination, album_from_folder,
                    trash, allow_duplicates)
        result.append((current_file, dest_path))
        has_errors = has_errors is True or not dest_path

Which on the following lines causes the program to exit:

    if has_errors:
        sys.exit(1)

from elodie.

D3Zyre avatar D3Zyre commented on June 26, 2024

ah, here it is. Just before the sys.exit(1) call, a Result object is used to write the error output to the command line. When a result with destination None is appended to the Result object, it is saved as being an "error". Then when the results are printed to the command line, it reports these files that have previously been imported, as being errors.

from elodie.

D3Zyre avatar D3Zyre commented on June 26, 2024

A potential solution to this issue is to add a "class" of results in the Result object. Instead of only having "success" and "error", we could also have a "duplicate" or "already_existed" variable to keep track of files that weren't imported due to already existing in the destination folder. This way it would not be reported as an error, but rather a duplicate file that has not been imported again.

from elodie.

D3Zyre avatar D3Zyre commented on June 26, 2024

I am working on this issue in my fork of Elodie.

I have encountered something that I don't understand. There are some log.info() calls that print nothing when the debug option is enabled. Expected behavior is that it prints the info message, as other log.info() calls do.

Example in filesystem.py:

                print("TEST!!!")
                log.info('%s already at %s.' % (
                    _file,
                    checksum_file
                ))

my print works, but log.info prints nothing with debug enabled, which is not what is expected

from elodie.

D3Zyre avatar D3Zyre commented on June 26, 2024

nevermind on that log.info thing. I'm just blind apparently

from elodie.

D3Zyre avatar D3Zyre commented on June 26, 2024

I believe I have fixed this issue to my satisfaction. See: this commit

from elodie.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.