파이썬

얼마전 TRANSMISSION 이 업데이트가 되었습니다.

귀신이보인다 2023. 2. 11. 00:00
728x90
반응형

트랜스미션이 4.0 버젼으로 업데이트가 되면서 몇가지 사용해보다가 어?

하고 않되는 문제가 있더군요.

토렌트파일(.torrent) 로 토렌트를 추가하게 되면 문제없이 다운로드가 진행이 되고 마그넷으로 다운로드를 진행시에는 

씨앗파일만 받고 일시정지가 되어 더이상 다운로드가 진행이 되질 않더군요.

고민 고민하다가 몇가지 검색도중 트랜스미션의 설정을 추가하라는 글이 있길래 추가해서 해봤더니 않되고 역시나 라고 생각하던 찰나 혹여 remote rpc 를 이용하면 되지 않을까? 라는 생각으로 시도중이긴한데 일단은 3.0 버젼에서는 문제없이 일시정지 된 토렌트가 시작으로 바뀌어서 적용을 해보려 하네요 ㅎㅎㅎ

일단 코드는 대충 찾아봤더니 간단하게 파이썬으로 있길래 

from transmission_rpc import Client

c = Client(host='0.0.0.0', port=9091, username='아이디', password='비밀번호')
c.start_all()

위와 같이 코딩하면 잘 적용이 되더라구요 ㅎㅎㅎ 3.0버젼에서 테스트했고 4.0 버젼은 아직이네요 ㅎㅎㅎ

추가) 2023-02-11 오전 10:11

어제 잠시 만들어보고 아침에 일어나서 추가적으로 만져봤습니다.

위의 코드는 전체 토렌트를 시작(START)하는 방법이고 지금부터는 각 토렌트 마다 퍼센트가 100프로가 아니라면 중지된 모든 토렌트를 시작하는 방법입니다.

torrent_check = c.get_torrents()
for i in torrent_check:
	print('Torrent ID : {}\nTorrent Status : {}\nTorrent Progress : {}'.format(i.id,i.status,i.progress))
	if i.progress != 100:
		i.start()
		print('Torrent Download Start')
	else:
		print('Torrent Download Stop')
		pass

맨위의 코드 2줄만 사용하고 바로위의 코드를 적용하면 됩니다.

이제 트랜스미션 4.0을 사용할수가 있겠네요 ㅎㅎㅎ

최종 완성 코드...

try:
	from transmission_rpc import Client
except:
	from transmissionrpc import Client
import time

#트랜스미션 서버 정보입력
host = '트랜스미션주소'
port = '트랜스미션포트'
id = '트랜스미션아이디'
pw= '트랜스미션비밀번호'
#날짜
nowtime = time.localtime()	
mytime = "%04d-%02d-%02d %02d:%02d:%02d" % (nowtime.tm_year, nowtime.tm_mon, nowtime.tm_mday, nowtime.tm_hour, nowtime.tm_min, nowtime.tm_sec)
try:
	c = Client(host=host, port=port, username=id, password=pw)
except:
	c = Client(host, port, user=id, password=pw)
torrent_check = c.get_torrents()
for i in torrent_check:
	if i.progress != 100:
		i.start()
		print('Torrent ID : {} | Torrent Status : {} | Torrent Progress : {} | Torrent Download Start : {}'.format(i.id,i.status,i.progress,mytime))
	else:
		print('Torrent Download Stop')
		pass
728x90
반응형