Whoo, glad to have contributed!
I didn't realize that Pushover has a 1024 character limit for messages

I added a bit more logic to get more out of that limitation.
Unfortunately, it's still not likely to fit a whole series at once, but it's a lot better than only fitting ~4 items into a single message as with the previous script.
1 Movie Renamed...
>5 Episodes Renamed...
Posting it here for anyone who might find it useful...
Groovy: Select all
// Send a PushOver notification, formatted to get more out of the 1024 character limit for messages...
if (model.size() == 1 && model[0].type == 'Movie') {
// A single movie...
pushMessage = model.each{ source, target, metadata ->
def genreType = 'Anime' in genres ? 'Anime' : 'Animation' in genres ? 'Animated' : 'Live-Action'
"π¬ <b><a href='https://www.themoviedb.org/movie/$id'>$target.nameWithoutExtension</a>\nβ $rating β’ $vf β’ $acf β’ $bytes β’ ${genreType}</b>\n<i>$source.name</i>\n\n<b><i>${metadata.info.tagline}</i></b>\n\n${metadata.info.overview}"
}.join('')
} else if (model.size() > 5 && model[0].type == 'Episode') {
// Probably a batch of episodes...
def firstItem = model[0]
def genreType = 'Anime' in firstItem.genres ? 'Anime' : 'Animation' in firstItem.genres ? 'Animated' : 'Live-Action'
pushMessage = "πΊ <b><a href='https://www.themoviedb.org/tv/${firstItem.id}'>${firstItem.ny}</a>\nβ ${firstItem.rating} β’ ${firstItem.vf} β’ ${firstItem.acf} β’ ${genreType}</b>\n\n<i>"
pushMessage = pushMessage + model.each{ source, target, metadata ->
"$source.name β $target.nameWithoutExtension"
}.join('\n\n') + '</i>'
} else {
// Probably a mix of movie(s) and/or episode(s)...
system 'curl', '--output', '.\\pushoverImage.jpg', "${model[0].info.Poster}"
pushMessage = model.each{ source, target, metadata ->
def genreType = 'Anime' in genres ? 'Anime' : 'Animation' in genres ? 'Animated' : 'Live-Action'
if( $type == 'Movie') {
"π¬ <b><a href='https://www.themoviedb.org/movie/$id'>$target.nameWithoutExtension</a>\nβ $rating β’ $vf β’ $acf β’ $bytes β’ ${genreType}</b>\n<i>$source.name</i>"
} else if( $type == 'Episode') {
"πΊ <b><a href='https://www.themoviedb.org/tv/$id'>$target.nameWithoutExtension</a>\n$ny\nβ $metadata.info.rating β’ $vf β’ $acf β’ $bytes β’ ${genreType}</b>\n<i>$source.name</i>"
} else {
"π $source.name β $target.name\n$target.path"
}
}.join('\n\n')
}
// Pushover Notification
submit 'https://api.pushover.net/1/messages.json', [
token: 'appToken123',
user: 'userToken123',
html: 1,
attachment: ".\\pushoverImage.jpg",
title: "FileBot: ${model.size()} file(s) processed",
message: pushMessage
]
----------------------------------------------
Pushover allows
attaching an image file when sending a message, which I thought would be great when only a single movie/series was renamed.
I spent some time trying to figure out how to do this through Groovy with the provided
info.Poster url.
Using curl to download the file worked fine, but I couldn't figure out how to send it through the submit function. Any tips?
Code: Select all
system 'curl', '--output', ".\\pushoverImage.jpg", "${model[0].info.Poster}"
P.S
It'd be great if the forums allowed for in-line code formatting, like in Discord when surrounding text with single backticks (`). So things like [c]$info.Poster[/c] would show up formatted and apparent as a snippet, without having to use a whole code block.
I've seen this function in other forums and it's great for distinguishing code in conversation.