From IMDB:
Set in Edinburgh, the mercurial Detective Inspector John Rebus’s investigations lead him through the city’s ancient beauty and into its more sinister quarters.
From Wikipedia:
Rebus is the title of the detective drama TV series based on the Inspector Rebus novels by the Scottish author Ian Rankin set in and around Edinburgh. The series was produced by STV Productions (previously known as “SMG Productions”) for the ITV network.
Four series have been aired; series 1 starred John Hannah and was made for STV by his own production company, Clerkenwell Films. A new cast featuring Ken Stott as DI John Rebus was introduced for the second and subsequent series (which went into production in 2005, made in-house by STV).
From AcornTV:
Adapted from the novels by acclaimed writer Ian Rankin, the Rebus stories have been applauded for their intricate plots, keen characterization, and flawless sense of place. CC Available.
Acorn TV offers all 4 series.
Just be aware that these excellent productions are grim. It seems that a divorced, unhappy, obsessive detective is a standard cliché. But that does not stop the suspenseful, well-acted stories from being a real treat for lovers of the genre.
Never, never expect a happy ending!