Page 1 of 1

LMMS Project Packager

Posted: December 25th, 2014, 11:25 pm
by Aristide
'Hi ! I have create a small python application for create LMMS projects package :

→ List all files from project

→ Compact all imported files into ZIP file (in data directory)

→ Update all import directory from projects



Usage : lmmspackager.py project.mmp [projectoutput.zip]




[code]
#!/usr/bin/env python3
# -*- coding:utf-8 -*-

import xml.etree.ElementTree as ET
import os
import zipfile
import sys

print("""LazyOne Software LMMS Project Packager

Code is under GPLV3 license. \
\
""")


if len(sys.argv) < 2:
print("""
USAGE : %s <project File Name (mmp file)> <output zip file>
""" % sys.argv[0])
sys.exit(1)

filein = sys.argv[1]

if len(sys.argv) < 3:
fileout = os.path.basename("".join(filein.split(".")[:-1])) + ".zip"
else:
fileout = sys.argv[2]


if not os.path.isfile(filein):
print("File not found : %s" % (filein))
sys.exit(2)

zipout = zipfile.ZipFile(fileout, "w")


print("Packaging LMMS Project. Please wait ...\
")
print("[INFO] Opening project source ...")


filehandler = open(filein, "r")
dataread = "".join(filehandler.readlines())
filehandler.close()

tree = ET.fromstring(dataread)
#root = tree.getroot()
compressed = list()
notfound = 0
for e in tree.findall("./

Re: LMMS Project Packager

Posted: December 26th, 2014, 12:44 am
by Sti-Jay
Couldn't get it working. Didn't understand where I would place the path name, if path's are even allowed, or if I should add ".mmpz". I am on Windows. Remember on Windows I use \\ in the paths which you can allow by making the string raw

open(r'c:\\tmp\\junkpythonfile','w')

Nice drums in Harry Stead - 01 - Alexander Brandt Wilson Plan Explanation

Re: LMMS Project Packager

Posted: December 26th, 2014, 7:50 am
by Aristide
So, I have test under Windows today. Is not work (into Zip File). I plan to support Windows in some days

So, I have post new update into main post (Fix : Try to zip file is not found). File has not been update into my Freebox for the moment.

So, Script don't generate .mmpz file. mmpz file don't embed external files (.sf2, external ogg files or wav file...). The file generated at the output is .zip. And last filename is optionnal :) You can just type lmmsprojectpackager.py "project.mmp", create a zip named « project.zip ». (So, script don't handle .mmpz for the moment).

Thank's for your feedback and thank's for musics :)

Re: LMMS Project Packager

Posted: December 26th, 2014, 9:54 am
by grejppi
What a coincidence. I've written a similar tool with a very similar name in the same language :3

https://github.com/grejppi/lmmspackager

Feel free to examine it.

Re: LMMS Project Packager

Posted: December 26th, 2014, 7:31 pm
by Aristide
Lolwut ?

Re: LMMS Project Packager

Posted: January 16th, 2015, 8:45 pm
by Aristide
NEW ! I'm working on a GUI for LMMS Packager.

Image

For the moment, only list files from a project :)

Re: LMMS Project Packager

Posted: January 19th, 2015, 8:43 pm
by Sti-Jay
That is really nice!

You know, the whole project could benefit from this. Ideally it should be included in the program itself, but python programs can run on all OS' if you have python installed so this can be a great program for collaborating.

Re: LMMS Project Packager

Posted: January 20th, 2015, 3:29 am
by tresf
You know, the whole project could benefit from this. Ideally it should be included in the program itself, but python programs can run on all OS' if you have python installed so this can be a great program for collaborating.
We'll certainly recommend it as a stop-gap solution (and it can start to set the stage in terms of file extension, structure), but it won't be included in the codebase unless it is ported to QT/C++. I would advise further work on this.is done in a language we can cherry-pick from. :)

-Tres