mirror of
https://github.com/blacktwin/JBOPS.git
synced 2025-12-15 20:45:37 +00:00
adding try/except for addressing #253
This commit is contained in:
parent
7f20da0ca9
commit
0125865124
@ -530,29 +530,32 @@ def action_show(items, selector, date, users=None):
|
|||||||
print("The following items were watched by {}".format(", ".join([user.name for user in users])))
|
print("The following items were watched by {}".format(", ".join([user.name for user in users])))
|
||||||
else:
|
else:
|
||||||
print("The following items were added before {}".format(date))
|
print("The following items were added before {}".format(date))
|
||||||
|
|
||||||
for item in items:
|
|
||||||
if selector == 'watched':
|
|
||||||
item = users[0].watch[item]
|
|
||||||
added_at = datetime.datetime.utcfromtimestamp(float(item.added_at)).strftime("%Y-%m-%d")
|
|
||||||
size = int(item.file_size) if item.file_size else 0
|
|
||||||
sizes.append(size)
|
|
||||||
|
|
||||||
if selector == 'lastPlayed':
|
for item in items:
|
||||||
last_played = datetime.datetime.utcfromtimestamp(float(item.last_played)).strftime("%Y-%m-%d")
|
try:
|
||||||
print(u"\t{} added {} and last played {}\tSize: {}\n\t\tFile: {}".format(
|
if selector == 'watched':
|
||||||
item.title, added_at, last_played, sizeof_fmt(size), item.file))
|
item = users[0].watch[item]
|
||||||
|
added_at = datetime.datetime.utcfromtimestamp(float(item.added_at)).strftime("%Y-%m-%d")
|
||||||
elif selector == 'transcoded':
|
size = int(item.file_size) if item.file_size else 0
|
||||||
print(u"\t{} added {}\tSize: {}\tTransocded: {} time(s)\n\t\tFile: {}".format(
|
sizes.append(size)
|
||||||
item.title, added_at, file_size, item.transcode_count, item.file))
|
|
||||||
|
if selector == 'lastPlayed':
|
||||||
else:
|
last_played = datetime.datetime.utcfromtimestamp(float(item.last_played)).strftime("%Y-%m-%d")
|
||||||
print(u"\t{} added {}\tSize: {}\n\t\tFile: {}".format(
|
print(u"\t{} added {} and last played {}\tSize: {}\n\t\tFile: {}".format(
|
||||||
item.title, added_at, sizeof_fmt(size), item.file))
|
item.title, added_at, last_played, sizeof_fmt(size), item.file))
|
||||||
|
|
||||||
total_size = sum(sizes)
|
elif selector == 'transcoded':
|
||||||
print("Total size: {}".format(sizeof_fmt(total_size)))
|
print(u"\t{} added {}\tSize: {}\tTransocded: {} time(s)\n\t\tFile: {}".format(
|
||||||
|
item.title, added_at, file_size, item.transcode_count, item.file))
|
||||||
|
|
||||||
|
else:
|
||||||
|
print(u"\t{} added {}\tSize: {}\n\t\tFile: {}".format(
|
||||||
|
item.title, added_at, sizeof_fmt(size), item.file))
|
||||||
|
|
||||||
|
total_size = sum(sizes)
|
||||||
|
print("Total size: {}".format(sizeof_fmt(total_size)))
|
||||||
|
except TypeError as e:
|
||||||
|
print("Item: {} caused the following error: {}".format(item.rating_key, e))
|
||||||
|
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user