ntv1000 / rtorrent-cleanup Goto Github PK
View Code? Open in Web Editor NEWA script to delete files from your rtorrent download directory that are not referenced in rtorrent.
License: MIT License
A script to delete files from your rtorrent download directory that are not referenced in rtorrent.
License: MIT License
When trying to run this code. I ran into an issue "RuntimeError: Maximum recursion depth exceeded"
return walk(exp, index + endsub)
File "/home/bobokun/install/rtorrent-cleanup/bencode.py", line 59, in walk
return walk(exp, index + endsub)
File "/home/bobokun/install/rtorrent-cleanup/bencode.py", line 59, in walk
return walk(exp, index + endsub)
File "/home/bobokun/install/rtorrent-cleanup/bencode.py", line 59, in walk
return walk(exp, index + endsub)
File "/home/bobokun/install/rtorrent-cleanup/bencode.py", line 59, in walk
return walk(exp, index + endsub)
File "/home/bobokun/install/rtorrent-cleanup/bencode.py", line 59, in walk
return walk(exp, index + endsub)
File "/home/bobokun/install/rtorrent-cleanup/bencode.py", line 59, in walk
return walk(exp, index + endsub)
File "/home/bobokun/install/rtorrent-cleanup/bencode.py", line 59, in walk
return walk(exp, index + endsub)
File "/home/bobokun/install/rtorrent-cleanup/bencode.py", line 58, in walk endsub = walk(exp[index:], 1)
File "/home/bobokun/install/rtorrent-cleanup/bencode.py", line 53, in walk
return walk(exp, index + strlength)
File "/home/bobokun/install/rtorrent-cleanup/bencode.py", line 47, in walk
return walk(exp, endchar + 1)
File "/home/bobokun/install/rtorrent-cleanup/bencode.py", line 53, in walk
return walk(exp, index + strlength)
File "/home/bobokun/install/rtorrent-cleanup/bencode.py", line 58, in walk
endsub = walk(exp[index:], 1)
File "/home/bobokun/install/rtorrent-cleanup/bencode.py", line 53, in walk
return walk(exp, index + strlength)
File "/home/bobokun/install/rtorrent-cleanup/bencode.py", line 53, in walk
return walk(exp, index + strlength)
File "/home/bobokun/install/rtorrent-cleanup/bencode.py", line 53, in walk
return walk(exp, index + strlength)
File "/home/bobokun/install/rtorrent-cleanup/bencode.py", line 53, in walk
return walk(exp, index + strlength)
File "/home/bobokun/install/rtorrent-cleanup/bencode.py", line 52, in walk
strlength = stringlength(exp, index)
File "/home/bobokun/install/rtorrent-cleanup/bencode.py", line 33, in stringlength
n = int(collapse(num)) # Collapse them, and turn them into an int.
File "/home/bobokun/install/rtorrent-cleanup/bencode.py", line 20, in collapse
return reduce(lambda x, y: x + y, data)
RuntimeError: maximum recursion depth exceeded
bobokun@raspberrypi ~/install/rtorrent-cleanup $
When running this script (only tested with the --dry parameter), I get the following error:
found 889 downloaded files
found 879 rtorrent files
Traceback (most recent call last):
File "~/./rtorrent_cleanup.py", line 154, in <module>
main(args.rtorrent_working_dir, args.rtorrent_download_dirs)
File "~/./rtorrent_cleanup.py", line 90, in main
if check_if_single_file_torrent(torrent_file):
File "~/./rtorrent_cleanup.py", line 21, in check_if_single_file_torrent
content = f.read()
File "/usr/lib/python-exec/python3.9/../../../lib/python3.9/codecs.py", line 322, in decode
(result, consumed) = self._buffer_decode(data, self.errors, final)
UnicodeDecodeError: 'utf-8' codec can't decode byte 0xdf in position 876: invalid continuation byte
I guess one of my downloads contains some weird unicode that can't be parsed in utf-8... but I'm not sure which? I haven't dabbled in python yet...
So I just ran a dry run and it selected everything. Then I tried it with the test files included in this repo and it did the same. Am I doing something wrong?
./rtorrent_cleanup.py ./tests/testenv_template/workingdir/ ./tests/testenv_template/downloaddir/ --dry --debug
debug_flag=True dryrun_flag=True rtorrent_working_dir=./tests/testenv_template/workingdir/ rtorrent_download_dirs=['./tests/testenv_template/downloaddir/'] found 2 downloaded files found 2 rtorrent files single-file torrent: {{pathtotestenv}}/downloaddir/file1.txt multi-file torrent: {{pathtotestenv}}/downloaddir/directory1 found 2 files that were referenced found 2 files that were not referenced deleting all unreferenced files will free up 16B of storage Not referenced files: ./tests/testenv_template/downloaddir/directory1 ./tests/testenv_template/downloaddir/file1.txt
It sees the 2 files, but seems to think they are both referenced and not referenced.
When I don't do a dry run it deletes directory1
and file1.txt
Running the script on Debian 8.8
, and Python 2.7.9
Feature request:
A way to filter the "set of files to deleted" by tracker.
Example:
./rtorrent-cleanup.py working_dir download_dir --filter-by-tracker mytracker
What I want to solve:
Sometimes the mess is so stronk, I need to do it one tracker at a time.
Something like rtorrent_cleanup.py --delete
That way it can be run in automated scripts and such if it didn't need any interaction from the user
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.