[Tutor] Fwd: Embedding resources

2014-08-20 Thread diliup gabadamudalige
Hi Danny!

The routine works fine and so does this one.

http://www.pygame.org/pcr/zipshow/index.php

The only problem with all these are that that the time taken to read these
files and to either make a list or send to screen is WAY TOO LONG.
The only one that works without much delay is in the file I have attached.
It is a bit of code that I wrote with verbose print statements to follow
the program in action while testing. As this uses base64 only there is no
secure encryption. Please have a look at it and try to improve it.

Am I doing this correctly? Are these messages getting to the community?




On Wed, Aug 20, 2014 at 1:18 PM, diliup gabadamudalige dili...@gmail.com
wrote:

 Hi Danny!

 You are always there to lend a helping hand I've noticed! Thanks for the
 quick response! Let me try the code and get back to you.



 On Wed, Aug 20, 2014 at 1:02 PM, Danny Yoo d...@hashcollision.org wrote:


 On Aug 19, 2014 11:53 PM, diliup gabadamudalige dili...@gmail.com
 wrote:
 
  Hi all!
 
  Is there any way I can bundle all my graphics only using Python and
 Pygame so that the user may not be able to read them out of the program?

 (Changing subject line to more descriptive title)

 Would something like http://www.pygame.org/pcr/image2py/index.php apply
 to your problem?




 --
 Diliup Gabadamudalige

 http://www.diliupg.com
 http://soft.diliupg.com/


 **
 This e-mail is confidential. It may also be legally privileged. If you are
 not the intended recipient or have received it in error, please delete it
 and all copies from your system and notify the sender immediately by return
 e-mail. Any unauthorized reading, reproducing, printing or further
 dissemination of this e-mail or its contents is strictly prohibited and may
 be unlawful. Internet communications cannot be guaranteed to be timely,
 secure, error or virus-free. The sender does not accept liability for any
 errors or omissions.

 **




-- 
Diliup Gabadamudalige

http://www.diliupg.com
http://soft.diliupg.com/

**
This e-mail is confidential. It may also be legally privileged. If you are
not the intended recipient or have received it in error, please delete it
and all copies from your system and notify the sender immediately by return
e-mail. Any unauthorized reading, reproducing, printing or further
dissemination of this e-mail or its contents is strictly prohibited and may
be unlawful. Internet communications cannot be guaranteed to be timely,
secure, error or virus-free. The sender does not accept liability for any
errors or omissions.
**

Author: Diliup Gabadamudalige. dili...@gmail.com

Copyright: If you wish to use this code please keep this multiline comment,
   along with function source. Thank you.

read the files in the current directory and get all files except ones in the 
exempt list or directories..
Get the file extension.
and convert them by using maketrans without file extensions.
When converting from original files with file extensions, remove the file 
extension(with the .), reverse it and add it to the begining of the filename.
encode the file.
add new file ext @lm.
eg: file name - picture.tiff - ffit.picture -AFKDiO$1#mL@lm.
encoded files added to a directory coded which is created if not exist.
decoded files added to a directory decoded which is created if not exist.

path = your path where the files are
run = True - encode
run = False - decode


import os
import string
import base64
from master_vars import alpha, coder

def main(path, code = None, ex = [.wpr, .wpu, .py, .pyc, .@lm]):

getfiles = []
path = path
code = code  #
exclude = ex
items = os.listdir(path)

if code:  # if code = True then encode
mode = encode
if not os.path.exists(coded):
os.makedirs(coded)

else:  # else decode
mode = decode
## if decode mode and coded folder does not exist exit program
if not os.path.exists(coded):
print nothing to decode.

elif not os.path.exists(decoded) and os.path.exists(coded):
os.makedirs(decoded)
elif os.path.exists(decoded):
items = os.listdir(path + \\ + coded)

## get the names of the files in the path which are not in the exclude list
## encode or decode either way this works correct
for n in items:
if code:
fpath = path + \\ + n
if  os.path.isfile(fpath):  # check if file is not a directory
if n[n.index(.):] not in exclude:
getfiles.append(n)
else:
fpath = path + \\coded\\ + n
if n.endswith(.@lm):  # get only 

Re: [Tutor] Fwd: Embedding resources

2014-08-20 Thread Danny Yoo
On Wed, Aug 20, 2014 at 6:45 AM, diliup gabadamudalige
dili...@gmail.com wrote:
 Hi Danny!

 The routine works fine and so does this one.

 http://www.pygame.org/pcr/zipshow/index.php

 The only problem with all these are that that the time taken to read these
 files and to either make a list or send to screen is WAY TOO LONG.
 The only one that works without much delay is in the file I have attached.

Hi Dilliup,

You'll probably want to contact the PyGame community to get more
specialized help on this one then. I suspect that this is a common
problem that the PyGame folks there have encountered (and hopefully
solved!).

The problem of including resources in packaged programs, in a way
that's resistant to outside peeking, is specialized enough that Tutor
is probably not the most effective place to ask.

You can talk to them from the links here:

http://pygame.org/wiki/info

Good luck!
___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
https://mail.python.org/mailman/listinfo/tutor