Feature #3663
Pushbullet Notifications Support
0%
Description
It would be awesome to see support for pushbullet in tvheadend, so when a recording is complete it could fire off a notification.
Thanks!
Files
History
Updated by Hanspeter Müller over 8 years ago
Nice idea, but if someone implements, please do it in a generic way (http get/post), so it won't be limited to Pushbullet but can be used with any service (Prowl/Pushover/Pushbullet etc) with an http-api...
/hp
Updated by Cameron Tetford about 8 years ago
I already have this functionality built into my post-processing and pre-processing scripts.
I've got a script that takes the title, subtitle, and epoch time (converted to YYYY-MM-DD format), looks up the series using TVDB's API, determines the season and episode number of the recording to make a proper filename following the typical Title.S01E01.Subtile.mkv format.
It also pushes out a notification using the following line:
curl --silent -o /dev/null -u "PUSHBULLET API KEY" -d type="note" -d body="Recording started for ${TITLE}.${SEASON}${EPISODE}.${SUBTITLE}." -d title="Tvheadend" 'https://api.pushbullet.com/v2/pushes'
The message could be changed and added to a post-processing script to notify when the recording is finished.
Updated by Bobby Lockwood about 8 years ago
Cameron, I like the sound of your script which does the TVDB lookup and file naming. Would you be prepared to share it please?
Updated by hakan kayam almost 8 years ago
it is possible to send notifications after recording with post-processor command. But what i want is:
1)send notifications when a recording starts (pre-processor command)
2)and most importantly send all error msgs to a push service. Recording conflicts etc.
Updated by Cameron Tetford almost 8 years ago
hakan kayam wrote:
it is possible to send notifications after recording with post-processor command. But what i want is:
1)send notifications when a recording starts (pre-processor command)
2)and most importantly send all error msgs to a push service. Recording conflicts etc.
It's definitely possible to do your first request, since that's what my current pre-processor script does. In terms of errors though, there isn't much that tvheadend can pass to the pre-processing script aside from the name of the episode. The "%e" string is supposed to indicate if there were any errors, but all I've ever had it pass to the script is "OK" in a string. Doesn't matter if there were errors or not. It seems to be a broken function I guess.
The available info is listed here:
http://docs.tvheadend.org/webui/config_dvr/#dvr-behaviour
Updated by Cameron Tetford almost 8 years ago
- File tvheadend_scripts.zip tvheadend_scripts.zip added
Bobby Lockwood wrote:
Cameron, I like the sound of your script which does the TVDB lookup and file naming. Would you be prepared to share it please?
I've attached a zip file containing my two scripts and some auxiliary files required. I'm by no means a programmer, and these were my first crack at trying python so if there are better ways of making it work feel free to let me know.
There's comments throughout explaining what each part does.
Pre-processing:
1) Determine season and episode number from title/subtitle/date. It uses fuzzy pattern matching in case TVDB is different than the guide data. It can also handle if TVDB's API returns multiple shows ID's for a given title.
2) I use Sonarr to organize and download metadata for my episodes, so it will check Sonarr's database to see if it's an existing episode or not. If yes, it will abort the recording. If no, the script ends.
Post-processing:
1) Determine season and episode number as above.
2) Determine quality (HDTV or SDTV) based on video resolution height. If 480p it's SDTV, otherwise assume 720p or 1080p.
3) Parse filename into acceptable Sonarr input, i.e. Title.S01E01.Subtitle.1080p.HDTV.x262.mkv
4) Make a symlink of recording in Sonarr's scanning folder and tell it to scan for a new episode.
A detailed explanation of the TVDB part:
It begins by looking up the title and TVDB returns xml data of any matching shows.
Then it will sequentially look up the title of each show returned and create a sorted list from most similar name to least similar by using the levenshtein function.
It can then look up every episode for the first show on that list, and again use the levenshtein function to find the most likely episode name match. If it finds an episode name with a levenshtein distance >0.7, it will assume it is the correct episode name.
If it doesn't find a match for that show, it moves on to the next on the list and continues until it finds a match or runs out.
Updated by hakan kayam almost 8 years ago
Cameron Tetford wrote:
It's definitely possible to do your first request, since that's what my current pre-processor script does.
Thanks for your reply and sharing your script. Can you give a little info about how to trigger this script since there is no pre-processor part in the settings. (At least in my setup)
Updated by Cameron Tetford almost 8 years ago
hakan kayam wrote:
Cameron Tetford wrote:
It's definitely possible to do your first request, since that's what my current pre-processor script does.
Thanks for your reply and sharing your script. Can you give a little info about how to trigger this script since there is no pre-processor part in the settings. (At least in my setup)
What version of tvheadend are you running?
Mine is running on the unstable branch for Ubuntu Trusty. Version 4.1-2405.
I don't think the pre-processor function is part of the 4.0 release.
Updated by hakan kayam almost 8 years ago
Cameron Tetford wrote:
What version of tvheadend are you running?
Mine is running on the unstable branch for Ubuntu Trusty. Version 4.1-2405.
I don't think the pre-processor function is part of the 4.0 release.
"Build: v4.0.9 ~ OpenELEC Tvh-addon v7.0.3"
As far as ı know this is the latest version for openelec. I found version 4.2 for librelec but can't find it for openelec.
Also there is no pre-processor section in wiki. Does 4.1 has it? :S
Updated by Cameron Tetford almost 8 years ago
hakan kayam wrote:
Cameron Tetford wrote:
What version of tvheadend are you running?
Mine is running on the unstable branch for Ubuntu Trusty. Version 4.1-2405.
I don't think the pre-processor function is part of the 4.0 release.
"Build: v4.0.9 ~ OpenELEC Tvh-addon v7.0.3"
As far as ı know this is the latest version for openelec. I found version 4.2 for librelec but can't find it for openelec.Also there is no pre-processor section in wiki. Does 4.1 has it? :S
Version 4.1 has the pre-processor functionality. You'll have to either wait for openelec to update to a newer version (which likely won't happen until 4.2 is marked as a stable release) or find a different distribution to run on.
I assume you're using a raspberry pi for openelec/Kodi? If you use one of the debian based OS's (Personally I'd choose OSMC) you're able to compile version 4.1 yourself to run, I've done that before. It just takes some time and effort.