Uploading new lessons

I tested it and it works. I only used it for German.

@ spatterson

Ok, so I used the script to upload an entire book earlier, and it was much better than doing it one lesson at a time on the website. However, I had converted the book into a .txt file, and it was still pretty tedius going through and making all the little text files to hold each lesson, and then zipping them all up, so I have edited the script.

http://goo.gl/sAaCxe

Instead of making a series of text files for each lesson, with this script, you can simply leave them all in the one text file. You need to supply two text files, one that holds the lesson texts, and the other that holds a list of lesson titles. In the one that holds the lesson texts, you specify the breaks between the lessons with the string “NEW_CHAPTER”. In the file for holding the lesson titles, it is just a list of titles in the same order as the lessons in the lesson file, separated by lines. For running it, you use

./selenium_approach.py USERNAME PASSWORD LANG COURSEID LESSONFILE TITLESFILE

Also, usually when I upload books, I want to break down the longer chapters into chunks of 2000-3000 words. This can be done by putting “BREAK_CHAPTER” anywhere in the text and the lesson will be broken into lessons with titles “lessontitle_1”, “lessontitle_2”,… When reading in and breaking up the chapters, a list of lesson titles will be printed with some approximate number of words in the lessons.

I found this much quicker than breaking it up individually.

Guys, you are amazing!

That’s a good idea Colin. You could simplify it even more probably by making the break like something like
BREAK_CHAPTER-LessonName

Anyway, I’ll update the script and re-commit (I’m going to make it do both options).

I made it work with individual files because I have a bunch of subtitle files from Star Trek DVDs I ripped

Okay Colin, it’s pushed

New usage
./selenium_approach.py spatterson pass de 1234 BookTest HeaderTest

or
./selenium_approach.py spatterson pass de 1234 ZipFile

Geat!

I just tested it and it seems to be taking ‘./selenium_approach.py’ as the username, and the username as the passoword.

Well, you can see I tested it well. Repull. I blame that on 8:30am coding without coffee

I am nowhere near as technically savvy as you clever people. However, I would very much like to bulk import a whole book. When it works properly, hopefully you will share with us ordinary mortals the details of how to implement this idea for ourselves. Thanks!

What operating system are you using? If it’s Windows, then I can’t help. Shaun is the real expert computer hacker here. I am just an expert at copying and pasting code in languages I can’t really program in.

I am using a Mac computer with OS X, Version 10.9.2, which is probably much worse than Windows to work with. And the captchas are really a pain. I guess we have had some real problems on the site and that is why we have the captchas, or whatever the spelling is.

Instructions. Good luck

Thanks. The internet has once again stopped allowing me to open anything. Perhaps it will sort itself out again tomorrow.
By the way, I got Office back today!

Thanks. The internet has once again stopped allowing me to open anything. Perhaps it will sort itself out again tomorrow.
By the way, I got Office back today!

Thanks. I’ll try again tomorrow. The internet has gone ultra-slow again here.
By the way, I got Office back today!

Ok, just a comment on the instructions, I got the following error when I ran the ‘sudo pip install selenium’ command

error: command ‘cc’ failed with exit status 1

I fixed this with the two commands

export CFLAGS=-Qunused-arguments
export CPPFLAGS=-Qunused-arguments

which meant that I had to use -E in the ‘sudo pip install selenium’ command

sudo -E pip install selenium

Many good. Such wow. Instructions so updated.

So I have had a problem with the batch upload with the website stopping to respond half way through uploading a book. My sollution to it is this

https://www.dropbox.com/s/o0hds4gwlw0qyfl/selenium_approach.py
http://goo.gl/sAaCxe

I added a line to ‘loadFromFileAndHeader’, such that if the lesson title in the lesson title file starts with a -, the lesson will not be uploaded, so if the batch upload gets stopped early, you can just put - before the titles of all the lessons that have already been uploaded, and start it again.

gepushed.

@all - By the way, I was reminded about this today as it looks like I forgot to post an update last week after we discussed this internally. It makes the most sense for us to add an API call, as per spatterson’s original suggestion, so we’ve added this to our list and should hopefully have something ready soon.

Cool, Colin better brush up on his Python skillz since I canceled my account yesterday…