示例#1
0
    parser.add_argument(
        '--radarr-key', '-rk',
        help='Radarr API key, find it on Radarr > Settings > General'
    )
    parser.add_argument(
        '--tmdb-key', '-tk',
        help='TMDB API Key, register app on tmdb to obtain API Key'
    )
    args = parser.parse_args()
    return args


args = _argparse()

radarr = RadarrApi(args.radarr_url, args.radarr_key)
radarr.unmonitorMovieIfNeeded(os.environ.get("radarr_movie_id"), os.environ.get("radarr_eventtype"))
radarr.loadData(os.environ.get("radarr_download_id"))
link = "https://www.themoviedb.org/movie/"+os.environ.get("radarr_movie_tmdbid", "")

tmdb = TmdbApi(args.tmdb_key)
tmdb.loadMovieData(radarr.tmdbId)
tmdb.downloadMovieProductionImage()

message = SlackMessage(args.webhook_url)
message.package("*"+ os.environ.get("radarr_movie_title", "") +"* ("+ radarr.year +") ["+ os.environ.get("radarr_moviefile_quality", "") +"]")
message.constructor("`" +radarr.indexer+"` _"+os.environ.get("radarr_moviefile_releasegroup", "")+"_ ("+radarr.sizeOnDisk+")")
message.release(radarr.releaseTitle)
message.link(link)
message.save()

message.notify()
示例#2
0
sonarr = SonarrApi(args.sonarr_url, args.sonarr_key)
sonarr.loadData(os.environ.get("sonarr_series_id", ""),
                os.environ.get("sonarr_episodefile_id", ""),
                os.environ.get("sonarr_download_id", ""))
sonarr.unmonitorMovieIfNeeded(os.environ.get("sonarr_eventtype"))

networkName = tmdb.normalizeNetworkName(sonarr.network)
networkLogoEmoji = tmdb.downloadImageIfNeeded(networkLogoUrl, networkName)

season = os.environ.get("sonarr_episodefile_seasonnumber", "")
episode = os.environ.get("sonarr_episodefile_episodenumbers", "")

link = ""
tvMaze = TvMazeApi(os.environ.get("sonarr_series_tvmazeid", ""))
link = tvMaze.getEpisodeUrl(season, episode)

message = SlackMessage(args.webhook_url)
message.package("*" + os.environ.get("sonarr_series_title", "") + " - " +
                season + "x" + episode + " - " +
                os.environ.get("sonarr_episodefile_episodetitles", "") +
                "* [" + os.environ.get("sonarr_episodefile_quality", "") + "]")
message.constructor("`" + sonarr.indexer + "` _" +
                    os.environ.get("sonarr_episodefile_releasegroup", "") +
                    "_ (" + sonarr.sizeOnDisk + ")")
message.link(link)
message.iconUrl = networkLogoUrl
message.iconEmoji = networkLogoEmoji
message.save()

message.notify()