[AppleTV2] Cannot open file using open('special://temp')
#1
So I seem to have found a problem where the crunchyroll addon by maruchan works on some systems, but not the atv2. The script downloads, preps and creates a formatted subtitle file that is later used by the video player.

The segment of code that opens the file is:

subfile = open('special://temp/crunchy_'+mediaid+'.ass', 'w')

Followed by some completion lines:
subfile.write(formattedSubs.encode('utf-8'))
subfile.close()

On the ATV2 this process breaks, and no files are written. If I modify the first line to:

subfile = open('/var/mobile/Library/Preferences/XBMC/temp/crunchy_'+mediaid+'.ass', 'w')

It works properly. I verified that the directory listed above is the one the system wants to use by doing a translate of special://temp and printing the result. (thats how I got the directory in the first place) So this isn't a permissions issue. Checked and everything is using user mobile and write is allowed.

Any idea what is going on with opening that file using special://temp?

The interesting thing is that later on it has to open the previously created file to connect the subtitles to the video. Of course it works just fine with the original naming structure, so I am confused.

xbmc.Player().setSubtitles('special://temp/crunchy_'+mediaid+'.ass')


There are no errors listed in xbmc.log (with or without debug logging turned on) so I am not sure what to do.

Any help would be greatly appreciated
Reply
#2
Code:
import xbmc

subfile = open(xbmc.translatePath('special://temp/crunchy_'+mediaid+'.ass'), 'w')
Reply
#3
Works perfectly! I'm guessing this will work on all platforms and will ask to have the addon updated to include this version of the open.

Thanks.
Reply

Logout Mark Read Team Forum Stats Members Help
[AppleTV2] Cannot open file using open('special://temp')0