Settings for filesize after filename

pull/5/head
Sergey Shramchenko 2016-03-18 02:00:56 +02:00
parent 27e68911bf
commit a0af92bd9f
4 changed files with 8 additions and 3 deletions

View File

@ -1467,14 +1467,16 @@ class Core:
if not torrent: torrent = Downloader.Torrent(self.userStorageDirectory, if not torrent: torrent = Downloader.Torrent(self.userStorageDirectory,
torrentFilesDirectory=self.torrentFilesDirectory) torrentFilesDirectory=self.torrentFilesDirectory)
self.__settings__.setSetting("lastTorrent", torrent.saveTorrent(url)) self.__settings__.setSetting("lastTorrent", torrent.saveTorrent(url))
append_filesize = self.__settings__.getSetting("append_filesize") == 'true'
hasSize = False hasSize = False
contentList = [] contentList = []
for filedict in torrent.getContentList(): for filedict in torrent.getContentList():
fileTitle = filedict.get('title') fileTitle = filedict.get('title')
size = filedict.get('size') size = filedict.get('size')
if size: if size:
fileTitle += ' [%d MB]' % (size / 1024 / 1024) if append_filesize:
fileTitle += ' [%d MB]' % (size / 1024 / 1024)
hasSize = True hasSize = True
contentList.append((unescape(fileTitle), str(filedict.get('ind')), size)) contentList.append((unescape(fileTitle), str(filedict.get('ind')), size))
#contentList = sorted(contentList, key=lambda x: x[0]) #contentList = sorted(contentList, key=lambda x: x[0])

View File

@ -66,6 +66,7 @@
<string id="30066">Confluence (by safonov_ivan)</string> <string id="30066">Confluence (by safonov_ivan)</string>
<string id="30067">Aeon Nox (by joyrider)</string> <string id="30067">Aeon Nox (by joyrider)</string>
<string id="30068">pyrrent2http (python-libtorrent via http)</string> <string id="30068">pyrrent2http (python-libtorrent via http)</string>
<string id="30069">Append size to file name</string>
<string id="30101">Interface</string> <string id="30101">Interface</string>
<string id="30102">P2P Network</string> <string id="30102">P2P Network</string>
<string id="30103">Advanced</string> <string id="30103">Advanced</string>

View File

@ -1,4 +1,4 @@
<?xml version="1.0" encoding="utf-8" standalone="yes"?> <?xml version="1.0" encoding="utf-8" standalone="yes"?>
<strings> <strings>
<string id="30001">Язык интерфейса</string> <string id="30001">Язык интерфейса</string>
<string id="30002">Удерживать стиль отображения</string> <string id="30002">Удерживать стиль отображения</string>
@ -66,6 +66,7 @@
<string id="30066">Confluence (от safonov_ivan)</string> <string id="30066">Confluence (от safonov_ivan)</string>
<string id="30067">Aeon Nox (от joyrider)</string> <string id="30067">Aeon Nox (от joyrider)</string>
<string id="30068">pyrrent2http (python-libtorrent по http)</string> <string id="30068">pyrrent2http (python-libtorrent по http)</string>
<string id="30069">Добавлять размер к имени файла</string>
<string id="30101">Интерфейс</string> <string id="30101">Интерфейс</string>
<string id="30102">P2P Сеть</string> <string id="30102">P2P Сеть</string>
<string id="30103">Дополнительные</string> <string id="30103">Дополнительные</string>

View File

@ -6,6 +6,7 @@
<setting id="sort_search" type="enum" label="30061" default="0" lvalues="30062|30063|30064"/> <setting id="sort_search" type="enum" label="30061" default="0" lvalues="30062|30063|30064"/>
<setting id="skin_optimization" type="enum" label="30002" default="1" lvalues="30003|30018|30017|30016|30019|30066|30067"/> <setting id="skin_optimization" type="enum" label="30002" default="1" lvalues="30003|30018|30017|30016|30019|30066|30067"/>
<setting id="open_option" type="enum" label="30034" default="0" lvalues="30035|30036|30037|30038"/> <setting id="open_option" type="enum" label="30034" default="0" lvalues="30035|30036|30037|30038"/>
<setting id="append_filesize" type="bool" label="30069" default="false"/>
</category> </category>
<category label="30103"> <category label="30103">
<setting id="timeout" type="enum" lvalues="30026|30027|30028" label="30025" default="1"/> <setting id="timeout" type="enum" lvalues="30026|30027|30028" label="30025" default="1"/>