1 | Index: core/core.py
|
---|
2 | ===================================================================
|
---|
3 | --- core/core.py (revision 4141)
|
---|
4 | +++ core/core.py (working copy)
|
---|
5 | @@ -68,7 +68,7 @@ STATUS_KEYS = ['active_time', 'compact', 'distribu
|
---|
6 | 'move_on_completed_path', 'name', 'next_announce', 'num_files', 'num_peers', 'num_pieces',
|
---|
7 | 'num_seeds', 'paused', 'peers', 'piece_length', 'prioritize_first_last', 'private', 'progress',
|
---|
8 | 'queue', 'ratio', 'remove_at_ratio', 'save_path', 'seed_rank', 'seeding_time', 'state', 'stop_at_ratio',
|
---|
9 | - 'stop_ratio', 'total_done', 'total_payload_download', 'total_payload_upload', 'total_peers',
|
---|
10 | + 'stop_ratio', 'time_added', 'total_done', 'total_payload_download', 'total_payload_upload', 'total_peers',
|
---|
11 | 'total_seeds', 'total_size', 'total_uploaded', 'total_wanted', 'tracker', 'tracker_host',
|
---|
12 | 'tracker_status', 'trackers', 'upload_payload_rate']
|
---|
13 |
|
---|
14 | Index: core/torrent.py
|
---|
15 | ===================================================================
|
---|
16 | --- core/torrent.py (revision 4141)
|
---|
17 | +++ core/torrent.py (working copy)
|
---|
18 | @@ -34,6 +34,7 @@
|
---|
19 | """Internal Torrent class"""
|
---|
20 |
|
---|
21 | import os
|
---|
22 | +import time
|
---|
23 | from urlparse import urlparse
|
---|
24 |
|
---|
25 | try:
|
---|
26 | @@ -198,6 +199,15 @@ class Torrent:
|
---|
27 | # The tracker status
|
---|
28 | self.tracker_status = ""
|
---|
29 |
|
---|
30 | + file_path = os.path.join(self.config["state_location"], self.torrent_id + ".torrent")
|
---|
31 | + #If a state .torrent file exists, this was a previously added torrent, and we take
|
---|
32 | + #the time it was last modified (which is usually when it was created). Otherwise,
|
---|
33 | + #it is a new torrent, so we take the current time instead.
|
---|
34 | + if os.path.exists(file_path):
|
---|
35 | + self.time_added = os.stat(file_path).st_mtime
|
---|
36 | + else:
|
---|
37 | + self.time_added = time.time()
|
---|
38 | +
|
---|
39 | log.debug("Torrent object created.")
|
---|
40 |
|
---|
41 | ## Options methods ##
|
---|
42 | @@ -566,7 +576,8 @@ class Torrent:
|
---|
43 | "stop_at_ratio": self.options["stop_at_ratio"],
|
---|
44 | "remove_at_ratio": self.options["remove_at_ratio"],
|
---|
45 | "move_on_completed": self.options["move_completed"],
|
---|
46 | - "move_on_completed_path": self.options["move_completed_path"]
|
---|
47 | + "move_on_completed_path": self.options["move_completed_path"],
|
---|
48 | + "time_added": self.time_added
|
---|
49 | }
|
---|
50 |
|
---|
51 | def ti_name():
|
---|
52 | Index: ui/gtkui/torrentview.py
|
---|
53 | ===================================================================
|
---|
54 | --- ui/gtkui/torrentview.py (revision 4141)
|
---|
55 | +++ ui/gtkui/torrentview.py (working copy)
|
---|
56 | @@ -180,6 +180,10 @@ class TorrentView(listview.ListView, component.Com
|
---|
57 | listview.cell_data_ratio,
|
---|
58 | [float],
|
---|
59 | status_field=["distributed_copies"])
|
---|
60 | + self.add_func_column(_("Added"),
|
---|
61 | + listview.cell_data_date,
|
---|
62 | + [float],
|
---|
63 | + status_field=["time_added"])
|
---|
64 | self.add_text_column(_("Tracker"), status_field=["tracker_host"])
|
---|
65 |
|
---|
66 | # Set filter to None for now
|
---|
67 | Index: ui/gtkui/listview.py
|
---|
68 | ===================================================================
|
---|
69 | --- ui/gtkui/listview.py (revision 4141)
|
---|
70 | +++ ui/gtkui/listview.py (working copy)
|
---|
71 | @@ -34,6 +34,7 @@
|
---|
72 |
|
---|
73 | import cPickle
|
---|
74 | import os.path
|
---|
75 | +import time
|
---|
76 |
|
---|
77 | import pygtk
|
---|
78 | pygtk.require('2.0')
|
---|
79 | @@ -88,6 +89,12 @@ def cell_data_ratio(column, cell, model, row, data
|
---|
80 |
|
---|
81 | cell.set_property('text', ratio_str)
|
---|
82 |
|
---|
83 | +def cell_data_date(column, cell, model, row, data):
|
---|
84 | + """Display value as a date, eg 2008/05/05."""
|
---|
85 | + time_val = model.get_value(row, data)
|
---|
86 | + time_str = time.strftime("%Y/%m/%d", time.localtime(time_val))
|
---|
87 | + cell.set_property('text', time_str)
|
---|
88 | +
|
---|
89 | class ListViewColumnState:
|
---|
90 | """Used for saving/loading column state"""
|
---|
91 | def __init__(self, name, position, width, visible, sort, sort_order):
|
---|