|
|
@ -7,7 +7,7 @@
|
|
|
|
#
|
|
|
|
#
|
|
|
|
# (c) 2005 Leo Franchi <lfranchi@gmail.com>
|
|
|
|
# (c) 2005 Leo Franchi <lfranchi@gmail.com>
|
|
|
|
#
|
|
|
|
#
|
|
|
|
# Depends on: Python 2.2, PyQt
|
|
|
|
# Depends on: Python 3, PyTQt
|
|
|
|
############################################################################
|
|
|
|
############################################################################
|
|
|
|
#
|
|
|
|
#
|
|
|
|
# This program is free software; you can redistribute it and/or modify
|
|
|
|
# This program is free software; you can redistribute it and/or modify
|
|
|
@ -17,7 +17,7 @@
|
|
|
|
#
|
|
|
|
#
|
|
|
|
############################################################################
|
|
|
|
############################################################################
|
|
|
|
|
|
|
|
|
|
|
|
import ConfigParser
|
|
|
|
import configparser
|
|
|
|
import os
|
|
|
|
import os
|
|
|
|
import sys
|
|
|
|
import sys
|
|
|
|
import threading
|
|
|
|
import threading
|
|
|
@ -25,9 +25,9 @@ import signal
|
|
|
|
from time import sleep
|
|
|
|
from time import sleep
|
|
|
|
|
|
|
|
|
|
|
|
try:
|
|
|
|
try:
|
|
|
|
from qt import *
|
|
|
|
from TQt.qt import *
|
|
|
|
except:
|
|
|
|
except:
|
|
|
|
os.popen( "kdialog --sorry 'PyQt (Qt bindings for Python) is required for this script.'" )
|
|
|
|
os.popen( "kdialog --sorry 'PyTQt (TQt bindings for Python) is required for this script.'" )
|
|
|
|
raise
|
|
|
|
raise
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@ -35,34 +35,34 @@ except:
|
|
|
|
debug_prefix = "LiveCD Remastering"
|
|
|
|
debug_prefix = "LiveCD Remastering"
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
class ConfigDialog ( QDialog ):
|
|
|
|
class ConfigDialog ( TQDialog ):
|
|
|
|
""" Configuration widget """
|
|
|
|
""" Configuration widget """
|
|
|
|
|
|
|
|
|
|
|
|
def __init__( self ):
|
|
|
|
def __init__( self ):
|
|
|
|
QDialog.__init__( self )
|
|
|
|
TQDialog.__init__( self )
|
|
|
|
self.setWFlags( Qt.WDestructiveClose )
|
|
|
|
self.setWFlags( TQt.WDestructiveClose )
|
|
|
|
self.setCaption("Amarok Live! Configuration")
|
|
|
|
self.setCaption("Amarok Live! Configuration")
|
|
|
|
|
|
|
|
|
|
|
|
self.lay = QGridLayout( self, 3, 2)
|
|
|
|
self.lay = TQGridLayout( self, 3, 2)
|
|
|
|
|
|
|
|
|
|
|
|
self.lay.addColSpacing( 0, 300 )
|
|
|
|
self.lay.addColSpacing( 0, 300 )
|
|
|
|
|
|
|
|
|
|
|
|
self.isopath = QLineEdit( self )
|
|
|
|
self.isopath = TQLineEdit( self )
|
|
|
|
self.isopath.setText( "Path to Amarok Live! iso" )
|
|
|
|
self.isopath.setText( "Path to Amarok Live! iso" )
|
|
|
|
self.tmppath = QLineEdit( self )
|
|
|
|
self.tmppath = TQLineEdit( self )
|
|
|
|
self.tmppath.setText( "Temporary directory used, 2.5gb free needed" )
|
|
|
|
self.tmppath.setText( "Temporary directory used, 2.5gb free needed" )
|
|
|
|
|
|
|
|
|
|
|
|
self.lay.addWidget( self.isopath, 0, 0 )
|
|
|
|
self.lay.addWidget( self.isopath, 0, 0 )
|
|
|
|
self.lay.addWidget( self.tmppath, 1, 0 )
|
|
|
|
self.lay.addWidget( self.tmppath, 1, 0 )
|
|
|
|
|
|
|
|
|
|
|
|
self.isobutton = QPushButton( self )
|
|
|
|
self.isobutton = TQPushButton( self )
|
|
|
|
self.isobutton.setText("Browse..." )
|
|
|
|
self.isobutton.setText("Browse..." )
|
|
|
|
self.tmpbutton = QPushButton( self )
|
|
|
|
self.tmpbutton = TQPushButton( self )
|
|
|
|
self.tmpbutton.setText("Browse..." )
|
|
|
|
self.tmpbutton.setText("Browse..." )
|
|
|
|
|
|
|
|
|
|
|
|
self.cancel = QPushButton( self )
|
|
|
|
self.cancel = TQPushButton( self )
|
|
|
|
self.cancel.setText( "Cancel" )
|
|
|
|
self.cancel.setText( "Cancel" )
|
|
|
|
self.ok = QPushButton( self )
|
|
|
|
self.ok = TQPushButton( self )
|
|
|
|
self.ok.setText( "Ok" )
|
|
|
|
self.ok.setText( "Ok" )
|
|
|
|
|
|
|
|
|
|
|
|
self.lay.addWidget( self.isobutton, 0, 1 )
|
|
|
|
self.lay.addWidget( self.isobutton, 0, 1 )
|
|
|
@ -82,7 +82,7 @@ class ConfigDialog ( QDialog ):
|
|
|
|
|
|
|
|
|
|
|
|
path = None
|
|
|
|
path = None
|
|
|
|
try:
|
|
|
|
try:
|
|
|
|
config = ConfigParser.ConfigParser()
|
|
|
|
config = configparser.ConfigParser()
|
|
|
|
config.read( "remasterrc" )
|
|
|
|
config.read( "remasterrc" )
|
|
|
|
path = config.get( "General", "path" )
|
|
|
|
path = config.get( "General", "path" )
|
|
|
|
iso = config.get( "General", "iso")
|
|
|
|
iso = config.get( "General", "iso")
|
|
|
@ -97,7 +97,7 @@ class ConfigDialog ( QDialog ):
|
|
|
|
def save( self ):
|
|
|
|
def save( self ):
|
|
|
|
""" Saves configuration to file """
|
|
|
|
""" Saves configuration to file """
|
|
|
|
self.file = file( "remasterrc", 'w' )
|
|
|
|
self.file = file( "remasterrc", 'w' )
|
|
|
|
self.config = ConfigParser.ConfigParser()
|
|
|
|
self.config = configparser.ConfigParser()
|
|
|
|
self.config.add_section( "General" )
|
|
|
|
self.config.add_section( "General" )
|
|
|
|
self.config.set( "General", "path", self.tmppath.text() )
|
|
|
|
self.config.set( "General", "path", self.tmppath.text() )
|
|
|
|
self.config.set( "General", "iso", self.isopath.text() )
|
|
|
|
self.config.set( "General", "iso", self.isopath.text() )
|
|
|
@ -109,7 +109,7 @@ class ConfigDialog ( QDialog ):
|
|
|
|
def clear():
|
|
|
|
def clear():
|
|
|
|
|
|
|
|
|
|
|
|
self.file = file( "remasterrc", 'w' )
|
|
|
|
self.file = file( "remasterrc", 'w' )
|
|
|
|
self.config = ConfigParser.ConfigParser()
|
|
|
|
self.config = configparser.ConfigParser()
|
|
|
|
self.config.add_section( "General" )
|
|
|
|
self.config.add_section( "General" )
|
|
|
|
self.config.set( "General", "path", "" )
|
|
|
|
self.config.set( "General", "path", "" )
|
|
|
|
self.config.set( "General", "iso", "" )
|
|
|
|
self.config.set( "General", "iso", "" )
|
|
|
@ -118,7 +118,7 @@ class ConfigDialog ( QDialog ):
|
|
|
|
|
|
|
|
|
|
|
|
def browseISO( self ):
|
|
|
|
def browseISO( self ):
|
|
|
|
|
|
|
|
|
|
|
|
path = QFileDialog.getOpenFileName( "/home",
|
|
|
|
path = TQFileDialog.getOpenFileName( "/home",
|
|
|
|
"CD Images (*.iso)",
|
|
|
|
"CD Images (*.iso)",
|
|
|
|
self,
|
|
|
|
self,
|
|
|
|
"iso choose dialogr",
|
|
|
|
"iso choose dialogr",
|
|
|
@ -127,7 +127,7 @@ class ConfigDialog ( QDialog ):
|
|
|
|
|
|
|
|
|
|
|
|
def browsePath( self ):
|
|
|
|
def browsePath( self ):
|
|
|
|
|
|
|
|
|
|
|
|
tmp = QFileDialog.getExistingDirectory( "/home",
|
|
|
|
tmp = TQFileDialog.getExistingDirectory( "/home",
|
|
|
|
self,
|
|
|
|
self,
|
|
|
|
"get tmp dir",
|
|
|
|
"get tmp dir",
|
|
|
|
"Choose working directory",
|
|
|
|
"Choose working directory",
|
|
|
@ -147,7 +147,7 @@ class ConfigDialog ( QDialog ):
|
|
|
|
path, iso = self.readConfig()
|
|
|
|
path, iso = self.readConfig()
|
|
|
|
os.system("tdesu -t sh %s/amarok.live.remaster.part1.sh %s %s" % (scriptdir, path, iso))
|
|
|
|
os.system("tdesu -t sh %s/amarok.live.remaster.part1.sh %s %s" % (scriptdir, path, iso))
|
|
|
|
#os.wait()
|
|
|
|
#os.wait()
|
|
|
|
print "got path: %s" % path
|
|
|
|
print("got path: %s" % path)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@ -156,7 +156,7 @@ class ConfigDialog ( QDialog ):
|
|
|
|
path = ""
|
|
|
|
path = ""
|
|
|
|
iso = ""
|
|
|
|
iso = ""
|
|
|
|
try:
|
|
|
|
try:
|
|
|
|
config = ConfigParser.ConfigParser()
|
|
|
|
config = configparser.ConfigParser()
|
|
|
|
config.read("remasterrc")
|
|
|
|
config.read("remasterrc")
|
|
|
|
path = config.get("General", "path")
|
|
|
|
path = config.get("General", "path")
|
|
|
|
iso = config.get("General", "iso")
|
|
|
|
iso = config.get("General", "iso")
|
|
|
@ -166,19 +166,18 @@ class ConfigDialog ( QDialog ):
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
class Notification( QCustomEvent ):
|
|
|
|
class Notification( TQCustomEvent ):
|
|
|
|
__super_init = QCustomEvent.__init__
|
|
|
|
__super_init = TQCustomEvent.__init__
|
|
|
|
def __init__( self, str ):
|
|
|
|
def __init__( self, str ):
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
self.__super_init(TQCustomEvent.User + 1)
|
|
|
|
|
|
|
|
self.eventStr = str
|
|
|
|
|
|
|
|
|
|
|
|
self.__super_init(QCustomEvent.User + 1)
|
|
|
|
class Remasterer( TQApplication ):
|
|
|
|
self.string = str
|
|
|
|
""" The main application, also sets up the TQt event loop """
|
|
|
|
|
|
|
|
|
|
|
|
class Remasterer( QApplication ):
|
|
|
|
|
|
|
|
""" The main application, also sets up the Qt event loop """
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def __init__( self, args ):
|
|
|
|
def __init__( self, args ):
|
|
|
|
QApplication.__init__( self, args )
|
|
|
|
TQApplication.__init__( self, args )
|
|
|
|
debug( "Started." )
|
|
|
|
debug( "Started." )
|
|
|
|
|
|
|
|
|
|
|
|
# Start separate thread for reading data from stdin
|
|
|
|
# Start separate thread for reading data from stdin
|
|
|
@ -187,7 +186,6 @@ class Remasterer( QApplication ):
|
|
|
|
|
|
|
|
|
|
|
|
self.readSettings()
|
|
|
|
self.readSettings()
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
# ugly hack, thanks mp8 anyway
|
|
|
|
# ugly hack, thanks mp8 anyway
|
|
|
|
os.system("dcop amarok script removeCustomMenuItem \"Amarok live\" \"Add playlist to livecd\"")
|
|
|
|
os.system("dcop amarok script removeCustomMenuItem \"Amarok live\" \"Add playlist to livecd\"")
|
|
|
|
os.system("dcop amarok script removeCustomMenuItem \"Amarok live\" \"Add selected to livecd\"")
|
|
|
|
os.system("dcop amarok script removeCustomMenuItem \"Amarok live\" \"Add selected to livecd\"")
|
|
|
@ -234,22 +232,22 @@ class Remasterer( QApplication ):
|
|
|
|
def customEvent( self, notification ):
|
|
|
|
def customEvent( self, notification ):
|
|
|
|
""" Handles notifications """
|
|
|
|
""" Handles notifications """
|
|
|
|
|
|
|
|
|
|
|
|
string = QString(notification.string)
|
|
|
|
eventStr = TQString(notification.eventStr)
|
|
|
|
debug( "Received notification: " + str( string ) )
|
|
|
|
debug( "Received notification: " + str( eventStr ) )
|
|
|
|
|
|
|
|
|
|
|
|
if string.contains( "configure" ):
|
|
|
|
if eventStr.contains( "configure" ):
|
|
|
|
self.configure()
|
|
|
|
self.configure()
|
|
|
|
if string.contains( "stop"):
|
|
|
|
if eventStr.contains( "stop" ):
|
|
|
|
self.stop()
|
|
|
|
self.stop()
|
|
|
|
|
|
|
|
|
|
|
|
elif string.contains( "customMenuClicked" ):
|
|
|
|
elif eventStr.contains( "customMenuClicked" ):
|
|
|
|
if "selected" in string:
|
|
|
|
if eventStr.contains( "selected" ):
|
|
|
|
self.copyTrack( string )
|
|
|
|
self.copyTrack( eventStr )
|
|
|
|
elif "playlist" in string:
|
|
|
|
elif eventStr.contains( "playlist" ):
|
|
|
|
self.copyPlaylist()
|
|
|
|
self.copyPlaylist()
|
|
|
|
elif "Create" in string:
|
|
|
|
elif eventStr.contains( "Create" ):
|
|
|
|
self.createCD()
|
|
|
|
self.createCD()
|
|
|
|
elif "Clear" in string:
|
|
|
|
elif eventStr.contains( "Clear" ):
|
|
|
|
self.clearCD()
|
|
|
|
self.clearCD()
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@ -297,7 +295,7 @@ class Remasterer( QApplication ):
|
|
|
|
os.system("dcop amarok playlist saveM3u '%s' false" % tmpfileloc)
|
|
|
|
os.system("dcop amarok playlist saveM3u '%s' false" % tmpfileloc)
|
|
|
|
tmpfile = open(tmpfileloc)
|
|
|
|
tmpfile = open(tmpfileloc)
|
|
|
|
|
|
|
|
|
|
|
|
import urllib
|
|
|
|
import urllib.request, urllib.parse, urllib.error
|
|
|
|
|
|
|
|
|
|
|
|
files = ""
|
|
|
|
files = ""
|
|
|
|
m3u = ""
|
|
|
|
m3u = ""
|
|
|
@ -310,7 +308,7 @@ class Remasterer( QApplication ):
|
|
|
|
name = line.split("/")[-1]
|
|
|
|
name = line.split("/")[-1]
|
|
|
|
|
|
|
|
|
|
|
|
#make url
|
|
|
|
#make url
|
|
|
|
url = "file://" + urllib.quote(line)
|
|
|
|
url = "file://" + urllib.parse.quote(line)
|
|
|
|
|
|
|
|
|
|
|
|
#make path on livecd
|
|
|
|
#make path on livecd
|
|
|
|
livecdpath = "/music/" + name
|
|
|
|
livecdpath = "/music/" + name
|
|
|
@ -394,7 +392,7 @@ def onSignal( signum, stackframe ):
|
|
|
|
fd.write( "stopping")
|
|
|
|
fd.write( "stopping")
|
|
|
|
fd.close()
|
|
|
|
fd.close()
|
|
|
|
|
|
|
|
|
|
|
|
print 'STOPPING'
|
|
|
|
print('STOPPING')
|
|
|
|
|
|
|
|
|
|
|
|
os.system("dcop amarok script removeCustomMenuItem \"Amarok live\" \"Add playlist to livecd\"")
|
|
|
|
os.system("dcop amarok script removeCustomMenuItem \"Amarok live\" \"Add playlist to livecd\"")
|
|
|
|
os.system("dcop amarok script removeCustomMenuItem \"Amarok live\" \"Add selected to livecd\"")
|
|
|
|
os.system("dcop amarok script removeCustomMenuItem \"Amarok live\" \"Add selected to livecd\"")
|
|
|
@ -405,7 +403,7 @@ def onSignal( signum, stackframe ):
|
|
|
|
def debug( message ):
|
|
|
|
def debug( message ):
|
|
|
|
""" Prints debug message to stdout """
|
|
|
|
""" Prints debug message to stdout """
|
|
|
|
|
|
|
|
|
|
|
|
print debug_prefix + " " + message
|
|
|
|
print(debug_prefix + " " + message)
|
|
|
|
|
|
|
|
|
|
|
|
def main():
|
|
|
|
def main():
|
|
|
|
app = Remasterer( sys.argv )
|
|
|
|
app = Remasterer( sys.argv )
|
|
|
@ -420,7 +418,7 @@ if __name__ == "__main__":
|
|
|
|
mainapp = threading.Thread(target=main)
|
|
|
|
mainapp = threading.Thread(target=main)
|
|
|
|
mainapp.start()
|
|
|
|
mainapp.start()
|
|
|
|
signal.signal(15, onSignal)
|
|
|
|
signal.signal(15, onSignal)
|
|
|
|
print signal.getsignal(15)
|
|
|
|
print(signal.getsignal(15))
|
|
|
|
while 1: sleep(120)
|
|
|
|
while 1: sleep(120)
|
|
|
|
|
|
|
|
|
|
|
|
#main( sys.argv )
|
|
|
|
#main( sys.argv )
|
|
|
|