download by libtorrent with start and stop

pull/1/head
DiMartinoXBMC 2015-01-13 20:06:34 +03:00
parent eff2c1c6f3
commit 5dd2c94fed
5 changed files with 429 additions and 188 deletions

View File

@ -2,6 +2,10 @@
<project version="4"> <project version="4">
<component name="ChangeListManager"> <component name="ChangeListManager">
<list default="true" id="56e91349-2444-4553-bc78-90c2bab49e9c" name="Default" comment=""> <list default="true" id="56e91349-2444-4553-bc78-90c2bab49e9c" name="Default" comment="">
<change type="MODIFICATION" beforePath="$PROJECT_DIR$/Core.py" afterPath="$PROJECT_DIR$/Core.py" />
<change type="MODIFICATION" beforePath="$PROJECT_DIR$/Libtorrent.py" afterPath="$PROJECT_DIR$/Libtorrent.py" />
<change type="MODIFICATION" beforePath="$PROJECT_DIR$/Localization.py" afterPath="$PROJECT_DIR$/Localization.py" />
<change type="MODIFICATION" beforePath="$PROJECT_DIR$/functions.py" afterPath="$PROJECT_DIR$/functions.py" />
<change type="MODIFICATION" beforePath="$PROJECT_DIR$/.idea/workspace.xml" afterPath="$PROJECT_DIR$/.idea/workspace.xml" /> <change type="MODIFICATION" beforePath="$PROJECT_DIR$/.idea/workspace.xml" afterPath="$PROJECT_DIR$/.idea/workspace.xml" />
</list> </list>
<ignored path="plugin.video.torrenter.iws" /> <ignored path="plugin.video.torrenter.iws" />
@ -33,12 +37,52 @@
<splitter split-orientation="horizontal" split-proportion="0.5"> <splitter split-orientation="horizontal" split-proportion="0.5">
<split-first> <split-first>
<leaf> <leaf>
<file leaf-file-name="Core.py" pinned="false" current="false" current-in-tab="false"> <file leaf-file-name="Core.py" pinned="false" current="true" current-in-tab="true">
<entry file="file://$PROJECT_DIR$/Core.py"> <entry file="file://$PROJECT_DIR$/Core.py">
<provider selected="true" editor-type-id="text-editor"> <provider selected="true" editor-type-id="text-editor">
<state vertical-scroll-proportion="0.0" vertical-offset="5865" max-vertical-offset="28220"> <state vertical-scroll-proportion="0.5247019" vertical-offset="1222" max-vertical-offset="4590">
<caret line="345" column="25" selection-start-line="345" selection-start-column="25" selection-end-line="345" selection-end-column="25" /> <caret line="324" column="43" selection-start-line="324" selection-start-column="43" selection-end-line="324" selection-end-column="43" />
<folding /> <folding>
<element signature="e#24#781#1" expanded="false" />
<element signature="e#2250#2547#0" expanded="false" />
<element signature="e#2584#7017#0" expanded="false" />
<element signature="e#7056#19021#0" expanded="false" />
<element signature="e#19062#19828#0" expanded="false" />
<element signature="e#25916#29025#0" expanded="false" />
<element signature="e#29066#30293#0" expanded="false" />
<element signature="e#30394#34748#0" expanded="false" />
<element signature="e#34796#36860#0" expanded="false" />
<element signature="e#36902#37890#0" expanded="false" />
<element signature="e#37940#42554#0" expanded="false" />
<element signature="e#42619#48972#0" expanded="false" />
<element signature="e#49020#49755#0" expanded="false" />
<element signature="e#49819#51129#0" expanded="false" />
<element signature="e#51178#53137#0" expanded="false" />
<element signature="e#53294#54546#0" expanded="false" />
<element signature="e#54602#55019#0" expanded="false" />
<element signature="e#55061#55170#0" expanded="false" />
<element signature="e#55213#55333#0" expanded="false" />
<element signature="e#55383#55534#0" expanded="false" />
<element signature="e#55587#62547#0" expanded="false" />
<element signature="e#62596#62635#0" expanded="false" />
<element signature="e#62684#63474#0" expanded="false" />
<element signature="e#63524#66451#0" expanded="false" />
<element signature="e#66496#67245#0" expanded="false" />
<element signature="e#67293#68789#0" expanded="false" />
<element signature="e#68834#69707#0" expanded="false" />
<element signature="e#69755#75611#0" expanded="false" />
<element signature="e#75659#77443#0" expanded="false" />
<element signature="e#77493#77589#0" expanded="false" />
<element signature="e#77652#78179#0" expanded="false" />
<element signature="e#78250#82263#0" expanded="false" />
<element signature="e#82307#82349#0" expanded="false" />
<element signature="e#82403#85599#0" expanded="false" />
<element signature="e#87592#88212#0" expanded="false" />
<element signature="e#88255#89036#0" expanded="false" />
<element signature="e#89072#89861#0" expanded="false" />
<element signature="e#89903#89998#0" expanded="false" />
<element signature="e#90048#90196#0" expanded="false" />
</folding>
</state> </state>
</provider> </provider>
</entry> </entry>
@ -46,55 +90,18 @@
<file leaf-file-name="Content.py" pinned="false" current="false" current-in-tab="false"> <file leaf-file-name="Content.py" pinned="false" current="false" current-in-tab="false">
<entry file="file://$PROJECT_DIR$/Content.py"> <entry file="file://$PROJECT_DIR$/Content.py">
<provider selected="true" editor-type-id="text-editor"> <provider selected="true" editor-type-id="text-editor">
<state vertical-scroll-proportion="0.0" vertical-offset="952" max-vertical-offset="4216"> <state vertical-scroll-proportion="0.0" vertical-offset="799" max-vertical-offset="4063">
<caret line="56" column="20" selection-start-line="56" selection-start-column="20" selection-end-line="56" selection-end-column="34" /> <caret line="56" column="20" selection-start-line="56" selection-start-column="20" selection-end-line="56" selection-end-column="34" />
<folding /> <folding />
</state> </state>
</provider> </provider>
</entry> </entry>
</file> </file>
<file leaf-file-name="Libtorrent.py" pinned="false" current="true" current-in-tab="true">
<entry file="file://$PROJECT_DIR$/Libtorrent.py">
<provider selected="true" editor-type-id="text-editor">
<state vertical-scroll-proportion="0.4187192" vertical-offset="816" max-vertical-offset="1785">
<caret line="282" column="36" selection-start-line="282" selection-start-column="36" selection-end-line="282" selection-end-column="36" />
<folding>
<element signature="e#24#785#1" expanded="false" />
<element signature="e#1478#2926#0" expanded="false" />
<element signature="e#2975#5674#0" expanded="false" />
<element signature="e#5713#6697#0" expanded="false" />
<element signature="e#6746#7748#0" expanded="false" />
<element signature="e#7787#7919#0" expanded="false" />
<element signature="e#7960#8094#0" expanded="false" />
<element signature="e#8128#8250#0" expanded="false" />
<element signature="e#8284#8406#0" expanded="false" />
<element signature="e#8456#8503#0" expanded="false" />
<element signature="e#8553#8653#0" expanded="false" />
<element signature="e#8693#9007#0" expanded="false" />
<element signature="e#9053#9221#0" expanded="false" />
<element signature="e#9277#9332#0" expanded="false" />
<element signature="e#9390#9447#0" expanded="false" />
<element signature="e#9484#9663#0" expanded="false" />
<element signature="e#9715#10664#0" expanded="false" />
<element signature="e#11703#12197#0" expanded="false" />
<element signature="e#12235#12837#0" expanded="false" />
<element signature="e#12874#12976#0" expanded="false" />
<element signature="e#13055#14201#0" expanded="false" />
<element signature="e#14250#15954#0" expanded="false" />
<element signature="e#15990#16407#0" expanded="false" />
<element signature="e#16444#16815#0" expanded="false" />
<element signature="e#16861#18101#0" expanded="false" />
<element signature="e#18136#18279#0" expanded="false" />
</folding>
</state>
</provider>
</entry>
</file>
<file leaf-file-name="Downloader.py" pinned="false" current="false" current-in-tab="false"> <file leaf-file-name="Downloader.py" pinned="false" current="false" current-in-tab="false">
<entry file="file://$PROJECT_DIR$/Downloader.py"> <entry file="file://$PROJECT_DIR$/Downloader.py">
<provider selected="true" editor-type-id="text-editor"> <provider selected="true" editor-type-id="text-editor">
<state vertical-scroll-proportion="0.0" vertical-offset="1598" max-vertical-offset="2329"> <state vertical-scroll-proportion="0.0" vertical-offset="1394" max-vertical-offset="2278">
<caret line="94" column="33" selection-start-line="94" selection-start-column="33" selection-end-line="94" selection-end-column="33" /> <caret line="97" column="33" selection-start-line="97" selection-start-column="33" selection-end-line="97" selection-end-column="33" />
<folding /> <folding />
</state> </state>
</provider> </provider>
@ -110,25 +117,46 @@
</provider> </provider>
</entry> </entry>
</file> </file>
</leaf> <file leaf-file-name="Libtorrent.py" pinned="false" current="false" current-in-tab="false">
</split-first> <entry file="file://$PROJECT_DIR$/Libtorrent.py">
<split-second>
<leaf>
<file leaf-file-name="Localization.py" pinned="false" current="false" current-in-tab="true">
<entry file="file://$PROJECT_DIR$/Localization.py">
<provider selected="true" editor-type-id="text-editor"> <provider selected="true" editor-type-id="text-editor">
<state vertical-scroll-proportion="0.72085387" vertical-offset="3063" max-vertical-offset="3842"> <state vertical-scroll-proportion="-3.25" vertical-offset="2391" max-vertical-offset="4097">
<caret line="206" column="36" selection-start-line="206" selection-start-column="36" selection-end-line="206" selection-end-column="36" /> <caret line="250" column="39" selection-start-line="250" selection-start-column="39" selection-end-line="250" selection-end-column="39" />
<folding /> <folding>
<element signature="e#24#785#1" expanded="false" />
<element signature="e#1478#2926#0" expanded="false" />
<element signature="e#7820#7952#0" expanded="false" />
<element signature="e#7993#8127#0" expanded="false" />
<element signature="e#8161#8283#0" expanded="false" />
<element signature="e#8317#8439#0" expanded="false" />
<element signature="e#8489#8536#0" expanded="false" />
<element signature="e#8586#8686#0" expanded="false" />
<element signature="e#8726#9040#0" expanded="false" />
<element signature="e#9086#9254#0" expanded="false" />
<element signature="e#9310#9365#0" expanded="false" />
<element signature="e#9423#9480#0" expanded="false" />
<element signature="e#9517#9696#0" expanded="false" />
<element signature="e#11951#12445#0" expanded="false" />
<element signature="e#13122#13224#0" expanded="false" />
<element signature="e#13303#14449#0" expanded="false" />
<element signature="e#14498#16202#0" expanded="false" />
<element signature="e#16238#16655#0" expanded="false" />
<element signature="e#17109#18349#0" expanded="false" />
<element signature="e#18384#18527#0" expanded="false" />
</folding>
</state> </state>
</provider> </provider>
</entry> </entry>
</file> </file>
<file leaf-file-name="KickAssSo.py" pinned="false" current="false" current-in-tab="false"> </leaf>
<entry file="file://$PROJECT_DIR$/resources/contenters/KickAssSo.py"> </split-first>
<split-second>
<leaf>
<file leaf-file-name="Localization.py" pinned="false" current="false" current-in-tab="false">
<entry file="file://$PROJECT_DIR$/Localization.py">
<provider selected="true" editor-type-id="text-editor"> <provider selected="true" editor-type-id="text-editor">
<state vertical-scroll-proportion="0.0" vertical-offset="1105" max-vertical-offset="1734"> <state vertical-scroll-proportion="-13.464286" vertical-offset="3176" max-vertical-offset="3893">
<caret line="65" column="24" selection-start-line="65" selection-start-column="24" selection-end-line="65" selection-end-column="24" /> <caret line="209" column="39" selection-start-line="209" selection-start-column="39" selection-end-line="209" selection-end-column="39" />
<folding /> <folding />
</state> </state>
</provider> </provider>
@ -154,11 +182,11 @@
</provider> </provider>
</entry> </entry>
</file> </file>
<file leaf-file-name="functions.py" pinned="false" current="false" current-in-tab="false"> <file leaf-file-name="functions.py" pinned="false" current="false" current-in-tab="true">
<entry file="file://$PROJECT_DIR$/functions.py"> <entry file="file://$PROJECT_DIR$/functions.py">
<provider selected="true" editor-type-id="text-editor"> <provider selected="true" editor-type-id="text-editor">
<state vertical-scroll-proportion="0.0" vertical-offset="25279" max-vertical-offset="26435"> <state vertical-scroll-proportion="0.39674798" vertical-offset="23726" max-vertical-offset="26163">
<caret line="1487" column="21" selection-start-line="1487" selection-start-column="8" selection-end-line="1487" selection-end-column="21" /> <caret line="1427" column="30" selection-start-line="1427" selection-start-column="30" selection-end-line="1427" selection-end-column="30" />
<folding /> <folding />
</state> </state>
</provider> </provider>
@ -188,17 +216,17 @@
<option value="$PROJECT_DIR$/README.txt" /> <option value="$PROJECT_DIR$/README.txt" />
<option value="$PROJECT_DIR$/resources/contenters/KinoPoisk.py" /> <option value="$PROJECT_DIR$/resources/contenters/KinoPoisk.py" />
<option value="$PROJECT_DIR$/controlcenter.py" /> <option value="$PROJECT_DIR$/controlcenter.py" />
<option value="$PROJECT_DIR$/Downloader.py" />
<option value="$PROJECT_DIR$/resources/searchers/NNMClubRu.py" /> <option value="$PROJECT_DIR$/resources/searchers/NNMClubRu.py" />
<option value="$PROJECT_DIR$/Content.py" /> <option value="$PROJECT_DIR$/Content.py" />
<option value="$PROJECT_DIR$/cal.py" /> <option value="$PROJECT_DIR$/cal.py" />
<option value="$PROJECT_DIR$/resources/contenters/KickAssSo.py" /> <option value="$PROJECT_DIR$/resources/contenters/KickAssSo.py" />
<option value="$PROJECT_DIR$/changelog.txt" /> <option value="$PROJECT_DIR$/changelog.txt" />
<option value="$PROJECT_DIR$/addon.xml" /> <option value="$PROJECT_DIR$/addon.xml" />
<option value="$PROJECT_DIR$/functions.py" />
<option value="$PROJECT_DIR$/Localization.py" /> <option value="$PROJECT_DIR$/Localization.py" />
<option value="$PROJECT_DIR$/Core.py" />
<option value="$PROJECT_DIR$/Libtorrent.py" /> <option value="$PROJECT_DIR$/Libtorrent.py" />
<option value="$PROJECT_DIR$/Downloader.py" />
<option value="$PROJECT_DIR$/functions.py" />
<option value="$PROJECT_DIR$/Core.py" />
</list> </list>
</option> </option>
</component> </component>
@ -484,7 +512,11 @@
<created>1421159093940</created> <created>1421159093940</created>
<updated>1421159093940</updated> <updated>1421159093940</updated>
</task> </task>
<option name="localTasksCounter" value="11" /> <task id="LOCAL-00011" summary="download by libtorrent with pause">
<created>1421159105711</created>
<updated>1421159105711</updated>
</task>
<option name="localTasksCounter" value="12" />
<servers /> <servers />
</component> </component>
<component name="TodoView" selected-index="0"> <component name="TodoView" selected-index="0">
@ -512,7 +544,7 @@
<editor active="true" /> <editor active="true" />
<layout> <layout>
<window_info id="Messages" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.33" sideWeight="0.5" order="7" side_tool="false" content_ui="tabs" /> <window_info id="Messages" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.33" sideWeight="0.5" order="7" side_tool="false" content_ui="tabs" />
<window_info id="Changes" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="true" weight="0.2769744" sideWeight="0.5" order="7" side_tool="false" content_ui="tabs" /> <window_info id="Changes" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="true" weight="0.27030033" sideWeight="0.5" order="7" side_tool="false" content_ui="tabs" />
<window_info id="Terminal" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.3288889" sideWeight="0.5" order="7" side_tool="false" content_ui="tabs" /> <window_info id="Terminal" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.3288889" sideWeight="0.5" order="7" side_tool="false" content_ui="tabs" />
<window_info id="TODO" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.32925472" sideWeight="0.5" order="6" side_tool="false" content_ui="tabs" /> <window_info id="TODO" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.32925472" sideWeight="0.5" order="6" side_tool="false" content_ui="tabs" />
<window_info id="Structure" active="false" anchor="left" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.25" sideWeight="0.5" order="1" side_tool="false" content_ui="tabs" /> <window_info id="Structure" active="false" anchor="left" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.25" sideWeight="0.5" order="1" side_tool="false" content_ui="tabs" />
@ -552,11 +584,12 @@
<MESSAGE value="return russian trackers" /> <MESSAGE value="return russian trackers" />
<MESSAGE value="moveout some minor functions from Core" /> <MESSAGE value="moveout some minor functions from Core" />
<MESSAGE value="download by libtorrent" /> <MESSAGE value="download by libtorrent" />
<option name="LAST_COMMIT_MESSAGE" value="download by libtorrent" /> <MESSAGE value="download by libtorrent with pause" />
<option name="LAST_COMMIT_MESSAGE" value="download by libtorrent with pause" />
</component> </component>
<component name="XDebuggerManager"> <component name="XDebuggerManager">
<breakpoint-manager> <breakpoint-manager>
<option name="time" value="2" /> <option name="time" value="3" />
</breakpoint-manager> </breakpoint-manager>
</component> </component>
<component name="editorHistoryManager"> <component name="editorHistoryManager">
@ -633,7 +666,47 @@
<provider selected="true" editor-type-id="text-editor"> <provider selected="true" editor-type-id="text-editor">
<state vertical-scroll-proportion="0.0" vertical-offset="0" max-vertical-offset="27387"> <state vertical-scroll-proportion="0.0" vertical-offset="0" max-vertical-offset="27387">
<caret line="1071" column="32" selection-start-line="1071" selection-start-column="32" selection-end-line="1071" selection-end-column="32" /> <caret line="1071" column="32" selection-start-line="1071" selection-start-column="32" selection-end-line="1071" selection-end-column="32" />
<folding /> <folding>
<element signature="e#24#781#1" expanded="false" />
<element signature="e#2250#2547#0" expanded="false" />
<element signature="e#2584#7017#0" expanded="false" />
<element signature="e#7056#19021#0" expanded="false" />
<element signature="e#19062#19828#0" expanded="false" />
<element signature="e#25916#29025#0" expanded="false" />
<element signature="e#29066#30293#0" expanded="false" />
<element signature="e#30394#34748#0" expanded="false" />
<element signature="e#34796#36860#0" expanded="false" />
<element signature="e#36902#37890#0" expanded="false" />
<element signature="e#37940#42554#0" expanded="false" />
<element signature="e#42619#48972#0" expanded="false" />
<element signature="e#49020#49755#0" expanded="false" />
<element signature="e#49819#51129#0" expanded="false" />
<element signature="e#51178#53137#0" expanded="false" />
<element signature="e#53294#54546#0" expanded="false" />
<element signature="e#54602#55019#0" expanded="false" />
<element signature="e#55061#55170#0" expanded="false" />
<element signature="e#55213#55333#0" expanded="false" />
<element signature="e#55383#55534#0" expanded="false" />
<element signature="e#55587#62547#0" expanded="false" />
<element signature="e#62596#62635#0" expanded="false" />
<element signature="e#62684#63474#0" expanded="false" />
<element signature="e#63524#66451#0" expanded="false" />
<element signature="e#66496#67245#0" expanded="false" />
<element signature="e#67293#68789#0" expanded="false" />
<element signature="e#68834#69707#0" expanded="false" />
<element signature="e#69755#75611#0" expanded="false" />
<element signature="e#75659#77443#0" expanded="false" />
<element signature="e#77493#77589#0" expanded="false" />
<element signature="e#77652#78179#0" expanded="false" />
<element signature="e#78250#82263#0" expanded="false" />
<element signature="e#82307#82349#0" expanded="false" />
<element signature="e#82403#85599#0" expanded="false" />
<element signature="e#87592#88212#0" expanded="false" />
<element signature="e#88255#89036#0" expanded="false" />
<element signature="e#89072#89861#0" expanded="false" />
<element signature="e#89903#89998#0" expanded="false" />
<element signature="e#90048#90196#0" expanded="false" />
</folding>
</state> </state>
</provider> </provider>
</entry> </entry>
@ -680,7 +753,47 @@
<provider selected="true" editor-type-id="text-editor"> <provider selected="true" editor-type-id="text-editor">
<state vertical-scroll-proportion="0.0" vertical-offset="0" max-vertical-offset="27387"> <state vertical-scroll-proportion="0.0" vertical-offset="0" max-vertical-offset="27387">
<caret line="1071" column="32" selection-start-line="1071" selection-start-column="32" selection-end-line="1071" selection-end-column="32" /> <caret line="1071" column="32" selection-start-line="1071" selection-start-column="32" selection-end-line="1071" selection-end-column="32" />
<folding /> <folding>
<element signature="e#24#781#1" expanded="false" />
<element signature="e#2250#2547#0" expanded="false" />
<element signature="e#2584#7017#0" expanded="false" />
<element signature="e#7056#19021#0" expanded="false" />
<element signature="e#19062#19828#0" expanded="false" />
<element signature="e#25916#29025#0" expanded="false" />
<element signature="e#29066#30293#0" expanded="false" />
<element signature="e#30394#34748#0" expanded="false" />
<element signature="e#34796#36860#0" expanded="false" />
<element signature="e#36902#37890#0" expanded="false" />
<element signature="e#37940#42554#0" expanded="false" />
<element signature="e#42619#48972#0" expanded="false" />
<element signature="e#49020#49755#0" expanded="false" />
<element signature="e#49819#51129#0" expanded="false" />
<element signature="e#51178#53137#0" expanded="false" />
<element signature="e#53294#54546#0" expanded="false" />
<element signature="e#54602#55019#0" expanded="false" />
<element signature="e#55061#55170#0" expanded="false" />
<element signature="e#55213#55333#0" expanded="false" />
<element signature="e#55383#55534#0" expanded="false" />
<element signature="e#55587#62547#0" expanded="false" />
<element signature="e#62596#62635#0" expanded="false" />
<element signature="e#62684#63474#0" expanded="false" />
<element signature="e#63524#66451#0" expanded="false" />
<element signature="e#66496#67245#0" expanded="false" />
<element signature="e#67293#68789#0" expanded="false" />
<element signature="e#68834#69707#0" expanded="false" />
<element signature="e#69755#75611#0" expanded="false" />
<element signature="e#75659#77443#0" expanded="false" />
<element signature="e#77493#77589#0" expanded="false" />
<element signature="e#77652#78179#0" expanded="false" />
<element signature="e#78250#82263#0" expanded="false" />
<element signature="e#82307#82349#0" expanded="false" />
<element signature="e#82403#85599#0" expanded="false" />
<element signature="e#87592#88212#0" expanded="false" />
<element signature="e#88255#89036#0" expanded="false" />
<element signature="e#89072#89861#0" expanded="false" />
<element signature="e#89903#89998#0" expanded="false" />
<element signature="e#90048#90196#0" expanded="false" />
</folding>
</state> </state>
</provider> </provider>
</entry> </entry>
@ -727,7 +840,47 @@
<provider selected="true" editor-type-id="text-editor"> <provider selected="true" editor-type-id="text-editor">
<state vertical-scroll-proportion="0.0" vertical-offset="25024" max-vertical-offset="26979"> <state vertical-scroll-proportion="0.0" vertical-offset="25024" max-vertical-offset="26979">
<caret line="1472" column="26" selection-start-line="1472" selection-start-column="26" selection-end-line="1472" selection-end-column="26" /> <caret line="1472" column="26" selection-start-line="1472" selection-start-column="26" selection-end-line="1472" selection-end-column="26" />
<folding /> <folding>
<element signature="e#24#781#1" expanded="false" />
<element signature="e#2250#2547#0" expanded="false" />
<element signature="e#2584#7017#0" expanded="false" />
<element signature="e#7056#19021#0" expanded="false" />
<element signature="e#19062#19828#0" expanded="false" />
<element signature="e#25916#29025#0" expanded="false" />
<element signature="e#29066#30293#0" expanded="false" />
<element signature="e#30394#34748#0" expanded="false" />
<element signature="e#34796#36860#0" expanded="false" />
<element signature="e#36902#37890#0" expanded="false" />
<element signature="e#37940#42554#0" expanded="false" />
<element signature="e#42619#48972#0" expanded="false" />
<element signature="e#49020#49755#0" expanded="false" />
<element signature="e#49819#51129#0" expanded="false" />
<element signature="e#51178#53137#0" expanded="false" />
<element signature="e#53294#54546#0" expanded="false" />
<element signature="e#54602#55019#0" expanded="false" />
<element signature="e#55061#55170#0" expanded="false" />
<element signature="e#55213#55333#0" expanded="false" />
<element signature="e#55383#55534#0" expanded="false" />
<element signature="e#55587#62547#0" expanded="false" />
<element signature="e#62596#62635#0" expanded="false" />
<element signature="e#62684#63474#0" expanded="false" />
<element signature="e#63524#66451#0" expanded="false" />
<element signature="e#66496#67245#0" expanded="false" />
<element signature="e#67293#68789#0" expanded="false" />
<element signature="e#68834#69707#0" expanded="false" />
<element signature="e#69755#75611#0" expanded="false" />
<element signature="e#75659#77443#0" expanded="false" />
<element signature="e#77493#77589#0" expanded="false" />
<element signature="e#77652#78179#0" expanded="false" />
<element signature="e#78250#82263#0" expanded="false" />
<element signature="e#82307#82349#0" expanded="false" />
<element signature="e#82403#85599#0" expanded="false" />
<element signature="e#87592#88212#0" expanded="false" />
<element signature="e#88255#89036#0" expanded="false" />
<element signature="e#89072#89861#0" expanded="false" />
<element signature="e#89903#89998#0" expanded="false" />
<element signature="e#90048#90196#0" expanded="false" />
</folding>
</state> </state>
</provider> </provider>
</entry> </entry>
@ -869,14 +1022,6 @@
</state> </state>
</provider> </provider>
</entry> </entry>
<entry file="file://$PROJECT_DIR$/Content.py">
<provider selected="true" editor-type-id="text-editor">
<state vertical-scroll-proportion="0.0" vertical-offset="599" max-vertical-offset="4063">
<caret line="56" column="20" selection-start-line="56" selection-start-column="20" selection-end-line="56" selection-end-column="34" />
<folding />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/addon.xml"> <entry file="file://$PROJECT_DIR$/addon.xml">
<provider selected="true" editor-type-id="text-editor"> <provider selected="true" editor-type-id="text-editor">
<state vertical-scroll-proportion="0.26064736" vertical-offset="0" max-vertical-offset="587"> <state vertical-scroll-proportion="0.26064736" vertical-offset="0" max-vertical-offset="587">
@ -892,14 +1037,6 @@
</state> </state>
</provider> </provider>
</entry> </entry>
<entry file="file://$PROJECT_DIR$/Downloader.py">
<provider selected="true" editor-type-id="text-editor">
<state vertical-scroll-proportion="0.0" vertical-offset="1598" max-vertical-offset="2329">
<caret line="94" column="33" selection-start-line="94" selection-start-column="33" selection-end-line="94" selection-end-column="33" />
<folding />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/resources/contenters/KickAssSo.py"> <entry file="file://$PROJECT_DIR$/resources/contenters/KickAssSo.py">
<provider selected="true" editor-type-id="text-editor"> <provider selected="true" editor-type-id="text-editor">
<state vertical-scroll-proportion="0.0" vertical-offset="836" max-vertical-offset="1717"> <state vertical-scroll-proportion="0.0" vertical-offset="836" max-vertical-offset="1717">
@ -916,61 +1053,111 @@
</state> </state>
</provider> </provider>
</entry> </entry>
<entry file="file://$PROJECT_DIR$/functions.py">
<provider selected="true" editor-type-id="text-editor">
<state vertical-scroll-proportion="0.0" vertical-offset="3334" max-vertical-offset="4760">
<caret line="1487" column="21" selection-start-line="1487" selection-start-column="8" selection-end-line="1487" selection-end-column="21" />
<folding />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/Core.py">
<provider selected="true" editor-type-id="text-editor">
<state vertical-scroll-proportion="0.0" vertical-offset="1530" max-vertical-offset="5610">
<caret line="345" column="25" selection-start-line="345" selection-start-column="25" selection-end-line="345" selection-end-column="25" />
<folding />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/Localization.py"> <entry file="file://$PROJECT_DIR$/Localization.py">
<provider selected="true" editor-type-id="text-editor"> <provider selected="true" editor-type-id="text-editor">
<state vertical-scroll-proportion="0.72085387" vertical-offset="3063" max-vertical-offset="3842"> <state vertical-scroll-proportion="-13.464286" vertical-offset="3176" max-vertical-offset="3893">
<caret line="206" column="36" selection-start-line="206" selection-start-column="36" selection-end-line="206" selection-end-column="36" /> <caret line="209" column="39" selection-start-line="209" selection-start-column="39" selection-end-line="209" selection-end-column="39" />
<folding />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/Content.py">
<provider selected="true" editor-type-id="text-editor">
<state vertical-scroll-proportion="0.0" vertical-offset="599" max-vertical-offset="4063">
<caret line="56" column="20" selection-start-line="56" selection-start-column="20" selection-end-line="56" selection-end-column="34" />
<folding /> <folding />
</state> </state>
</provider> </provider>
</entry> </entry>
<entry file="file://$PROJECT_DIR$/Libtorrent.py"> <entry file="file://$PROJECT_DIR$/Libtorrent.py">
<provider selected="true" editor-type-id="text-editor"> <provider selected="true" editor-type-id="text-editor">
<state vertical-scroll-proportion="0.4187192" vertical-offset="816" max-vertical-offset="1785"> <state vertical-scroll-proportion="-3.25" vertical-offset="2391" max-vertical-offset="4097">
<caret line="282" column="36" selection-start-line="282" selection-start-column="36" selection-end-line="282" selection-end-column="36" /> <caret line="250" column="39" selection-start-line="250" selection-start-column="39" selection-end-line="250" selection-end-column="39" />
<folding> <folding>
<element signature="e#24#785#1" expanded="false" /> <element signature="e#24#785#1" expanded="false" />
<element signature="e#1478#2926#0" expanded="false" /> <element signature="e#1478#2926#0" expanded="false" />
<element signature="e#2975#5674#0" expanded="false" /> <element signature="e#7820#7952#0" expanded="false" />
<element signature="e#5713#6697#0" expanded="false" /> <element signature="e#7993#8127#0" expanded="false" />
<element signature="e#6746#7748#0" expanded="false" /> <element signature="e#8161#8283#0" expanded="false" />
<element signature="e#7787#7919#0" expanded="false" /> <element signature="e#8317#8439#0" expanded="false" />
<element signature="e#7960#8094#0" expanded="false" /> <element signature="e#8489#8536#0" expanded="false" />
<element signature="e#8128#8250#0" expanded="false" /> <element signature="e#8586#8686#0" expanded="false" />
<element signature="e#8284#8406#0" expanded="false" /> <element signature="e#8726#9040#0" expanded="false" />
<element signature="e#8456#8503#0" expanded="false" /> <element signature="e#9086#9254#0" expanded="false" />
<element signature="e#8553#8653#0" expanded="false" /> <element signature="e#9310#9365#0" expanded="false" />
<element signature="e#8693#9007#0" expanded="false" /> <element signature="e#9423#9480#0" expanded="false" />
<element signature="e#9053#9221#0" expanded="false" /> <element signature="e#9517#9696#0" expanded="false" />
<element signature="e#9277#9332#0" expanded="false" /> <element signature="e#11951#12445#0" expanded="false" />
<element signature="e#9390#9447#0" expanded="false" /> <element signature="e#13122#13224#0" expanded="false" />
<element signature="e#9484#9663#0" expanded="false" /> <element signature="e#13303#14449#0" expanded="false" />
<element signature="e#9715#10664#0" expanded="false" /> <element signature="e#14498#16202#0" expanded="false" />
<element signature="e#11703#12197#0" expanded="false" /> <element signature="e#16238#16655#0" expanded="false" />
<element signature="e#12235#12837#0" expanded="false" /> <element signature="e#17109#18349#0" expanded="false" />
<element signature="e#12874#12976#0" expanded="false" /> <element signature="e#18384#18527#0" expanded="false" />
<element signature="e#13055#14201#0" expanded="false" /> </folding>
<element signature="e#14250#15954#0" expanded="false" /> </state>
<element signature="e#15990#16407#0" expanded="false" /> </provider>
<element signature="e#16444#16815#0" expanded="false" /> </entry>
<element signature="e#16861#18101#0" expanded="false" /> <entry file="file://$PROJECT_DIR$/Downloader.py">
<element signature="e#18136#18279#0" expanded="false" /> <provider selected="true" editor-type-id="text-editor">
<state vertical-scroll-proportion="0.0" vertical-offset="1394" max-vertical-offset="2278">
<caret line="97" column="33" selection-start-line="97" selection-start-column="33" selection-end-line="97" selection-end-column="33" />
<folding />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/functions.py">
<provider selected="true" editor-type-id="text-editor">
<state vertical-scroll-proportion="0.39674798" vertical-offset="23726" max-vertical-offset="26163">
<caret line="1427" column="30" selection-start-line="1427" selection-start-column="30" selection-end-line="1427" selection-end-column="30" />
<folding />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/Core.py">
<provider selected="true" editor-type-id="text-editor">
<state vertical-scroll-proportion="0.5247019" vertical-offset="1222" max-vertical-offset="4590">
<caret line="324" column="43" selection-start-line="324" selection-start-column="43" selection-end-line="324" selection-end-column="43" />
<folding>
<element signature="e#24#781#1" expanded="false" />
<element signature="e#2250#2547#0" expanded="false" />
<element signature="e#2584#7017#0" expanded="false" />
<element signature="e#7056#19021#0" expanded="false" />
<element signature="e#19062#19828#0" expanded="false" />
<element signature="e#25916#29025#0" expanded="false" />
<element signature="e#29066#30293#0" expanded="false" />
<element signature="e#30394#34748#0" expanded="false" />
<element signature="e#34796#36860#0" expanded="false" />
<element signature="e#36902#37890#0" expanded="false" />
<element signature="e#37940#42554#0" expanded="false" />
<element signature="e#42619#48972#0" expanded="false" />
<element signature="e#49020#49755#0" expanded="false" />
<element signature="e#49819#51129#0" expanded="false" />
<element signature="e#51178#53137#0" expanded="false" />
<element signature="e#53294#54546#0" expanded="false" />
<element signature="e#54602#55019#0" expanded="false" />
<element signature="e#55061#55170#0" expanded="false" />
<element signature="e#55213#55333#0" expanded="false" />
<element signature="e#55383#55534#0" expanded="false" />
<element signature="e#55587#62547#0" expanded="false" />
<element signature="e#62596#62635#0" expanded="false" />
<element signature="e#62684#63474#0" expanded="false" />
<element signature="e#63524#66451#0" expanded="false" />
<element signature="e#66496#67245#0" expanded="false" />
<element signature="e#67293#68789#0" expanded="false" />
<element signature="e#68834#69707#0" expanded="false" />
<element signature="e#69755#75611#0" expanded="false" />
<element signature="e#75659#77443#0" expanded="false" />
<element signature="e#77493#77589#0" expanded="false" />
<element signature="e#77652#78179#0" expanded="false" />
<element signature="e#78250#82263#0" expanded="false" />
<element signature="e#82307#82349#0" expanded="false" />
<element signature="e#82403#85599#0" expanded="false" />
<element signature="e#87592#88212#0" expanded="false" />
<element signature="e#88255#89036#0" expanded="false" />
<element signature="e#89072#89861#0" expanded="false" />
<element signature="e#89903#89998#0" expanded="false" />
<element signature="e#90048#90196#0" expanded="false" />
</folding> </folding>
</state> </state>
</provider> </provider>

77
Core.py
View File

@ -316,6 +316,21 @@ class Core:
xbmc.executebuiltin('Container.Refresh') xbmc.executebuiltin('Container.Refresh')
showMessage(self.localize('Download Status'), self.localize('Paused!')) showMessage(self.localize('Download Status'), self.localize('Paused!'))
if action2 == 'stop':
db.update_status(addtime, 'stopped')
xbmc.executebuiltin('Container.Refresh')
showMessage(self.localize('Download Status'), self.localize('Stopped!'))
if action2 == 'start':
start=db.get_byaddtime(addtime)
link, ind=start[6], start[7]
storage=get('storage') if get('storage') else ''
start_exec='XBMC.RunPlugin(%s)' % ('%s?action=%s&url=%s&ind=%s&storage=%s') % (
sys.argv[0], 'downloadLibtorrent', urllib.quote_plus(link.encode('utf-8')), str(ind), storage)
xbmc.executebuiltin(start_exec)
xbmc.executebuiltin('Container.Refresh')
showMessage(self.localize('Download Status'), self.localize('Started!'))
if action2 == 'unpause': if action2 == 'unpause':
db.update_status(addtime, 'downloading') db.update_status(addtime, 'downloading')
xbmc.executebuiltin('Container.Refresh') xbmc.executebuiltin('Container.Refresh')
@ -328,33 +343,56 @@ class Core:
if not action2: if not action2:
items = db.get_all() items = db.get_all()
if items: if items:
ListString = 'XBMC.RunPlugin(%s)' % (sys.argv[0] + '?action=DownloadStatus&action2=%s&%s=%s') for addtime, title, path, type, info, status, torrent, ind, lastupdate, storage in items:
for addtime, title, path, type, info, status in items: ListString = 'XBMC.RunPlugin('+sys.argv[0] + '?action=DownloadStatus&storage='+urllib.quote_plus(storage.encode('utf-8'))+'&addtime='+str(addtime)+'&action2='
jsoninfo=json.loads(urllib.unquote_plus(info)) jsoninfo=json.loads(urllib.unquote_plus(info))
if status!='stopped' and int(lastupdate)<int(time.time())-10:
status='stopped'
db.update_status(addtime, status)
progress=int(jsoninfo.get('progress')) progress=int(jsoninfo.get('progress'))
if status=='pause': status_sign='[||]' if status=='pause':
else:status_sign='[>]' status_sign='[||]'
img=self.ROOT + '/icons/pause-icon.png'
elif status=='stopped':
status_sign='[X]'
img=self.ROOT + '/icons/stop-icon.png'
else:
status_sign='[>]'
if progress==100:
img=self.ROOT + '/icons/upload-icon.png'
else:
img=self.ROOT + '/icons/download-icon.png'
title = '[%d%%]%s %s' % (progress, status_sign, title) title = '[%d%%]%s %s' % (progress, status_sign, title)
if jsoninfo.get('seeds')!=None and jsoninfo.get('peers')!=None and \ if jsoninfo.get('seeds')!=None and jsoninfo.get('peers')!=None and \
jsoninfo.get('download')!=None and jsoninfo.get('upload')!=None: jsoninfo.get('download')!=None and jsoninfo.get('upload')!=None:
d,u=int(jsoninfo['download']/ 1000000), int(jsoninfo['upload'] / 1000000) d,u=int(jsoninfo['download']/ 1000000), int(jsoninfo['upload'] / 1000000)
s,p=str(jsoninfo['seeds']),str(jsoninfo['peers']) s,p=str(jsoninfo['seeds']),str(jsoninfo['peers'])
title='%s [S/L %s/%s][D/U %s/%s (MB/s)]' %(title,s,p,d,u) title='%s [S/L %s/%s][D/U %s/%s (MB/s)]' %(title,s,p,d,u)
if status!='pause':
contextMenu=[((self.localize('Delete and Stop'), ListString % ('delete', 'addtime', str(addtime)))), if status=='pause':
((self.localize('Pause'), ListString % ('pause', 'addtime', str(addtime)))),] contextMenu=[(self.localize('Unpause'), ListString+'unpause)'),
(self.localize('Delete and Stop'), ListString+'delete)'),]
elif status=='stopped':
contextMenu=[(self.localize('Start'), ListString+'start)'),
(self.localize('Delete'), ListString+'delete)'),]
else: else:
contextMenu=[((self.localize('Delete and Stop'), ListString % ('delete', 'addtime', str(addtime)))), contextMenu=[(self.localize('Pause'), ListString+'pause)'),
((self.localize('Unpause'), ListString % ('unpause', 'addtime', str(addtime)))),] (self.localize('Stop'), ListString+'stop)'),
(self.localize('Delete and Stop'), ListString+'delete)'),]
if progress==100 or progress>30 and type=='file': if progress==100 or progress>30 and type=='file':
link={'action2':'play', 'type':type, 'path':path.encode('utf-8')} link={'action2':'play', 'type':type, 'path':path.encode('utf-8')}
self.drawItem('[B]%s[/B]' % title, 'DownloadStatus', link, image='', contextMenu=contextMenu, replaceMenu=False, isFolder=type=='folder') self.drawItem('[B]%s[/B]' % title, 'DownloadStatus', link, image=img, contextMenu=contextMenu, replaceMenu=False, isFolder=type=='folder')
else: else:
link={'action2':'notfinished'} link={'action2':'notfinished'}
self.drawItem(title, 'DownloadStatus', link, image='', contextMenu=contextMenu, replaceMenu=False) self.drawItem(title, 'DownloadStatus', link, image=img, contextMenu=contextMenu, replaceMenu=False)
view_style('DownloadStatus') view_style('DownloadStatus')
xbmcplugin.endOfDirectory(handle=int(sys.argv[1]), succeeded=True) xbmcplugin.endOfDirectory(handle=int(sys.argv[1]), succeeded=True)
xbmc.sleep(30000)
xbmc.executebuiltin('Container.Refresh')
def History(self, params={}): def History(self, params={}):
db = HistoryDB() db = HistoryDB()
@ -1019,13 +1057,18 @@ class Core:
if not hash: if not hash:
for data in DownloadList: for data in DownloadList:
status = " " status = " "
img=''
if data['status'] in ('seed_pending', 'stopped'): if data['status'] in ('seed_pending', 'stopped'):
status = TextBB(' [||] ', 'b') status = TextBB(' [||] ', 'b')
elif data['status'] in ('seeding', 'downloading'): elif data['status'] in ('seeding', 'downloading'):
status = TextBB(' [>] ', 'b') status = TextBB(' [>] ', 'b')
if data['status']=='seed_pending':img=self.ROOT + '/icons/pause-icon.png'
elif data['status']=='stopped': img=self.ROOT + '/icons/stop-icon.png'
elif data['status']=='seeding':img=self.ROOT + '/icons/upload-icon.png'
elif data['status']=='downloading':img=self.ROOT + '/icons/download-icon.png'
menu.append( menu.append(
{"title": '[' + str(data['progress']) + '%]' + status + data['name'] + ' [' + str( {"title": '[' + str(data['progress']) + '%]' + status + data['name'] + ' [' + str(
data['ratio']) + ']', data['ratio']) + ']', "image":img,
"argv": {'hash': str(data['id'])}}) "argv": {'hash': str(data['id'])}})
elif not tdir: elif not tdir:
dllist = sorted(Download().listfiles(hash), key=lambda x: x[0]) dllist = sorted(Download().listfiles(hash), key=lambda x: x[0])
@ -1059,6 +1102,7 @@ class Core:
for i in menu: for i in menu:
app = i['argv'] app = i['argv']
link = json.dumps(app) link = json.dumps(app)
img = i['image']
popup = [] popup = []
if not hash: if not hash:
actions = [('start', self.localize('Start')), ('stop', self.localize('Stop')), actions = [('start', self.localize('Start')), ('stop', self.localize('Stop')),
@ -1075,7 +1119,7 @@ class Core:
app['action'] = a app['action'] = a
popup.append((self.localize(title), contextMenustring % urllib.quote_plus(json.dumps(app)))) popup.append((self.localize(title), contextMenustring % urllib.quote_plus(json.dumps(app))))
self.drawItem(unicode(i['title']), 'uTorrentBrowser', link, isFolder=folder, contextMenu=popup, self.drawItem(unicode(i['title']), 'uTorrentBrowser', link, image=img, isFolder=folder, contextMenu=popup,
replaceMenu=True) replaceMenu=True)
view_style('uTorrentBrowser') view_style('uTorrentBrowser')
xbmcplugin.endOfDirectory(handle=int(sys.argv[1]), succeeded=True) xbmcplugin.endOfDirectory(handle=int(sys.argv[1]), succeeded=True)
@ -1555,7 +1599,9 @@ class Core:
def downloadLibtorrent(self, params={}): def downloadLibtorrent(self, params={}):
get = params.get get = params.get
self.userStorage(params) storage=get('storage')
if not storage: self.userStorage(params)
else: self.userStorageDirectory=urllib.unquote_plus(storage).decode('utf-8')
try: try:
url = urllib.unquote_plus(get("url")) url = urllib.unquote_plus(get("url"))
except: except:
@ -1576,7 +1622,8 @@ class Core:
url = searcherObject.getTorrentFile(classMatch.group(2)) url = searcherObject.getTorrentFile(classMatch.group(2))
torrent = Downloader.Torrent(self.userStorageDirectory, torrentFilesDirectory=self.torrentFilesDirectory) torrent = Downloader.Torrent(self.userStorageDirectory, torrentFilesDirectory=self.torrentFilesDirectory)
torrent.initSession() torrent.initSession()
self.__settings__.setSetting("lastTorrent", torrent.saveTorrent(url)) url=torrent.saveTorrent(url)
self.__settings__.setSetting("lastTorrent", url)
if 0 < int(self.__settings__.getSetting("upload_limit")): if 0 < int(self.__settings__.getSetting("upload_limit")):
torrent.setUploadLimit(int(self.__settings__.getSetting("upload_limit")) * 1000000 / 8) #MBits/second torrent.setUploadLimit(int(self.__settings__.getSetting("upload_limit")) * 1000000 / 8) #MBits/second
if 0 < int(self.__settings__.getSetting("download_limit")): if 0 < int(self.__settings__.getSetting("download_limit")):

View File

@ -93,6 +93,7 @@ class Libtorrent:
if re.match("^magnet\:.+$", torrentUrl): if re.match("^magnet\:.+$", torrentUrl):
self.magnetLink = torrentUrl self.magnetLink = torrentUrl
self.magnetToTorrent(torrentUrl) self.magnetToTorrent(torrentUrl)
self.magnetLink=None
return self.torrentFile return self.torrentFile
else: else:
if not xbmcvfs.exists(self.torrentFilesPath): if not xbmcvfs.exists(self.torrentFilesPath):
@ -252,19 +253,24 @@ class Libtorrent:
self.paused=False self.paused=False
db=DownloadDB() db=DownloadDB()
ContentList=self.getContentList() ContentList=self.getContentList()
if len(ContentList)==1 or contentId: if contentId!=None: contentId=int(contentId)
if len(ContentList)==1 or contentId not in [None, -1]:
if not contentId: contentId=0 if not contentId: contentId=0
title=os.path.basename(ContentList[int(contentId)]['title']) title=os.path.basename(ContentList[contentId]['title'])
path=os.path.join(self.storageDirectory, ContentList[int(contentId)]['title']) path=os.path.join(self.storageDirectory, ContentList[contentId]['title'])
type='file' type='file'
else: else:
contentId=-1
title=ContentList[0]['title'].split('\\')[0] title=ContentList[0]['title'].split('\\')[0]
path=os.path.join(self.storageDirectory, title) path=os.path.join(self.storageDirectory, title)
type='folder' type='folder'
add=db.add(title, path, type, {'progress':0}, 'downloading') add=db.add(title, path, type, {'progress':0}, 'downloading', self.torrentFile, contentId, self.storageDirectory)
if add: get=db.get(title)
if None!=contentId: if add or get[5]=='stopped':
if get[5]=='stopped':
db.update_status(get[0], 'downloading')
if contentId not in [None, -1]:
self.continueSession(int(contentId), Offset=0, seeding=False) self.continueSession(int(contentId), Offset=0, seeding=False)
else: else:
for i in range(self.torrentFileInfo.num_pieces()): for i in range(self.torrentFileInfo.num_pieces()):
@ -272,19 +278,17 @@ class Libtorrent:
thread.start_new_thread(self.downloadLoop, (title,)) thread.start_new_thread(self.downloadLoop, (title,))
def downloadLoop(self, title): def downloadLoop(self, title):
i=1
db=DownloadDB() db=DownloadDB()
while db.get(title): status='downloading'
xbmc.sleep(1000*i) while db.get(title) and status!='stopped':
xbmc.sleep(1000)
status=db.get_status(title) status=db.get_status(title)
if not self.paused: if not self.paused:
if status=='pause': if status=='pause':
i=10
self.paused=True self.paused=True
self.session.pause() self.session.pause()
else: else:
if status!='pause': if status!='pause':
i=1
self.paused=False self.paused=False
self.session.resume() self.session.resume()
s = self.torrentHandle.status() s = self.torrentHandle.status()
@ -294,11 +298,10 @@ class Libtorrent:
info['peers']=s.num_peers info['peers']=s.num_peers
info['seeds']=s.num_seeds info['seeds']=s.num_seeds
iterator = int(s.progress * 100) iterator = int(s.progress * 100)
if iterator==100 and status!='seeding':
db.update_status(str(db.get(title)), 'seeding')
info['progress']=iterator info['progress']=iterator
db.update(title, info) db.update(title, info)
self.debug() self.debug()
self.session.remove_torrent(self.torrentHandle)
def initSession(self): def initSession(self):
try: try:

View File

@ -205,10 +205,13 @@ dictionary = {
'Download has not finished yet':'Загрука не завершена', 'Download has not finished yet':'Загрука не завершена',
'Deleted and Stopped!':'Загрузка удалена и остановлена!', 'Deleted and Stopped!':'Загрузка удалена и остановлена!',
'Unpaused!':'Возобновлено!', 'Unpaused!':'Возобновлено!',
'Paused!':'Остановлено!', 'Paused!':'Приостановлено!',
'Stopped!':'Остановлено!',
'Started!':'Начинается загрузка!',
'Delete and Stop':'Удалить и Остановить', 'Delete and Stop':'Удалить и Остановить',
'Unpause':'Возобновить', 'Unpause':'Возобновить',
'Pause':'Пауза', 'Pause':'Пауза',
'Delete':'Удалить',
} }
} }

View File

@ -1423,52 +1423,43 @@ def delete_russian(ok=False, action='delete'):
return False return False
class DownloadDB: class DownloadDB:
def __init__(self, version=1.2): def __init__(self, version=1.41):
self.name = 'download.db3' self.name = 'download.db3'
self.version = version self.version = version
def get_all(self): def get_all(self):
self._connect() self._connect()
self.cur.execute('select addtime, title, path, type, jsoninfo, status from downloads order by addtime DESC') self.cur.execute('select addtime, title, path, type, jsoninfo, status, torrent, ind, lastupdate, storage from downloads order by addtime DESC')
x = self.cur.fetchall() x = self.cur.fetchall()
self._close() self._close()
return x if x else None return x if x else None
def get(self, title): def get(self, title):
try:
title = title.decode('utf-8')
except:
pass
self._connect() self._connect()
self.cur.execute('select addtime from downloads where title="' + title + '"') self.cur.execute('select addtime, title, path, type, jsoninfo, status, torrent, ind, lastupdate, storage from downloads where title="' + decode(title) + '"')
x = self.cur.fetchone() x = self.cur.fetchone()
self._close() self._close()
return x[0] if x else None return x if x else None
def get_byaddtime(self, addtime):
self._connect()
self.cur.execute('select addtime, title, path, type, jsoninfo, status, torrent, ind, lastupdate, storage from downloads where addtime="' + str(addtime) + '"')
x = self.cur.fetchone()
self._close()
return x if x else None
def get_status(self, title): def get_status(self, title):
try:
title = title.decode('utf-8')
except:
pass
self._connect() self._connect()
self.cur.execute('select status from downloads where title="' + title + '"') self.cur.execute('select status from downloads where title="' + decode(title) + '"')
x = self.cur.fetchone() x = self.cur.fetchone()
self._close() self._close()
return x[0] if x else None return x[0] if x else None
def add(self, title, path, type, info, status): def add(self, title, path, type, info, status, torrent, ind, storage):
try:
title = title.decode('utf-8')
except:
pass
try:
path = path.decode('utf-8')
except:
pass
if not self.get(title): if not self.get(title):
self._connect() self._connect()
self.cur.execute('insert into downloads(addtime, title, path, type, jsoninfo, status)' self.cur.execute('insert into downloads(addtime, title, path, type, jsoninfo, status, torrent, ind, lastupdate, storage)'
' values(?,?,?,?,?,?)', (int(time.time()), title, path, type, json.dumps(info), status)) ' values(?,?,?,?,?,?,?,?,?,?)', (int(time.time()), decode(title), decode(path), type, json.dumps(info), status, decode(torrent), ind, int(time.time()), decode(storage)))
self.db.commit() self.db.commit()
self._close() self._close()
return True return True
@ -1481,19 +1472,19 @@ class DownloadDB:
except: except:
pass pass
self._connect() self._connect()
self.cur.execute('UPDATE downloads SET jsoninfo = "' + urllib.quote_plus(json.dumps(info)) + '" where title="' + title+'"') self.cur.execute('UPDATE downloads SET jsoninfo = "' + urllib.quote_plus(json.dumps(info)) + '", lastupdate='+str(int(time.time()))+' where title="' + title+'"')
self.db.commit() self.db.commit()
self._close() self._close()
def update_status(self, addtime, status): def update_status(self, addtime, status):
self._connect() self._connect()
self.cur.execute('UPDATE downloads SET status = "' + status + '" where addtime="' + addtime+'"') self.cur.execute('UPDATE downloads SET status = "' + status + '" where addtime="' + str(addtime)+'"')
self.db.commit() self.db.commit()
self._close() self._close()
def delete(self, addtime): def delete(self, addtime):
self._connect() self._connect()
self.cur.execute('delete from downloads where addtime="' + addtime + '"') self.cur.execute('delete from downloads where addtime="' + str(addtime) + '"')
self.db.commit() self.db.commit()
self._close() self._close()
@ -1539,7 +1530,7 @@ class DownloadDB:
cur.execute('pragma auto_vacuum=1') cur.execute('pragma auto_vacuum=1')
cur.execute('create table db_ver(version real)') cur.execute('create table db_ver(version real)')
cur.execute( cur.execute(
'create table downloads(addtime integer PRIMARY KEY, title varchar(32), path varchar(32), type varchar(32), jsoninfo varchar(32), status varchar(32))') 'create table downloads(addtime integer PRIMARY KEY, title varchar(32), path varchar(32), type varchar(32), jsoninfo varchar(32), status varchar(32), torrent varchar(32), ind integer, lastupdate integer, storage varchar(32))')
cur.execute('insert into db_ver(version) values(?)', (self.version, )) cur.execute('insert into db_ver(version) values(?)', (self.version, ))
self.db.commit() self.db.commit()
cur.close() cur.close()
@ -1547,4 +1538,14 @@ class DownloadDB:
def _close(self): def _close(self):
self.cur.close() self.cur.close()
self.db.close() self.db.close()
def decode(string, ret=None):
try:
string = string.decode('utf-8')
return string
except:
if ret:
return ret
else:
return string