Browse Source

Fixed #19

master
Abrax 3 years ago
parent
commit
73daacbf7c
2 changed files with 10 additions and 12 deletions
  1. 4
    6
      README.md
  2. 6
    6
      lizard.py

+ 4
- 6
README.md View File

@@ -13,7 +13,7 @@ This version will change syntax for some commands:
These changes take effect with version 0.4 so be ready to update your scripts!

### 0.3 (in development)
This version will change syntax for some commands:
This version changes syntax for some commands:

* Database creation: `lizard c` becomes `lizard create`
* Conservative refresh:
@@ -21,8 +21,6 @@ This version will change syntax for some commands:
* `lizard r` does conservative refresh
* Refresh all threads: `lizard ra` instead of `lizard r`

These changes take effect with version 0.3 so be ready to update your scripts!

### 0.2 (current)
* Help message now shows version. (issue #24)
* New command: `rl` is refresh + list
@@ -60,7 +58,7 @@ You can also run the `.py` files in the repo directly. If you want to do this I'
## Usage
Running `lizard` without any arguments will print the help message explaining the syntax. It will also create a `~/lizard_data` directory to store files.

After you install, run `lizard c` to create a new database (if you don't have one already). Everything else will crash unless a valid database exists.
After you install, run `lizard create` to create a new database (if you don't have one already). Everything else will crash unless a valid database exists.

Add a thread to the database with `lizard a <URL>`. Upon adding a thread, Lizard will immediately download a copy of the thread and the files in it. These will be put under `~/lizard_data/`.

@@ -114,9 +112,9 @@ Alternatively you can try running the scripts with the interpreter. Just clone o
### Does Lizard work at all?
Simply running `lizard` without any commands will print a help message (and also ensure that `~/lizard_data/` exists). If you can't get this to happen, the problem is probably your environment.

Next, try to run `lizard c`. It should create a new database, but if one already exists you need to get rid of it (either delete or rename). `lizard b` will back up the DB for you, but it won't erase the current one. Make sure the database it creates is `~/lizard_data/threads.orm.db` and not somewhere else.
Next, try to run `lizard create`. It should create a new database, but if one already exists you need to get rid of it (either delete or rename). `lizard b` will back up the DB for you, but it won't erase the current one. Make sure the database it creates is `~/lizard_data/threads.orm.db` and not somewhere else.

If `lizard c` is able to create a database, then see if you can add a thread. Try `lizard a <URL of a thread>` for a few different threads. If none of them worked, again, probably something is fucked in your Lizard installation. If all worked, great! Lizard should be working correctly. If only some threads work, it's probably because of a bug specific to those I didn't know about, submit an issue and include steps to reproduce.
If `lizard create` is able to create a database, then see if you can add a thread. Try `lizard a <URL of a thread>` for a few different threads. If none of them worked, again, probably something is fucked in your Lizard installation. If all worked, great! Lizard should be working correctly. If only some threads work, it's probably because of a bug specific to those I didn't know about, submit an issue and include steps to reproduce.

### Corrupted database
If your existing `threads.orm.db` file causes problems, but a fresh one works fine, either your database is just fucked or one of the threads in it is causing problems. You can elminate the latter possibility by re-adding the threads to the fresh database. If there's a thread that consistently causes problems, congratulations, you found a bug! Submit an issue and wait for me to fix it, meanwhile don't add that thread. If you manage to re-add all the threads to the fresh database and everything works, just delete the old database and forget about it. Life's too short, man.

+ 6
- 6
lizard.py View File

@@ -24,16 +24,14 @@ Usage: lizard [command] [options]

Available commands:
l - Lists all threads in database. Legend: ! - new replies, x - 404'd, Y - >(You).
r - Refresh all threads and update database.
rc - Conservative refresh: Tries to refresh only threads which are likely to receive new replies, reducing
unnecessary network activity.
r - Refresh threads which are likely to receive new replies (to reduce unnecessary network activity).
ra - Refresh all threads and update database.
rl - Conservative refresh and list threads.
ro - Conservative refresh and open threads with new replies in browsed.
o - Open threads with new replies in the default browser. Will also update the "new replies"
field accordingly.
oa - Open all threads.
p - Purge (remove) 404'd threads from database.
c - Create new database.
b - Backup current database.
e - Export list of threads. This will create a list of lizard add commands for all threads currently in the
database. Useful for migrating between database versions.
@@ -41,6 +39,8 @@ Available commands:
the thread.
d - Remove all instances of a thread (board & number) from the database.
Example: "lizard d b 123" will remove thread >>>/b/123
create - Create new database.
""".format(version))
exit()

@@ -53,10 +53,10 @@ def main():
if command == 'l':
db_methods.check_database()
db_methods.list_threads()
elif command == 'r':
elif command == 'ra':
db_methods.check_database()
db_methods.refresh_all_threads()
elif command == 'rc':
elif command == 'r':
db_methods.check_database()
db_methods.refresh_all_threads(conservative=True)
elif command == 'rl':

Loading…
Cancel
Save