Check for updates every 90 days

This commit is contained in:
Reinhard Pointner 2019-05-04 19:38:26 +07:00
parent 1c9440ed3c
commit e6c5d5fb14
1 changed files with 11 additions and 10 deletions

View File

@ -51,17 +51,17 @@ void build(ids, section, db, query) {
return
}
def artwork = retry(2, 60000) {
try {
return db.getArtwork(id, query, Locale.ENGLISH)
} catch (FileNotFoundException e) {
log.warning "[ARTWORK NOT FOUND] $e"
return null
if (original.length() == 0 || !original.exists()) {
def artwork = retry(2, 60000) {
try {
return db.getArtwork(id, query, Locale.ENGLISH)
} catch (FileNotFoundException e) {
log.warning "[ARTWORK NOT FOUND] $e"
return null
}
}
}
if (!original.exists()) {
artwork.findResult{ a ->
artwork?.findResult{ a ->
return retry(2, 60000) {
try {
log.fine "Fetch $a"
@ -74,8 +74,9 @@ void build(ids, section, db, query) {
}
// create empty placeholder if there is no artwork
if (!original.exists()) {
if (original.length() == 0 || !original.exists()) {
original.createNewFile()
original.setLastModified(System.currentTimeMillis())
}
ls original