diff --git a/tagger.py b/comictagger.py similarity index 95% rename from tagger.py rename to comictagger.py index c304b8a..bd34993 100755 --- a/tagger.py +++ b/comictagger.py @@ -28,7 +28,12 @@ import time from pprint import pprint import json -from PyQt4 import QtCore, QtGui +qt_available = True +try: + from PyQt4 import QtCore, QtGui +except ImportError: + qt_available = False + from settings import ComicTaggerSettings from taggerwindow import TaggerWindow @@ -43,6 +48,10 @@ import codecs #----------------------------- def cli_mode( opts, settings ): + if len( opts.file_list ) < 1: + print "You must specify at least one filename. Use the -h option for more info" + return + for f in opts.file_list: if len( opts.file_list ) > 1: print "Processing: ", f @@ -50,8 +59,6 @@ def cli_mode( opts, settings ): def process_file_cli( filename, opts, settings ): - if filename is None: - return ca = ComicArchive(filename) if settings.rar_exe_path != "": @@ -212,7 +219,7 @@ def process_file_cli( filename, opts, settings ): # ok, done building our metadata. time to save #HACK - opts.dryrun = True + #opts.dryrun = True #HACK if not opts.dryrun: @@ -243,8 +250,11 @@ def main(): signal.signal(signal.SIGINT, signal.SIG_DFL) + if not qt_available: + opts.no_gui = True + print "QT is not available. Running in text mode" + if opts.no_gui: - cli_mode( opts, settings ) else: diff --git a/mac/Makefile b/mac/Makefile index 803d22c..315876a 100644 --- a/mac/Makefile +++ b/mac/Makefile @@ -16,7 +16,7 @@ DMG_FILE := $(VOLUME_NAME).dmg all: clean dist diskimage dist: - $(PY2INSTALLER_CMD) $(TAGGER_BASE)/tagger.py -o $(MAC_BASE) -c -n $(APP_NAME) -s + $(PY2INSTALLER_CMD) $(TAGGER_BASE)/comictagger.py -o $(MAC_BASE) -c -n $(APP_NAME) -s cp $(TAGGER_BASE)/*.ui $(APP_BUNDLE)/Contents/MacOS cp -a $(TAGGER_BASE)/graphics $(APP_BUNDLE)/Contents/MacOS cp $(MAC_BASE)/app.icns $(APP_BUNDLE)/Contents/Resources/icon-windowed.icns diff --git a/windows/Makefile b/windows/Makefile index b9d76cc..65992cd 100644 --- a/windows/Makefile +++ b/windows/Makefile @@ -10,7 +10,7 @@ all: clean dist package dist: cd "$(TAGGER_BASE)" & - "C:\Python27\Scripts\cxfreeze.bat" $(TAGGER_BASE)\tagger.py --icon nsis\app.ico + "C:\Python27\Scripts\cxfreeze.bat" $(TAGGER_BASE)\comictagger.py --icon nsis\app.ico #--base-name=Win32GUI cp -R C:\Python27\Lib\site-packages\PyQt4\plugins\imageformats $(DIST_DIR) cp "$(TAGGER_BASE)\UnRAR2\UnRARDLL\unrar.dll" $(DIST_DIR) diff --git a/windows/nsis/comictagger.nsi b/windows/nsis/comictagger.nsi index 63e018b..e3e54c3 100644 --- a/windows/nsis/comictagger.nsi +++ b/windows/nsis/comictagger.nsi @@ -123,11 +123,11 @@ Section "Install Section" SecInstall ;Create shortcuts CreateDirectory "$SMPROGRAMS\$StartMenuFolder" CreateShortCut "$SMPROGRAMS\$StartMenuFolder\Uninstall.lnk" "$INSTDIR\Uninstall.exe" - CreateShortCut "$SMPROGRAMS\$StartMenuFolder\ComicTagger.lnk" "$INSTDIR\tagger.exe" + CreateShortCut "$SMPROGRAMS\$StartMenuFolder\ComicTagger.lnk" "$INSTDIR\comictagger.exe" !insertmacro MUI_STARTMENU_WRITE_END - CreateShortCut "$DESKTOP\ComicTagger.lnk" "$INSTDIR\tagger.exe" "" + CreateShortCut "$DESKTOP\ComicTagger.lnk" "$INSTDIR\comictagger.exe" "" SectionEnd