mirror of
https://github.com/nikdoof/tvorganise.git
synced 2025-12-13 06:42:16 +00:00
Fix logger issues, renamed path formatting names
This commit is contained in:
@@ -1,6 +1,6 @@
|
|||||||
[main]
|
[main]
|
||||||
# Target directory
|
# Target directory
|
||||||
target_path: /mnt/vault/video/TV Shows/%(file_showname)s/Season %(seasno)s/
|
target_path: /mnt/vault/video/TV Shows/%(showname)s/Season %(seasonnum)s/
|
||||||
|
|
||||||
[regex]
|
[regex]
|
||||||
# Replacement strings used within regexs.
|
# Replacement strings used within regexs.
|
||||||
|
|||||||
@@ -62,7 +62,6 @@ class TvOrganiser():
|
|||||||
"""
|
"""
|
||||||
if not hasattr(self, "__logger"):
|
if not hasattr(self, "__logger"):
|
||||||
self.__logger = logging.getLogger(self.__class__.__name__)
|
self.__logger = logging.getLogger(self.__class__.__name__)
|
||||||
self.__logger.addHandler(logging.StreamHandler())
|
|
||||||
return self.__logger
|
return self.__logger
|
||||||
|
|
||||||
def _get_config(self, cfile):
|
def _get_config(self, cfile):
|
||||||
@@ -101,9 +100,10 @@ class TvOrganiser():
|
|||||||
self._config = config
|
self._config = config
|
||||||
return config
|
return config
|
||||||
|
|
||||||
def process(self, names):
|
def parse_filenames(self, names):
|
||||||
"""
|
"""
|
||||||
Takes list of names, runs them though the regexs
|
Takes list of names, runs them though the regexs and breaks them down
|
||||||
|
into logical information.
|
||||||
"""
|
"""
|
||||||
episodelist = []
|
episodelist = []
|
||||||
for efile in names:
|
for efile in names:
|
||||||
@@ -129,12 +129,12 @@ class TvOrganiser():
|
|||||||
self._logger.debug("Seas:", seasno)
|
self._logger.debug("Seas:", seasno)
|
||||||
self._logger.debug("Ep:", epno)
|
self._logger.debug("Ep:", epno)
|
||||||
|
|
||||||
episodelist.append({'file_showname': showname,
|
episodelist.append({'showname': showname,
|
||||||
'seasno': seasno,
|
'seasonnum': seasno,
|
||||||
'epno': epno,
|
'episodenum': epno,
|
||||||
'filepath': filepath,
|
'filepath': filepath,
|
||||||
'filename': filename,
|
'filename': filename,
|
||||||
'epname': epname,
|
'episodename': epname,
|
||||||
'ext': ext})
|
'ext': ext})
|
||||||
break # Matched - to the next file!
|
break # Matched - to the next file!
|
||||||
else:
|
else:
|
||||||
@@ -170,7 +170,7 @@ class TvOrganiser():
|
|||||||
sys.exit(1)
|
sys.exit(1)
|
||||||
|
|
||||||
files = find_files(args)
|
files = find_files(args)
|
||||||
files = self.process(files)
|
files = self.parse_filenames(files)
|
||||||
|
|
||||||
self._logger.debug(files)
|
self._logger.debug(files)
|
||||||
|
|
||||||
@@ -212,5 +212,10 @@ class TvOrganiser():
|
|||||||
self._logger.warning("Skipping file: %s" % filename)
|
self._logger.warning("Skipping file: %s" % filename)
|
||||||
|
|
||||||
def main():
|
def main():
|
||||||
|
logging.basicConfig(format="%(name)s:%(levelname)s: %(message)s")
|
||||||
|
|
||||||
t = TvOrganiser()
|
t = TvOrganiser()
|
||||||
t.main()
|
t.main()
|
||||||
|
|
||||||
|
if __name__ == '__main__':
|
||||||
|
main()
|
||||||
|
|||||||
Reference in New Issue
Block a user