updated folder

This commit is contained in:
FrederikBaerentsen 2022-10-03 15:03:26 +02:00
parent 30a489662c
commit 69a6343c2e
7 changed files with 648 additions and 129091 deletions

File diff suppressed because one or more lines are too long

View File

@ -108,3 +108,10 @@ py: Finding Error in comic list: 98%
py: Finding Error in comic list: 99%
sh: Moving old file to archive
sh: git add
sh: git commit
[master 30a4896] Updated 20220929
3 files changed, 117 insertions(+)
rename Update Missing/{20220927_latest.mcl => archive/20220927.mcl} (100%)
create mode 100644 Update Missing/log/20220929.log
sh: git push
sh: Error: cannot git push

View File

@ -0,0 +1,3 @@
log: 20220930
sh: Starting update.sh
sh: Error: cannot latest mcl file

View File

@ -0,0 +1,3 @@
log: 20221001
sh: Starting update.sh
sh: Error: cannot latest mcl file

View File

@ -0,0 +1,432 @@
log: 20221002
sh: Starting update.sh
sh: Error: cannot latest mcl file
log: 20221002
sh: Starting update.sh
py: Reading in current database
py: Querying ComicVine for new issues
py: Error. Trying Again...
py: Error. Trying Again...
py: Error. Trying Again...
py: Error. Trying Again...
py: Finding Error in comic list: 0%
py: Finding Error in comic list: 1%
py: Finding Error in comic list: 2%
py: Finding Error in comic list: 3%
py: Finding Error in comic list: 4%
py: Finding Error in comic list: 5%
py: Finding Error in comic list: 6%
py: Finding Error in comic list: 7%
py: Finding Error in comic list: 8%
py: Finding Error in comic list: 9%
py: Finding Error in comic list: 10%
py: Finding Error in comic list: 11%
py: Finding Error in comic list: 12%
py: Finding Error in comic list: 13%
py: Finding Error in comic list: 14%
py: Finding Error in comic list: 15%
py: Finding Error in comic list: 16%
py: Finding Error in comic list: 17%
py: Finding Error in comic list: 18%
py: Finding Error in comic list: 19%
py: Finding Error in comic list: 20%
py: Finding Error in comic list: 21%
py: Finding Error in comic list: 22%
py: Finding Error in comic list: 23%
py: Finding Error in comic list: 24%
py: Finding Error in comic list: 25%
py: Finding Error in comic list: 26%
py: Finding Error in comic list: 27%
py: Finding Error in comic list: 28%
py: Finding Error in comic list: 29%
py: Finding Error in comic list: 30%
py: Finding Error in comic list: 31%
py: Finding Error in comic list: 32%
py: Finding Error in comic list: 33%
py: Finding Error in comic list: 34%
py: Finding Error in comic list: 35%
py: Finding Error in comic list: 36%
py: Finding Error in comic list: 37%
py: Finding Error in comic list: 38%
py: Finding Error in comic list: 39%
py: Finding Error in comic list: 40%
py: Finding Error in comic list: 41%
py: Finding Error in comic list: 42%
py: Finding Error in comic list: 43%
py: Finding Error in comic list: 44%
py: Finding Error in comic list: 45%
py: Finding Error in comic list: 46%
py: Finding Error in comic list: 47%
py: Finding Error in comic list: 48%
py: Finding Error in comic list: 49%
py: Finding Error in comic list: 50%
py: Finding Error in comic list: 51%
py: Finding Error in comic list: 52%
py: Finding Error in comic list: 53%
py: Finding Error in comic list: 54%
py: Finding Error in comic list: 55%
py: Finding Error in comic list: 56%
py: Finding Error in comic list: 57%
py: Finding Error in comic list: 58%
py: Finding Error in comic list: 59%
py: Finding Error in comic list: 60%
py: Finding Error in comic list: 61%
py: Finding Error in comic list: 62%
py: Finding Error in comic list: 63%
py: Finding Error in comic list: 64%
py: Finding Error in comic list: 65%
py: Finding Error in comic list: 66%
py: Finding Error in comic list: 67%
py: Finding Error in comic list: 68%
py: Finding Error in comic list: 69%
py: Finding Error in comic list: 70%
py: Finding Error in comic list: 71%
py: Finding Error in comic list: 72%
py: Finding Error in comic list: 73%
py: Finding Error in comic list: 74%
py: Finding Error in comic list: 75%
py: Finding Error in comic list: 76%
py: Finding Error in comic list: 77%
py: Finding Error in comic list: 78%
py: Finding Error in comic list: 79%
py: Finding Error in comic list: 80%
py: Finding Error in comic list: 81%
py: Finding Error in comic list: 82%
py: Finding Error in comic list: 83%
py: Finding Error in comic list: 84%
py: Finding Error in comic list: 85%
py: Finding Error in comic list: 86%
py: Finding Error in comic list: 87%
py: Finding Error in comic list: 88%
py: Finding Error in comic list: 89%
py: Finding Error in comic list: 90%
py: Finding Error in comic list: 91%
py: Finding Error in comic list: 92%
py: Finding Error in comic list: 93%
py: Finding Error in comic list: 94%
py: Finding Error in comic list: 95%
py: Finding Error in comic list: 96%
py: Finding Error in comic list: 97%
py: Finding Error in comic list: 98%
py: Finding Error in comic list: 99%
sh: Moving old file to archive
sh: git add
sh: Error: cannot git add
py: Reading in current database
py: Querying ComicVine for new issues
py: Error. Trying Again...
py: Error. Trying Again...
py: Error. Trying Again...
py: Error. Trying Again...
py: Finding Error in comic list: 0%
py: Finding Error in comic list: 1%
py: Finding Error in comic list: 2%
py: Finding Error in comic list: 3%
py: Finding Error in comic list: 4%
py: Finding Error in comic list: 5%
py: Finding Error in comic list: 6%
py: Finding Error in comic list: 7%
py: Finding Error in comic list: 8%
py: Finding Error in comic list: 9%
py: Finding Error in comic list: 10%
py: Finding Error in comic list: 11%
py: Finding Error in comic list: 12%
py: Finding Error in comic list: 13%
py: Finding Error in comic list: 14%
py: Finding Error in comic list: 15%
py: Finding Error in comic list: 16%
py: Finding Error in comic list: 17%
py: Finding Error in comic list: 18%
py: Finding Error in comic list: 19%
py: Finding Error in comic list: 20%
py: Finding Error in comic list: 21%
py: Finding Error in comic list: 22%
py: Finding Error in comic list: 23%
py: Finding Error in comic list: 24%
py: Finding Error in comic list: 25%
py: Finding Error in comic list: 26%
py: Finding Error in comic list: 27%
py: Finding Error in comic list: 28%
py: Finding Error in comic list: 29%
py: Finding Error in comic list: 30%
py: Finding Error in comic list: 31%
py: Finding Error in comic list: 32%
py: Finding Error in comic list: 33%
py: Finding Error in comic list: 34%
py: Finding Error in comic list: 35%
py: Finding Error in comic list: 36%
py: Finding Error in comic list: 37%
py: Finding Error in comic list: 38%
py: Finding Error in comic list: 39%
py: Finding Error in comic list: 40%
py: Finding Error in comic list: 41%
py: Finding Error in comic list: 42%
py: Finding Error in comic list: 43%
py: Finding Error in comic list: 44%
py: Finding Error in comic list: 45%
py: Finding Error in comic list: 46%
py: Finding Error in comic list: 47%
py: Finding Error in comic list: 48%
py: Finding Error in comic list: 49%
py: Finding Error in comic list: 50%
py: Finding Error in comic list: 51%
py: Finding Error in comic list: 52%
py: Finding Error in comic list: 53%
py: Finding Error in comic list: 54%
py: Finding Error in comic list: 55%
py: Finding Error in comic list: 56%
py: Finding Error in comic list: 57%
py: Finding Error in comic list: 58%
py: Finding Error in comic list: 59%
py: Finding Error in comic list: 60%
py: Finding Error in comic list: 61%
py: Finding Error in comic list: 62%
py: Finding Error in comic list: 63%
py: Finding Error in comic list: 64%
py: Finding Error in comic list: 65%
py: Finding Error in comic list: 66%
py: Finding Error in comic list: 67%
py: Finding Error in comic list: 68%
py: Finding Error in comic list: 69%
py: Finding Error in comic list: 70%
py: Finding Error in comic list: 71%
py: Finding Error in comic list: 72%
py: Finding Error in comic list: 73%
py: Finding Error in comic list: 74%
py: Finding Error in comic list: 75%
py: Finding Error in comic list: 76%
py: Finding Error in comic list: 77%
py: Finding Error in comic list: 78%
py: Finding Error in comic list: 79%
py: Finding Error in comic list: 80%
py: Finding Error in comic list: 81%
py: Finding Error in comic list: 82%
py: Finding Error in comic list: 83%
py: Finding Error in comic list: 84%
py: Finding Error in comic list: 85%
py: Finding Error in comic list: 86%
py: Finding Error in comic list: 87%
py: Finding Error in comic list: 88%
py: Finding Error in comic list: 89%
py: Finding Error in comic list: 90%
py: Finding Error in comic list: 91%
py: Finding Error in comic list: 92%
py: Finding Error in comic list: 93%
py: Finding Error in comic list: 94%
py: Finding Error in comic list: 95%
py: Finding Error in comic list: 96%
py: Finding Error in comic list: 97%
py: Finding Error in comic list: 98%
py: Finding Error in comic list: 99%
py: Reading in current database
py: Querying ComicVine for new issues
py: Error. Trying Again...
py: Error. Trying Again...
py: Error. Trying Again...
py: Error. Trying Again...
py: Finding Error in comic list: 0%
py: Finding Error in comic list: 1%
py: Finding Error in comic list: 2%
py: Finding Error in comic list: 3%
py: Finding Error in comic list: 4%
py: Finding Error in comic list: 5%
py: Finding Error in comic list: 6%
py: Finding Error in comic list: 7%
py: Finding Error in comic list: 8%
py: Finding Error in comic list: 9%
py: Finding Error in comic list: 10%
py: Finding Error in comic list: 11%
py: Finding Error in comic list: 12%
py: Finding Error in comic list: 13%
py: Finding Error in comic list: 14%
py: Finding Error in comic list: 15%
py: Finding Error in comic list: 16%
py: Finding Error in comic list: 17%
py: Finding Error in comic list: 18%
py: Finding Error in comic list: 19%
py: Finding Error in comic list: 20%
py: Finding Error in comic list: 21%
py: Finding Error in comic list: 22%
py: Finding Error in comic list: 23%
py: Finding Error in comic list: 24%
py: Finding Error in comic list: 25%
py: Finding Error in comic list: 26%
py: Finding Error in comic list: 27%
py: Finding Error in comic list: 28%
py: Finding Error in comic list: 29%
py: Finding Error in comic list: 30%
py: Finding Error in comic list: 31%
py: Finding Error in comic list: 32%
py: Finding Error in comic list: 33%
py: Finding Error in comic list: 34%
py: Finding Error in comic list: 35%
py: Finding Error in comic list: 36%
py: Finding Error in comic list: 37%
py: Finding Error in comic list: 38%
py: Finding Error in comic list: 39%
py: Finding Error in comic list: 40%
py: Finding Error in comic list: 41%
py: Finding Error in comic list: 42%
py: Finding Error in comic list: 43%
py: Finding Error in comic list: 44%
py: Finding Error in comic list: 45%
py: Finding Error in comic list: 46%
py: Finding Error in comic list: 47%
py: Finding Error in comic list: 48%
py: Finding Error in comic list: 49%
py: Finding Error in comic list: 50%
py: Finding Error in comic list: 51%
py: Finding Error in comic list: 52%
py: Finding Error in comic list: 53%
py: Finding Error in comic list: 54%
py: Finding Error in comic list: 55%
py: Finding Error in comic list: 56%
py: Finding Error in comic list: 57%
py: Finding Error in comic list: 58%
py: Finding Error in comic list: 59%
py: Finding Error in comic list: 60%
py: Finding Error in comic list: 61%
py: Finding Error in comic list: 62%
py: Finding Error in comic list: 63%
py: Finding Error in comic list: 64%
py: Finding Error in comic list: 65%
py: Finding Error in comic list: 66%
py: Finding Error in comic list: 67%
py: Finding Error in comic list: 68%
py: Finding Error in comic list: 69%
py: Finding Error in comic list: 70%
py: Finding Error in comic list: 71%
py: Finding Error in comic list: 72%
py: Finding Error in comic list: 73%
py: Finding Error in comic list: 74%
py: Finding Error in comic list: 75%
py: Finding Error in comic list: 76%
py: Finding Error in comic list: 77%
py: Finding Error in comic list: 78%
py: Finding Error in comic list: 79%
py: Finding Error in comic list: 80%
py: Finding Error in comic list: 81%
py: Finding Error in comic list: 82%
py: Finding Error in comic list: 83%
py: Finding Error in comic list: 84%
py: Finding Error in comic list: 85%
py: Finding Error in comic list: 86%
py: Finding Error in comic list: 87%
py: Finding Error in comic list: 88%
py: Finding Error in comic list: 89%
py: Finding Error in comic list: 90%
py: Finding Error in comic list: 91%
py: Finding Error in comic list: 92%
py: Finding Error in comic list: 93%
py: Finding Error in comic list: 94%
py: Finding Error in comic list: 95%
py: Finding Error in comic list: 96%
py: Finding Error in comic list: 97%
py: Finding Error in comic list: 98%
py: Finding Error in comic list: 99%
py: Reading in current database
py: Querying ComicVine for new issues
py: Error. Trying Again...
py: Error. Trying Again...
py: Error. Trying Again...
py: Error. Trying Again...
py: Finding Error in comic list: 0%
py: Finding Error in comic list: 1%
py: Finding Error in comic list: 2%
py: Finding Error in comic list: 3%
py: Finding Error in comic list: 4%
py: Finding Error in comic list: 5%
py: Finding Error in comic list: 6%
py: Finding Error in comic list: 7%
py: Finding Error in comic list: 8%
py: Finding Error in comic list: 9%
py: Finding Error in comic list: 10%
py: Finding Error in comic list: 11%
py: Finding Error in comic list: 12%
py: Finding Error in comic list: 13%
py: Finding Error in comic list: 14%
py: Finding Error in comic list: 15%
py: Finding Error in comic list: 16%
py: Finding Error in comic list: 17%
py: Finding Error in comic list: 18%
py: Finding Error in comic list: 19%
py: Finding Error in comic list: 20%
py: Finding Error in comic list: 21%
py: Finding Error in comic list: 22%
py: Finding Error in comic list: 23%
py: Finding Error in comic list: 24%
py: Finding Error in comic list: 25%
py: Finding Error in comic list: 26%
py: Finding Error in comic list: 27%
py: Finding Error in comic list: 28%
py: Finding Error in comic list: 29%
py: Finding Error in comic list: 30%
py: Finding Error in comic list: 31%
py: Finding Error in comic list: 32%
py: Finding Error in comic list: 33%
py: Finding Error in comic list: 34%
py: Finding Error in comic list: 35%
py: Finding Error in comic list: 36%
py: Finding Error in comic list: 37%
py: Finding Error in comic list: 38%
py: Finding Error in comic list: 39%
py: Finding Error in comic list: 40%
py: Finding Error in comic list: 41%
py: Finding Error in comic list: 42%
py: Finding Error in comic list: 43%
py: Finding Error in comic list: 44%
py: Finding Error in comic list: 45%
py: Finding Error in comic list: 46%
py: Finding Error in comic list: 47%
py: Finding Error in comic list: 48%
py: Finding Error in comic list: 49%
py: Finding Error in comic list: 50%
py: Finding Error in comic list: 51%
py: Finding Error in comic list: 52%
py: Finding Error in comic list: 53%
py: Finding Error in comic list: 54%
py: Finding Error in comic list: 55%
py: Finding Error in comic list: 56%
py: Finding Error in comic list: 57%
py: Finding Error in comic list: 58%
py: Finding Error in comic list: 59%
py: Finding Error in comic list: 60%
py: Finding Error in comic list: 61%
py: Finding Error in comic list: 62%
py: Finding Error in comic list: 63%
py: Finding Error in comic list: 64%
py: Finding Error in comic list: 65%
py: Finding Error in comic list: 66%
py: Finding Error in comic list: 67%
py: Finding Error in comic list: 68%
py: Finding Error in comic list: 69%
py: Finding Error in comic list: 70%
py: Finding Error in comic list: 71%
py: Finding Error in comic list: 72%
py: Finding Error in comic list: 73%
py: Finding Error in comic list: 74%
py: Finding Error in comic list: 75%
py: Finding Error in comic list: 76%
py: Finding Error in comic list: 77%
py: Finding Error in comic list: 78%
py: Finding Error in comic list: 79%
py: Finding Error in comic list: 80%
py: Finding Error in comic list: 81%
py: Finding Error in comic list: 82%
py: Finding Error in comic list: 83%
py: Finding Error in comic list: 84%
py: Finding Error in comic list: 85%
py: Finding Error in comic list: 86%
py: Finding Error in comic list: 87%
py: Finding Error in comic list: 88%
py: Finding Error in comic list: 89%
py: Finding Error in comic list: 90%
py: Finding Error in comic list: 91%
py: Finding Error in comic list: 92%
py: Finding Error in comic list: 93%
py: Finding Error in comic list: 94%
py: Finding Error in comic list: 95%
py: Finding Error in comic list: 96%
py: Finding Error in comic list: 97%
py: Finding Error in comic list: 98%
py: Finding Error in comic list: 99%

View File

@ -0,0 +1,203 @@
#!/usr/bin/env python
"""
Ver 2.0
Overview:
This script grabs the newest issues from ComicVine and 'appends' them to the
missing.mcl file contents.
usage:
python update_missing.py <in_file> <out_file> <api_key> <start_date> <end_date>
in_file: missing.mcl (i.e., your most recent version)
out_file: missing_<date> (or w/e you want to name it)
api_key: provided by ComicVine
start_date: the date the mcl file is synched with (YYYY-MM-DD)
end_date: today's date (YYYY-MM-DD)
e.g.,
python update_missing.py missing.mcl missing_20170917.mcl API_KEY 2017-09-11 2017-09-17
Technical stuff:
The mcl file format contains a header followed by a list of volumes with
their respective issues/numbers.
Missing;<date_of_last_update>
<volume_id>;list of <issue_id>;list of <issue_num>
<volume_id>;list of <issue_id>;list of <issue_num>
...
<volume_id>;list of <issue_id>;list of <issue_num>
The lists are comma delimited. Commas followed immediately by a space are
not considered a delimiter. Some issues are numbered like "v. 1, no. 01".
If there is a space in the list of issue numbers, the entire list is
wrapped in double quotes.
Note: There is one volume (id: 77901) that has an issue number "1,5". This
can potentially wreak some havoc if not treated carefully.
"""
import requests
import sys
if len(sys.argv) < 6 :
print "usage: python update_missing.py <in_file> <out_file> <api_key> <start_date> <end_date>"
exit()
in_file = str(sys.argv[1]) # missing.mcl
out_file = str(sys.argv[2]) # updated_missing.mcl
api_key = str(sys.argv[3]) # ComicVine API key
start_date = str(sys.argv[4]) # start date range to search for new issues
end_date = str(sys.argv[5]) # end date range to search for new issues
comiclist = open(in_file, "r")
issues_number = {}
issues_volume = {}
skip_header = True
cont = 0
print "Reading in current database"
for line in comiclist:
if skip_header:
skip_header = False
continue
line_split = unicode(line, encoding='utf-8').replace("\n","").split(";")
volume_id = int(line_split[0])
if (line_split[1][0] == '"') and (line_split[1][len(line_split[1])] == '"'):
line_split = line_split[1:-1]
issue_split = line_split[1].split(",")
num_split = line_split[2].split(",")
for i in range(0,len(issue_split)):
if issues_number.has_key(int(issue_split[i])):
cont += 1
issues_number[int(issue_split[i])] = num_split[i]
issues_volume[int(issue_split[i])] = volume_id
comiclist.close()
print "Querying ComicVine for new issues"
headers = {'User-Agent': 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_11_5) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/50.0.2661.102 Safari/537.36'}
new_comics_cont = 0
old_comics_cont = 0
updated_comics_cont = 0
deleted_comics_cont = 0
comic_skip_cont = 0
offset = 0
max = 100
limit = 100
skip = 0
retry = 0
ErrorIds = ""
non_retrieved_comics = issues_number.copy()
FindingError = False
while offset < max:
try:
request_url = "https://comicvine.gamespot.com/api/issues/?api_key=" + api_key +"&limit=" + str(limit) + "&format=json&offset=" + str(offset) + "&field_list=id,issue_number,volume&filter=date_last_updated:" + start_date + "|" + end_date + "&sort=id"
print request_url
r = requests.get(request_url, headers=headers)
json_obj = r.json()
max = json_obj['number_of_total_results']
print str(min(offset,max)) + "/" + str(max) + " Since " + start_date
for i in json_obj['results']:
volume_id = i['volume']['id']
issue_id = i['id']
num = unicode(i['issue_number']).replace(",",".&@1").replace(";",".&@2").replace("\n","").replace("\r","")
if not issues_number.has_key(issue_id):
new_comics_cont += 1
issues_number[issue_id] = num
issues_volume[issue_id] = volume_id
else:
del non_retrieved_comics[issue_id]
old_comics_cont += 1
if issues_number[issue_id] != num or issues_volume[issue_id] != volume_id:
updated_comics_cont += 1
issues_number[issue_id] = num
issues_volume[issue_id] = volume_id
offset += limit + skip
FindingError = False
if skip == 1:
print "Comic with error found, id= " + str(issue_id+1)
ErrorIds += ";"+ str(issue_id+1)
comic_skip_cont += 1
print "Continue loading comics now..."
FindingError = True
skip = 0
limit = 100
retry = 0
except:
if retry < 4 and not FindingError:
print "Error. Trying Again..."
retry += 1
else:
if not FindingError:
print "Finding Error in comic list: " + str(100-limit) + "%"
skip = 1
limit -= 1
if limit == 0 or FindingError:
print "Comic with error found, id= " + str(issue_id+offset)
FindingError = True
limit = 1
offset += 1
comic_skip_cont += 1
ErrorIds += ";"+ str(issue_id+offset)
comics = {}
for issue_id in issues_number.keys():
if not comics.has_key(issues_volume[issue_id]):
comics[issues_volume[issue_id]] = {}
comics[issues_volume[issue_id]][issue_id]=issues_number[issue_id]
print "Writing missings to file"
deleted_file = open("Deleted_Comics.txt", "wb")
for issue_id in non_retrieved_comics.keys():
deleted_file.write(str(issue_id)+"\n")
deleted_comics_cont += 1
deleted_file.close()
print "Writing database to file"
outfile = open(out_file,"wb")
outfile.write("Missing;" + end_date + "\n")
for volume_id in sorted(comics.iterkeys()):
issues = ""
nums = ""
for issue_id in sorted(comics[volume_id].iterkeys()):
issues += str(issue_id) + ","
nums += comics[volume_id][issue_id] + ","
issues = issues[:-1]
outfile.write(str(volume_id) + ";" + issues + ";" + nums.encode('utf-8','ignore') + "\n")
outfile.close()
print "Done! " + str(new_comics_cont) + " comics added to database! (" + str(comic_skip_cont)+ " skipped and " + str(old_comics_cont) + " comics already in database)"
print str(deleted_comics_cont) + " comics in databased not retrieved in this round."
print str(updated_comics_cont) + " comics updated in database."
print "Ids with error in server: " + ErrorIds[1:]
print cont
raw_input("Press Enter to continue...")