A U.S. appeals court upheld on Wednesday a finding that EchoStar Corp was in contempt of a patent infringement injunction involving TiVo Inc technology, raising hopes the long legal battle could end with a TiVo victory.

TiVo shares shot up after the ruling, trading up more than 30 percent in the early afternoon, and analysts said the decision could signal a TiVo win.

The ruling does seems skewed in TiVo's favor, said Maxim Group analyst Mark Harding. I'm upbeat about the company benefiting from not only a damages award, but potentially from a licensing agreement with Dish.

Harding did not have an estimate for how much TiVo could get from Dish Network Corp, but added that a licensing agreement could come in the form of a a large upfront cash payment.

TiVo said in a statement the ruling paves the way for TiVo to receive substantial damages.

The next step is for the patent fight to be sent to a lower court in Texas, where the judge has the authority to shut down within the next seven days Dish digital recorders that infringe on TiVo's patents.

Faced with an imminent shut-down of millions of DVRs, we believe Dish will be faced with a gun-to-the-head settlement, said Bernstein Research analyst Craig Moffett in a research note.

Dish said in a statement it was working as quickly as possible to upgrade customers who might own boxes covered by the lawsuit to newer digital recorders that use different technology.

Dish added in the statement it was disappointed by the decision and it intends to seek a review, as well as seek a stay of the injunction.

But analysts said the court decisions on Wednesday were not entirely in TiVo's favor and may not lead to an immediate end to the fight. The U.S. Court of Appeals for the Federal Circuit did ask a lower court to reconsider how it reached its decision that EchoStar was in contempt of a permanent injunction related to the infringement of a patent for TiVo's Time Warp software.

For that ruling, TiVo said it intends to pursue the most rapid path to resolution.

The legal battle dates back to 2004, when TiVo accused satellite TV provider EchoStar's Dish Network of violating TiVo's patent for Time Warp software that allows users to record one TV program while watching another.

The extended legal battle hurt TiVo's ability to profit from its software patents. Alviso, California-based TiVo pioneered digital TV recording software, but has posted quarter after quarter of losses as cable companies crowded into its market with cheaper recording boxes.

TiVo shares were trading 38 percent higher, while Dish shares were trading 1.6 percent lower after the decision and the shares of Dish's spinoff company, EchoStar, were 2 percent higher.

(Additional reporting by Diane Bartz in Washington; editing by Andre Grenon)