Spaces:
Building
Building
GilbertClaus
commited on
Commit
•
1dbb152
1
Parent(s):
276b543
Update app.py
Browse files
app.py
CHANGED
@@ -8,13 +8,13 @@ os.system('apt install python3-libtorrent')
|
|
8 |
|
9 |
import streamlit as st
|
10 |
from streamlit_option_menu import option_menu
|
11 |
-
from Torrent import torrent_info, torrent_download, torrent_group, simpan_txt
|
12 |
|
13 |
|
14 |
# Navigasi Sidebar
|
15 |
with st.sidebar:
|
16 |
-
selected = option_menu("Torrent", ['Magnet Link', 'Torrent
|
17 |
-
icons=['search', 'house'], menu_icon="cast", default_index=0)
|
18 |
|
19 |
st.sidebar.image('DanMachi.png')
|
20 |
|
@@ -34,8 +34,8 @@ if selected == 'Magnet Link':
|
|
34 |
selected_index = int(file_priority.split('.')[0])
|
35 |
downloaded_files = torrent_download(link, [selected_index])
|
36 |
|
37 |
-
|
38 |
-
st.title("
|
39 |
teks = st.text_area("Masukkan Teks", '', height=(25 * 10))
|
40 |
tim = st.checkbox("Gak Perlu Dikelompokkan")
|
41 |
if tim:
|
@@ -61,6 +61,25 @@ else:
|
|
61 |
file_name=st.session_state.lokasi_file.replace('/home/user/app/', '').title().replace('Txt', 'txt'),
|
62 |
mime='text/plain'
|
63 |
)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
64 |
|
65 |
-
|
66 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
8 |
|
9 |
import streamlit as st
|
10 |
from streamlit_option_menu import option_menu
|
11 |
+
from Torrent import torrent_info, torrent_download, torrent_group, simpan_txt, link_redirect
|
12 |
|
13 |
|
14 |
# Navigasi Sidebar
|
15 |
with st.sidebar:
|
16 |
+
selected = option_menu("Torrent", ['Magnet Link', 'Index Torrent', 'Link Redirect'],
|
17 |
+
icons=['search', 'house', 'fire'], menu_icon="cast", default_index=0)
|
18 |
|
19 |
st.sidebar.image('DanMachi.png')
|
20 |
|
|
|
34 |
selected_index = int(file_priority.split('.')[0])
|
35 |
downloaded_files = torrent_download(link, [selected_index])
|
36 |
|
37 |
+
elif selected == 'Index Torrent':
|
38 |
+
st.title("Index Torrent")
|
39 |
teks = st.text_area("Masukkan Teks", '', height=(25 * 10))
|
40 |
tim = st.checkbox("Gak Perlu Dikelompokkan")
|
41 |
if tim:
|
|
|
61 |
file_name=st.session_state.lokasi_file.replace('/home/user/app/', '').title().replace('Txt', 'txt'),
|
62 |
mime='text/plain'
|
63 |
)
|
64 |
+
else:
|
65 |
+
st.title("Link Redirect")
|
66 |
+
link = st.text_input("Masukkan Link", "https://t.co/c31TBe7s4W")
|
67 |
+
|
68 |
+
if st.button("Trace On"):
|
69 |
+
info = link_redirect(link)
|
70 |
+
lokasi_file = simpan_txt('Group Torrent', info)
|
71 |
+
st.session_state.info = info
|
72 |
+
st.session_state.lokasi_file = lokasi_file
|
73 |
|
74 |
+
if 'info' in st.session_state:
|
75 |
+
num_lines = st.session_state.info.count('\n') + 1
|
76 |
+
text_area_height = 25 * num_lines
|
77 |
+
st.text_area("Hasil Redirect", st.session_state.info, height=text_area_height)
|
78 |
+
with open(st.session_state.lokasi_file, 'rb') as f:
|
79 |
+
file_contents = f.read()
|
80 |
+
st.download_button(
|
81 |
+
label="Download File TXT",
|
82 |
+
data=file_contents,
|
83 |
+
file_name=st.session_state.lokasi_file.replace('/home/user/app/', '').title().replace('Txt', 'txt'),
|
84 |
+
mime='text/plain'
|
85 |
+
)
|