• You are not logged in.

    Deleting a text from Amphetype

    • Started by Twoddle
    • 9 Replies:
    • Reputation: 0
    • Registered: 04-Jul-2013
    • Posts: 38

    I've imported a book in plain UTF-8 encoded text into Amphetype and I've discovered that all the apostrophes within the book are some weird character (’) that I can't easily access on my keyboard. So did a search and replace on the original text changing all occurrences to the standard apostrophe ('). But now if I try to import the new text Amphetype freezes and the old book is still in its database when I rerun the program.

    How do you delete an old imported text without deleting everything and starting from scratch losing all my statistics?

    Offline
    • 0
    • Reputation: 214
    • From: Viken, Norway
    • Registered: 13-Dec-2006
    • Posts: 5,361

    As the book is imported into Amphetype's database, I don't think you can delete it without losing the statistics for that book. Is that what you meant?

    IIRC, Amphetype uses MySQL or some other common database format so if you can edit such a base you might be able to do it. But not from the Amphetype interface.

    *** Learn Colemak in 2–5 steps with Tarmak! ***
    *** Check out my Big Bag of Keyboard Tricks for Win/Linux/TMK... ***

    Offline
    • 0
    • Reputation: 7
    • Registered: 21-Apr-2010
    • Posts: 818

    I couldn't work out how to delete texts either:

    https://forum.colemak.com/viewtopic.php … 397#p10397

    Looks like you should be able to disable texts then delete them, but I can't work out how to do so, without pulling the program apart.  (I've only had success running this on Linux through Wine.)

    --
    Physicians deafen our ears with the Honorificabilitudinitatibus of their heavenly Panacaea, their sovereign Guiacum.

    Offline
    • 0
    • Reputation: 214
    • From: Viken, Norway
    • Registered: 13-Dec-2006
    • Posts: 5,361

    Running Amphetype on Linux is easy enough: You navigate to its folder and issue the command 'python Amphetype'. You'll usually want a shortcut for that; I've made a launcher icon for myself.

    As I recall it, you disable a text from the flag where you see your progress in the different books. Then you can delete all disabled texts. I don't remember exactly how that's done, but I'll try to remember to look into it.

    *** Learn Colemak in 2–5 steps with Tarmak! ***
    *** Check out my Big Bag of Keyboard Tricks for Win/Linux/TMK... ***

    Offline
    • 0
    • Reputation: 7
    • Registered: 21-Apr-2010
    • Posts: 818

    (@Dreymar it was the QT dependencies holding me back.  Development wise it's a bit of a pickle with python and various dependency/package management options..  yawn...  I tried before, using virtualenv and gave up.  This time I used the system packages.  I installed the dependencies using 'apt-get python-qt4' on debian Wheezy, but the window is too large for my monitor, probably some annoying QT thing and weird desktop issues (I normally use GTK apps).  So yes, it would probably work for others - but sadly not for me on this occasion.  At least though I can dig into the source now.  Thanks.)

    Aha when I'm not running Amphetype under Wine, but instead running from todays trunk under Linux, I can disable and delete texts.

    Probably best to file a note to the author.

    Last edited by pinkyache (07-Apr-2014 16:14:51)

    --
    Physicians deafen our ears with the Honorificabilitudinitatibus of their heavenly Panacaea, their sovereign Guiacum.

    Offline
    • 0
    • Reputation: 0
    • Registered: 04-Jul-2013
    • Posts: 38

    I don't mind losing statistics for that book I just wondered if it was possible to not have to reinstall the program and start from scratch which I've had to do before. My stats go back months now, no biggy though.

    When I start playing about with 'Enable All', 'Delete Disabled' etc. the program crashes.

    Offline
    • 0
    • Reputation: 0
    • Registered: 04-Apr-2013
    • Posts: 538
    Twoddle said:

    When I start playing about with 'Enable All', 'Delete Disabled' etc. the program crashes.

    I had a similar problem, ended up using a new database.  I suspect the database becomes corrupted or something. Don't know enough to try to fix it.



    Here's a hack that might replace the apostrophe for you in all future texts - I'm not sure if it'll have side-effects (on the database or otherwise).

    In Quizzer.py, right below the function declaration:

    def setText(self, text):

    insert

    text = (text[0],text[1],text[2].replace(u"’",u"'"))

    What it should do: setText will continued to get called with [a tuple containing] the stored text.  This hijacks that called text right before it's used, and replaces the apostrophe with the ascii version.

    Offline
    • 0
    • Reputation: 7
    • Registered: 21-Apr-2010
    • Posts: 818

    If your SQLlite database becomes fragmented, you can VACUUM it (perhaps try grouping your data under the database tab first as @dreymar suggests below):

    http://www.tutorialspoint.com/sqlite/sqlite_vacuum.htm

    Might be totally unrelated but worth a try.  Close Amphetype and backup your database first.  It helped me with a Firefox issue once.

    Last edited by pinkyache (08-Apr-2014 11:00:59)

    --
    Physicians deafen our ears with the Honorificabilitudinitatibus of their heavenly Panacaea, their sovereign Guiacum.

    Offline
    • 0
    • Reputation: 214
    • From: Viken, Norway
    • Registered: 13-Dec-2006
    • Posts: 5,361

    Actually, Amphetype has an option to compact the database; did you try that first? Might help, I don't know.

    As for the apostrophe issue, I usually download the ASCII texts from Gutenberg so it won't be a problem; then the em dash becomes '--' and suchlike but that's okay.

    You could probably save other text files with ANSI encoding before importing them?

    Last edited by DreymaR (08-Apr-2014 09:03:55)

    *** Learn Colemak in 2–5 steps with Tarmak! ***
    *** Check out my Big Bag of Keyboard Tricks for Win/Linux/TMK... ***

    Offline
    • 0
    • Reputation: 2
    • Registered: 25-Oct-2013
    • Posts: 136
    DreymaR said:

    Running Amphetype on Linux is easy enough: You navigate to its folder and issue the command 'python Amphetype'. You'll usually want a shortcut for that; I've made a launcher icon for myself.

    I do it even simpler: I open a terminal and type amphetype

    Offline
    • 0