From 8e3d34fe644d2500d7165206b286354136c3c9ed Mon Sep 17 00:00:00 2001 From: nblomqvist Date: Mon, 20 May 2019 09:40:45 +0200 Subject: [PATCH 1/3] wait for popen, filter accepted submissions automatically patch by Asad Sayeed --- README.md | 2 +- easy2acl.py | 10 +++++++--- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index 90dbd08..854ea30 100644 --- a/README.md +++ b/README.md @@ -54,7 +54,7 @@ We now have information about all the submissions but not whether they are accep ### A list of the accepted submissions -Go to _Status -> All papers_. Here we find the information on what submissions are accepted. Copy the content of this table as you did with the previous one, except only select the lines of the _ACCEPTED_ papers. It is very important that you do not include any of the _REJECTED_ papers when selecting the content, or else these papers will be included in the resulting `db` file as well. Save the content as `accepted`, and make sure that each row in the table corresponds to one line in the resulting file. A sample `accepted` file is available [here](example-files/accepted). +Go to _Status -> All papers_. Here we find the information on what submissions are accepted. Copy the content of this table as you did with the previous one. Save the content as `accepted`, and make sure that each row in the table corresponds to one line in the resulting file. A sample `accepted` file is available [here](example-files/accepted). ### A short explanation of the steps above diff --git a/easy2acl.py b/easy2acl.py index d5ade8a..0e6289e 100644 --- a/easy2acl.py +++ b/easy2acl.py @@ -56,8 +56,11 @@ def texify(string): with open('accepted') as accepted_file: for line in accepted_file: entry = line.split("\t") - submission_id = entry[0] - title = entry[1] + + if entry[-1][0] == "A": # if it's "ACCEPT" + #print(entry[-1]) + submission_id = entry[0] + title = entry[1] accepted.append((submission_id, title)) @@ -129,7 +132,8 @@ def texify(string): copy(current_path, final_path) break -Popen(['tar', '-czf', 'final.tar.gz', 'final']) +myprocess = Popen(['tar', '-czf', 'final.tar.gz', 'final']) +myprocess.wait() rmtree('final') #,---- From e4c19747f7cf635ef2874ce3b146cae2fafd894b Mon Sep 17 00:00:00 2001 From: nblomqvist Date: Mon, 20 May 2019 09:49:32 +0200 Subject: [PATCH 2/3] strip trailing whitespace --- README.md | 24 ++++++++++---------- easy2acl.py | 64 ++++++++++++++++++++++++++--------------------------- 2 files changed, 44 insertions(+), 44 deletions(-) diff --git a/README.md b/README.md index 854ea30..646534d 100644 --- a/README.md +++ b/README.md @@ -1,7 +1,7 @@ # easy2acl.py This short script is useful in the scenario where peer-reviewing is done using EasyChair but proceedings are to be produced with aclpub. The user must retrieve information from EasyChair before running the script. - + easy2acl.py produces two files for use with aclpub; the `db` file, and an archive `final.tar.gz` containing a folder `final`, which in turn contains the PDF files of the accepted submissions. You should make yourself familiar with the db file, which you can read more about in the aclpub documentation. Please report bugs and suggest improvements. @@ -10,22 +10,22 @@ Please report bugs and suggest improvements. The Python 3 packages PyPDF2 and unicode_tex are needed and can be installed using pip. The tar command is also needed (and should be available at PATH). -## How to run +## How to run -Create the files `accepted` and `submissions` and the folder `pdf` as shown in [Getting data from EasyChair](#getting-data-from-easychair). Before running this script, your file structure should look like this: +Create the files `accepted` and `submissions` and the folder `pdf` as shown in [Getting data from EasyChair](#getting-data-from-easychair). Before running this script, your file structure should look like this: - |-- easy2acl.py - |-- submissions - |-- accepted - `-- pdf - |-- ..._submission_1.pdf - |-- ..._submission_2.pdf + |-- easy2acl.py + |-- submissions + |-- accepted + `-- pdf + |-- ..._submission_1.pdf + |-- ..._submission_2.pdf `-- ... Run the script: $ python3 easy2acl.py - + When the script has finished, you will find the files `db` and `final.tar.gz` in the same folder. Place these files in your `proceedings` folder as suggested by the aclpub documentation, and proceed as you usually would with aclpub. ## Additional information @@ -33,13 +33,13 @@ When the script has finished, you will find the files `db` and `final.tar.gz` in It is your responsibility to make sure that the `db` file is correct. The author(s) of this script make no claims that this script works as intended. Below are some things to look out for regarding the data you get from EasyChair, and the assumptions made by the script. * **Title of submission in EasyChair does not match title in the submitted PDF.** In case of a substantial change to the title, and depending on the policy of your conference, you might want to contact the Program Chair. You might want to do so anyways in case the title is used anywhere else, for example in the conference program. - + * **Order of authors of submission in EasyChair does not match the order in the submitted PDF.** * **Order of author name internally, as in ` `, in EasyChair is incorrect.** This can cause problems with the order of the papers since they are written to the `db` file in alphabetical order according to the first author's last name. * **Author has multiple names before the last name, e.g. ` `.** This can cause problems with the order of the papers since they are written in alphabetical order according to the first author's last name. The script assumes the format ` [] [] ...`. - + * **Some diacritics and special characters in names are not converted by the script.** Certain characters that you expected to be translated into LaTeX escape codes, but were not, might be because they are not handled in the unicode_tex package. Make sure that the name was properly written in EasyChair; it might be that the person who entered the name forgot to add diacritics. If you want to be nice, you can check the names in your resulting `db` file against the names of the actual submissions and make the appropriate changes to the `db` file. ## Getting data from EasyChair diff --git a/easy2acl.py b/easy2acl.py index 0e6289e..a8821da 100644 --- a/easy2acl.py +++ b/easy2acl.py @@ -1,32 +1,32 @@ #!/usr/bin/env python3 #,---- -#| easy2acl.py - Convert data from EasyChair for use with aclpub -#| +#| easy2acl.py - Convert data from EasyChair for use with aclpub +#| #| Author: Nils Blomqvist -#| +#| #| Documentation #| ------------- -#| Full documentation at http://github.com/nblomqvist/easy2acl. -#| -#| Quick reference -#| --------------- -#| Before running this script, your file structure should look like this: -#| -#| |-- easy2acl.py -#| |-- submissions -#| |-- accepted -#| `-- pdf -#| |-- ..._submission_1.pdf -#| |-- ..._submission_2.pdf -#| `-- ... -#| -#| Run the script: -#| -#| $ ./easy2acl.py -#| +#| Full documentation at http://github.com/nblomqvist/easy2acl. +#| +#| Quick reference +#| --------------- +#| Before running this script, your file structure should look like this: +#| +#| |-- easy2acl.py +#| |-- submissions +#| |-- accepted +#| `-- pdf +#| |-- ..._submission_1.pdf +#| |-- ..._submission_2.pdf +#| `-- ... +#| +#| Run the script: +#| +#| $ ./easy2acl.py +#| #| When the script has finished, you will find the files 'db' and 'final.tar.gz' -#| in the same folder. +#| in the same folder. #`---- from shutil import copy, rmtree @@ -41,17 +41,17 @@ def texify(string): """ output = '' - + for w in string.split(): output += unicode_to_tex(w) + ' ' output = output.strip() - + return output #,---- #| Append each accepted submission, as a tuple, to the 'accepted' list. #`---- -accepted = [] +accepted = [] with open('accepted') as accepted_file: for line in accepted_file: @@ -85,7 +85,7 @@ def texify(string): for last in author_fullname[1:]: author_last_name += last + ' ' author_last_name.strip() - + authors_clean.append((author_last_name, author_first_name)) submissions.append((submission_id, title, authors_clean)) @@ -109,10 +109,10 @@ def texify(string): #| Add the submissions whose submission ID is found in the 'accepted' list to a #| new list 'final_papers'. A match must made for both the submission ID and the #| title (just in case). -#| +#| #| Copy the PDFs whose submission ID is found in the 'accepted' list to a #| directory 'final'. -#| +#| #| Finally, compress the 'final' directory into 'final.tar.gz' and remove folder #| 'final'. #`---- @@ -138,7 +138,7 @@ def texify(string): #,---- #| Write the db file. -#| +#| #| Sort papers naturally by key 'first author's last name'. #`---- final_papers = sorted(final_papers, key=lambda paper: paper[2][0][0]) @@ -148,20 +148,20 @@ def texify(string): id = paper[0] title = texify(paper[1]) authors = paper[2] - + db.write('P: ' + id + '\n') db.write('T: ' + title + '\n') for author in authors: lastname = texify(author[0]) firstname = texify(author[1]) - + db.write('A: ' + lastname + ', ' + firstname + '\n') for pdf in pdfs: if paper[0] == pdf[0]: path = pdf[3] length = str(pdf[1]) - + db.write('F: ' + path + '\n') db.write('L: ' + length + '\n') break From 8464c70eab4d97cba2e7be5960961c4b1fb38bc8 Mon Sep 17 00:00:00 2001 From: nblomqvist Date: Mon, 20 May 2019 09:51:55 +0200 Subject: [PATCH 3/3] add contributors list to readme --- README.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/README.md b/README.md index 646534d..3e7384a 100644 --- a/README.md +++ b/README.md @@ -61,3 +61,7 @@ Go to _Status -> All papers_. Here we find the information on what submissions a Neither of the two pages we saved data from alone contain all the information we need to create the `db` file – the _Submissions_ page does not say which ones are accepted, and the _Status page_ does not tell us the author names of the papers. By taking the intersection of the submission IDs of the two lists that we saved, we get the information we need about the accepted submissions. Copying the table contents directly from the web browser results in a nice tab separated list when pasting into a text editor. This makes it easy to work with, and if the table format should change in EasyChair it is simple to adapt the script. + +# Contributors + +* Asad Sayeed