forked from djib/PDMameUpdate
Update Pipfile and bump transmission-clutch to latest version
This commit is contained in:
@ -25,7 +25,8 @@ Requirements:
|
|||||||
* Transmission for Bitorrent
|
* Transmission for Bitorrent
|
||||||
* A proper PDMameUpdate.json file (see PDMameUpdate.template.json)
|
* A proper PDMameUpdate.json file (see PDMameUpdate.template.json)
|
||||||
* Python3 with the libraries below
|
* Python3 with the libraries below
|
||||||
- feedparser
|
- bs4
|
||||||
|
- requests
|
||||||
- transmission-clutch
|
- transmission-clutch
|
||||||
- tabulate
|
- tabulate
|
||||||
* Linux (untested on other OS, but it might work)
|
* Linux (untested on other OS, but it might work)
|
||||||
@ -47,11 +48,11 @@ import re
|
|||||||
from requests import get
|
from requests import get
|
||||||
import time
|
import time
|
||||||
import pathlib
|
import pathlib
|
||||||
from clutch.core import Client
|
from clutch import Client
|
||||||
from tabulate import tabulate
|
from tabulate import tabulate
|
||||||
from collections import defaultdict
|
from collections import defaultdict
|
||||||
from pprint import pformat
|
from pprint import pformat
|
||||||
from urllib.parse import quote, urlparse
|
from urllib.parse import urlparse
|
||||||
|
|
||||||
|
|
||||||
def open_config_file():
|
def open_config_file():
|
||||||
@ -132,7 +133,8 @@ def fetch_remote_torrents():
|
|||||||
if urlparse(link.get('href')).netloc == 'mgnet.me':
|
if urlparse(link.get('href')).netloc == 'mgnet.me':
|
||||||
matched_version = match.group(0)
|
matched_version = match.group(0)
|
||||||
matched_torrent = torrents[regexp.sub('#', link.string)]
|
matched_torrent = torrents[regexp.sub('#', link.string)]
|
||||||
if matched_version > matched_torrent.get('remote-version', ''):
|
remote_version = matched_torrent.get('remote-version', '')
|
||||||
|
if matched_version > remote_version:
|
||||||
matched_torrent['remote-version'] = matched_version
|
matched_torrent['remote-version'] = matched_version
|
||||||
matched_torrent['remote-link'] = link.get('href')
|
matched_torrent['remote-link'] = link.get('href')
|
||||||
matched_torrent['remote-name'] = link.string
|
matched_torrent['remote-name'] = link.string
|
||||||
@ -177,7 +179,12 @@ def prompt_for_update():
|
|||||||
data['remote-version'],
|
data['remote-version'],
|
||||||
data.get('transmission-id', 'N/A')
|
data.get('transmission-id', 'N/A')
|
||||||
])
|
])
|
||||||
print(tabulate(output, headers=output_header, tablefmt="simple", disable_numparse=True))
|
print(tabulate(
|
||||||
|
output,
|
||||||
|
headers=output_header,
|
||||||
|
tablefmt="simple",
|
||||||
|
disable_numparse=True
|
||||||
|
))
|
||||||
print('Should I update the torrents listed above? (y/N)')
|
print('Should I update the torrents listed above? (y/N)')
|
||||||
answer = input()
|
answer = input()
|
||||||
if answer.lower() != 'y':
|
if answer.lower() != 'y':
|
||||||
@ -206,7 +213,11 @@ def fetch_transmission_torrents():
|
|||||||
"""Gets the torrents id from Transmission"""
|
"""Gets the torrents id from Transmission"""
|
||||||
|
|
||||||
logging.info('Listing Transmission torrents')
|
logging.info('Listing Transmission torrents')
|
||||||
for torrent in client.list().values():
|
local_torrents = client.torrent.accessor(
|
||||||
|
fields=['id', 'name']
|
||||||
|
).arguments.torrents
|
||||||
|
for local_torrent in local_torrents:
|
||||||
|
torrent = local_torrent.dict(exclude_none=True)
|
||||||
for regexp in regexps:
|
for regexp in regexps:
|
||||||
match = regexp.search(torrent['name'])
|
match = regexp.search(torrent['name'])
|
||||||
if match:
|
if match:
|
||||||
@ -235,7 +246,10 @@ def update_torrents():
|
|||||||
torrent['remote-name']
|
torrent['remote-name']
|
||||||
)
|
)
|
||||||
if 'transmission-id' in torrent:
|
if 'transmission-id' in torrent:
|
||||||
logging.debug('Removing from transmission : %s',torrent['transmission-id'])
|
logging.debug(
|
||||||
|
'Removing from transmission : %s',
|
||||||
|
torrent['transmission-id']
|
||||||
|
)
|
||||||
client.torrent.remove(torrent['transmission-id'])
|
client.torrent.remove(torrent['transmission-id'])
|
||||||
logging.debug('Renaming %s to %s', old_name, new_name)
|
logging.debug('Renaming %s to %s', old_name, new_name)
|
||||||
os.rename(old_name, new_name)
|
os.rename(old_name, new_name)
|
||||||
|
14
Pipfile
14
Pipfile
@ -1,14 +1,16 @@
|
|||||||
[[source]]
|
[[source]]
|
||||||
name = "pypi"
|
url = "https://pypi.python.org/simple"
|
||||||
url = "https://pypi.org/simple"
|
|
||||||
verify_ssl = true
|
verify_ssl = true
|
||||||
|
name = "pypi"
|
||||||
[dev-packages]
|
|
||||||
|
|
||||||
[packages]
|
[packages]
|
||||||
feedparser = "*"
|
bs4 = "*"
|
||||||
|
requests = "*"
|
||||||
|
clutch = "*"
|
||||||
transmission-clutch = "*"
|
transmission-clutch = "*"
|
||||||
tabulate = "*"
|
tabulate = "*"
|
||||||
|
|
||||||
|
[dev-packages]
|
||||||
|
|
||||||
[requires]
|
[requires]
|
||||||
python_version = "3.7"
|
python_version = "3.9"
|
||||||
|
86
Pipfile.lock
generated
86
Pipfile.lock
generated
@ -1,86 +0,0 @@
|
|||||||
{
|
|
||||||
"_meta": {
|
|
||||||
"hash": {
|
|
||||||
"sha256": "e3d43ff4830ae48696b6a19aa3a6766e8dbfafe9290959dfc620deb9e4258e7f"
|
|
||||||
},
|
|
||||||
"pipfile-spec": 6,
|
|
||||||
"requires": {
|
|
||||||
"python_version": "3.7"
|
|
||||||
},
|
|
||||||
"sources": [
|
|
||||||
{
|
|
||||||
"name": "pypi",
|
|
||||||
"url": "https://pypi.org/simple",
|
|
||||||
"verify_ssl": true
|
|
||||||
}
|
|
||||||
]
|
|
||||||
},
|
|
||||||
"default": {
|
|
||||||
"certifi": {
|
|
||||||
"hashes": [
|
|
||||||
"sha256:14131608ad2fd56836d33a71ee60fa1c82bc9d2c8d98b7bdbc631fe1b3cd1296",
|
|
||||||
"sha256:edbc3f203427eef571f79a7692bb160a2b0f7ccaa31953e99bd17e307cf63f7d"
|
|
||||||
],
|
|
||||||
"version": "==2018.1.18"
|
|
||||||
},
|
|
||||||
"chardet": {
|
|
||||||
"hashes": [
|
|
||||||
"sha256:84ab92ed1c4d4f16916e05906b6b75a6c0fb5db821cc65e70cbd64a3e2a5eaae",
|
|
||||||
"sha256:fc323ffcaeaed0e0a02bf4d117757b98aed530d9ed4531e3e15460124c106691"
|
|
||||||
],
|
|
||||||
"version": "==3.0.4"
|
|
||||||
},
|
|
||||||
"feedparser": {
|
|
||||||
"hashes": [
|
|
||||||
"sha256:bd030652c2d08532c034c27fcd7c85868e7fa3cb2b17f230a44a6bbc92519bf9",
|
|
||||||
"sha256:cd2485472e41471632ed3029d44033ee420ad0b57111db95c240c9160a85831c",
|
|
||||||
"sha256:ce875495c90ebd74b179855449040003a1beb40cd13d5f037a0654251e260b02"
|
|
||||||
],
|
|
||||||
"index": "pypi",
|
|
||||||
"version": "==5.2.1"
|
|
||||||
},
|
|
||||||
"idna": {
|
|
||||||
"hashes": [
|
|
||||||
"sha256:2c6a5de3089009e3da7c5dde64a141dbc8551d5b7f6cf4ed7c2568d0cc520a8f",
|
|
||||||
"sha256:8c7309c718f94b3a625cb648ace320157ad16ff131ae0af362c9f21b80ef6ec4"
|
|
||||||
],
|
|
||||||
"version": "==2.6"
|
|
||||||
},
|
|
||||||
"requests": {
|
|
||||||
"hashes": [
|
|
||||||
"sha256:6a1b267aa90cac58ac3a765d067950e7dbbf75b1da07e895d1f594193a40a38b",
|
|
||||||
"sha256:9c443e7324ba5b85070c4a818ade28bfabedf16ea10206da1132edaa6dda237e"
|
|
||||||
],
|
|
||||||
"version": "==2.18.4"
|
|
||||||
},
|
|
||||||
"six": {
|
|
||||||
"hashes": [
|
|
||||||
"sha256:70e8a77beed4562e7f14fe23a786b54f6296e34344c23bc42f07b15018ff98e9",
|
|
||||||
"sha256:832dc0e10feb1aa2c68dcc57dbb658f1c7e65b9b61af69048abc87a2db00a0eb"
|
|
||||||
],
|
|
||||||
"version": "==1.11.0"
|
|
||||||
},
|
|
||||||
"tabulate": {
|
|
||||||
"hashes": [
|
|
||||||
"sha256:5470cc6687a091c7042cee89b2946d9235fe9f6d49c193a4ae2ac7bf386737c8"
|
|
||||||
],
|
|
||||||
"index": "pypi",
|
|
||||||
"version": "==0.8.6"
|
|
||||||
},
|
|
||||||
"transmission-clutch": {
|
|
||||||
"hashes": [
|
|
||||||
"sha256:dbe9673420ae9bf07c00c249c59346d1a0f71023b29297e816d3a2afa1aa716a"
|
|
||||||
],
|
|
||||||
"index": "pypi",
|
|
||||||
"version": "==1.0.5"
|
|
||||||
},
|
|
||||||
"urllib3": {
|
|
||||||
"hashes": [
|
|
||||||
"sha256:06330f386d6e4b195fbfc736b297f58c5a892e4440e54d294d7004e3a9bbea1b",
|
|
||||||
"sha256:cc44da8e1145637334317feebd728bd869a35285b93cbb4cca2577da7e62db4f"
|
|
||||||
],
|
|
||||||
"version": "==1.22"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"develop": {}
|
|
||||||
}
|
|
Reference in New Issue
Block a user