why are you starting form the lamedb?
If you create favorites (aka bouquets) with the channels that you are watching, you will have immediately the right service reference in it.
So you will ease your life if you work from the userbouquet files than from the lamedb.