Griffith - media collection manager
May 21, 2012, 06:59:47 PM *
Welcome, Guest. Please login or register.

Login with username, password and session length
News: New mailing lists,
 
   Home   Help Search Login Register  
Pages: [1]   Go Down
  Print  
Author Topic: flags  (Read 1395 times)
Ivoc
Newbie
*
Offline Offline

Posts: 11


View Profile
« on: February 19, 2011, 05:24:40 PM »

Hi
sorry for my english
I need to know how to delete in one shot all the flags on "saw movie"
Is it any possibility? one by one is a big job

thanks
cheers
Ivo
Logged
mike
Global Moderator
Hero Member
*****
Offline Offline

Posts: 996


View Profile WWW
« Reply #1 on: March 03, 2011, 02:29:31 PM »

Direct changing via sql should be possible:

Code:
griffith --shell
>>> from sqlalchemy.sql import update
>>> query = update(db.tables.movies, values={'seen': False})
>>> sess.execute(query)
>>> sess.commit()
Logged
Ivoc
Newbie
*
Offline Offline

Posts: 11


View Profile
« Reply #2 on: July 11, 2011, 03:29:40 PM »

Thanks for your reply, but this is it very complicate. Can you explain me step by step? I really don't know how to do this.

Many thanks in advance
cheers
Ivo
Logged
Hernals
Newbie
*
Offline Offline

Posts: 33


View Profile
« Reply #3 on: July 12, 2011, 01:06:51 PM »

In my german version I activated "Ansicht" - "Erweiterungen", then a new toolbar appeared with three buttons. One  is to "mark all currently selected movies as seen".

By the way, is it possible to preselect (predefine) new movies as "seen"?
Logged

Schöne Grüße aus Wien
Technisch:
Windows 7 Home Premium 64-bit SP1; GeForce 315
Griffith V 0.13.1
SQLite3 (internal)
CinéphOli
Jr. Member
**
Offline Offline

Posts: 87



View Profile
« Reply #4 on: July 13, 2011, 02:09:05 PM »

In sqliteman:

Code:
UPDATE movies SET seen=0 ;

Thanks for your reply, but this is it very complicate. Can you explain me step by step? I really don't know how to do this.
  • open a console/terminal
  • type griffith --shell
  • you get the prompt >>>
  • type in the four lines indicated by mike (do not type >>>, press enter/return after each line)
  • you are done.
  • type quit() to quit the Griffith shell.
  • close the console/terminal.

If you are not sure of yourself, test first on a copy of your database.
Logged

Using Griffith v0.13 r1621 on Linux Ubuntu
Griffith SQL for Dummies
CinéphOli
Jr. Member
**
Offline Offline

Posts: 87



View Profile
« Reply #5 on: July 13, 2011, 02:47:28 PM »

By the way, is it possible to preselect (predefine) new movies as "seen"?

CAUTION: tempering with the data structure itself is potentially hazardous… Test on a copy!

Well, in theory it is very simple, all you have to do is ALTER the structure of the table movies so that the field seen has a default value of 1:

Code:
ALTER TABLE movies
      MODIFY seen BOOLEAN NOT NULL DEFAULT (1) ;

But I don't think sqlite3 (sqliteman?) allows ALTERing the tables, it copies all the data to a new temporary table with the new structure then deletes the old table and renames the new one. But when I tried this with sqliteman, all info concerning the FOREIGN KEYS were lost in the process, so bad idea I would say…

Maybe SQL Alchemy handles this better ?

Now, if your database happens to be in PostgreSQL / MySQL / MSQL instead of sqlite3, then you are lucky, because I think those formats will handle the ALTER command properly. Not sure though, to be verified…
« Last Edit: July 14, 2011, 02:05:29 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 #6 on: July 18, 2011, 08:34:00 PM »

@CinéphOli
Thanks for your good explanations.

@Hernals
In rev. 1562 I added the ability to set a default value for the field "seen it". It will be available with the next version of griffith.
Logged
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!