The city has a good bus system. Just be aware if you want to go east and board the west bound bus by mistake you will ride it to the end of the line. Then have to pay another fare to ride it back east to your destination. IE, the fare is good only for one direction. I don't know about transfers.
If you decide to take a train the station is easy to find, and it's suggested you purchase a ticket at least a day in advance. Cheaper that way. We found the ticket agent was not available until 4 PM if we were wanting to purchase train tickets for a future day of travel. We used the services of an agent at the train station versus a kiosk.
The cathedral is undergoing renovation. As such entry and exit is not via the main entrance off the plaza mayor. That side is blocked. There is security screening at the entry, not obtrusive but there just the same. No photography allowed during the mass or of persons using a confessional booth. Each booth is located below a Station of the Cross. So, if you want to photograph the carvings, do so when each booth is unoccupied. The confessor occupies the booth, and the penitent will be kneeling outside in front of the booth. Easy enough to know which ones are in use. The Botafumeiro is not swung during every mass, not even during every pilgrim's mass.