1
0
mirror of https://github.com/gryf/pygtktalog.git synced 2026-03-27 06:33:30 +01:00

8 Commits

216 changed files with 2484 additions and 7891 deletions

2
.gitignore vendored Normal file
View File

@@ -0,0 +1,2 @@
__pycache__/
*.py[cod]

View File

@@ -1,4 +0,0 @@
include setup.py
include pavement.py
include paver-minilib.zip
include pygtktalog/locale/*/*/*.mo

182
README
View File

@@ -1,182 +0,0 @@
pyGTKtalog
==========
pyGTKtalog is Linux/FreeBSD program for indexing CD/DVD or directories on
filesystem. It is similar to `gtktalog <http://www.nongnu.org/gtktalog/>`_ or
`gwhere <http://www.gwhere.org/home.php3>`_. There is no coincidence in name of
application, because it's menat to be replacement (in some way) for gtktalog,
which seems to be dead project for years.
Current version is 1.9.
FEATURES
--------
* scan for files in selected media
* get/generate thumbnails from exif and other images
* most important exif tags
* add/edit description and notes
* fetch comments for images made in `gThumb <http://gthumb.sourceforge.net>`_
* add/remove unlimited images to any file or directory
* `tagging files <http://en.wikipedia.org/wiki/Tag_%28metadata%29>`_
* and more :)
REQUIREMENTS
------------
pyGTKtalog requires python and following libraries:
* `python 2.6 <http://www.python.org/>`_
* `pygtk 2.16 <http://www.pygtk.org>`_
* `pygtkmvc 1.99 <http://sourceforge.net/apps/trac/pygtkmvc/wiki>`_
* `sqlalchemy 0.6 <http://www.sqlalchemy.org>`_
It may work on other (lower) version of libraries, and it should work with
higher versions of libraries.
.. note::
Although pygtkmvc is `listed on pypi
<http://pypi.python.org/pypi/python-gtkmvc/>`_ it may happen that you
have to download it directly from
`sourceforge <http://sourceforge.net/apps/trac/pygtkmvc/wiki>`_ page and
install manually. I don't know about pygtk (I've installed it by my
system package manager), but all the others python libraries (sqlalchemy,
paver, nose, coverage) should be installable via `pip
<http://pypi.python.org/pypi/pip>`_
Optional modules
^^^^^^^^^^^^^^^^
* `PIL <http://www.pythonware.com/products/pil/index.htm>`_ for image manipulation
Additional pyGTKtalog uses EXIF module by Gene Cash (slightly updatetd to EXIF
2.2 by me) which is included in sources.
pyGTKtalog extensivly uses external programs in unix spirit, however there is
small possibility of using it Windows (probably with limitations) and quite big
possiblity to run it on other sofisticated unix-like systems (i.e.
BeOS/ZETA/Haiku, QNX or MacOSX).
Programs that are used:
* mencoder (provided by mplayer package)
* montage, convert from ImageMagick
For development process following programs are used:
* `gettext <http://www.gnu.org/software/gettext/gettext.html>`_
* `intltool <http://www.gnome.org/>`_
* `nose <http://code.google.com/p/python-nose/>`_
* `coverage <http://nedbatchelder.com/code/coverage/>`_
* `paver <http://code.google.com/p/paver/>`__
INSTALATION
-----------
You don't have to install it if you don't want to. You can just change current
directory to pyGTKtalog and simply run::
$ paver run
That's it. Alternatively, if you like to put it in more system wide place, all
you have to do is:
#. put pyGTKtalog directory into your destination of choice (/usr/local/share,
/opt or ~/ is typical bet)
#. copy pyGTKtalog shell script to /usr/bin, /usr/local/bin or in
other place, where PATH variable is pointing or you feel like.
#. then modify pyGTKtalog line 6 to match right pygtktalog.py directory
Then, just run pyGTKtalog script.
TODO
----
PyGTKtalog is still under heavy development, however there is small chance to
change structure of catalogs (and if it'll change, there will be transparent
function to update DB schema).
For version 1.0 there are no features to be done, just bug fixes.
There are still minor aims for versions 1.x to be done:
* consolidate popup-menus with edit menu
* add popup menu for directly removing tag from tag cloud
* implement advanced search
For version 2.0:
* Export/Import
* Icon grid in files view
* command line support: query, adding media to collection etc
* internationalization
* export to XLS
* user definied group of tags (represented by color in cloud tag)
* hiding specified files - configurable, like dot prefixed, cfg and manualy
selected
* tests
* warning about existing image in media directory
Removed:
* filetypes handling (movies, images, archives, documents etc). Now it have
common, unified external "plugin" system - simple text output from command
line programs.
* anime/movie
* title
* alt title
* type (anime movie, movie, anime oav, anime tv series, tv series, etc)
* cover/images
* genre
* lang
* sub lang
* release date (from - to)
* anidb link/imdb link
Maybe in future versions. Now text file descriptions/notes and tags have to
be enough for good and fast information search.
NOTES
-----
Catalog file is plain sqlite database (optionally compressed with bzip2). All
images are stored in ``~/.pygtktalog/images`` directory. Names for images are
generated sha512 hash from image file itself. There is small possibility for two
identical hash for different image files. However, no images are overwritten.
Thumbnail filename for each image is simply concatenation of image filename in
images directory and '_t' string.
There is also converter from old database to new for internal use only. In
public release there will be no other formats so it will be useless, and
deleted. There are some issues with converting. All thumbnails will be lost.
All images without big image will be lost. There are serious changes with
application design, and I decided, that is better to keep media unpacked on
disk, instead of pack it every time with save and unpack with open methods. New
design prevent from deleting any file from media directory (placed in
``~/.pygtktalog/images``). Functionality for exporting images and corresponding
db file is planned.
DEVELOPMENT
-----------
Several tools has been used to develop pyGTKtalog.
Paver
^^^^^
I've choose `Paver <http://www.blueskyonmars.com/projects/paver/>`_ as make
equivalent. Inside main project directory there is pavement.py script, which
provides several tasks, that can be helpfull in a work with sources. Paver is
also used to generate standard setup.py.
Nose
^^^^
BUGS
----
All bugs please report to Roman 'gryf' Dobosz <gryf73@gmail.com>.

180
README.rst Normal file
View File

@@ -0,0 +1,180 @@
pyGTKtalog 1.0
==============
pyGTKtalog is Linux/FreeBSD program for indexing CD/DVD or directories on
filesystem. It is similar to `gtktalog`_ or `gwhere`_ . There is no coincidence
in name of application, because it's meant to be replacement (in some way) for
gtktalog, which seems to be dead project for years.
.. image:: /example/main.png
:alt: pyGTKtalog main screen
WARNING!
========
**This version is mostly outdated, full of bugs, and may eat your data!** First
usable version (this is what you are looking at right now) was completed around
2009 year, but implementation was done much earlier. During that time GTK2 was
changed significantly several times, because of that couple of pyGTKtalog
functionalities goes bad.
The reason for keeping this branch is for history and for GUI to the new engine
which was rewritten couple of years ago and have only cli tool to manipulate
DBs.
In other words - pyGTKtalog version on this branch is safe for **view only**
your catalog database, while it may corrupt database or other files while trying
to create/update your databases in any way.
You have been warned.
The rest of the README file:
FEATURES
========
* scan for files in selected media
* get/generate thumbnails from EXIF and other images
* stores selected EXIF tags
* add/edit description and notes
* fetch comments for images made in `gThumb`_
* add/remove unlimited images to any file or directory
* `tagging files`_
* and more :)
Couple of screens showing how it looks like:
.. image:: /example/tags_images.png
:alt: Other tabs - tags and images
.. image:: /example/tags_selected.png
:alt: Narrow down the files by tags
.. image:: /example/search.png
:alt: Search window and image view
Also, in ``example`` directory you'll find a database ``example.sqlite`` to play
with.
REQUIREMENTS
============
pyGTKtalog is written in python with following dependencies:
* python 2.4 or higher
* `pygtk 2.10`_ or higher
* `pysqlite2`_ (unnecessary, if python 2.5 is used)
Optional modules:
* `PIL`_ for image manipulation
Additional pyGTKtalog uses `pygtkmvc`_ by Roberto Cavada and EXIF module by Gene
Cash (slightly updatetd to EXIF 2.2 by me) which are included in sources.
pyGTKtalog extensively uses external programs in unix spirit, however there is
small possibility of using it Windows (probably with limitations) and quite
big possibility to run it on other sophisticated unix-like systems (i.e.
BeOS/ZETA/Haiku, QNX or MacOSX).
INSTALLATION
============
You don't have to install it if you don't want to. You can just change current
directory to pyGTKtalog and simply run:
./pyGTKtalog
That's it. Alternatively, if you like to put it in more system wide place, all
you have to do is:
* put pyGTKtalog directory into your destination of choice (/usr/local/share,
/opt or ~/ is typical bet)
* copy pyGTKtalog shell script to /usr/bin, /usr/local/bin or in
other place, where PATH variable is pointing or you feel like.
* then modify pyGTKtalog line 6 to match right ``pygtktalog.py`` directory
Then, just run pyGTKtalog script.
TODO
====
PyGTKtalog is still under heavy development, however there is small chance to
change structure of catalogs (and if it'll change, there will be transparent
function to update DB schema).
For version 1.0 there are no features to be done, just bug fixes.
There are still minor aims for versions 1.x to be done:
- consolidate popup-menus with edit menu
- add popup menu for directly removing tag from tag cloud
- implement advanced search
For version 2.0:
- Export/Import
- Icon grid in files view
- command line support: query, adding media to collection etc
- internationalization
- export to XLS
- user defined group of tags (represented by color in cloud tag)
- hiding specified files - configurable, like dot prefixed, config files and
manually selected
- tests
- warning about existing image in media directory
Removed:
- filetypes handling (movies, images, archives, documents etc). Now it have
common, unified external "plugin" system - simple text output from command
line programs.
- anime/movie
- title
- alt title
- type (anime movie, movie, anime oav, anime tv series, tv series, etc)
- cover/images
- genre
- lang
- sub lang
- release date (from - to)
- anidb link/imdb link
Maybe in future versions. Now text file descriptions/notes and tags have to
be enough for good and fast information search.
NOTES
=====
Catalog file is plain sqlite database (optionally compressed with bzip2). All
images are stored in ``[CONFIG_PATH]/images`` directory, where ``[CONFIG_PATH]``
is one of the following location:
- ``$XDG_CONFIG_HOME/pygtktalog``
- ``$HOME/.pytgtktalog``
Names for images are generated sha512 hash from image file itself. There is
small possibility for two identical hash for different image files. However, no
images are overwritten. Thumbnail filename for each image is simply
concatenation of image filename in images directory and ``_t`` string.
There is also converter from old database to new for internal use only. In
public release there will be no other formats so it will be useless, and
deleted. There are some issues with converting. All thumbnails will be lost. All
images without big image will be lost. There are serious changes with
application design, and I decided, that is better to keep media unpacked on
disk, instead of pack it every time with save and unpack with open methods. New
design prevent from deleting any file from media directory (placed in
``[CONFIG_PATH]/images``). Functionality for exporting images and corresponding
db file is planned.
LICENSE
=======
This work is licensed under the terms of the GNU GPL, version 3. See the LICENCE
file in top-level directory.
.. _gtktalog: http://www.nongnu.org/gtktalog/
.. _gwhere: http://www.gwhere.org/home.php3
.. _PIL: http://www.pythonware.com/products/pil/index.htm
.. _pygtk 2.10: http://www.pygtk.org
.. _pysqlite2: http://pysqlite.org/
.. _pygtkmvc: http://pygtkmvc.sourceforge.net
.. _gThumb: http://gthumb.sourceforge.net
.. _tagging files: http://en.wikipedia.org/wiki/Tag_%28metadata%29

5
cleanup.sh Executable file
View File

@@ -0,0 +1,5 @@
#!/bin/sh
# remove ~, pyc, pyo files from current directory
find . -name \*~ -exec rm '{}' ';'
find . -name \*pyc -exec rm '{}' ';'
find . -name \*pyo -exec rm '{}' ';'

View File

@@ -1,121 +0,0 @@
#!/usr/bin/env python
"""
Project: pyGTKtalog
Description: convert db created with v.1.x into v.2.x
Type: tool
Author: Roman 'gryf' Dobosz, gryf73@gmail.com
Created: 2009-08-14
"""
import sys
import os
import bz2
import shutil
from tempfile import mkstemp
from sqlite3 import dbapi2 as sqlite
from datetime import datetime
# import db objects just to create schema
from pygtktalog.dbobjects import File, Exif, Group, Gthumb
from pygtktalog.dbobjects import Image, Tag, Thumbnail
from pygtktalog.dbcommon import connect
def create_schema(cur):
pass
def create_temporary_db_file():
"""create temporary db file"""
fd, fname = mkstemp()
os.close(fd)
return fname
def connect_to_db(filename):
"""initialize db connection and store it in class attributes"""
db_connection = sqlite.connect(filename, \
detect_types=sqlite.PARSE_DECLTYPES | sqlite.PARSE_COLNAMES)
db_cursor = db_connection.cursor()
return db_connection, db_cursor
def opendb(filename=None):
"""try to open db file"""
db_tmp_path = create_temporary_db_file()
try:
test_file = open(filename).read(15)
except IOError:
os.unlink(db_tmp_path)
return False
if test_file == "SQLite format 3":
db_tmp = open(db_tmp_path, "wb")
db_tmp.write(open(filename).read())
db_tmp.close()
elif test_file[0:10] == "BZh91AY&SY":
open_file = bz2.BZ2File(filename)
try:
curdb = open(db_tmp_path, "w")
curdb.write(open_file.read())
curdb.close()
open_file.close()
except IOError:
# file is not bz2
os.unlink(db_tmp_path)
return False
else:
os.unlink(db_tmp_path)
return False
return connect_to_db(db_tmp_path), db_tmp_path
if __name__ == "__main__":
if len(sys.argv) != 3:
print "usage: %s src_base dst_base" % sys.argv[0]
exit()
result = opendb(sys.argv[1])
if not result:
print "unable to open src db file"
exit()
(src_con, src_c), src_tmpf = result
shutil.copy(src_tmpf, sys.argv[2])
# close src db.
src_c.close()
src_con.close()
os.unlink(src_tmpf)
# create or update shema
connect(sys.argv[2])
dst_con = sqlite.connect(sys.argv[2])
dst_c = dst_con.cursor()
sql = "select id, date from files"
for id, date in dst_c.execute(sql).fetchall():
sql = "update files set date=? where id=?"
if date and int(date) > 0:
dst_c.execute(sql, (datetime.fromtimestamp(int(date)), id))
else:
dst_c.execute(sql, (None, id))
sql = "select id, date from gthumb"
for id, date in dst_c.execute(sql).fetchall():
sql = "update gthumb set date=? where id=?"
try:
if int(date) > 0:
dst_c.execute(sql, (datetime.fromtimestamp(int(date)), id))
else:
dst_c.execute(sql, (None, id))
except:
print id, date
dst_con.commit()
dst_c.close()
dst_con.close()

9
example/README.rst Normal file
View File

@@ -0,0 +1,9 @@
Example
=======
Here you can find example database and some screen shots made using this db.
All materials used to prepare sample database and the screen shots were
downloaded from freely available resources from pages:
http://www.hd-trailers.net/ and http://www.imdb.com - all rights goes to
appropriate parties.

BIN
example/example.sqlite Normal file

Binary file not shown.

Binary file not shown.

After

Width:  |  Height:  |  Size: 58 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 40 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 41 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 39 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 45 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 52 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 60 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 78 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 126 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 65 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 82 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 51 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 67 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 53 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 109 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 14 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 38 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 46 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 50 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 58 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 42 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 33 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 41 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 82 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 59 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 52 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 53 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 43 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 84 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 44 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 66 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 34 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 28 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 56 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 42 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 57 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 50 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 70 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 96 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 63 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 49 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 34 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 76 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 91 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 44 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 29 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 49 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.2 KiB

Some files were not shown because too many files have changed in this diff Show More