Griffith - media collection manager
May 21, 2012, 07:36:56 PM *
Welcome, Guest. Please login or register.

Login with username, password and session length
News: Please check ask.griffith.cc and wiki.griffith.cc before asking questions.
 
   Home   Help Search Login Register  
Pages: [1]   Go Down
  Print  
Author Topic: [SOLVED] Copy/Save a subset of griffith.db ?  (Read 853 times)
CinéphOli
Jr. Member
**
Offline Offline

Posts: 87



View Profile
« on: August 10, 2011, 09:39:11 PM »

Hello,

Is it possible to copy or save a subset of griffith.db without losing any information?
I suppose I can do that in SQL, starting with a copy of the db and deleting everything I don't want included, but it would be easier to do from the main screen.

And btw, symetrically, is it possible to import/merge a griffith db into another one? Much trickier I would say, because of the records ID…
« Last Edit: August 24, 2011, 04:00:39 PM by CinéphOli » Logged

Using Griffith v0.13 r1621 on Linux Ubuntu
Griffith SQL for Dummies
mike
Global Moderator
Hero Member
*****
Offline Offline

Posts: 996


View Profile WWW
« Reply #1 on: August 13, 2011, 07:15:14 PM »

In the past there was a merge option in the main menu. But POX remove it two years ago. I don't know why. Perhaps it doesn't work as expected.
The other way (splitting) isn't supported directly. But I think you can do it with griffith and the backup/restore option.
Make a backup from the database. Take a filter which shows all movies you don't want to have in the first database. Delete the movie entries. Switch griffith now to a new empty database with a different name. Restore the backup and now remove all movies which are left in the first database.
Logged
CinéphOli
Jr. Member
**
Offline Offline

Posts: 87



View Profile
« Reply #2 on: August 14, 2011, 02:05:05 PM »

Of course, you are right, duplicate the db and delete what is filtered, obvious, silly me, I should have thought of that myself  Grin !

Now, unfortunately, I have two issues with remover.py: it doesn't delete the posters and, more seriously, in some cases, it deletes the tags instead of the films.

Let's start with this second problem. I duplicated my griffith.db twice, the idea being to get one db with the films I possess and the other one with the films I seek. Those two db are complementary to each other, using only the tag "Get it" (with or require) and its negation (without).

First, the films I seek. Since for this I need to eliminate the films I already have, I go in the Advanced Filter window  and I check the radio button "Without" next to the tag "Get it". I get the list allright and I press the button "Remove all". It works, except for the posters not being deleted as well (more on that later).

Second, the films I have. Since for this I need to eliminate the films I seek, I go in the Advanced Filter window  and I check the radio button "With" or "Require" next to the tag "Get it". I get the list allright and I press the button "Remove all". This time, it doesn't work properly. I still have all my films in the db, but the films matching the filter have all their tags gone! Not only the "Get it" tag, all of them.

This is true with any tag I used, when the filter is built with "without" then "Remove all" works, but when the filter is built with "with/require", "Remove all" doesn't work. I didn't try the various combinations of several tags…

Now, the posters.

I don't know if this is of any use to you, but I noticed that in sqliteman I had to use a little trick in order to be able to remove the unused posters.
This obvious command doesn't work:
Code:
DELETE FROM posters
 WHERE md5sum NOT IN (SELECT poster_md5 FROM movies)
Although the fields are of the same type, the match is not done. It doesn't produce any error, it returns 0.

But this little tricky solution works:
Code:
DELETE FROM posters
 WHERE md5sum NOT IN (SELECT md5sum
                        FROM posters
                       WHERE md5sum IN (SELECT poster_md5 FROM movies)) ;
Hopefully, the match between md5sum and poster_md5 is done in the SELECT, and then the match between md5sum and md5sum is possible for the DELETE. It's ugly, but it works.
Maybe this is a problem within sqlite3 itself and the same limitation is encountered too within SQLAlchemy?
Logged

Using Griffith v0.13 r1621 on Linux Ubuntu
Griffith SQL for Dummies
mike
Global Moderator
Hero Member
*****
Offline Offline

Posts: 996


View Profile WWW
« Reply #3 on: August 23, 2011, 08:51:11 PM »

First you found a bug within the extension "remover" (it's the second issue in your post with the tags). I fixed it.
Second the posters are left in database by design. I didn't made the decision so I'm not absolutely sure. I think they are left so that they can be reused if you add the movie again to the database.
Logged
CinéphOli
Jr. Member
**
Offline Offline

Posts: 87



View Profile
« Reply #4 on: August 24, 2011, 03:59:38 PM »

Thank you mike, it works now.

As for the posters being left in the database by design, I can understand. It doesn't suit me but it doesn't matter, since I know how to do it myself. The idea is for me to get precisely the smallest possible subset db, in order to mail it to a friend with a slow/bad connection. In this case, the size of the file is of paramount importance, the full db being (for the moment) 30 MB large, and the compacted version being only 10 MB… In this case, 20 MB of useless posters is worth getting rid of !
Logged

Using Griffith v0.13 r1621 on Linux Ubuntu
Griffith SQL for Dummies
Pages: [1]   Go Up
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.16 | SMF © 2006-2007, Simple Machines Valid XHTML 1.0! Valid CSS!