diff --git a/delojza.py b/delojza.py
index 50fa677..e4dd1a9 100755
--- a/delojza.py
+++ b/delojza.py
@@ -156,6 +156,7 @@ class DelojzaBot:
id3.add(mutagen.id3.TPE1(encoding=3, text=artist))
id3.save()
+ # noinspection PyUnusedLocal
def download_ytdl(self, urls, out_path, date, message, audio=False, filename=None):
ydl_opts = {
'noplaylist': True,
@@ -336,19 +337,19 @@ class DelojzaBot:
def tag_dirs(self):
return list(filter(lambda x: x.upper() == x,
- filter(lambda dir: os.path.isdir(os.path.join(self.out_dir, dir)),
+ filter(lambda directory: os.path.isdir(os.path.join(self.out_dir, directory)),
os.listdir(self.out_dir))))
def tg_stats(self, _, update):
tag_dirs = self.tag_dirs()
reply = "Total number of tags: {}\n\n".format(len(tag_dirs))
- counts = [(dir, os.listdir(os.path.join(self.out_dir, dir))) for dir in tag_dirs]
+ counts = [(directory, os.listdir(os.path.join(self.out_dir, directory))) for directory in tag_dirs]
counts.sort(key=itemgetter(0))
counts.sort(key=lambda x: len(x[1]), reverse=True)
- for dir, files in counts:
+ for directory, files in counts:
if len(files) == 1:
break
- abs_paths = [os.path.join(self.out_dir, dir, file) for file in files]
+ abs_paths = [os.path.join(self.out_dir, directory, file) for file in files]
abs_files = list(filter(os.path.isfile, abs_paths))
# mimes = [magic.from_file(path, mime=True).split("/")[0] for path in abs_files]
# mime_counts = [(mime, mimes.count(mime)) for mime in set(mimes)]
@@ -359,9 +360,9 @@ class DelojzaBot:
details = ", ".join(["{} {}s".format(cnt, mime) for mime, cnt in
sorted(type_counts, key=itemgetter(1), reverse=True)])
if len(type_counts) == 1:
- reply += "{}: {}\n".format(dir, details)
+ reply += "{}: {}\n".format(directory, details)
else:
- reply += "{}: {} files ({})\n".format(dir, len(files), details)
+ reply += "{}: {} files ({})\n".format(directory, len(files), details)
orphans = list(filter(lambda cnt: len(cnt[1]) <= 1, counts))
if len(orphans) > 0:
reply += "\nFollowing tags are orphans: " + ", ".join(map(itemgetter(0), orphans))
@@ -370,12 +371,12 @@ class DelojzaBot:
def orphans(self):
result = []
tag_dirs = self.tag_dirs()
- for dir in tag_dirs:
- files = os.listdir(os.path.join(self.out_dir, dir))
+ for directory in tag_dirs:
+ files = os.listdir(os.path.join(self.out_dir, directory))
if len(files) == 1:
- result.append((dir, files[0]))
+ result.append((directory, files[0]))
if len(files) == 0:
- result.append((dir, "NO FILE AT ALL..."))
+ result.append((directory, "NO FILE AT ALL..."))
return sorted(result, key=itemgetter(0))
def tg_orphan(self, _, update):
@@ -392,8 +393,8 @@ class DelojzaBot:
update.message.reply_text("Good job, no orphan tags!")
else:
tmp_reply = "The following tags only contain a single file:\n"
- for dir, file in orphans:
- line = "{}: {}\n".format(dir, file)
+ for directory, file in orphans:
+ line = "{}: {}\n".format(directory, file)
if len(tmp_reply + line) > 4096:
update.message.reply_text(tmp_reply)
tmp_reply = ""
@@ -426,6 +427,7 @@ class DelojzaBot:
else:
update.message.reply_text("Nothing to remove!")
+ # noinspection PyMethodMayBeStatic
def tg_version(self, _, update):
delojza_date = datetime.fromtimestamp(os.path.getmtime(os.path.realpath(__file__))) \
.strftime('%Y/%m/%d - %H:%M:%S')