NaPs / Kolekto

Kolekto is a really KISS movie catalog software
MIT License
27 stars 3 forks source link

OSError: [Errno 2] No such file or directory: '[...]/.kolekto/movies/[SHA1]' #17

Closed tetraf closed 10 years ago

tetraf commented 10 years ago

With ArchLinux, python 2.7.6, last Kolekto from git (commit 77f348fab572fe32ecefdac03527714dbda79ecd). I use symlinks.

$ kolekto -d -V stats
[debug] Executing command <bound method Stats.run of <kolekto.commands.stats.Stats object at 0x1b18d90>>
Traceback (most recent call last):
  File "/usr/bin/kolekto", line 85, in <module>
    main()
  File "/usr/bin/kolekto", line 78, in main
    args.command(args, config)
  File "/usr/lib/python2.7/site-packages/kolekto/commands/stats.py", line 61, in run
    total_size += os.path.getsize(movie_fullpath)
  File "/usr/lib/python2.7/genericpath.py", line 49, in getsize
    return os.stat(filename).st_size
OSError: [Errno 2] No such file or directory: '[...]/.kolekto/movies/b45cd3bc48c91e84b6758fe805cb5f609f7ffb1e'

The tree:

$ tree -a
.
└── .kolekto
    ├── config
    ├── metadata.db
    └── movies
        ├── b45cd3bc48c91e84b6758fe805cb5f609f7ffb1e -> ../Movies/movie.1.avi
        └── b997d57d4c5f01e28b8745e520c42280a00f4939 -> ../Movies/movie.2.avi
2 directories, 4 files
NaPs commented 10 years ago

I think this bug is caused by a relative path used while import with --symlink. Can you try using an absolute one?

If you confirm that the problem is actually caused by a relative path, I'll patch Kolekto to convert relative paths to absolute one.

tetraf commented 10 years ago

With absolute symlinks, I don't have this error. But I need relative symlinks, the tree is on a network mountpoint.

NaPs commented 10 years ago

Ok, I can translate relative symlink to relative one from the root of the Kolekto tree, but I can't promise you a patch today.

That said, I do not recommend using symbolic links to import movies in Kolekto. I rely on the fact that the movies pool will not be modified by hand and Kolekto will traceback if you rename/delete any movie which will cause a broken link. I recommend using hard links: they are not affected by any rename or delete, and if you decide someday to use Kolekto as your main movies pool, you just have to delete the original files to do the job :-).

tetraf commented 10 years ago

Yeah but the hardlinks don't works with distinct FS and some FS don't support them. If I want to backup the tree, it's lighter to backup symlinks. I can't use Kolekto as my main movie pool, if a bug breaks the system, I has a bunch of files named by sha1 which is not usable.

NaPs commented 10 years ago

Yep, I anticipated this kind of problem (as I use Kolekto as main pool) and implemented a dump command which allow to export the database in JSON format. I run it each day by a cronjob.

NaPs commented 10 years ago

I finally fixed your problem. Can you confirm that 478e2ec do what is expected from it?

tetraf commented 10 years ago

I confirm, no more problem with this version.