The past perfect continuous is the equivalent of the present perfect continuous for the past.
We use the past perfect continuous when we want to show that the activity began in the past and it has been going on for some time in relation to the moment of speaking in the past. It doesn't matter if the activity ended or resumed afterwards.
Yesterday I had a problem with my task. It was difficult to find the answer on the Internet. I had been browsing websites for an hour when I finally found a forum thread where my problem was described. (= I had a problem, I started browsing, I spent an hour browsing, then I found a solution).
Nancy got a job last week. She had been looking for a job for the last two month. (= Two months ago Nancy started looking for a job. Last week she got one.)
At eleven o'clock we noticed that we had been playing that game for five hours. But we didn't stop and continued playing. (= It was eleven o'clock. Five hours ago we started playing the game. After 11 o'clock we continued to play.)
It had been raining since Monday. Now it was Thursday and it seemed like the rain wasn't going to stop. (= It started raining on Monday. It was still raining on Thursday.)