-
-
Save mattatcha/2d4bdd6f0c2079b7c7521e5a2b7b0417 to your computer and use it in GitHub Desktop.
Revisions
-
mattatcha revised this gist
Jun 29, 2016 . 1 changed file with 2 additions and 2 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -25,8 +25,8 @@ state_modified = False for torrent in state.torrents: if torrent.auto_managed: torrent.auto_managed = False state_modified = True if state_modified: -
mattatcha revised this gist
Jun 29, 2016 . 1 changed file with 2 additions and 2 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -25,8 +25,8 @@ state_modified = False for torrent in state.torrents: if torrent["auto_managed"]: torrent["auto_managed"] = False state_modified = True if state_modified: -
mattatcha revised this gist
Jun 29, 2016 . 1 changed file with 1 addition and 9 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,18 +1,12 @@ #!/usr/bin/env python import os import sys import platform import shutil import cPickle if platform.system() in ('Windows', 'Microsoft'): state_file_path = os.path.join(os.environ.get('APPDATA'), 'deluge', 'state', 'torrents.state') deluge_dir = os.path.join(os.environ['ProgramFiles'], 'Deluge') @@ -25,7 +19,6 @@ state_file_path = os.path.expanduser('~/.config/deluge/state/torrents.state') print("State file: %s" % state_file_path) state_file = open(state_file_path, 'rb') state = cPickle.load(state_file) state_file.close() @@ -36,7 +29,6 @@ torrent.options["auto_managed"] = False state_modified = True if state_modified: shutil.copyfile(state_file_path, state_file_path + '.old') state_file = open(state_file_path, 'wb') -
mattatcha renamed this gist
Jun 29, 2016 . 1 changed file with 3 additions and 4 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -32,10 +32,9 @@ state_modified = False for torrent in state.torrents: if torrent.options["auto_managed"]: torrent.options["auto_managed"] = False state_modified = True if state_modified: -
cas-- revised this gist
Sep 18, 2014 . 1 changed file with 6 additions and 0 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,3 +1,9 @@ #!/usr/bin/env python # # Find and replace tracker urls in a Deluge torrents.state # # Need to edit the variables: orig_tracker_url and new_tracker_url import os import sys import platform -
cas-- renamed this gist
Apr 6, 2013 . 1 changed file with 0 additions and 0 deletions.There are no files selected for viewing
File renamed without changes. -
cas-- revised this gist
Apr 6, 2013 . 1 changed file with 7 additions and 0 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,4 +1,5 @@ import os import sys import platform import shutil import cPickle @@ -8,6 +9,12 @@ if platform.system() in ('Windows', 'Microsoft'): state_file_path = os.path.join(os.environ.get('APPDATA'), 'deluge', 'state', 'torrents.state') deluge_dir = os.path.join(os.environ['ProgramFiles'], 'Deluge') if os.path.isdir(deluge_dir): sys.path.append(deluge_dir) for item in os.listdir(deluge_dir): if item.endswith(('.egg', '.zip')): sys.path.append(os.path.join(deluge_dir, item)) else: state_file_path = os.path.expanduser('~/.config/deluge/state/torrents.state') -
cas-- revised this gist
Apr 6, 2013 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -12,7 +12,7 @@ state_file_path = os.path.expanduser('~/.config/deluge/state/torrents.state') print("State file: %s" % state_file_path) print("Replace '%s' with '%s'" % (orig_tracker_url, new_tracker_url)) state_file = open(state_file_path, 'rb') state = cPickle.load(state_file) state_file.close() -
cas-- revised this gist
Apr 6, 2013 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -7,7 +7,7 @@ new_tracker_url = 'udp://xxx' if platform.system() in ('Windows', 'Microsoft'): state_file_path = os.path.join(os.environ.get('APPDATA'), 'deluge', 'state', 'torrents.state') else: state_file_path = os.path.expanduser('~/.config/deluge/state/torrents.state') -
cas-- revised this gist
Apr 6, 2013 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -12,7 +12,7 @@ state_file_path = os.path.expanduser('~/.config/deluge/state/torrents.state') print("State file: %s" % state_file_path) print("Replace '{}' with '{}'").format(orig_tracker_url, new_tracker_url) state_file = open(state_file_path, 'rb') state = cPickle.load(state_file) state_file.close() -
cas-- revised this gist
Apr 6, 2013 . 1 changed file with 4 additions and 4 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -11,8 +11,8 @@ else: state_file_path = os.path.expanduser('~/.config/deluge/state/torrents.state') print("State file: %s" % state_file_path) print("Replace '%s' with '%s'", orig_tracker_url, new_tracker_url) state_file = open(state_file_path, 'rb') state = cPickle.load(state_file) state_file.close() @@ -30,6 +30,6 @@ state_file = open(state_file_path, 'wb') cPickle.dump(state, state_file) state_file.close() print("State Updated") else: print("Nothing to do") -
cas-- renamed this gist
Apr 6, 2013 . 1 changed file with 0 additions and 0 deletions.There are no files selected for viewing
File renamed without changes. -
cas-- created this gist
Apr 6, 2013 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,35 @@ import os import platform import shutil import cPickle orig_tracker_url = 'udp://xxx' new_tracker_url = 'udp://xxx' if platform.system() in ('Windows', 'Microsoft'): state_file_path = os.path.join(os.environ.get('APPDATA'), 'deluge', 'torrents.state') else: state_file_path = os.path.expanduser('~/.config/deluge/state/torrents.state') print "State file: %s" % state_file_path print "Replace '%s' with '%s'" % (orig_tracker_url, new_tracker_url) state_file = open(state_file_path, 'rb') state = cPickle.load(state_file) state_file.close() state_modified = False for torrent in state.torrents: for tracker in torrent.trackers: if tracker['url'] == orig_tracker_url: tracker['url'] = new_tracker_url state_modified = True if state_modified: shutil.copyfile(state_file_path, state_file_path + '.old') state_file = open(state_file_path, 'wb') cPickle.dump(state, state_file) state_file.close() print "State Updated" else: print "Nothing to do"