mirror of
https://github.com/nikdoof/tvorganise.git
synced 2025-12-13 06:42:16 +00:00
Cleaned up logging output
This commit is contained in:
@@ -192,30 +192,34 @@ class TvOrganiser():
|
|||||||
if not os.path.exists(newpath):
|
if not os.path.exists(newpath):
|
||||||
os.makedirs(newpath)
|
os.makedirs(newpath)
|
||||||
if os.path.exists(newfile):
|
if os.path.exists(newfile):
|
||||||
self._logger.warning("[!] File already exists, not copying")
|
self._logger.warning("File already exists, not copying")
|
||||||
else:
|
else:
|
||||||
if same_partition(oldfile, newpath):
|
if same_partition(oldfile, newpath):
|
||||||
self._logger.info("[*] Moving file")
|
self._logger.info("Moving file")
|
||||||
try:
|
try:
|
||||||
os.rename(oldfile, newfile)
|
os.rename(oldfile, newfile)
|
||||||
except OSError, errormsg:
|
except OSError, errormsg:
|
||||||
self._logger.error("[!] Error moving file! %s" % (errormsg))
|
self._logger.error("Error moving file! %s" % (errormsg))
|
||||||
else:
|
else:
|
||||||
self._logger.info("[*] Copying file")
|
self._logger.info("Copying file")
|
||||||
try:
|
try:
|
||||||
shutil.copy(oldfile, newfile)
|
shutil.copy(oldfile, newfile)
|
||||||
except IOError, errormsg:
|
except IOError, errormsg:
|
||||||
self._logger.error("[!] Error copying file! %s" % (errormsg))
|
self._logger.error("Error copying file! %s" % (errormsg))
|
||||||
else:
|
else:
|
||||||
self._logger.info("[*] ..done")
|
self._logger.info("done")
|
||||||
else:
|
else:
|
||||||
self._logger.warning("Skipping file: %s" % filename)
|
self._logger.warning("Skipping file: %s" % filename)
|
||||||
|
|
||||||
def main():
|
def main():
|
||||||
|
"""
|
||||||
|
Start a stand alone instance of TvOrganise
|
||||||
|
"""
|
||||||
|
|
||||||
logging.basicConfig(format="%(name)s:%(levelname)s: %(message)s")
|
logging.basicConfig(format="%(name)s:%(levelname)s: %(message)s")
|
||||||
|
|
||||||
t = TvOrganiser()
|
tvorg = TvOrganiser()
|
||||||
t.main()
|
tvorg.main()
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
main()
|
main()
|
||||||
|
|||||||
Reference in New Issue
Block a user