Browse Source

Add --keep argument to download torrent files to local directory

master
Sebastian Robinson 2 weeks ago
parent
commit
994747c0b4
3 changed files with 19 additions and 5 deletions
  1. +12
    -0
      PDMameUpdate.py
  2. +4
    -3
      README.md
  3. +3
    -2
      config.template.json

+ 12
- 0
PDMameUpdate.py View File

@@ -224,6 +224,10 @@ def update_torrents():
config['mame-directory'],
torrent['remote-name']
)
new_torrent = os.path.join(
config['torrent-directory'],
torrent['remote-name']+'.torrent'
)

client.torrent.remove(torrent['transmission-id'])
os.rename(old_name, new_name)
@@ -234,6 +238,9 @@ def update_torrents():
paused=False
)

if args.keep:
t = requests.get(torrent['remote-link'], verify=False)
open(new_torrent, 'wb').write(t.content)

if __name__ == '__main__':
logging.basicConfig(
@@ -254,6 +261,11 @@ if __name__ == '__main__':
help='Display debugging messages'
)
parser.add_argument(
'-k', '--keep',
action='store_true',
help='Keep torrent files localy'
)
parser.add_argument(
'-c', '--countdown',
action='store_true',
help='Start with a 5 second countdown'

+ 4
- 3
README.md View File

@@ -1,7 +1,7 @@
# PDMameUpdate

Checks available MAME Torrents on PleasureDome
and updates the local versions if more recent
Checks available MAME Torrents on PleasureDome
and updates the local versions if more recent
versions are detected

![Sample output](https://djib.fr/djib/PDMameUpdate/raw/branch/master/screenshot.png)
@@ -20,7 +20,7 @@ pipenv run python3 PDMameUpdate.py

## Usage
```shell
usage: PDMameUpdate.py [-h] [-l] [-d] [-c]
usage: PDMameUpdate.py [-h] [-l] [-d] [-k] [-c]

Update PleasureDome MAME Torrents

@@ -28,5 +28,6 @@ optional arguments:
-h, --help show this help message and exit
-l, --log Display more log messages
-d, --debug Display debugging messages
-k, --keep Keep torrent files localy
-c, --countdown Start with a 5 second countdown
```

+ 3
- 2
config.template.json View File

@@ -1,8 +1,9 @@
{
"mame-directory":"/path/to/your/locol/mame/torrent/target/folders",
"mame-directory":"/path/to/your/local/mame/files/target/folder",
"torrent-directory":"/path/to/your/local/mame/torrent/target/folder",
"transmission-user":"user",
"transmission-password":"pass",
"pleasuredome-user":"user",
"pleasuredome-password":"pass",
"transmission-port":8080
}
}

Loading…
Cancel
Save