Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 12 additions & 3 deletions .github/workflows/update_cache.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,9 @@ on:
push:
branches:
- main
pull_request:
branches:
- main

jobs:
update-cache:
Expand All @@ -19,8 +22,14 @@ jobs:
git config --global user.name 'L-CAS GitHub'
git config --global user.email 'marc@hanheide.net'
- run: |
python3 lcas-bib-export-generator.py
git add -f *.bib *.rss *.html
git commit -m "automated commit"
python -m venv .venv
source .venv/bin/activate
pip install -r requirements.txt
python lcas-bib-export-generator.py

- if: github.event_name != 'pull_request'
run: |
git add -f *.bib *.json *.html
git commit -m "automated commit `date`"
git push

9 changes: 6 additions & 3 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
*.bib
*.rss
wordpress.html
#*.bib
#*.rss
#wordpress.html
.venv
*.pyc
.DS_Store
73 changes: 73 additions & 0 deletions config.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
class Config:

staff_dict = {
'mhanheide': {
'sys_id': '9784d77a-95ab-4b79-b2b7-fec86960cadb',
},
'tduckett': {
'sys_id': '94e90db9-b0da-44bd-93bd-cd7649f35ae8',
},
'esklar': {
'sys_id': '5a55374c-44b0-4a2a-946d-7350a68138aa',
},
'mrai': {
'sys_id': '26bc3d5d-a0b2-4a5f-a14b-0314092cfcf9',
},
'pbosilj': {
'sys_id': 'de6e2d62-190c-425a-9066-f8e2c963abb6',
},
'gdas': {
'sys_id': '66512f78-e480-4ec8-9980-7ce1145ae018',
},
'lguevara': {
'sys_id': 'a304664e-6445-4f1e-b8ad-74fa88abc715',
},
'smaleki': {
'sys_id': '9634ee84-d602-47a5-830b-d0e673ffd788',
},
'malkhafajiy': {
'sys_id': 'd533aaa5-bee2-4439-acbe-686567ae5384',
},
'apolydoros': {
'sys_id': '99d1bfa4-2d7f-4a30-9a81-3de5a3a495f2',
},
'nbellotto': {
'sys_id': 'f487270f-7ff0-47eb-b4b6-656cee47efbf',
},
'pbaxter': {
'sys_id': '4e5d4601-928f-429f-a1ea-4e39a555a968',
},
'gcielniak': {
'sys_id': 'e69a17de-0ef1-4771-8004-646967ea1ac9',
},
'hcuayahuitl': {
'sys_id': '6832ced4-f983-44ca-8bc7-36cde054bf0b',
},
'chfox': {
'sys_id': '4311dbb7-1b10-4844-bba9-20f527168e7b',
},
'sparsons': {
'sys_id': 'f6d2a6e0-3f48-40d7-8c0d-15dcefb9bd47',
},
'spearson': {
'sys_id': '6e38837c-9f3d-49e1-ab0c-dbbdf3362853',
},
'dbochtis': {
'sys_id': '04c88bff-e35d-4e6e-8a2f-01f8aaec3c62',
},
'rpolvara': {
'sys_id': 'f65aae87-dc86-4c92-b0ea-ab120ee3a540',
},
'fdelduchetto': {
'sys_id': '9033283c-a405-472e-886a-a4799bf19b1b',
},
'aklimchik': {
'sys_id': 'bd4f1364-7872-4f53-936f-9bdb21e29fed',
},
'hharman': {
'sys_id': '992df11b-7944-4aa7-a123-f63a28942afb',
},
'tzied': {
'sys_id': '5e45b953-1d84-4210-85f7-5b216c28efff',
},
}
119 changes: 119 additions & 0 deletions lcas-bib-export-generator-eprints.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,119 @@
#!/usr/bin/env python

from requests import get
from sys import stderr

# old URL using IDs that is NOT working reliably:
# http://eprints.lincoln.ac.uk/cgi/search/archive/advanced/export_lirolem_BibTeX.bib?screen=Search&dataset=archive&_action_export=1&output=BibTeX&exp=0%7C1%7C-date%2Fcreators_name%2Ftitle%7Carchive%7C-%7Ccreators_id%3Acreators_id%3AANY%3AIN%3A002146+801704+801872+801929+003092+002165+001928+802799+002604+504752+504299+002325%7Ctype%3Atype%3AANY%3AEQ%3Aarticle+review+book_section+monograph+conference_item+book+thesis+dataset%7C-%7Ceprint_status%3Aeprint_status%3AANY%3AEQ%3Aarchive%7Cmetadata_visibility%3Ametadata_visibility%3AANY%3AEQ%3Ashow&n=

staff = [
'Hanheide, Marc',
'Duckett, Tom',
'Sklar, Elizabeth',
'Saaj, Mini',
'Elgeneidy',
'Esfahani',
'Bosilj',
'Calisti, Marcello',
'Das, Gautham',
'Gao, Junfeng',
'Guevara, Leonardo',
'Maleki, Sepehr',
'Al-Khafajiy',
'Polydoros',
'Yue, Shigang',
'Bellotto, Nicola',
'Baxter, Paul',
'Cielniak, Grzegorz',
'Cuayahuitl, Heriberto',
'Fox, Charles',
'Parsons, Simon',
'Pearson, Simon',
'Bochtis',
'Polvara, Riccardo',
'del Duchetto, Francesco',
'Klimchik, Alexandr',
'Rai, Mini',
'Harman, Helen',
'Zied, Tayeb'
]

# recent
years = list(range(2012,2025))

def quote_name(n):
return '%%22%s%%22' % n.replace(',','%2C').replace(' ','+')

def quote_names(ns):
return [quote_name(n) for n in ns]


#http://eprints.lincoln.ac.uk/cgi/search/archive/advanced?screen=Search&dataset=archive&_action_search=Search&documents_merge=ALL&documents=&title_merge=ALL&title=&documents.title_merge=ALL&documents.title=&creators_name_merge=ANY&creators_name=Hanheide+Duckett+Saaj+Sklar+Yue+Bellotto+Baxter&creators_id_merge=ALL&creators_id=&abstract_merge=ALL&abstract=&date_online=&date_accepted=&date=2019-&documents.description_merge=ALL&documents.description=&keywords_merge=ALL&keywords=&subjects_merge=ANY&divisions_merge=ANY&editors_name_merge=ALL&editors_name=&refereed=EITHER&publication_merge=ALL&publication=&projects_merge=ALL&projects=&satisfyall=ALL&order=-date%2Fcreators_name%2Ftitle
#http://eprints.lincoln.ac.uk/cgi/search/archive/advanced/export_lincoln_BibTeX.bib?screen=Search&dataset=archive&_action_export=1&output=BibTeX&exp=0%7C1%7C-date%2Fcreators_name%2Ftitle%7Carchive%7C-%7Ccreators_name%3Acreators_name%3AANY%3AEQ%3AHanheide+Duckett+Saaj+Sklar+Yue+Bellotto+Baxter%7Cdate%3Adate%3AALL%3AEQ%3A2019-%7C-%7Ceprint_status%3Aeprint_status%3AANY%3AEQ%3Aarchive%7Cmetadata_visibility%3Ametadata_visibility%3AANY%3AEQ%3Ashow&n=&cache=11353462

url_pattern='http://eprints.lincoln.ac.uk/cgi/search/archive/advanced/export_lirolem_BibTeX.bib?screen=Search&dataset=archive&_action_export=1&output=BibTeX&exp=0%%7C1%%7C-%%7Ccreators_name%%3Acreators_name%%3AANY%%3AIN%%3A%s%%7Cdate%%3Adate%%3AALL%%3AEQ%%3A%s'


'https://eprints.lincoln.ac.uk/cgi/search/archive/advanced/export_lincoln_AllRSS.rss?screen=Search&dataset=archive&_action_export=1&output=AllRSS&exp=0%7C1%7C-date%2Fcreators_name%2Ftitle%7Carchive%7C-%7Ccreators_name%3Acreators_name%3AALL%3AEQ%3AHanheide'

rss_url_pattern='http://eprints.lincoln.ac.uk/cgi/search/archive/advanced/export_lincoln_RSS2.xml?screen=Search&dataset=archive&_action_export=1&output=RSS2&exp=0%%7C1%%7C-%%7Ccreators_name%%3Acreators_name%%3AANY%%3AIN%%3A%s'


def highlight_names(names):
ret = ''
filtered = [s.split(', ')[0] for s in names]
return '|'.join(filtered)

shortcode_pattern=(
'[bibfilter group="firstauthor" group_order="desc" format="ieee" order=asc limit=1000 '
'file="%s" '
'timeout=60000 '
'highlight="%s" '
'sortauthors=1 '
'allow="incollection,mastersthesis,article,conference,techreport,inproceedings" '
'author="%s"'
']'
)

def pubs_year_url(year, staff):
return url_pattern % ('%2C+'.join(quote_names(staff)), str(year))

def rss_url(staff):
return rss_url_pattern % ('%2C+'.join(quote_names(staff)))

def get_file(bibtex_url):
return get(bibtex_url, verify=False, timeout=200).text

years.reverse()

with open('wordpress.html','w') as html_file:
print('<p>Download the <a href="%s" target="_blank">BibTeX file of all L-CAS publications</a></p>' % (
pubs_year_url('', staff)
), file=html_file)

with open('lcas.bib', 'w') as all_bib:
bibtex = get_file(pubs_year_url('', staff))
all_bib.write(bibtex)

for year in years:
print("<h2>%s</h2>" % str(year), file=html_file)
bibtex_url = pubs_year_url(year, staff)
print('generating for year %d using %s' % (year, bibtex_url), file=stderr)
print(shortcode_pattern % (
bibtex_url,
highlight_names(staff),
highlight_names(staff)
), file=html_file)

bibtex = get_file(bibtex_url)
with open('%d.bib' % year, 'w') as bibtex_file:
bibtex_file.write(bibtex)


print('-------------------------------')
with open('lcas.rss','w') as rss_file:
rssdata = get_file(rss_url(staff))
rss_file.write(rssdata)
print(rss_url(staff))


Loading
Loading