how to convert filename to udf filename?
#1
Hi,

I would like to play a blu-ray stream with:

player = XBMCPlayer()
player.play(videofile)


It works, but the videofile is: "bluray://udf%3a%2f%2fL%253a%255cPython%255cTest_video_files%255cPeter%2520%2526%2520the%2520Wolf%2520(2006).BR.iso%2f/BDMV/PLAYLIST/00000.mpls"

I got this from playing the bluray, and then in onPlayBackStarted "videofile = self.getPlayingFile()"


How do I get from
"L:\Python\Test_video_files\Peter & the Wolf (2006).BR.iso /BDMV/PLAYLIST/00000.mpls"

to

"bluray://udf%3a%2f%2fL%253a%255cPython%255cTest_video_files%255cPeter%2520%2526%2520the%2520Wolf%2520(2006).BR.iso%2f/BDMV/PLAYLIST/00000.mpls"

?


Is there some sort of conversion function?

Thanks!
Add-on : Bluray iso utils Rewrite of BR_iso_enhancements
Add-on : BR_iso_Enhancements Give theatrical & directors cut from the same bluray iso each their own library entry, use bluray iso's of tv shows as if they are already ripped.
Reply
#2
it's

bluray://[udf://[path to iso]]/BDMV/PLAYLIST/000000.mpls

here [] indicates an url encode operation.
Reply
#3
Thank you! That's a golden tip.

Searched the forum and found:

http://forum.xbmc.org/showthread.php?tid=146865

Wil try this as soon as I have time...
Add-on : Bluray iso utils Rewrite of BR_iso_enhancements
Add-on : BR_iso_Enhancements Give theatrical & directors cut from the same bluray iso each their own library entry, use bluray iso's of tv shows as if they are already ripped.
Reply
#4
Question 
I still can't solve it Confused

I have this string from the debug log from Kodi:

bluray://udf%3a%2f%2fM%253a%255cPeter%2520%2526%2520the%2520Wolf%2520(2006).BR.iso%2f/BDMV/PLAYLIST/00000.mpls

If I give this string to the player.play, then it plays this bluray stream. So far everything works...

If I break this string into it's parts according:
Quote:bluray://[udf://[path to iso]]/BDMV/PLAYLIST/00000.mpls

here [] indicates an url encode operation.
I get (using same python version as Isengard):
Code:
>>> print sys.version
2.7.8 (default, Jun 30 2014, 16:03:49) [MSC v.1500 32 bit (Intel)]

>>> import urllib

>>> urllib.unquote('udf%3a%2f%2fM%253a%255cPeter%2520%2526%2520the%2520Wolf%2520(2006).BR.iso%2f')
'udf://M%3a%5cPeter%20%26%20the%20Wolf%20(2006).BR.iso/'


>>> urllib.unquote('M%3a%5cPeter%20%26%20the%20Wolf%20(2006).BR.iso/')
'M:\\Peter & the Wolf (2006).BR.iso/'

'bluray://udf://'
'M:\\Peter & the Wolf (2006).BR.iso/'
'/BDMV/PLAYLIST/000000.mpls'

OK so far (I think...)

What I really need is the conversion the other way arround. In other words, I have a path to a bluray iso and a .mpls file I want to play.

This is the file (windows 7 CLI): 'M:\Peter & the Wolf (2006).BR.iso'

I convert this to: 'M:\\Peter & the Wolf (2006).BR.iso/'

Then my first encode. urlencode doesn't work:
Code:
>>> urllib.urlencode('M:\\Peter & the Wolf (2006).BR.iso/')
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "C:\Python27\lib\urllib.py", line 1318, in urlencode
    raise TypeError
TypeError: not a valid non-string sequence or mapping object
So I try quote:
Code:
>>> urllib.quote('M:\\Peter & the Wolf (2006).BR.iso/')
'M%3A%5CPeter%20%26%20the%20Wolf%20%282006%29.BR.iso/'
This is better, but not completely the same as what I expected. The '()' around 2006 are also escaped, and the last '/' is not escaped. Maybe better with the second encode?:
Code:
udf://M%3A%5CPeter%20%26%20the%20Wolf%20%282006%29.BR.iso/

>>> urllib.quote('udf://M%3A%5CPeter%20%26%20the%20Wolf%20%282006%29.BR.iso/')
'udf%3A//M%253A%255CPeter%2520%2526%2520the%2520Wolf%2520%25282006%2529.BR.iso/'

nope...

This gives me something else than what I needed/expected. It also doesn't work when I give it to player.play :
Expected:
bluray://udf%3a%2f%2fM%253a%255cPeter%2520%2526%2520the%2520Wolf%2520(2006).BR.iso%2f/BDMV/PLAYLIST/00000.mpls
Result:
bluray://udf%3A//M%253A%255CPeter%2520%2526%2520the%2520Wolf%2520%25282006%2529.BR.iso//BDMV/PLAYLIST/00000.mpls

So I'm stuck... Can somebody help me with this please?

Thanks!
Add-on : Bluray iso utils Rewrite of BR_iso_enhancements
Add-on : BR_iso_Enhancements Give theatrical & directors cut from the same bluray iso each their own library entry, use bluray iso's of tv shows as if they are already ripped.
Reply
#5
Found it!

First of all is it not:

bluray://[udf://[path to iso]]/BDMV/PLAYLIST/00000.mpls

but:

bluray://[udf://[path to iso]/]/BDMV/PLAYLIST/00000.mpls


The following then gets the correct URL escaped string:
Code:
>>> urllib.quote('M:\\Peter & the Wolf (2006).BR.iso', safe='()')
'M%3A%5CPeter%20%26%20the%20Wolf%20(2006).BR.iso'
>>> urllib.quote('udf://M%3A%5CPeter%20%26%20the%20Wolf%20(2006).BR.iso/', safe='()')
'udf%3A%2F%2FM%253A%255CPeter%2520%2526%2520the%2520Wolf%2520(2006).BR.iso%2F'

This gives in the end:

bluray://udf%3A%2F%2FM%253A%255CPeter%2520%2526%2520the%2520Wolf%2520(2006).BR.iso%2F/BDMV/PLAYLIST/00000.mpls

And this is the string I wanted:

bluray://udf%3a%2f%2fM%253a%255cPeter%2520%2526%2520the%2520Wolf%2520(2006).BR.iso%2f/BDMV/PLAYLIST/00000.mpls
Add-on : Bluray iso utils Rewrite of BR_iso_enhancements
Add-on : BR_iso_Enhancements Give theatrical & directors cut from the same bluray iso each their own library entry, use bluray iso's of tv shows as if they are already ripped.
Reply

Logout Mark Read Team Forum Stats Members Help
how to convert filename to udf filename?0