-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathia_upload.py
33 lines (18 loc) · 1.1 KB
/
ia_upload.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
import yaml
import os
import time
import sys
book_info = yaml.load(open('book-info.yaml'))
book_title_in_english = book_info['book_title_in_english']
cover_image = book_info['cover_image']
content = book_info["content"]
timestamp = time.strftime('%Y-%m-%d-%H-%M-%S')
ia_identifier = book_title_in_english + "-" + timestamp
content_dir = book_title_in_english + "-upload/"
tar = "tar czf " + book_title_in_english + ".tar.gz " + book_title_in_english + "-tex"
os.system(tar)
ia_upload = "ia upload " + ia_identifier + " -m collection:opensource -m mediatype:texts -m sponsor:FreeTamilEbooks -m language:ta " + content_dir + book_title_in_english + ".epub " + content_dir + book_title_in_english + ".mobi " + content_dir + book_title_in_english + ".pdf " + content_dir + book_title_in_english + "_6_inch.pdf " + content_dir + cover_image + " " + book_title_in_english + ".tar.gz" + " " + "book-info.yaml" + " " + content_dir + content
print("Uploading to Internet Archive")
os.system(ia_upload)
os.system("rm " + book_title_in_english + ".tar.gz ")
print("Uploaded to https://archive.org/details/" + ia_identifier)