How-To: Create a portable version of the database builder

GO TO ADMIN PANEL > ADD-ONS AND INSTALL VERTIFORO SIDEBAR TO SEE FORUMS AND SIDEBAR

ashtonaut

New member
Joined
May 14, 2005
Messages
23
Points
0
Hi All,

I don't own an iPod Shuffle (yet), but when I get one I want to be able to use it without iTunes. The iPod Shuffle database builder from Martin Fiedler is perfect for this, allowing drag-and-drop file transfer like most other flash-based mp3 players.

However, this doesn't quite solve the problem completely. In order for the Shuffle to be completely transportable, every Windows computer you want to use the builder on must have a Python interpreter installed (a pain).

So, I set about creating a version that was completely self-contained for use on any Windows machine. Without a website to host the resulting file, I thought I would post the steps I used so others can do it themselves (including any future releases of the database builder). Here's what you need to do this:

[Note: Because I am not an 'established member' I can't post straight URLs to the following resources. I have done my best :)]

1) A Windows Python interpreter (I had Python 2.3):
www DOT python DOT org

2) The Python for Windows Extensions:
pywin32 DOT sourceforge DOT net

3) Gordon McMillan's Python Installer (creates the actual exe):
Google "mcmillan python"

4) The Ultimate Packer for eXecutables (optional):
upx DOT sourceforge DOT net

5) A cool icon for the exe file! I got mine from:
www DOT iconfactory DOT com

6) The Python database builder script rebuild_db.py
shuffle-db DOT sourceforge DOT net

With all this in place, these are the steps to create the exe file. They assume the following (adapt to your situation as required):
- Python is installed to C:\python and this directory is in the Windows path
- UPX (upx.exe) is in C:\python (if you are using it)
- The McMillan Installer is extracted to C:\compiler
- The rebuild_db.py script and the icon file (shuffle.ico in this example) are located in C:\shuffle

1) Open a command prompt and "cd C:\compiler"

2) Run "python Configure.py"

3) Run "python Makespec.py --onefile --noconsole --icon C:\shuffle\shuffle.ico --out C:\shuffle --upx C:\shuffle\rebuild_db.py"
(If you don't have UPX, leave out the "--upx")

4) Run "python Build.py C:\shuffle\rebuild_db.spec"

You should now have a single exe file, C:\shuffle\rebuild_db.exe, with the icon you chose. Put this exe file in the root directory of your Shuffle, and run it (via double-click or command line) each time you want to build the database again. This should work on any Windows machine :).

DISCLAIMERS:
1) I don't have a Shuffle, so I cant 100% guarantee the file works. I have tested it on a dummy Shuffle directory structure, and it worked exactly like the Python script did. [EDIT] I do have a Shuffle, and it works. [/EDIT]
2) I have no idea if this works on older Windows versions, I have XP and it works fine.
3) If you get stuck, the McMillan installer has comprehensive html help included.

I hope this is useful to someone, it has been an interesting learning experience for me personally (I know nothing about Python).

Regards,

Ashton
 
Last edited:

ashtonaut

New member
Joined
May 14, 2005
Messages
23
Points
0
From shuffle-db.sourceforge.net:

The Win32 version is made for Windows users (obviously), and requires no additional installed software to work. Please not that it is not supported any longer and lacks many features. However, you may continue to use it if you don't need all the cool stuff like smart shuffle.
It seems like he is only releasing the new versions as Python scripts.

Ashton
 

Noodlewad

New member
Joined
Jul 16, 2005
Messages
5
Points
0
Age
48
Has anyone else been able to make this work?

I've tried it several times and haven't had any luck. So far my results have been:

Compled to an exe sucessfully but it doens't do anything when run.

Compiled without the --onefile option, which creates a distribution folder, the .exe in there runs without any function as well.

Compiled without the upx, this makes a small .exe which causes a dump and starts drwatson error reporting.

I have confirmed that my rebuild_db.py works and builds a database in the folder I am working in fine.

I have also been able to compile a .exe file using py2exe, but it dosn't package into a single file, it outputs 4 files (python dll, rebuild_db.exe, win32dlls Ithink and a win9x something .exe). This py2exe version works fine, but I'd really like something that is all one file to work.

The only error report I can find is in the following warnrebuild_db.txt file:
W: no module named posix (conditional import by os)
W: no module named org (top-level import by copy)
W: no module named posix (delayed, conditional import by iu)
W: no module named pwd (delayed, conditional import by posixpath)
W: no module named _emx_link (conditional import by os)
W: delayed __import__ hack detected at line 0 - encodings (C:\PYTHON24\lib\encodings\__init__.pyc)
W: __all__ is built strangely at line 0 - re (C:\PYTHON24\lib\re.pyc)
W: __all__ is built strangely at line 0 - dis (C:\PYTHON24\lib\dis.pyc)
W: delayed eval hack detected at line 0 - os (C:\PYTHON24\lib\os.pyc)
W: __all__ is built strangely at line 0 - tokenize (C:\PYTHON24\lib\tokenize.pyc)
W: delayed conditional exec statment detected at line 0 - iu (C:\Python24\Installer\iu.pyc)
W: delayed conditional exec statment detected at line 0 - iu (C:\Python24\Installer\iu.pyc)
W: delayed conditional eval hack detected at line 0 - warnings (C:\PYTHON24\lib\warnings.pyc)
W: delayed conditional __import__ hack detected at line 0 - warnings (C:\PYTHON24\lib\warnings.pyc)

FYI I am using the following versions of the programs listed to install:

installer_5b5_5.zip
python-2.4.1.msi
pywin32-204.win32-py2.4.exe
rebuild_db-0.7-pre1.zip
upx125w.zip



Any help with this would be great.
 

ashtonaut

New member
Joined
May 14, 2005
Messages
23
Points
0
Hey,

When you say it doesn't work, is this on a dummy directory structure or on the actual iPod Shuffle? As I said, I had only tested it on a dummy directory structure, but it should work on the Shuffle also. Also, I haven't tested this with the latest release of the database builder (0.7), only 0.6.

I just yesterday purchased a Shuffle (my first iPod), so over the next few days I will be a) checking the Shuffle works properly with iTunes, b) checking my compiled rebuild_db 0.6 works properly, then c) trying to compile 0.7 and get that to work. I will post back with results when I have done that.

Perhaps 0.7 uses a different command line approach to excecuting the script, requiring the compiled exe to be run with a command line argument? When you say the compiled exe "doesn't work", what do you mean? Is there any log file?

I will check it out, in the meantime see if you can get hold of version 0.6 and see if that works OK - it did fine for me.

Ash
 

Noodlewad

New member
Joined
Jul 16, 2005
Messages
5
Points
0
Age
48
When I say that it doesn't work I mean that it doesn't even generate its usual output log file. The program just doesn't run at all, it actually crashes. It won't work on my shuffe or on the dummy dir structure.

I've had no problems using my compiled version with py2exe, but that version isn't a single file executable unfortunatly.

I tried with version 0.6pre2 and no luck :(

The only error output is what I entered in my last post, the one from the warnrebuild_db.txt That is generated during the python Build.py command.
 

ashtonaut

New member
Joined
May 14, 2005
Messages
23
Points
0
Sorry to hear that still isn't working for you.

I used my pre-compiled 0.6 version on my Shuffle this morning and it worked perfectly. If you would like me to email it to you (it's about 700k), send an email to ashtonaut at hotmail dot com, and I'll send you the copy I compiled. This is a single file version created with the MacMillan installer. I can't think why compiling fails in your case, to be honest its been a while since I compiled it myself so I can't remember the process exactly.

Sometime in the next week I will be attampting to create a standalone version of 0.7pre1, if I get this to work I will post back again so others know it works. I am assuming the process will be identical to that which I have already posted above, I guess there must be something in your configuration or computer setup that is stopping the compiling from working in your case.

Cheers,

Ash
 

ashtonaut

New member
Joined
May 14, 2005
Messages
23
Points
0
Update:

Version 0.7pre1 compiled without errors and runs fine using the steps outlined earlier in the thread. FYI, here are the program versions I was using:

Python 2.3.4
UPX 1.25
McMillan Installer 5 beta 5
Python Win32 Extensions 1.63

BTW... I actually did get all the same warnings you did when compiling in the warnrebuild_db.txt file. They must be just that (warnings), because they didn't cause anything to stop working.
 
Last edited:

Noodlewad

New member
Joined
Jul 16, 2005
Messages
5
Points
0
Age
48
I don't know why I didn't request it before, but using the same versions you did seemed to do the job. I can now compile my own .exe using the following software versions:

Python 2.3.5
UPX 1.25
McMillan Installer 5 beta 5
Python Win32 Extensions 1.63

For some reason Python 2.4 with the appropriate win32 extensions doesn't seem to do the job.

Thanks for your help, I wonder why 2.4 wont work for me. Maybe you could give it a go and see what happens.
 

ashtonaut

New member
Joined
May 14, 2005
Messages
23
Points
0
That's interesting, obviously like you say the Python version and/or the Win32 extensions caused some problem.

What's interesting is that I had exactly the same warning messages as you in the warnrebuild_db.txt file. There must be another log or warning file somewhere that contains some information as to why Python 2.4 didn't work.

Because I know about this much -> . <- about Python (and don't have v2.4), I'm not going to investigate this any further. Perhaps someone with more extensive knowledge can work out what the issue was (or alternatively, just make sure you are using the same software versions as I used). Glad to hear it worked for you eventually!

Regards,

Ash
 

need2know

New member
Joined
Feb 27, 2005
Messages
5
Points
0
Age
73
If anyone is still interested a new version is out. Current version: 1.0-rc1 (2006-04-26)
and you can get it at the above address. It can be built as described by ashtonaut in the first post.
 
Top