diff --git a/addon.xml b/addon.xml
index 8eebe26..a5e6ab9 100644
--- a/addon.xml
+++ b/addon.xml
@@ -8,26 +8,26 @@
- Regularly deletes old movies, TV show episodes and music videos
-
+ Regularly deletes old movies, TV show episodes and music videos
+
This addon will automatically scan your library for watched movies, TV show episodes and music videos, and delete them from the file system based on numerous critia such as age, rating, free disk space, etc. All these options and more can be configured via the addon's settings. Also make sure you set the correct path to the disk you wish to check for free space, especially when you store your videos on a secondary drive or a network share. Through the settings you can view which videos have been cleaned.
-Beware!
-This addon has the potential to erase your entire video collection! Please make sure you understand exactly what this addon is designed to do before enabling any type of cleaning in the settings. I will not be held responsible for loss of data due to user error.
+[B]Beware![/B]
+This addon has the potential to erase your entire video collection! Please make sure you understand exactly what this addon is designed to do before enabling any type of cleaning in the settings. I will [B]not[/B] be held responsible for loss of data due to user error.
-Originally developed by Andrew 'drewzh' Higginson (xbmcfilecleaner@drewzh.com)
+[I]Originally developed by Andrew 'drewzh' Higginson (xbmcfilecleaner@drewzh.com)[/I]
- Verwijdert regelmatig oude films, afleveringen van TV-series en videoclips
-
+ Verwijdert regelmatig oude films, afleveringen van TV-series en videoclips
+
Deze addon zal automatisch de videobibliotheek scannen op zoek naar bekeken films, afleveringen van TV-series en videoclips, en deze van de harde schijf verwijderen en daarbij letten op verscheidene criteria, zoals leeftijd, cijfer, vrije harde schijfruimte, etc. Al deze opties, en andere, zijn in te stellen via het optiesmenu van de addon. Let er daarbij ook op dat je het juiste pad instelt naar de schijf die je wil gebruiken voor het controleren van de vrije schijfruimte, met name als je videocollectie op een andere harde schijf staat of op een netwerkshare. Via de instellingen kun je tevens bekijken welke video's er opgeschoond zijn.
-Waarschuwing!
-Deze addon kan in een keer je hele videocollectie verwijderen! Zorg dat je precies weet wat deze addon doet voor je voor een type video's het opschonen activeert in de opties. Ik ben niet verantwoordelijk voor verlies van gegevens door handelen van de gebruiker.
+[B]Waarschuwing![/B]
+Deze addon kan in een keer je hele videocollectie verwijderen! Zorg dat je precies weet wat deze addon doet voor je voor een type video's het opschonen activeert in de opties. Ik ben [B]niet[/B] verantwoordelijk voor verlies van gegevens door handelen van de gebruiker.
-Oorspronkelijk ontwikkeld door Andrew 'drewzh' Higginson (xbmcfilecleaner@drewzh.com)
+[I]Oorspronkelijk ontwikkeld door Andrew 'drewzh' Higginson (xbmcfilecleaner@drewzh.com)[/I]
- It is recommended to not delete videos permanently until you are familiar with all of the settings.
- Het is verstandig om videos pas permanent te verwijderen als je bekend bent met alle instellingen.
+ It is recommended to not delete videos permanently until you are familiar with all of the settings.
+ Het is verstandig om videos pas permanent te verwijderen als je bekend bent met alle instellingen.
all
GNU GENERAL PUBLIC LICENSE. Version 3, 29 June 2007
@@ -40,109 +40,6 @@ Oorspronkelijk ontwikkeld door Andrew 'drewzh' Higginson (xbmcfilecleaner@drewzh
- [NEW] Krypton compatibility
- [NEW] Clean files that are not hard linked (mainly for seeding torrents)
- [NEW] Allow more excluded paths
-
-[B][I]Version 4.2.1[/I][/B]
-- [NEW] Improve exclusion checking by offloading to Kodi via JSON-RPC
-- [FIX] Monitoring issues with running as service
-- [FIX] Showing dialog with titles containing unicode characters
-
-[B][I]Version 4.2.0[/I][/B]
-- [NEW] Jarvis compatibility
-- [NEW] Kodi File Cleaner is now known as Janitor
-- [NEW] Manual cleaning now features a progress dialog that can be used to interrupt cleaning
-- [FIX] Kodi library was not being cleaned after Janitor finished cleaning
-
-[B][I]Version 4.1.0[/I][/B]
-- [NEW] Helix compatibility
-- [NEW] Show information dialogs when errors occur
-- [NEW] Change name to Kodi File Cleaner
-- [NEW] Kodi library cleaning occurs silently
-- [NEW] Allow users to reset excluded paths by pressing a button
-- [FIX] Fall back to copy and delete in case of permission problems
-- [FIX] Log file was not being created automatically
-
-[B][I]Version 4.0.1[/I][/B]
-- [NEW] Specify whether to clean up or view log on manual run
-- [FIX] A memory leak could occur when the user enabled deleting empty folders
-- [FIX] Disabling the addon froze XBMC completely
-- [FIX] Video library was not being cleaned up afterwards
-
-[B][I]Version 4.0.0[/I][/B]
-- [NEW] Gotham compatibility
-- [NEW] Start addon manually
-- [NEW] Allow disabling the service
-- [NEW] Log file viewer (accessible from settings)
-- [NEW] Support for stacked movies (does not include DVD folder structures, e.g. VIDEO_TS)
-- [NEW] Polish translation (thanks struart)
-
-- [FIX] Subtitles with language codes were not cleaned
-- [FIX] Changed localizations to use the new PO structure
-- [FIX] Increased the maximum allowed scan interval
-- [FIX] Videos are now moved by default instead of deleted, to prevent loss of data
-- [FIX] Improved support for unicode filenames
-
-[B][I]Version 3.2.1[/I][/B]
-- [FIX] Related files were not being cleaned
-
-[B][I]Version 3.2.0[/I][/B]
-- [NEW] Clean related files with similar names (e.g. subtitles) (thanks WoLpH)
-
-[B][I]Version 3.1.0[/I][/B]
-- [NEW] Exclude up to three file paths from being cleaned
-
-[B][I]Version 3.0.2[/I][/B]
-- [FIX] Filenames with non-ASCII characters were not being cleaned
-
-[B][I]Version 3.0.1[/I][/B]
-- [FIX] Setting a different locale broke the addon
-
-[B][I]Version 3.0.0[/I][/B]
-- [NEW] Frodo compatibility
-- [NEW] Music videos support (please use TheAudioDB.com scraper)
-- [NEW] Only clean while not playing video
-- [NEW] Do not clean videos that are in progress
-- [NEW] Do not clean during video playback
-- [NEW] Hide notifications during video playback
-- [NEW] Delete the parent folder of the file being cleaned, if that folder becomes empty (configurable)
-- [NEW] No more individual notifications, but a summary instead (see logs for more details)
-- [NEW] JSON-RPC is used to find watched videos (backward compatibility with Eden is effectively lost)
-- [FIX] Redesigned addon settings
-
-[B][I]Version 2.0.0[/I][/B]
-- [NEW] Eden compatibility
-- [NEW] Addon now runs as a service
-- [NEW] Dutch language support
-- [NEW] Set delayed start
-- [NEW] Set scan interval
-- [FIX] Totally revamped the settings page
-- [FIX] Removed obsolete setting to delete files after x days in the holding folder
-- [FIX] Users could not disable expiration checks
-- [FIX] Disk space checks did not work on Windows
-- [FIX] Enhanced queries used to select files to be deleted
-- [FIX] Updated text strings
-- [FIX] More more descriptive notifications and logging
-
-[B][I]Version 1.3.5[/I][/B]
-- [FIX] Various bug fixes
-
-[B][I]Version 1.2.0[/I][/B]
-- [NEW] Delete based on rating
-- [NEW] Move videos to holding folder instead of deleting
-- [FIX] Code cleanup
-
-[B][I]Version 1.1.2[/I][/B]
-- [FIX] Adhere to file naming conventions
-- [FIX] Updated contact details
-- [FIX] Fixed autoStart method call
-
-[B][I]Version 1.1.0[/I][/B]
-- [FIX] Almost entire rewrite of script
-- [FIX] Created service loop instead of relying on AlarmClock
-- [FIX] Setting changes will now be detected by the running service
-- [FIX] Removed 'delete only if watched' option and instead will ONLY delete watched files
-
-[B][I]Version 1.0.0[/I][/B]
-- [NEW] Intial version
resources/icon.png
diff --git a/changelog.txt b/changelog.txt
new file mode 100644
index 0000000..c6e281d
--- /dev/null
+++ b/changelog.txt
@@ -0,0 +1,107 @@
+[B][I]Version 4.2.1[/I][/B]
+- [NEW] Krypton compatibility
+- [NEW] Clean files that are not hard linked (mainly for seeding torrents)
+- [NEW] Allow more excluded paths
+
+[B][I]Version 4.2.1[/I][/B]
+- [NEW] Improve exclusion checking by offloading to Kodi via JSON-RPC
+- [FIX] Monitoring issues with running as service
+- [FIX] Showing dialog with titles containing unicode characters
+
+[B][I]Version 4.2.0[/I][/B]
+- [NEW] Jarvis compatibility
+- [NEW] Kodi File Cleaner is now known as Janitor
+- [NEW] Manual cleaning now features a progress dialog that can be used to interrupt cleaning
+- [FIX] Kodi library was not being cleaned after Janitor finished cleaning
+
+[B][I]Version 4.1.0[/I][/B]
+- [NEW] Helix compatibility
+- [NEW] Show information dialogs when errors occur
+- [NEW] Change name to Kodi File Cleaner
+- [NEW] Kodi library cleaning occurs silently
+- [NEW] Allow users to reset excluded paths by pressing a button
+- [FIX] Fall back to copy and delete in case of permission problems
+- [FIX] Log file was not being created automatically
+
+[B][I]Version 4.0.1[/I][/B]
+- [NEW] Specify whether to clean up or view log on manual run
+- [FIX] A memory leak could occur when the user enabled deleting empty folders
+- [FIX] Disabling the addon froze XBMC completely
+- [FIX] Video library was not being cleaned up afterwards
+
+[B][I]Version 4.0.0[/I][/B]
+- [NEW] Gotham compatibility
+- [NEW] Start addon manually
+- [NEW] Allow disabling the service
+- [NEW] Log file viewer (accessible from settings)
+- [NEW] Support for stacked movies (does not include DVD folder structures, e.g. VIDEO_TS)
+- [NEW] Polish translation (thanks struart)
+
+- [FIX] Subtitles with language codes were not cleaned
+- [FIX] Changed localizations to use the new PO structure
+- [FIX] Increased the maximum allowed scan interval
+- [FIX] Videos are now moved by default instead of deleted, to prevent loss of data
+- [FIX] Improved support for unicode filenames
+
+[B][I]Version 3.2.1[/I][/B]
+- [FIX] Related files were not being cleaned
+
+[B][I]Version 3.2.0[/I][/B]
+- [NEW] Clean related files with similar names (e.g. subtitles) (thanks WoLpH)
+
+[B][I]Version 3.1.0[/I][/B]
+- [NEW] Exclude up to three file paths from being cleaned
+
+[B][I]Version 3.0.2[/I][/B]
+- [FIX] Filenames with non-ASCII characters were not being cleaned
+
+[B][I]Version 3.0.1[/I][/B]
+- [FIX] Setting a different locale broke the addon
+
+[B][I]Version 3.0.0[/I][/B]
+- [NEW] Frodo compatibility
+- [NEW] Music videos support (please use TheAudioDB.com scraper)
+- [NEW] Only clean while not playing video
+- [NEW] Do not clean videos that are in progress
+- [NEW] Do not clean during video playback
+- [NEW] Hide notifications during video playback
+- [NEW] Delete the parent folder of the file being cleaned, if that folder becomes empty (configurable)
+- [NEW] No more individual notifications, but a summary instead (see logs for more details)
+- [NEW] JSON-RPC is used to find watched videos (backward compatibility with Eden is effectively lost)
+- [FIX] Redesigned addon settings
+
+[B][I]Version 2.0.0[/I][/B]
+- [NEW] Eden compatibility
+- [NEW] Addon now runs as a service
+- [NEW] Dutch language support
+- [NEW] Set delayed start
+- [NEW] Set scan interval
+- [FIX] Totally revamped the settings page
+- [FIX] Removed obsolete setting to delete files after x days in the holding folder
+- [FIX] Users could not disable expiration checks
+- [FIX] Disk space checks did not work on Windows
+- [FIX] Enhanced queries used to select files to be deleted
+- [FIX] Updated text strings
+- [FIX] More more descriptive notifications and logging
+
+[B][I]Version 1.3.5[/I][/B]
+- [FIX] Various bug fixes
+
+[B][I]Version 1.2.0[/I][/B]
+- [NEW] Delete based on rating
+- [NEW] Move videos to holding folder instead of deleting
+- [FIX] Code cleanup
+
+[B][I]Version 1.1.2[/I][/B]
+- [FIX] Adhere to file naming conventions
+- [FIX] Updated contact details
+- [FIX] Fixed autoStart method call
+
+[B][I]Version 1.1.0[/I][/B]
+- [FIX] Almost entire rewrite of script
+- [FIX] Created service loop instead of relying on AlarmClock
+- [FIX] Setting changes will now be detected by the running service
+- [FIX] Removed 'delete only if watched' option and instead will ONLY delete watched files
+
+[B][I]Version 1.0.0[/I][/B]
+- [NEW] Intial version
diff --git a/default.py b/default.py
index c8778d2..7786d93 100644
--- a/default.py
+++ b/default.py
@@ -634,7 +634,7 @@ def has_no_hard_links(self, filename):
if __name__ == "__main__":
if len(sys.argv) > 1 and sys.argv[1] == "log":
- win = LogViewerDialog("DialogLogViewer.xml", ADDON.getAddonInfo("path"))
+ win = LogViewerDialog("JanitorLogViewer.xml", ADDON.getAddonInfo("path"))
win.doModal()
del win
else:
diff --git a/resources/language/English/strings.po b/resources/language/resource.language.en_gb/strings.po
similarity index 99%
rename from resources/language/English/strings.po
rename to resources/language/resource.language.en_gb/strings.po
index 64ed1a0..e02bb26 100644
--- a/resources/language/English/strings.po
+++ b/resources/language/resource.language.en_gb/strings.po
@@ -1,7 +1,7 @@
# XBMC Media Center language file
-# Addon Name: Kodi File Cleaner
-# Addon id: script.filecleaner
-# Addon version: 4.0.0
+# Addon Name: Janitor
+# Addon id: script.service.janitor
+# Addon version: 4.3.0
# Addon Provider: Anthirian, drewzh
msgid ""
msgstr ""
diff --git a/resources/language/Dutch/strings.po b/resources/language/resource.language.nl_nl/strings.po
similarity index 99%
rename from resources/language/Dutch/strings.po
rename to resources/language/resource.language.nl_nl/strings.po
index 015c8de..1e36ea8 100644
--- a/resources/language/Dutch/strings.po
+++ b/resources/language/resource.language.nl_nl/strings.po
@@ -1,7 +1,7 @@
# XBMC Media Center language file
-# Addon Name: Kodi File Cleaner
-# Addon id: script.filecleaner
-# Addon version: 4.0.0
+# Addon Name: Janitor
+# Addon id: script.service.janitor
+# Addon version: 4.3.0
# Addon Provider: Anthirian, drewzh
msgid ""
msgstr ""
diff --git a/resources/language/Polish/strings.po b/resources/language/resource.language.pl_pl/strings.po
similarity index 99%
rename from resources/language/Polish/strings.po
rename to resources/language/resource.language.pl_pl/strings.po
index 49cfe2a..f5c03a4 100644
--- a/resources/language/Polish/strings.po
+++ b/resources/language/resource.language.pl_pl/strings.po
@@ -1,7 +1,7 @@
# XBMC Media Center language file
-# Addon Name: Kodi File Cleaner
-# Addon id: script.filecleaner
-# Addon version: 4.0.0
+# Addon Name: Janitor
+# Addon id: script.service.janitor
+# Addon version: 4.3.0
# Addon Provider: Anthirian, drewzh
msgid ""
msgstr ""
diff --git a/resources/skins/Default/720p/DialogLogViewer.xml b/resources/skins/Default/720p/JanitorLogViewer.xml
similarity index 100%
rename from resources/skins/Default/720p/DialogLogViewer.xml
rename to resources/skins/Default/720p/JanitorLogViewer.xml
diff --git a/resources/skins/Default/skin.xml b/resources/skins/Default/JanitorSkin.xml
similarity index 100%
rename from resources/skins/Default/skin.xml
rename to resources/skins/Default/JanitorSkin.xml
diff --git a/utils.py b/utils.py
index cb35b9c..59fd2da 100644
--- a/utils.py
+++ b/utils.py
@@ -14,7 +14,7 @@
# Addon info
ADDON_ID = "script.service.janitor"
-ADDON = xbmcaddon.Addon(ADDON_ID)
+ADDON = xbmcaddon.Addon()
ADDON_NAME = ADDON.getAddonInfo("name").decode("utf-8")
ADDON_PROFILE = xbmc.translatePath(ADDON.getAddonInfo("profile")).decode("utf-8")
ADDON_ICON = xbmc.translatePath(ADDON.getAddonInfo("icon")).decode("utf-8")
@@ -41,33 +41,29 @@ def prepend(self, data):
try:
debug("Prepending the log file with new data.")
debug("Backing up current log.")
- f = open(self.logpath, "a+") # use append mode to make sure it is created if non-existent
- previous_data = f.read()
+ with open(self.logpath, "a+") as f: # use append mode to make sure it is created if non-existent
+ previous_data = f.read()
except (IOError, OSError) as err:
debug("{0!s}".format(err, xbmc.LOGERROR))
else:
- f.close()
-
try:
debug("Writing new log data.")
- f = open(self.logpath, "w")
- if data:
- f.write("[B][{0!s}][/B]\n".format(time.strftime("%d/%m/%Y - %H:%M:%S")))
- for line in data:
- if isinstance(line, unicode):
- line = line.encode()
- f.write(" - {0!s}\n".format(line))
- f.write("\n")
- debug("New data written to log file.")
- else:
- debug("No data to write. Stopping.")
-
- debug("Appending previous log file contents.")
- f.writelines(previous_data)
+ with open(self.logpath, "w") as f:
+ if data:
+ f.write("[B][{0!s}][/B]\n".format(time.strftime("%d/%m/%Y - %H:%M:%S")))
+ for line in data:
+ if isinstance(line, unicode):
+ line = line.encode()
+ f.write(" - {0!s}\n".format(line))
+ f.write("\n")
+ debug("New data written to log file.")
+ else:
+ debug("No data to write. Stopping.")
+
+ debug("Appending previous log file contents.")
+ f.writelines(previous_data)
except (IOError, OSError) as err:
- debug("%s" % err, xbmc.LOGERROR)
- else:
- f.close()
+ debug("{0!s}".format(err), xbmc.LOGERROR)
def trim(self, lines_to_keep=25):
"""
@@ -80,25 +76,22 @@ def trim(self, lines_to_keep=25):
"""
try:
debug("Trimming log file contents.")
- f = open(self.logpath)
- debug("Saving the top {0!d} lines.".format(lines_to_keep))
- lines = []
- for i in range(lines_to_keep):
- lines.append(f.readline())
+ with open(self.logpath) as f:
+ debug("Saving the top {0!r} lines.".format(lines_to_keep))
+ lines = []
+ for i in range(lines_to_keep):
+ lines.append(f.readline())
except (IOError, OSError) as err:
debug("{0!s}".format(err, xbmc.LOGERROR))
else:
- f.close()
-
try:
debug("Removing all log contents.")
- f = open(self.logpath, "w")
- debug("Restoring saved log contents.")
- f.writelines(lines)
+ with open(self.logpath, "w") as f:
+ debug("Restoring saved log contents.")
+ f.writelines(lines)
except (IOError, OSError) as err:
debug("{0!s}".format(err, xbmc.LOGERROR))
else:
- f.close()
return self.get()
def clear(self):
@@ -110,12 +103,11 @@ def clear(self):
"""
try:
debug("Clearing log file contents.")
- f = open(self.logpath, "r+")
- f.truncate()
+ with open(self.logpath, "r+") as f:
+ f.truncate()
except (IOError, OSError) as err:
debug("{0!s}".format(err, xbmc.LOGERROR))
else:
- f.close()
return self.get()
def get(self):
@@ -127,12 +119,11 @@ def get(self):
"""
try:
debug("Retrieving log file contents.")
- f = open(self.logpath, "a+")
+ with open(self.logpath, "a+") as f:
+ contents = f.read()
except (IOError, OSError) as err:
debug("{0!s}".format(err, xbmc.LOGERROR))
else:
- contents = f.read()
- f.close()
return contents